Discussion:
[PATCH] glsl: get correct member type when processing xfb ifc arrays
Add Reply
Timothy Arceri
2017-12-06 23:34:57 UTC
Reply
Permalink
Raw Message
This fixes a crash (although the test still fails) in release builds
with:

KHR-GL45.enhanced_layouts.xfb_block_stride

Fixes: 0822517936d4 "glsl: add helper to process xfb qualifiers during linking"
Cc: Kenneth Graunke <***@whitecape.org>
---
src/compiler/glsl/link_varyings.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index 0f53cd4aa95..3f35780b1b4 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -160,21 +160,21 @@ process_xfb_layout_qualifiers(void *mem_ctx, const gl_linked_shader *sh,
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 */
member_type =
- type->fields.structure[type->field_index(var->name)].type;
+ type->fields.structure[type->without_array()->field_index(var->name)].type;
name = ralloc_strdup(NULL, type->without_array()->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
Timothy Arceri
2017-12-07 00:57:05 UTC
Reply
Permalink
Raw Message
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 <***@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
Kenneth Graunke
2017-12-07 02:55:26 UTC
Reply
Permalink
Raw Message
Post by Timothy Arceri
KHR-GL45.enhanced_layouts.xfb_block_stride
Fixes: 0822517936d4 "glsl: add helper to process xfb qualifiers during linking"
Thanks a ton for fixing this, Tim!

Reviewed-by: Kenneth Graunke <***@whitecape.org>

Loading...