[Mesa-dev] [PATCH 14/18] glsl: Don't include the array index.

Kenneth Graunke kenneth at whitecape.org
Mon Aug 1 17:29:41 UTC 2016


Issue 16 of the ARB_program_interface_query spec gives an example:

      For example, in the following code:

        uniform Block1 {
          int member1;
        };
        uniform Block2 {
          int member2;
        } instance2;
        uniform Block3 {
          int member3;
        } instance3[2];  // uses two separate buffer bindings

      the three uniforms (if active) are enumerated as "member1",
      "Block2.member2", and "Block3.member3".

>From this it's pretty clear that the array index should not be included.

Cc: mesa-stable at lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/compiler/glsl/linker.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 6d45a02..bf11cb4 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -3800,7 +3800,8 @@ add_shader_variable(struct gl_shader_program *shProg, unsigned stage_mask,
        */
       const char *prefixed_name = (var->data.from_named_ifc_block &&
                                    !is_gl_identifier(var->name))
-         ? ralloc_asprintf(shProg, "%s.%s", var->get_interface_type()->name,
+         ? ralloc_asprintf(shProg, "%s.%s",
+                           var->get_interface_type()->without_array()->name,
                            name)
          : name;
 
-- 
2.9.2



More information about the mesa-dev mailing list