Module: Mesa
Branch: master
Commit: 742bc53d040632fd98fac8930e4e8749f5c430e2
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=742bc53d040632fd98fac8930e4e8749f5c430e2

Author: Kenneth Graunke <[email protected]>
Date:   Sun Mar 13 00:08:56 2016 -0800

spirv: Fix structure splitting with per-vertex interface arrays.

We want to use interface_type, not vtn_var->type.  They're normally
equivalent, but for geometry/tessellation per-vertex interface arrays,
we need to unwrap a level.

Otherwise, we tried to iterate a structure members but instead used
an array length.  If the array length was longer than the number of
fields in the structure, we'd crash.

Fixes the CreatePipelineGeometryInputBlockPositive layer validation
test.

v2: Just use glsl_without_array() on the vtn_var type
    (requested by Jason Ekstrand).

Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Chris Forbes <[email protected]>

---

 src/compiler/spirv/vtn_variables.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/compiler/spirv/vtn_variables.c 
b/src/compiler/spirv/vtn_variables.c
index 3b495b2..d2f174c 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -929,7 +929,8 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value 
*val, int member,
          vtn_var->var->data.explicit_location = true;
       } else {
          assert(vtn_var->members);
-         unsigned length = glsl_get_length(vtn_var->type->type);
+         unsigned length =
+            glsl_get_length(glsl_without_array(vtn_var->type->type));
          for (unsigned i = 0; i < length; i++) {
             vtn_var->members[i]->data.location = location;
             vtn_var->members[i]->data.explicit_location = true;

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to