From 1c73ac668fd33880b42d7e97c98fc8bcb819c9a0 Mon Sep 17 00:00:00 2001 From: Conor McCarthy Date: Mon, 4 Mar 2024 15:23:27 +1000 Subject: [PATCH] tests/hlsl: Add a test for UAV InterlockedExchange(). --- tests/hlsl/uav-atomics.shader_test | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/hlsl/uav-atomics.shader_test b/tests/hlsl/uav-atomics.shader_test index 549877ec..1acb1add 100644 --- a/tests/hlsl/uav-atomics.shader_test +++ b/tests/hlsl/uav-atomics.shader_test @@ -3,9 +3,9 @@ shader model >= 5.0 [uav 1] format r32 uint -size (buffer, 7) +size (buffer, 9) -0xd 5 6 0x10 4 4 7 +0xd 5 6 0x10 4 4 7 2 0 [compute shader todo] RWBuffer u : register(u1); @@ -15,6 +15,7 @@ uniform uint4 v; [numthreads(3, 1, 1)] void main() { + uint old; InterlockedAnd(u[0], v.x); InterlockedCompareStore(u[1], v.y, v.x); InterlockedAdd(u[2], v.x); @@ -22,6 +23,8 @@ void main() InterlockedMax(u[4], v.x); InterlockedMin(u[5], v.x); InterlockedXor(u[6], v.x); + InterlockedExchange(u[7], v.x, old); + InterlockedAdd(u[8], old == 2); } [test] @@ -34,6 +37,8 @@ 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) uniform 0 uint4 1 2 0 0 todo(sm<6) dispatch 2 1 1 @@ -44,6 +49,8 @@ probe uav 1 (3) rui (0x13) probe uav 1 (4) rui (4) probe uav 1 (5) rui (1) probe uav 1 (6) rui (4) +probe uav 1 (7) rui (1) +probe uav 1 (8) rui (1) [uav 2]