mesa: Return -1 for glGetUniformLocation on UBOs.

Fixes piglit ARB_uniform_buffer_object/getuniformlocation.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Eric Anholt 2012-06-25 10:10:26 -07:00
parent bbd1d6124d
commit fa08b8ad54
1 changed files with 10 additions and 0 deletions

View File

@ -522,6 +522,16 @@ _mesa_GetUniformLocationARB(GLhandleARB programObj, const GLcharARB *name)
if (index == GL_INVALID_INDEX)
return -1;
/* From the GL_ARB_uniform_buffer_object spec:
*
* "The value -1 will be returned if <name> does not correspond to an
* active uniform variable name in <program>, if <name> is associated
* with a named uniform block, or if <name> starts with the reserved
* prefix "gl_"."
*/
if (shProg->UniformStorage[index].block_index != -1)
return -1;
return _mesa_uniform_merge_location_offset(index, offset);
}