KhronosGroup / KhronosGroup/SPIRV-Reflect

SPIRV-Reflect breaks on arrays of StructuredBuffer

Open
#64 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
871
Forks
188
Avg merge
19m
Merged PRs (30d)
1

Description

SPIRV-Reflect does not seem to like arrays of StructuredBuffer. Trying to reflect this declaration:

`StructuredBuffer test[16];`

will cause it to fail this assert:
https://github.com/chaoticbob/SPIRV-Reflect/blob/0780aee6ec8882d1f34a0de443a706fdae03e618/spirv_reflect.c#L1778-L1780

which is caused by this code:
https://github.com/chaoticbob/SPIRV-Reflect/blob/0780aee6ec8882d1f34a0de443a706fdae03e618/spirv_reflect.c#L1332-L1336

The decoration_flags are applied only once but not on recurring calls to ParseType(). I fixed this in my build by modifying the code to this:

```
if (p_type->id == INVALID_VALUE) {
p_type->id = p_node->result_id;
p_type->op = p_node->op;
p_type->decoration_flags = 0;
}
p_type->decoration_flags |= ApplyDecorations(&p_node->decorations);
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in spirv_reflect.c at ParseType(), the ApplyDecorations() call, and the assertion around lines 1778-1780. Reproduce the issue with StructuredBuffer test[16]; and trace the recurring type parsing. Done means this declaration reflects without triggering the assertion and its decorations remain correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
computer-graphics
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.