KhronosGroup / KhronosGroup/SPIRV-Reflect
Why are all storage buffers treated like runtime arrays ?
- Dominant language
- C
- Stars
- 871
- Forks
- 188
- Avg merge
- 19m
- Merged PRs (30d)
- 1
Description
I'm trying to get the size of descriptor blocks.
For uniform buffers it seems to work, but for storage buffers `block.size` is zero.
This is caused by this bit of code in `spirv_reflect.c` :
```
bool is_parent_rta = (p_descriptor->descriptor_type == SPV_REFLECT_DESCRIPTOR_TYPE_STORAGE_BUFFER);
result = ParseDescriptorBlockVariableSizes(p_parser, p_module, true, false, is_parent_rta, &p_descriptor->block);
if (result != SPV_REFLECT_RESULT_SUCCESS) {
return result;
}
if (is_parent_rta) {
p_descriptor->block.size = 0;
p_descriptor->block.padded_size = 0;
}
}
```
Why are all storage buffers treated runtime arrays ?
(I presume that's what `is_parent_rta` mean)
PS:
My wider goal is to make an automated system to create C structs that exactly represent shader block variables (with correct alignment and size).
I assume that is a common goal here, so if you have pointers to similar projects I'm interested.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in spirv_reflect.c at the is_parent_rta logic and trace ParseDescriptorBlockVariableSizes for storage-buffer descriptors. Compare how uniform and storage buffers are classified, then verify what block.size and block.padded_size should report for storage buffers that are not runtime arrays. Done means the reported descriptor-block sizes match the shader variables' actual layout without breaking runtime-array handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100