From 161d463f3c962cb8fddbb87d54d3de0f9c5c2b51 Mon Sep 17 00:00:00 2001 From: Victor Chiletto Date: Fri, 18 Jul 2025 21:29:25 -0300 Subject: [PATCH] tests/hlsl: Add a few extra structured buffer matrix load + swizzle tests. --- tests/hlsl/srv-structuredbuffer.shader_test | 51 +++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/tests/hlsl/srv-structuredbuffer.shader_test b/tests/hlsl/srv-structuredbuffer.shader_test index d0f050984..6841335de 100644 --- a/tests/hlsl/srv-structuredbuffer.shader_test +++ b/tests/hlsl/srv-structuredbuffer.shader_test @@ -283,6 +283,47 @@ todo(sm<6 | msl) draw quad if(sm<6) probe(0, 0) rgba(7.0, 8.0, 9.0, 1.0) if(sm>=6) probe(0, 0) rgba(7.0, 9.0, 11.0, 1.0) +[pixel shader todo] +StructuredBuffer buf; + +uniform uint buf_idx; + +float4 main() : sv_target +{ + return float4(buf[buf_idx]._22_23_13, 1.0); +} + +[test] +uniform 0 uint 0 +todo(sm<6 | msl) draw quad +probe (0, 0) f32(4.0, 6.0, 5.0, 1.0) + +uniform 0 uint 1 +todo(sm<6 | msl) draw quad +probe (0, 0) f32(10.0, 12.0, 11.0, 1) + +[pixel shader todo] +typedef row_major float2x3 rm_float2x3; +StructuredBuffer buf; + +uniform uint buf_idx; + +float4 main() : sv_target +{ + return float4(buf[buf_idx]._22_23_13, 1.0); +} + +[test] +uniform 0 uint 0 +todo(sm<6 | msl) draw quad +if(sm<6) probe (0, 0) f32(5.0, 6.0, 3.0, 1.0) +if(sm>=6) probe (0, 0) f32(4.0, 6.0, 5.0, 1.0) + +uniform 0 uint 1 +todo(sm<6 | msl) draw quad +if(sm<6) probe (0, 0) f32(11.0, 12.0, 9.0, 1.0) +if(sm>=6) probe (0, 0) f32(10.0, 12.0, 11.0, 1.0) + [srv 0] stride 20 size (buffer, 3) @@ -430,3 +471,13 @@ probe (0, 0) rgba(0.0, 1.0, 2.0, 3.0) uniform 0 uint 1 todo(sm<6 | msl) draw quad probe (0, 0) rgba(5.0, 6.0, 7.0, 8.0) + +% Check that an index load of a non-structured resource load +% is not interpreted as a structured resource load. +[pixel shader] +Texture2D tex; + +float4 main() : sv_target +{ + return tex.Load(int3(1, 2, 3))[1]; +}