summaryrefslogtreecommitdiffstats
path: root/tests/metal/barrier.slang
blob: 366abe1d0c220f3b7d856f63e850b46778c5f0b7 (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
//TEST:SIMPLE(filecheck=METAL): -target metal
//TEST:SIMPLE(filecheck=METALLIB): -target metallib
//TEST(compute, metal):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-metal -compute -output-using-type
//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -output-using-type

// METAL: threadgroup_barrier

// METALLIB: define void @computeMain

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

[numthreads(1,1,1)]
void computeMain()
{
    // BUF: 1.0
    outputBuffer[0] = 1;
    GroupMemoryBarrierWithGroupSync();
    // BUF: 2.0
    outputBuffer[1] = 2;
    AllMemoryBarrierWithGroupSync();
    // BUF: 3.0
    outputBuffer[2] = 3;
}