KhronosGroup / KhronosGroup/SPIRV-Tools
Add a spirv-opt pass to add NonWritable to top-level structs when all members are NonWritable
- Dominant language
- C++
- Stars
- 1.4k
- Forks
- 709
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 28
Description
A quirk of DXC that went unnoticed for years is that instead of decorating the top-level of a buffer as NonWritable, it decorates all members of the buffer. While this is legal, it wasn't noticed during bring up of VK_EXT_descriptor_heap, and a key part of how the mapping APIs in that extension works is making use of this decoration.
A [DXC issue has been raised](https://github.com/microsoft/DirectXShaderCompiler/issues/8492) to modify DXC to adjust for this, but for existing shaders it could be useful to be able to do a quick fixup pass, without needing to regenerate all of the shaders.
This issue is a request to at least consider adding a pass to do this to spirv-opt.
Contributor guide
Research direction
Start by reviewing the spirv-opt pass framework and existing decoration-related passes. Determine how to identify top-level buffer structs whose members are all NonWritable, then verify that the pass produces the requested top-level decoration without changing unrelated shaders.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100