From 75a96cedf7b0e5613560be0962dec973a4d2f2fe Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Sat, 4 Jul 2015 15:43:15 +1000 Subject: [PATCH] glsl: set stage flag for structs and arrays in resource list MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This fixes the remaining failing tests in: ES31-CTS.program_interface_query.uniform-types Reviewed-by: Samuel Iglesias Gonsálvez Reviewed-by: Tapani Pälli --- 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 a7812116944..a16dab4ddcd 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -3129,9 +3129,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.30.2