yum-mirror/slang

Making it easier to work with shaders

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

Mukund KeshavaFix RWStructuredBuffer emission (#7139)1fd7b2296

master
825 B26 linesraw
1//DISABLE_TEST(smoke):SIMPLE: -target ptx -entry computeMain -stage compute 
2//DISABLE_TEST(compute):COMPARE_COMPUTE:-cpu -compute 
3//TEST(compute):COMPARE_COMPUTE:-cuda -compute 
4
5//TEST_INPUT:ubuffer(data=[1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer
6RWStructuredBuffer<int> outputBuffer : register(u0);
7
8[shader("compute")]
9[numthreads(4, 1, 1)]
10void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
11{
12    int tid = int(dispatchThreadID.x);
13    for(;;)
14    {
15        if(outputBuffer[0] == 1)
16        {
17            // This is just a statement to trigger bug #7127
18            outputBuffer[0] = tid;
19            break;
20        }
21    }
22    outputBuffer[tid * 4] = tid;
23    outputBuffer[tid * 4 + 1] = tid + 1;
24    outputBuffer[tid * 4 + 2] = tid + 2; 
25    outputBuffer[tid * 4 + 3] = tid + 3;
26}