[Mesa-dev] [PATCH] mesa: don't crash in KHR_no_error uniform variants when location == -1

Timothy Arceri tarceri at itsqueeze.com
Sat May 13 06:48:56 UTC 2017


My commit message seems to have gone missing. By -1 is allowed so that 
inactive uniforms don't cause the app to throw an error.

On 13/05/17 16:31, Timothy Arceri wrote:
> ---
>   src/mesa/main/uniform_query.cpp | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
> index 0e02a76..5f38aa5 100644
> --- a/src/mesa/main/uniform_query.cpp
> +++ b/src/mesa/main/uniform_query.cpp
> @@ -904,20 +904,23 @@ validate_uniform(GLint location, GLsizei count, const GLvoid *values,
>   extern "C" void
>   _mesa_uniform(GLint location, GLsizei count, const GLvoid *values,
>                 struct gl_context *ctx, struct gl_shader_program *shProg,
>                 enum glsl_base_type basicType, unsigned src_components)
>   {
>      unsigned offset;
>      int size_mul = glsl_base_type_is_64bit(basicType) ? 2 : 1;
>   
>      struct gl_uniform_storage *uni;
>      if (_mesa_is_no_error_enabled(ctx)) {
> +      if (location == -1)
> +         return;
> +
>         uni = shProg->UniformRemapTable[location];
>   
>         /* The array index specified by the uniform location is just the
>          * uniform location minus the base location of of the uniform.
>          */
>         assert(uni->array_elements > 0 || location == (int)uni->remap_location);
>         offset = location - uni->remap_location;
>      } else {
>         uni = validate_uniform(location, count, values, &offset, ctx, shProg,
>                                basicType, src_components);
> 


More information about the mesa-dev mailing list