summaryrefslogtreecommitdiff
path: root/tests/metal/groupshared.slang
blob: 4d1f6ecac6ba68d07fabb8eee949e3eab8f4522d (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
26
27
28
29
30
31
//TEST:SIMPLE(filecheck=CHECK): -target metal
//TEST:SIMPLE(filecheck=CHECK-ASM): -target metallib

uniform RWStructuredBuffer<float> outputBuffer;

struct MyBlock
{
    StructuredBuffer<float> b1;
    StructuredBuffer<float> b2;
}
ParameterBlock<MyBlock> block;

groupshared int myArr[16];

void func(float v)
{
    outputBuffer[0] = myArr[0];
}

// CHECK: array<int, int(16)> threadgroup* myArr{{.*}};
// CHECK: {{\[\[}}kernel{{\]\]}} void main_kernel
// CHECK: threadgroup array<int, int(16)> myArr{{.*}};
// CHECK: (&kernelContext{{.*}})->myArr{{.*}} = &myArr{{.*}};
// CHECK-ASM: define void @main_kernel

[numthreads(1,1,1)]
void main_kernel(uint3 tid: SV_DispatchThreadID)
{
    myArr[tid.x] = tid.x;
    func(3.0f);
}