[Mesa-dev] [PATCH 05/14] mesa: add KHR_no_error support to glUniform*() functions

Timothy Arceri tarceri at itsqueeze.com
Fri Apr 14 00:05:58 UTC 2017


On 13/04/17 19:50, Nicolai Hähnle wrote:
> On 13.04.2017 01:42, Timothy Arceri wrote:
>> ---
>>  src/mesa/main/uniform_query.cpp | 76
>> ++++++++++++++++++++++++++++-------------
>>  1 file changed, 53 insertions(+), 23 deletions(-)
>>
>> diff --git a/src/mesa/main/uniform_query.cpp
>> b/src/mesa/main/uniform_query.cpp
>> index e613898..7aa035a 100644
>> --- a/src/mesa/main/uniform_query.cpp
>> +++ b/src/mesa/main/uniform_query.cpp
>> @@ -775,57 +775,50 @@ glsl_type_name(enum glsl_base_type type)
>>     case GLSL_TYPE_VOID:
>>        return "void";
>>     case GLSL_TYPE_ERROR:
>>        return "error";
>>     default:
>>        return "other";
>>     }
>>  }
>>
>>
>> -/**
>> - * Called via glUniform*() functions.
>> - */
>> -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)
>> +struct gl_uniform_storage *
>> +validate_uniform(GLint location, GLsizei count, const GLvoid *values,
>> +                 unsigned *offset, struct gl_context *ctx,
>> +                 struct gl_shader_program *shProg,
>> +                 enum glsl_base_type basicType, unsigned src_components)
>
> This should probably be a static function.
>
>
>>  {
>> -   unsigned offset;
>> -   int size_mul = glsl_base_type_is_64bit(basicType) ? 2 : 1;
>> -
>>     struct gl_uniform_storage *const uni =
>> -      validate_uniform_parameters(location, count, &offset,
>> +      validate_uniform_parameters(location, count, offset,
>>                                    ctx, shProg, "glUniform");
>>     if (uni == NULL)
>> -      return;
>> +      return NULL;
>>
>>     if (uni->type->is_matrix()) {
>>        /* Can't set matrix uniforms (like mat4) with glUniform */
>>        _mesa_error(ctx, GL_INVALID_OPERATION,
>>                    "glUniform%u(uniform \"%s\"@%d is matrix)",
>>                    src_components, uni->name, location);
>> -      return;
>> +      return NULL;
>>     }
>>
>> -   /* Verify that the types are compatible.
>> -    */
>
> Why are you removing this comment?

Originally I moved the code below to the validation function, before 
moving it back. I think I just lost the comment in the process. I've 
fixed up the commit with all your suggestions. Thanks.



More information about the mesa-dev mailing list