KhronosGroup / KhronosGroup/glslang
buffer_reference incorrectly bypasses SPIR-V binding check when declaring blocks
- Dominant language
- C++
- Stars
- 3.6k
- Forks
- 989
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 31
Description
GL_EXT_buffer_reference says:
> If there is an instance name, then a block variable is declared and that variable behaves the same as if "buffer_reference" were not used. Set and binding layouts as well as qualifiers like coherent and volatile don't apply to the reference type, but do apply to the instance variable.
When declaring an instance using a non-buffer-reference type for SPIR-V it is compulsory to include a binding qualifier. When using `buffer_reference` this check is bypassed in the compiler, meaning that the following code is incorrectly allowed:
```
layout (std430, buffer_reference) buffer B {
float foo;
} b;
```
and the declared block automatically gets assigned `binding=0`.
Contributor guide
Research direction
Reproduce the issue with the shader shown in the report, then trace the SPIR-V binding validation for blocks declared with buffer_reference. The fix is complete when this declaration is rejected unless it includes a binding qualifier, rather than being accepted with binding=0; add coverage for the reported example if the existing compiler tests provide a suitable place.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100