KhronosGroup / KhronosGroup/glslang
Probably invalid SPIR-V when using Vulkan relaxed mode
- Dominant language
- C++
- Stars
- 3.6k
- Forks
- 989
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 31
Description
When using glslang (via shaderc) the given compute shader (preprocessed GLSL implementation of XeGTAO) it can compile, but fails to optimize, while when relaxed mode is turned off, the optimization works too.
The error is:
```
shaderc: internal error: compilation succeeded but failed to optimize: [VUID-StandaloneSpirv-UniformConstant-06677] UniformConstant id '281' is missing DescriptorSet decoration.
From Vulkan spec:
These variables must have DescriptorSet and Binding decorations specified
%sourceViewspaceDepthdepthSampler = OpVariable %_ptr_UniformConstant_279 UniformConstant
```
[XeGTAO.txt](https://github.com/user-attachments/files/30104396/XeGTAO.txt)
Contributor guide
Research direction
Start by reproducing the failure with the attached XeGTAO.txt compute shader through glslang via shaderc, comparing relaxed mode with relaxed mode disabled. Inspect the generated SPIR-V and the optimizer error around the UniformConstant variable missing DescriptorSet decoration. Done means the relaxed-mode case optimizes successfully and produces SPIR-V accepted by the relevant Vulkan validation checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100