From 6ecfcf19109f1a5385ed6606b258c23975bd5648 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Sun, 28 Sep 2025 20:18:50 +0200 Subject: [PATCH] tests/hlsl: Add a test for SV_DispatchThreadId. --- tests/hlsl/compute.shader_test | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/hlsl/compute.shader_test b/tests/hlsl/compute.shader_test index cc6d6bbe6..8b28c4a44 100644 --- a/tests/hlsl/compute.shader_test +++ b/tests/hlsl/compute.shader_test @@ -20,3 +20,27 @@ void main() [test] dispatch 1 1 1 probe uav 0 (0, 0) f32(-123.0) + +[require] +shader model >= 5.0 +format r32g32b32a32-uint uav-load + +[uav 0] +format r32g32b32a32-uint +size (2d, 50, 50) + +[compute shader] +RWTexture2D u; + + [numthreads(4, 4, 1)] +void main(uint3 thread_id : SV_DispatchThreadId) +{ + if (thread_id.x < 50 && thread_id.y < 50) + u[thread_id.xy] = uint4(thread_id, 1); +} + +[test] +todo(msl) dispatch 13 13 1 +probe uav 0 (0, 0) u32(0, 0, 0, 1) +probe uav 0 (14, 38) u32(14, 38, 0, 1) +probe uav 0 (49, 49) u32(49, 49, 0, 1)