KhronosGroup / KhronosGroup/glslang
Reading from Mesh Shader output should be rejected by compiler
- Dominant language
- C++
- Stars
- 3.6k
- Forks
- 989
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 31
Description
The fllowing code is compiled ok by glslc, but later rejected by the optimizer:
```
layout(location = 1) out PBRVertexOut outVert[];
outVert[v].worldPos = worldPos;
gl_MeshVerticesEXT[v].gl_Position = ubo.proj * ubo.view * vec4(outVert[v].worldPos, 1.0);
```
Optimizer error is `[VUID-StandaloneSpirv-MeshEXT-07107] The Output Storage Class in a Mesh Execution Model must not be read from`
Probably the compiler should reject this kind of code, if it is not allowed.
I attached a very simple mesh shader source to test this. Please use this command after extracting the source from the zip:
`glslc --target-env=vulkan1.4 -O pbr.mesh -o pbr.mesh.spv`
[pbr.zip](https://github.com/user-attachments/files/25121163/pbr.zip)
Contributor guide
Research direction
Extract pbr.zip and run the reported glslc command on pbr.mesh to reproduce the accepted shader and optimizer error. Trace the glslc compiler path for mesh shader output reads and add coverage for this source. Done means the compiler rejects the invalid read with a diagnostic before optimization.
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
- 55/100