yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

ArielG-NV[CBP] Pointer frontend changes + groupshared pointer support (#7848)7758625d3

master
1011 B28 linesraw
1//TEST:SIMPLE(filecheck=SPIRV):-stage compute -entry computeMain -target spirv -capability vk_mem_model+sm_6_0+spvGroupNonUniformBallot
2//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -emit-spirv-directly -capability vk_mem_model+sm_6_0+spvGroupNonUniformBallot
3
4// Tests if we pass-through and handle pointers via groupshared-memory correctly.
5// Ensure SPIRV emits coherent operations here
6// SPIRV: OpEntryPoint
7// SPIRV-NOT: error
8
9// CHECK: 1
10// CHECK-NEXT: 0
11// CHECK-NEXT: 2
12// CHECK-NEXT: 0
13// CHECK-NEXT: 3
14
15//TEST_INPUT:ubuffer(data=[0 0 0 0 0], stride=4):out,name=outputBuffer
16uniform int* outputBuffer;
17
18groupshared int* sharedPtr[3];
19
20[numthreads(3, 1, 1)]
21void computeMain(uint3 group_thread_id: SV_GroupThreadID)
22{
23    sharedPtr[group_thread_id.x] = outputBuffer + group_thread_id.x;
24    sharedPtr[group_thread_id.x] = sharedPtr[group_thread_id.x]+group_thread_id.x;
25    GroupMemoryBarrierWithGroupSync();
26
27    *sharedPtr[group_thread_id.x] = group_thread_id.x+1;
28}