summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/pointer/pointer-access/read-only-pointer-2.slang
blob: c5288cabaa8e343731e27f89183ea9daecd8fa3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//TEST:SIMPLE(filecheck=CHECK):-stage compute -entry computeMain -target spirv

// Tests valid use of read-only pointer

// CHECK: OpEntryPoint
// CHECK-NOT: error

int* processMemory;
int* output;

typealias ReadPtr = Ptr<int, Access::Read, AddressSpace::Device>;

[numthreads(1, 1, 1)]
void computeMain(int id : SV_DispatchThreadID)
{
    ReadPtr ptr1 = ReadPtr(processMemory + id.x);

    output[id] = ptr1[id];
}