[Mesa-dev] [PATCH] mesa: check that uniform exists in glUniform* functions

Tapani tapani.palli at intel.com
Thu Sep 11 06:50:10 PDT 2014


On 09/11/2014 03:12 PM, Erik Faye-Lund wrote:
> On Thu, Aug 28, 2014 at 9:58 AM, Tapani Pälli <tapani.palli at intel.com> wrote:
>> Remap table for uniforms may contain empty entries when using explicit
>> uniform locations. If no active/inactive variable exists with given
>> location, remap table contains NULL.
>>
>> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
>> ---
>>   src/mesa/main/uniform_query.cpp | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
>> index 4cd2bca..5dcb528 100644
>> --- a/src/mesa/main/uniform_query.cpp
>> +++ b/src/mesa/main/uniform_query.cpp
>> @@ -239,7 +239,7 @@ validate_uniform_parameters(struct gl_context *ctx,
>>       *         - if count is greater than one, and the uniform declared in the
>>       *           shader is not an array variable,
>>       */
>> -   if (location < -1) {
>> +   if (location < -1 || !shProg->UniformRemapTable[location]) {
>>         _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)",
>>                     caller, location);
> Nice. But shouldn't the the error-message be updated? With a location
> smaller than -1, it's very clear what's wrong. But when triggering the
> introduced condition, it's not. I think some wording should be added
> to make it clear that the location does not exist.

It's not a new condition, this is the same error you got already before 
this code existed when calling glUniform() with some random number (not 
retrieved with getUniformLocation) which is the case here also. But we 
could have a better error message, any proposals?

// Tapani



More information about the mesa-dev mailing list