summaryrefslogtreecommitdiffstats
path: root/tests/wgsl/workgroup-uniform-load.slang
blob: 3ace37826e3a4ac4a712c27e117681b6c18551ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// groupshared-ref-param.slang

//TEST:SIMPLE(filecheck=CHECK): -target wgsl -entry computeMain -stage compute


//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<int> outputBuffer;

groupshared uint sharedVal;

// Expect sharedVal to be passed by reference.
//
// CHECK: fn computeMain({{.*}}({{.*}})
// CHECK: {{.*}}workgroupUniformLoad(&((sharedVal_{{[a-zA-Z0-9_]*}}))){{.*}};
// CHECK: }


[numthreads(1, 1, 1)]
void computeMain(int3 dispatchThreadID: SV_DispatchThreadID)
{
    int idx = dispatchThreadID.x;

    sharedVal = 1;
    outputBuffer[0] = workgroupUniformLoad(sharedVal);
}