From d214f9ebcaf988d8506e76155c4d05e94ec11ca0 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Tue, 20 May 2025 17:06:03 +0200 Subject: [PATCH] tests/hlsl: Test minimum precision stride for signed integers too. --- tests/hlsl/minimum-precision.shader_test | 59 ++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/tests/hlsl/minimum-precision.shader_test b/tests/hlsl/minimum-precision.shader_test index 7111f9e04..684f527ec 100644 --- a/tests/hlsl/minimum-precision.shader_test +++ b/tests/hlsl/minimum-precision.shader_test @@ -96,3 +96,62 @@ uniform 4 uint4 0x120011 0x140013 0x160015 0x180017 uniform 8 uint4 0x220021 0x240023 0x260025 0x280027 draw quad todo probe (0, 0) rgbaui(1, 1, 1, 1) + +% Same tests for signed integers + +[require] +shader model >= 4.0 +shader model < 6.0 + +[pixel shader] +uniform min16int4 p; +uniform min16int3 q; +uniform min16int2 r; +uniform min16int s; + +uint4 main() : sv_target +{ + if (p.x == 0x020001 && p.y == 0x040003 && p.z == 0x060005 && p.w == 0x080007 + && q.x == 0x120011 && q.y == 0x140013 && q.z == 0x160015 + && r.x == 0x220021 && r.y == 0x240023 && s == 0x260025) + return 1; + return 0; +} + +[test] +uniform 0 uint4 0x020001 0x040003 0x060005 0x080007 +uniform 4 uint4 0x120011 0x140013 0x160015 0x180017 +uniform 8 uint4 0x220021 0x240023 0x260025 0x280027 +draw quad +probe (0, 0) rgbaui(1, 1, 1, 1) + +[require] +shader model >= 6.0 + +[pixel shader] +uniform min16int4 p; +uniform min16int3 q; +uniform min16int2 r; +uniform min16int s; + +uint4 main() : sv_target +{ + /* On AMD the stride is 4. */ + if (p.x == 0x01 && p.y == 0x03 && p.z == 0x05 && p.w == 0x07 + && q.x == 0x11 && q.y == 0x13 && q.z == 0x15 + && r.x == 0x21 && r.y == 0x23 && s == 0x25) + return 1; + /* On NVIDIA and WARP the stride is 2. */ + if (p.x == 0x01 && p.y == 0x02 && p.z == 0x03 && p.w == 0x04 + && q.x == 0x11 && q.y == 0x12 && q.z == 0x13 + && r.x == 0x21 && r.y == 0x22 && s == 0x23) + return 1; + return 0; +} + +[test] +uniform 0 uint4 0x020001 0x040003 0x060005 0x080007 +uniform 4 uint4 0x120011 0x140013 0x160015 0x180017 +uniform 8 uint4 0x220021 0x240023 0x260025 0x280027 +draw quad +todo probe (0, 0) rgbaui(1, 1, 1, 1)