From: Jason Ekstrand Date: Sat, 2 Jan 2016 19:51:40 +0000 (-0800) Subject: nir/spirv: Fix group decorations X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f6c4658cde51fb1db3d880c2ffc5921929e5615f;p=mesa.git nir/spirv: Fix group decorations They were completely bogus before. For one thing, OpDecorationGroup created a value of type undef rather than decoration_group. Also OpGroupMemberDecorate didn't properly apply the decoration to the different members of the different groups. It *should* be correct now but there's no good way to test it yet. --- diff --git a/src/glsl/nir/spirv/spirv_to_nir.c b/src/glsl/nir/spirv/spirv_to_nir.c index 681adc74d1f..3a8949438f4 100644 --- a/src/glsl/nir/spirv/spirv_to_nir.c +++ b/src/glsl/nir/spirv/spirv_to_nir.c @@ -298,7 +298,7 @@ vtn_handle_decoration(struct vtn_builder *b, SpvOp opcode, switch (opcode) { case SpvOpDecorationGroup: - vtn_push_value(b, target, vtn_value_type_undef); + vtn_push_value(b, target, vtn_value_type_decoration_group); break; case SpvOpDecorate: @@ -331,21 +331,19 @@ vtn_handle_decoration(struct vtn_builder *b, SpvOp opcode, case SpvOpGroupMemberDecorate: case SpvOpGroupDecorate: { - struct vtn_value *group = &b->values[target]; - assert(group->value_type == vtn_value_type_decoration_group); - - int scope; - if (opcode == SpvOpGroupDecorate) { - scope = VTN_DEC_DECORATION; - } else { - scope = VTN_DEC_STRUCT_MEMBER0 + *(w++); - } + struct vtn_value *group = + vtn_value(b, target, vtn_value_type_decoration_group); for (; w < w_end; w++) { - struct vtn_value *val = &b->values[*w]; + struct vtn_value *val = vtn_untyped_value(b, *w); struct vtn_decoration *dec = rzalloc(b, struct vtn_decoration); - dec->scope = scope; + dec->group = group; + if (opcode == SpvOpGroupDecorate) { + dec->scope = VTN_DEC_DECORATION; + } else { + dec->scope = VTN_DEC_STRUCT_MEMBER0 + *(w++); + } /* Link into the list */ dec->next = val->decoration;