microsoft / microsoft/DirectXShaderCompiler
Erroneous gradients warning when indexing to an array of textures
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
Getting the following warning which I think it's incorrect warning: Gradient operations are not affected by wave-sensitive data or control flow. [-Winline-asm]
Steps to Reproduce
Following was built with -T ps_6_6 -E PSMain
struct PSInput
{
nointerpolation int dynamicallyUniformIndex : IDX; // Same value for the whole drawcall
float2 uv : UV;
};
Texture2D texes[100];
SamplerState sam;
float4 PSMain(PSInput input) : SV_Target0
{
int idx = WaveReadLaneFirst(input.dynamicallyUniformIndex); // Scalarize
float4 val = texes[idx].Sample(sam, input.uv);
return val;
}
Actual Behavior
The idx is used to select a texture and it shouldn't affect the gradients. I don't think the warning is correct.
Environment
- DXC version: DXC trunk & 1.8.2403
- 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 by reproducing the supplied PSMain example with DXC using -T ps_6_6 -E PSMain and compare the warning on trunk and version 1.8.2403. Trace how the compiler handles WaveReadLaneFirst before the indexed texture Sample; done means the warning is either removed for this case or its behavior is documented and covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100