mesa: support inactive uniforms in glUniform* functions
authorTapani Pälli <tapani.palli@intel.com>
Wed, 19 Mar 2014 10:39:10 +0000 (10:39 +0000)
committerTapani Pälli <tapani.palli@intel.com>
Mon, 16 Jun 2014 03:49:59 +0000 (06:49 +0300)
Support inactive uniforms that have explicit location set in
glUniform* functions.

v2: remove unnecessary extension check, use new define (Ian)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/uniform_query.cpp

index 5f1af087321ee280235dacd2136c418a558eb504..480bc6f163f4ff7d1bd203cfa0f3671d130d402b 100644 (file)
@@ -253,6 +253,21 @@ validate_uniform_parameters(struct gl_context *ctx,
       return false;
    }
 
+   /* If the driver storage pointer in remap table is -1, we ignore silently.
+    *
+    * GL_ARB_explicit_uniform_location spec says:
+    *     "What happens if Uniform* is called with an explicitly defined
+    *     uniform location, but that uniform is deemed inactive by the
+    *     linker?
+    *
+    *     RESOLVED: The call is ignored for inactive uniform variables and
+    *     no error is generated."
+    *
+    */
+   if (shProg->UniformRemapTable[location] ==
+       INACTIVE_UNIFORM_EXPLICIT_LOCATION)
+      return false;
+
    _mesa_uniform_split_location_offset(shProg, location, loc, array_index);
 
    if (shProg->UniformStorage[*loc].array_elements == 0 && count > 1) {