summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-11-20 15:15:38 -0800
committerJason Ekstrand <[email protected]>2015-11-20 15:15:40 -0800
commit1157b0360d9978028685dd78fa77871d5172c628 (patch)
tree30d9c16ef644b9cd2fc5fd4e89d3c88babf7f088
parentcff74d6fb876c0ca4a6c5c5041c02770241beeb2 (diff)
nir/spirv: Rework decoration iteration
The old code didn't work correctly if you had member decorations after non-member decorations. Since glslang never gave us any of those, it wasn't properly tested.
-rw-r--r--src/glsl/nir/spirv_to_nir.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/glsl/nir/spirv_to_nir.c b/src/glsl/nir/spirv_to_nir.c
index ba49b04a54e..70610ca0f66 100644
--- a/src/glsl/nir/spirv_to_nir.c
+++ b/src/glsl/nir/spirv_to_nir.c
@@ -186,24 +186,25 @@ vtn_handle_extension(struct vtn_builder *b, SpvOp opcode,
static void
_foreach_decoration_helper(struct vtn_builder *b,
struct vtn_value *base_value,
- int member,
+ int parent_member,
struct vtn_value *value,
vtn_decoration_foreach_cb cb, void *data)
{
- int new_member = member;
-
for (struct vtn_decoration *dec = value->decoration; dec; dec = dec->next) {
- if (dec->member >= 0) {
- assert(member == -1);
- new_member = dec->member;
+ int member;
+ if (dec->member < 0) {
+ member = parent_member;
+ } else {
+ assert(parent_member == -1);
+ member = dec->member;
}
if (dec->group) {
assert(dec->group->value_type == vtn_value_type_decoration_group);
- _foreach_decoration_helper(b, base_value, new_member, dec->group,
+ _foreach_decoration_helper(b, base_value, member, dec->group,
cb, data);
} else {
- cb(b, base_value, new_member, dec, data);
+ cb(b, base_value, member, dec, data);
}
}
}