From 7aa6f4f8b6aa0fdd153df80d6bcc1c2998a69fb2 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 6 Oct 2025 22:28:08 +0200 Subject: [PATCH] tests: Replace the test_shader_instructions() "ps_udiv" test with a shader runner test. --- tests/d3d12.c | 35 -------------------------- tests/hlsl/arithmetic-uint.shader_test | 33 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 35 deletions(-) diff --git a/tests/d3d12.c b/tests/d3d12.c index 7363e6ca0..0026ba9e0 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -9838,30 +9838,6 @@ static void test_shader_instructions(void) 0x00000000, 0x00000000, 0x0100003e, }; static struct named_shader ps_imul = {"imul", ps_imul_code, sizeof(ps_imul_code)}; - static const DWORD ps_udiv_code[] = - { -#if 0 - uint4 src0; - uint4 src1; - - void main(out uint4 dst : SV_Target) - { - dst = 0; - dst.x = src0.x / src1.x; - dst.y = src0.x % src1.x; - } -#endif - 0x43425844, 0x007d5f29, 0x042f2e56, 0x212eddf2, 0xc98cca76, 0x00000001, 0x00000120, 0x00000003, - 0x0000002c, 0x0000003c, 0x00000070, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x58454853, 0x000000a8, 0x00000050, 0x0000002a, - 0x0100086a, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, - 0x02000068, 0x00000002, 0x08000036, 0x001020c2, 0x00000000, 0x00004002, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x0b00004e, 0x00100012, 0x00000000, 0x00100012, 0x00000001, 0x0020800a, - 0x00000000, 0x00000000, 0x0020800a, 0x00000000, 0x00000001, 0x05000036, 0x00102012, 0x00000000, - 0x0010000a, 0x00000000, 0x05000036, 0x00102022, 0x00000000, 0x0010000a, 0x00000001, 0x0100003e, - }; - static struct named_shader ps_udiv = {"udiv", ps_udiv_code, sizeof(ps_udiv_code)}; static const DWORD ps_nested_switch_code[] = { #if 0 @@ -11011,17 +10987,6 @@ static void test_shader_instructions(void) {&ps_imul, {{{2}, {~0u}}}, {{~1u}}}, {&ps_imul, {{{3}, {~0u}}}, {{~2u}}}, - {&ps_udiv, {{{0}, {0}}}, {{~0u, ~0u}}}, - {&ps_udiv, {{{1}, {0}}}, {{~0u, ~0u}}}, - {&ps_udiv, {{{1}, {1}}}, {{ 1u, 0u}}}, - {&ps_udiv, {{{7}, {1}}}, {{ 7u, 0u}}}, - {&ps_udiv, {{{7}, {2}}}, {{ 3u, 1u}}}, - {&ps_udiv, {{{7}, {3}}}, {{ 2u, 1u}}}, - {&ps_udiv, {{{7}, {4}}}, {{ 1u, 3u}}}, - {&ps_udiv, {{{7}, {5}}}, {{ 1u, 2u}}}, - {&ps_udiv, {{{7}, {6}}}, {{ 1u, 1u}}}, - {&ps_udiv, {{{7}, {7}}}, {{ 1u, 0u}}}, - {&ps_nested_switch, {{{~0u, 0, 0, 0}, {0}}}, {{ 1, 0, 0, 0}}}, {&ps_nested_switch, {{{ 0u, 0, 0, 0}, {0}}}, {{ 2, 0, 0, 0}}}, {&ps_nested_switch, {{{ 1u, 0, 0, 0}, {0}}}, {{ 2, 0, 0, 0}}}, diff --git a/tests/hlsl/arithmetic-uint.shader_test b/tests/hlsl/arithmetic-uint.shader_test index 6a1bbd79d..93e7dfdc4 100644 --- a/tests/hlsl/arithmetic-uint.shader_test +++ b/tests/hlsl/arithmetic-uint.shader_test @@ -53,9 +53,42 @@ float4 main() : SV_TARGET draw quad probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0) +[rtv 0] +format r32g32b32a32-uint +size (2d, 640, 480) + +[pixel shader] +uint4 src; + +void main(out uint4 dst : sv_target) +{ + dst = float4(src.xz / src.yw, src.xz % src.yw); +} + +[test] +uniform 0 uint4 0 0 1 0 +todo(msl) draw quad +% Integer division by zero is undefined for shader model 6 targets. +if(sm<6) todo(glsl & !llvmpipe) probe (0, 0) u32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff) +uniform 0 uint4 1 1 7 1 +todo(msl) draw quad +probe (0, 0) u32(1, 7, 0, 0) +uniform 0 uint4 7 2 7 3 +todo(msl) draw quad +probe (0, 0) u32(3, 2, 1, 1) +uniform 0 uint4 7 4 7 5 +todo(msl) draw quad +probe (0, 0) u32(1, 1, 3, 2) +uniform 0 uint4 7 6 7 7 +todo(msl) draw quad +probe (0, 0) u32(1, 1, 1, 0) % Test expression normalization and simplification. +[rtv 0] +format r32g32b32a32-float +size (2d, 640, 480) + [pixel shader] uniform uint4 x;