summaryrefslogtreecommitdiffstats
path: root/tests/current-bugs/specialize-with-undefined-resource.slang
blob: 50b006368b18caa2af1f277e72f72ed710d80e0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//DISABLE_TEST:SIMPLE:-target dxil -entry computeMain -profile cs_6_2

struct ValueContainer
{
    Texture2D<uint> values;
 
    uint getValue(uint2 at)
    {
        return values[at];
    }
};
  
ParameterBlock<ValueContainer> gContainer;

Texture2D<uint> gValues;    
    
RWStructuredBuffer<int> outputBuffer;    
    
[numthreads(4, 4, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
    ValueContainer container;

    // This will work
    // container = gContainer;
    // Or just setting directly
    // container.values = gValues; 
    
    // But if values in container is not .... then specialization fails
    // and invalid HLSL is output.
    
    uint2 pos = dispatchThreadID.xy;
    
    outputBuffer[pos.x + pos.y] = container.getValue(pos);
}