diff options
author | Jason Ekstrand <[email protected]> | 2015-05-01 11:27:21 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-08-31 16:58:20 -0700 |
commit | e709a4ebb8d3ebcdd101899223dd239b647a540b (patch) | |
tree | 18011bc569e105c654616d834539ad1d29a464c0 | |
parent | 67af6c59f22cf5a223e539faa4215e7722bda75c (diff) |
nir/spirv: Use vtn_value in the types code and fix a off-by-one error
-rw-r--r-- | src/glsl/nir/spirv_to_nir.c | 12 |
1 files changed, 7 insertions, 5 deletions
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: |