yum-mirror/slang

Making it easier to work with shaders

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

Anders LeinoEnable a bunch of WGPU tests (#5513)43df1da01

master
906 B29 linesraw
1// compute-system-values.slang
2
3//TEST(compute):COMPARE_COMPUTE: -shaderobj
4//TEST(compute):COMPARE_COMPUTE: -cpu -shaderobj
5//TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl
6
7//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer
8RWStructuredBuffer<int> outputBuffer;
9
10[numthreads(4, 2, 1)]
11void computeMain(
12    uint2 groupThreadID     : SV_GroupThreadID,
13    int groupIndex          : SV_GroupIndex,
14    uint3 dispatchThreadID  : SV_DispatchThreadID,
15    int2 groupID            : SV_GroupID)
16{
17    int tid = groupID.x + groupIndex;
18
19    int value = 0;
20    value = value*16 + groupIndex;
21    value = value*16 + groupID.x;
22    value = value*16 + groupID.y;
23    value = value*16 + int(groupThreadID.x);
24    value = value*16 + int(groupThreadID.y);
25    value = value*16 + int(dispatchThreadID.x);
26    value = value*16 + int(dispatchThreadID.y);
27
28    outputBuffer[tid] = value;
29}