diff options
Diffstat (limited to 'tests/bugs')
| -rw-r--r-- | tests/bugs/gh-3997.slang | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/bugs/gh-3997.slang b/tests/bugs/gh-3997.slang new file mode 100644 index 000000000..8c75da426 --- /dev/null +++ b/tests/bugs/gh-3997.slang @@ -0,0 +1,23 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv -emit-spirv-directly -O0 -g + +//CHECK: OpEntryPoint + +float atomicAdd(__ref float value, float amount) +{ + __target_switch + { + case cpp: + __requirePrelude("#include <atomic>"); + __intrinsic_asm "std::atomic_ref(*$0).fetch_add($1)"; + case spirv: + return __atomicAdd(value, amount); + } +} + +RWStructuredBuffer<float> outputBuffer; + +[numthreads(4, 1, 1)] +[shader("compute")] +void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) { + atomicAdd(outputBuffer[0], 1); +}
\ No newline at end of file |
