From 5dd4386b92a665869b249eae07af78e648bd891d Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 29 Dec 2015 13:15:17 -0800 Subject: [PATCH] nir/spirv: Use a C99-style initializer for structure fields This ensures that all unknown fields get zero-initizlied so we don't have undefined values floating around. --- src/glsl/nir/spirv/spirv_to_nir.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/glsl/nir/spirv/spirv_to_nir.c b/src/glsl/nir/spirv/spirv_to_nir.c index 4a90f1827cf..da586533529 100644 --- a/src/glsl/nir/spirv/spirv_to_nir.c +++ b/src/glsl/nir/spirv/spirv_to_nir.c @@ -587,16 +587,13 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode, NIR_VLA(struct glsl_struct_field, fields, count); for (unsigned i = 0; i < num_fields; i++) { - /* TODO: Handle decorators */ val->type->members[i] = vtn_value(b, w[i + 2], vtn_value_type_type)->type; - fields[i].type = val->type->members[i]->type; - fields[i].name = ralloc_asprintf(b, "field%d", i); - fields[i].location = -1; - fields[i].interpolation = 0; - fields[i].centroid = 0; - fields[i].sample = 0; - fields[i].matrix_layout = 2; + fields[i] = (struct glsl_struct_field) { + .type = val->type->members[i]->type, + .name = ralloc_asprintf(b, "field%d", i), + .location = -1, + }; } struct member_decoration_ctx ctx = { -- 2.30.2