From 48228c114ef127126dfcb55d242e9125ac116a06 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 20 Nov 2015 12:49:20 -0800 Subject: [PATCH] nir/spirv: Add support for runtime arrays --- src/glsl/nir/spirv_to_nir.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/glsl/nir/spirv_to_nir.c b/src/glsl/nir/spirv_to_nir.c index 024988e06ef..db023f614a8 100644 --- a/src/glsl/nir/spirv_to_nir.c +++ b/src/glsl/nir/spirv_to_nir.c @@ -507,10 +507,15 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode, break; } + case SpvOpTypeRuntimeArray: case SpvOpTypeArray: { struct vtn_type *array_element = vtn_value(b, w[2], vtn_value_type_type)->type; - val->type->type = glsl_array_type(array_element->type, w[3]); + + /* A length of 0 is used to denote unsized arrays */ + unsigned length = (opcode == SpvOpTypeArray) ? w[3] : 0; + + val->type->type = glsl_array_type(array_element->type, length); val->type->array_element = array_element; val->type->stride = 0; break; @@ -630,7 +635,6 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode, GLSL_TYPE_FLOAT); break; - case SpvOpTypeRuntimeArray: case SpvOpTypeOpaque: case SpvOpTypeEvent: case SpvOpTypeDeviceEvent: -- 2.30.2