yum-mirror/slang

Making it easier to work with shaders

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

jsmall-nvidiaHandling static const variables in generics (#2171)7f36c34da

master
609 B24 linesraw
1//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -Xslang -dump-ir
2
3/* Doesn't work correctly failing in emit with a 'generic' instruction that is not expected. */
4
5//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
6RWStructuredBuffer<int> outputBuffer;
7    
8struct GetValue2<let N : int>
9{
10    static int getValue()
11    {
12        static const int v = N;
13        return v;
14    }
15};    
16  
17[numthreads(4, 1, 1)]
18void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
19{    
20    int index = dispatchThreadID.x;
21
22	outputBuffer[index] = GetValue2<20>::getValue(); 
23}
24