glsl: Add all system variables to the input resource list.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 29 Mar 2016 19:07:37 +0000 (12:07 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Sat, 2 Apr 2016 05:05:18 +0000 (22:05 -0700)
System values are just built-in input variables that we've opted to
special-case out of convenience.  We need to consider all inputs,
regardless of how we've classified them.

Unfortunately, there's one exception: we shouldn't add gl_BaseVertex
unless ARB_shader_draw_parameters is enabled, because it doesn't
actually exist in the language, and shouldn't be counted in the
GL_ACTIVE_RESOURCES query.

Fixes dEQP-GLES31.functional.program_interface_query.program_input.
resource_list.compute.empty, which expects gl_NumWorkGroups to appear
in the resource list.

v2: Delete more code

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
src/compiler/glsl/linker.cpp
src/mesa/main/shader_query.cpp

index 0005d4965e1208033720979871eb56134b7c7295..19f4641c72436b3c2d9a718fbb1d75f7fde6cca2 100644 (file)
@@ -3531,17 +3531,7 @@ add_interface_variables(struct gl_shader_program *shProg,
          continue;
 
       switch (var->data.mode) {
-      /* From GL 4.3 core spec, section 11.1.1 (Vertex Attributes):
-       * "For GetActiveAttrib, all active vertex shader input variables
-       * are enumerated, including the special built-in inputs gl_VertexID
-       * and gl_InstanceID."
-       */
       case ir_var_system_value:
-         if (var->data.location != SYSTEM_VALUE_VERTEX_ID &&
-             var->data.location != SYSTEM_VALUE_VERTEX_ID_ZERO_BASE &&
-             var->data.location != SYSTEM_VALUE_INSTANCE_ID)
-            continue;
-         /* FALLTHROUGH */
       case ir_var_shader_in:
          if (programInterface != GL_PROGRAM_INPUT)
             continue;
index 993dc863220ba67cebfdd5ecc4a3d018cc7bbca6..e85e81d897c8d39c7773943947f521998a86ce71 100644 (file)
@@ -112,14 +112,7 @@ is_active_attrib(const gl_shader_variable *var)
       return var->location != -1;
 
    case ir_var_system_value:
-      /* From GL 4.3 core spec, section 11.1.1 (Vertex Attributes):
-       * "For GetActiveAttrib, all active vertex shader input variables
-       * are enumerated, including the special built-in inputs gl_VertexID
-       * and gl_InstanceID."
-       */
-      return var->location == SYSTEM_VALUE_VERTEX_ID ||
-             var->location == SYSTEM_VALUE_VERTEX_ID_ZERO_BASE ||
-             var->location == SYSTEM_VALUE_INSTANCE_ID;
+      return true;
 
    default:
       return false;