summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-12-17 16:36:23 -0800
committerJason Ekstrand <[email protected]>2015-12-17 16:36:29 -0800
commitd7f66f9f6fb47ddf30c782961eb2fc1dcc593975 (patch)
tree0fb0048fd6f60251a023c0dc5fc60d9589581e8a
parent1473a8dc6f4a015558c8c3e818d706f9af584364 (diff)
nir/spirv: Array lengths are constants not literals
-rw-r--r--src/glsl/nir/spirv_to_nir.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/glsl/nir/spirv_to_nir.c b/src/glsl/nir/spirv_to_nir.c
index 1b1d7b5098f..07d47891770 100644
--- a/src/glsl/nir/spirv_to_nir.c
+++ b/src/glsl/nir/spirv_to_nir.c
@@ -515,8 +515,14 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
struct vtn_type *array_element =
vtn_value(b, w[2], vtn_value_type_type)->type;
- /* A length of 0 is used to denote unsized arrays */
- unsigned length = (opcode == SpvOpTypeArray) ? w[3] : 0;
+ unsigned length;
+ if (opcode == SpvOpTypeRuntimeArray) {
+ /* A length of 0 is used to denote unsized arrays */
+ length = 0;
+ } else {
+ length =
+ vtn_value(b, w[3], vtn_value_type_constant)->constant->value.u[0];
+ }
val->type->type = glsl_array_type(array_element->type, length);
val->type->array_element = array_element;