[Mesa-dev] [PATCH v2] glsl: get correct member type when processing xfb ifc arrays

Timothy Arceri tarceri at itsqueeze.com
Thu Dec 7 00:57:05 UTC 2017


This fixes a crash in:

KHR-GL45.enhanced_layouts.xfb_block_stride

Fixes: 0822517936d4 "glsl: add helper to process xfb qualifiers during linking"
Cc: Kenneth Graunke <kenneth at whitecape.org>
---
 src/compiler/glsl/link_varyings.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index 0f53cd4aa95..2be81b3f93a 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -158,24 +158,26 @@ process_xfb_layout_qualifiers(void *mem_ctx, const gl_linked_shader *sh,
       ir_variable *var = node->as_variable();
       if (!var || var->data.mode != ir_var_shader_out)
          continue;
 
       if (var->data.explicit_xfb_offset) {
          char *name;
          const glsl_type *type, *member_type;
 
          if (var->data.from_named_ifc_block) {
             type = var->get_interface_type();
+
             /* Find the member type before it was altered by lowering */
+            const glsl_type *type_wa = type->without_array();
             member_type =
-               type->fields.structure[type->field_index(var->name)].type;
-            name = ralloc_strdup(NULL, type->without_array()->name);
+               type_wa->fields.structure[type_wa->field_index(var->name)].type;
+            name = ralloc_strdup(NULL, type_wa->name);
          } else {
             type = var->type;
             member_type = NULL;
             name = ralloc_strdup(NULL, var->name);
          }
          create_xfb_varying_names(mem_ctx, type, &name, strlen(name), &i,
                                   var->name, member_type, varying_names);
          ralloc_free(name);
       }
    }
-- 
2.14.3



More information about the mesa-dev mailing list