summaryrefslogtreecommitdiffstats
path: root/tests/metal/test_buffer.slang
blob: 122af3b9a866a5fad3bc15137aa3577d75db91ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Test that Buffer<T> maps to texture_buffer<uint, access::read> in Metal

//TEST:SIMPLE(filecheck=METAL): -stage compute -entry computeMain -target metal


// METAL: texture_buffer<uint, access::read> inputBuffer_{{.*}}
Buffer<uint> inputBuffer;

RWStructuredBuffer<uint> outputBuffer;

[numthreads(4, 1, 1)]
void computeMain(uint3 dtid : SV_DispatchThreadID)
{
    uint idx = dtid.x;
    // Load values from the buffer to verify correct access
    outputBuffer[idx] = inputBuffer.Load(idx);
}