microsoft / microsoft/DirectXShaderCompiler
[SPIR-V] SPV_EXT_descriptor_heap: Remove error diagnostic for discarded descriptor heap indexing`
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
Discarded descriptor heap indexing (ResourceDescriptorHeap[i]; as a bare statement) is valid HLSL. The DXIL case which used to crash was fixed in #8749, which established the intended silent no-op behavior.
The current SPIR-V path instead emits an error:
error: ResourceDescriptorHeap/SamplerDescriptorHeap indexing must be used as a resource
This is now inconsistent with DXIL and incorrect by the language.
Fix
In doCXXOperatorCallExpr (SpirvEmitter.cpp), drop the emitError when parentMap->getParent(expr) yields no parent cast. Keep the null guard and return nullptr (result is unused). Remove or repurpose sm6_6.descriptorheap.ext.discarded.error.hlsl.
References
- #8749 DXIL fix + discussion establishing correct behavior
- https://github.com/microsoft/DirectXShaderCompiler/pull/8517#discussion_r3750881342) original review discussion flagged by @llvm-beanz
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in SpirvEmitter.cpp at doCXXOperatorCallExpr and compare the discarded descriptor heap handling with the DXIL fix from #8749. Remove the diagnostic while preserving the null guard and unused-result return, then remove or repurpose sm6_6.descriptorheap.ext.discarded.error.hlsl and run the related SPIR-V tests to verify silent handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100