yum-mirror/slang

Making it easier to work with shaders

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

Anders LeinoRefresh of disabled WGPU tests (#5614)93f5d13fc

master
986 B29 linesraw
1// atomics.slang
2
3//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
4//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -shaderobj
5//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -vk -shaderobj
6//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -cuda -shaderobj
7//TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl
8// Not supported in WGSL: Use of traditional atomics intrinsics (InterlockedXXX functions)
9//DISABLE_TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -wgpu
10
11//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out, name outputBuffer
12
13RWStructuredBuffer<uint> outputBuffer;
14
15void test(uint val)
16{
17    uint originalValue;
18
19	InterlockedAdd(outputBuffer[val], 		val, 		originalValue);
20	InterlockedAdd(outputBuffer[val ^ 1], 	val*16, 	originalValue);
21	InterlockedAdd(outputBuffer[val ^ 2], 	val*16*16, 	originalValue);
22}
23
24[numthreads(4, 1, 1)]
25void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
26{
27    uint tid = dispatchThreadID.x;
28    test(tid);
29}