yum-mirror/slang

Making it easier to work with shaders

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

Yong HeFix GLSL static initialization bug. (#3409)3979660d4

master
559 B21 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -entry computeMain -stage compute -target glsl
2//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUF): -shaderobj -vk
3
4//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
5RWStructuredBuffer<int> outputBuffer;
6
7[numthreads(4, 1, 1)]
8void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
9{
10    // CHECK-NOT: {{\b}}if{{\b}}
11
12    int tid = dispatchThreadID.x;
13    
14    static int a[] = { 1, 2 };
15    
16	outputBuffer[dispatchThreadID.x] = a[tid & 1];
17    // BUF: 1
18    // BUF: 2
19    // BUF: 1
20    // BUF: 2
21}