<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Mar 13, 2016 at 6:08 PM, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We want to use interface_type, not vtn_var->type. They're normally<br>
equivalent, but for geometry/tessellation per-vertex interface arrays,<br>
we need to unwrap a level.<br>
<br>
Otherwise, we tried to iterate a structure members but instead used<br>
an array length. If the array length was longer than the number of<br>
fields in the structure, we'd crash.<br>
---<br>
src/compiler/nir/spirv/vtn_variables.c | 2 +-<br>
1 file changed, 1 insertion(+), 1 deletion(-)<br>
<br>
diff --git a/src/compiler/nir/spirv/vtn_variables.c b/src/compiler/nir/spirv/vtn_variables.c<br>
index 31bf416..1628042 100644<br>
--- a/src/compiler/nir/spirv/vtn_variables.c<br>
+++ b/src/compiler/nir/spirv/vtn_variables.c<br>
@@ -923,7 +923,7 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,<br>
vtn_var->var->data.explicit_location = true;<br>
} else {<br>
assert(vtn_var->members);<br>
- unsigned length = glsl_get_length(vtn_var->type->type);<br>
+ unsigned length = glsl_get_length(val->type->type);<br></blockquote><div><br></div><div>Good catch. What I think we really want here though is a "without_array" helper. I'm not a huge fan of grabbing the type from the value because that comes in from the client and I don't really trust it.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
for (unsigned i = 0; i < length; i++) {<br>
vtn_var->members[i]->data.location = location;<br>
vtn_var->members[i]->data.explicit_location = true;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.2<br>
<br>
</font></span></blockquote></div><br></div></div>