yum-mirror/slang

Making it easier to work with shaders

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

16-Bit-DogAddition of `Load`/`Store` coherent operations (#8395)1e0908bd7

master
810 B24 linesraw
1//TEST:SIMPLE(filecheck=SPIRV):-stage compute -entry computeMain -target spirv -capability vk_mem_model
2//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -emit-spirv-directly -capability vk_mem_model
3
4// Ensure SPIRV emits coherent operations here
5// SPIRV: MakePointerVisible
6// SPIRV: MakePointerAvailable
7
8// CHECK: 2
9
10//TEST_INPUT:ubuffer(data=[1 2 3], stride=4):name=inputBuffer
11uniform int* inputBuffer;
12
13//TEST_INPUT:ubuffer(data=[0 0 0], stride=4):out,name=outputBuffer
14uniform int* outputBuffer;
15
16[shader("compute")]
17[numthreads(32, 1, 1)]
18void computeMain()
19{
20    Ptr<int> ptrIn = inputBuffer;
21    Ptr<int> secondPtrIn = ptrIn;
22    Ptr<int> ptrOut = outputBuffer;
23    storeCoherent<4, MemoryScope::Device>(ptrOut, loadCoherent<4, MemoryScope::Device>(&secondPtrIn[1]));
24}