microsoft / microsoft/DirectXShaderCompiler
assert/crash on min16int raw buffer templated Store
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
ReplaceMinPrecisionRawBufferStoreByType is meant to translate min precision raw buffer stores to full precision store operations. However, for min16int or min16uint types there is a comment which seems incorrect, and an assert is hit.
This comment does not seem correct, since we have a RWByteAddressBuffer templated Store<min16int> operation, not a typed buffer store.
https://github.com/microsoft/DirectXShaderCompiler/blob/bbcbb2de14a67b5d8f4a0bff9b9db274b27b7fc5/lib/HLSL/DxilGenerationPass.cpp#L1029-L1031
When this code attempts to cast the inner type from the resouce type %struct.RWByteAddressBuffer = type { i32 } to a StructType (from i32), the cast fails and aborts compilation:
Steps to Reproduce
// RUN: %dxc -T vs_6_2
RWByteAddressBuffer BAB : register(u1, space0);
void main(min16int In : INPUT) {
BAB.Store(0, In);
}
Actual Behavior
error: cast<X>() argument of incompatible type!
Environment
- DXC version: current main and releases going back at least to 1.6
- Host Operating System: any
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 lib/HLSL/DxilGenerationPass.cpp around lines 1029-1043 and reproduce the failure with the provided HLSL snippet using dxc -T vs_6_2. Trace ReplaceMinPrecisionRawBufferStoreByType for the templated RWByteAddressBuffer Store path. Done means the repro compiles without the incompatible cast assertion and the existing behavior for other store types remains intact.
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
- Clearly specified
- Newbie friendliness
- 45/100