[Mesa-dev] [PATCH] mesa: add additional checks for uniform location query

Samuel Iglesias Gonsálvez siglesias at igalia.com
Mon Oct 26 02:53:39 PDT 2015


Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>

Thanks!

Sam

On 26/10/15 10:22, Tapani Pälli wrote:
> Patch adds additional check to make sure we don't return locations for
> structures or arrays of structures.
> 
> From page 79 of the OpenGL 4.2 spec:
>     "A valid name cannot be a structure, an array of structures, or any
>     portion of a single vector or a matrix."
> 
> No Piglit or CTS regressions observed.
> 
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> ---
>  src/mesa/main/shader_query.cpp | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
> index 8182d3d..b0707a4 100644
> --- a/src/mesa/main/shader_query.cpp
> +++ b/src/mesa/main/shader_query.cpp
> @@ -808,6 +808,16 @@ program_resource_location(struct gl_shader_program *shProg,
>        if (RESOURCE_UNI(res)->builtin)
>           return -1;
>  
> +     /* From page 79 of the OpenGL 4.2 spec:
> +      *
> +      *     "A valid name cannot be a structure, an array of structures, or any
> +      *     portion of a single vector or a matrix."
> +      */
> +      if (RESOURCE_UNI(res)->type->is_record() ||
> +          (RESOURCE_UNI(res)->type->is_array() &&
> +           RESOURCE_UNI(res)->type->fields.array->is_record()))
> +         return -1;
> +
>        /* From the GL_ARB_uniform_buffer_object spec:
>         *
>         *     "The value -1 will be returned if <name> does not correspond to an
> 


More information about the mesa-dev mailing list