From ee8ca0e9c20ebfda6625521ee74c919aae5bcecc Mon Sep 17 00:00:00 2001 From: Conor McCarthy Date: Mon, 4 Mar 2024 15:24:41 +1000 Subject: [PATCH] tests/hlsl: Add tests for texture UAV atomics. --- tests/hlsl/uav-atomics.shader_test | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/hlsl/uav-atomics.shader_test b/tests/hlsl/uav-atomics.shader_test index 1acb1add..8235affb 100644 --- a/tests/hlsl/uav-atomics.shader_test +++ b/tests/hlsl/uav-atomics.shader_test @@ -81,3 +81,43 @@ uniform 0 int4 -3 1 0 0 todo(sm<6) dispatch 1 1 1 probe uav 2 (0) ri (1) probe uav 2 (1) ri (-3) + + +[uav 1] +format r32 uint +size (2d, 9, 1) + +0xd 5 6 0x10 4 4 7 2 0 + +[compute shader todo] +RWTexture2D u : register(u1); + +uniform uint4 v; + + [numthreads(3, 1, 1)] +void main() +{ + uint old; + InterlockedAnd(u[uint2(0, 0)], v.x); + InterlockedCompareStore(u[uint2(1, 0)], v.y, v.x); + InterlockedAdd(u[uint2(2, 0)], v.x); + InterlockedOr(u[uint2(3, 0)], v.x); + InterlockedMax(u[uint2(4, 0)], v.x); + InterlockedMin(u[uint2(5, 0)], v.x); + InterlockedXor(u[uint2(6, 0)], v.x); + InterlockedExchange(u[uint2(7, 0)], v.x, old); + InterlockedAdd(u[uint2(8, 0)], old == 2); +} + +[test] +uniform 0 uint4 3 5 0 0 +todo(sm<6) dispatch 1 1 1 +probe uav 1 (0) rui (1) +probe uav 1 (1) rui (3) +probe uav 1 (2) rui (15) +probe uav 1 (3) rui (0x13) +probe uav 1 (4) rui (4) +probe uav 1 (5) rui (3) +probe uav 1 (6) rui (4) +probe uav 1 (7) rui (3) +probe uav 1 (8) rui (1)