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
544 B21 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
8static int getValue<let N: int>()
9{
10    static const int v = N;
11    return v;
12}
13
14[numthreads(4, 1, 1)]
15void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
16{    
17    int index = dispatchThreadID.x;
18
19	outputBuffer[index] = getValue<10>();
20}
21