From: Jason Ekstrand Date: Fri, 1 May 2015 18:27:21 +0000 (-0700) Subject: nir/spirv: Use vtn_value in the types code and fix a off-by-one error X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e709a4ebb8d3ebcdd101899223dd239b647a540b;p=mesa.git nir/spirv: Use vtn_value in the types code and fix a off-by-one error --- diff --git a/src/glsl/nir/spirv_to_nir.c b/src/glsl/nir/spirv_to_nir.c index a7ce17a77d5..abcdd66a4f7 100644 --- a/src/glsl/nir/spirv_to_nir.c +++ b/src/glsl/nir/spirv_to_nir.c @@ -218,7 +218,8 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode, return glsl_float_type(); case SpvOpTypeVector: { - const struct glsl_type *base = b->values[args[0]].type; + const struct glsl_type *base = + vtn_value(b, args[0], vtn_value_type_type)->type; unsigned elems = args[1]; assert(glsl_type_is_scalar(base)); @@ -226,7 +227,8 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode, } case SpvOpTypeMatrix: { - const struct glsl_type *base = b->values[args[0]].type; + const struct glsl_type *base = + vtn_value(b, args[0], vtn_value_type_type)->type; unsigned columns = args[1]; assert(glsl_type_is_vector(base)); @@ -242,7 +244,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode, NIR_VLA(struct glsl_struct_field, fields, count); for (unsigned i = 0; i < count; i++) { /* TODO: Handle decorators */ - fields[i].type = b->values[args[i]].type; + fields[i].type = vtn_value(b, args[i], vtn_value_type_type)->type; fields[i].name = ralloc_asprintf(b, "field%d", i); fields[i].location = -1; fields[i].interpolation = 0; @@ -258,7 +260,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode, const struct glsl_type *return_type = b->values[args[0]].type; NIR_VLA(struct glsl_function_param, params, count - 1); for (unsigned i = 1; i < count; i++) { - params[i - 1].type = b->values[args[i]].type; + params[i - 1].type = vtn_value(b, args[i], vtn_value_type_type)->type; /* FIXME: */ params[i - 1].in = true; @@ -272,7 +274,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode, * the same type. The validator should ensure that the proper number * of dereferences happen */ - return b->values[args[0]].type; + return vtn_value(b, args[1], vtn_value_type_type)->type; case SpvOpTypeSampler: case SpvOpTypeRuntimeArray: