yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Jay KwakFix incorrect resolve of specialization instance (#6162)a9ce7520e

master
688 B30 linesraw
1//TEST:SIMPLE(filecheck=CHK): -target spirv -entry computeMain
2
3//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
4RWStructuredBuffer<float> outputBuffer;
5
6groupshared float4 gsVar;
7
8__generic<TYPE1 : __BuiltinArithmeticType>
9struct MyContainer
10{
11    __generic<TYPE2 : __BuiltinArithmeticType>
12    void store(__ref vector<TYPE2,4> v)
13    {
14        v[0] = TYPE2(0);
15        v[1] = TYPE2(1);
16        v[2] = TYPE2(2);
17        v[3] = TYPE2(3);
18    }
19};
20
21[Shader("compute")]
22[NumThreads(1, 1, 1)]
23void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
24{
25    MyContainer<float> obj;
26    obj.store(gsVar);
27
28    // CHK-NOT:warning 41017:
29    outputBuffer[0] = gsVar.x;
30}