[Mesa-dev] [PATCH 05/13] mesa: add double uniform support. (v4)

Matt Turner mattst88 at gmail.com
Wed Feb 4 23:49:21 PST 2015


On Wed, Feb 4, 2015 at 11:27 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c
> index 0ef4641..e1bbc00 100644
> --- a/src/mesa/program/prog_parameter.c
> +++ b/src/mesa/program/prog_parameter.c
> @@ -111,7 +111,13 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList,
>                      const gl_state_index state[STATE_LENGTH])
>  {
>     const GLuint oldNum = paramList->NumParameters;
> -   const GLuint sz4 = (size + 3) / 4; /* no. of new param slots needed */
> +   GLuint sz4 = (size + 3) / 4; /* no. of new param slots needed */
> +   int actual_size = size;
> +
> +   if (mesa_type_is_double(datatype)) {
> +      actual_size *= 2;
> +      sz4 = ((actual_size + 3) / 4);
> +   }
>
>     assert(size > 0);
>

Does this really need to be updated? I thought this code was just for
ARB vp/fp programs.

> @@ -150,15 +156,15 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList,
>           struct gl_program_parameter *p = paramList->Parameters + oldNum + i;
>           p->Name = name ? _mesa_strdup(name) : NULL;
>           p->Type = type;
> -         p->Size = size;
> +         p->Size = actual_size;
>           p->DataType = datatype;
>           if (values) {
> -            if (size >= 4) {
> +            if (actual_size >= 4) {
>                 COPY_4V(paramList->ParameterValues[oldNum + i], values);
>              }
>              else {
>                 /* copy 1, 2 or 3 values */
> -               GLuint remaining = size % 4;
> +               GLuint remaining = actual_size % 4;
>                 assert(remaining < 4);
>                 for (j = 0; j < remaining; j++) {
>                    paramList->ParameterValues[oldNum + i][j].f = values[j].f;
> @@ -176,7 +182,7 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList,
>              for (j = 0; j < 4; j++)
>                 paramList->ParameterValues[oldNum + i][j].f = 0;
>           }
> -         size -= 4;
> +         actual_size -= 4;
>        }
>
>        if (state) {
> --
> 2.0.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list