[Mesa-dev] [PATCH] glsl: set stage flag for structs and arrays in resource list

Timothy Arceri t_arceri at yahoo.com.au
Fri Jul 3 23:44:12 PDT 2015


This fixes: ES31-CTS.program_interface_query.uniform-types

Cc: Tapani Pälli <tapani.palli at intel.com>
---
 Note: This only fixes the remaining CTS subtests for uniform-types the
 other fixes are part of my clean-up series:
 http://lists.freedesktop.org/archives/mesa-dev/2015-July/088122.html

 src/glsl/linker.cpp | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 0d4bc15..6a69c15 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -2648,9 +2648,19 @@ build_stageref(struct gl_shader_program *shProg, const char *name)
        */
       foreach_in_list(ir_instruction, node, sh->ir) {
          ir_variable *var = node->as_variable();
-         if (var && strcmp(var->name, name) == 0) {
-            stages |= (1 << i);
-            break;
+         if (var) {
+            unsigned baselen = strlen(var->name);
+            if (strncmp(var->name, name, baselen) == 0) {
+               /* Check for exact name matches but also check for arrays and
+                * structs.
+                */
+               if (name[baselen] == '\0' ||
+                   name[baselen] == '[' ||
+                   name[baselen] == '.') {
+                  stages |= (1 << i);
+                  break;
+               }
+            }
          }
       }
    }
-- 
2.4.3



More information about the mesa-dev mailing list