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
1.0 KiB29 linesraw
1//DISABLE_TEST:SIMPLE(filecheck=SPIRV):-stage compute -entry computeMain -target spirv -capability vk_mem_model
2//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -emit-spirv-directly -profile spirv_1_3 -capability vk_mem_model
3// These tests are expected to fail, pointers to texels are
4// currently a broken feature and do not work.
5// Additionally, we do not allow texel pointers with `__getAddress`.
6
7
8// Ensure SPIRV emits coherent operations here
9// SPIRV: MakeTexelAvailable
10// SPIRV: MakeTexelVisible
11
12// CHECK: 0
13// CHECK-NEXT: 5
14
15//TEST_INPUT: RWTexture1D(format=R32Uint, size=8, content = one, mipMaps = 1):name=texture
16RWTexture1D<uint> texture;
17
18//TEST_INPUT: ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
19RWStructuredBuffer<uint> outputBuffer;
20
21[numthreads(32, 1, 1)]
22void computeMain()
23{
24    Ptr<uint> ptrIn = __getAddress(texture[1]);
25    Ptr<uint> secondPtrIn = ptrIn;
26
27    storeCoherent<4, MemoryScope::Device>(ptrIn, 5);
28    outputBuffer[0] = loadCoherent<4, MemoryScope::Device>(ptrIn);
29}