From 7b3644d9f28a9e25016a4fa8deb5df4162630d56 Mon Sep 17 00:00:00 2001 From: Francisco Casas Date: Fri, 3 May 2024 04:15:09 -0400 Subject: [PATCH] tests: Test SM1 const register allocation with relative addressing. --- tests/hlsl/sm1-const-allocation.shader_test | 37 +++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/hlsl/sm1-const-allocation.shader_test b/tests/hlsl/sm1-const-allocation.shader_test index 3f4da40a..ca641b14 100644 --- a/tests/hlsl/sm1-const-allocation.shader_test +++ b/tests/hlsl/sm1-const-allocation.shader_test @@ -373,3 +373,40 @@ uniform 20 float 5 uniform 24 float 6 draw quad todo probe all rgba (6, 1, 0, 0) + + +[pixel shader todo] +// Relative addressing extends the allocation size only up to the array's size. +float idx; + +struct +{ + float dyn[5]; + float unused; +} a; + + +float4 main() : sv_target +{ + return a.dyn[idx]; +} +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// a c0 5 +// idx c5 1 +// + +[test] +uniform 0 float 0 +uniform 4 float 1 +uniform 8 float 2 +uniform 12 float 3 +uniform 16 float 4 +uniform 20 float 3 +todo draw quad +probe all rgba (3, 3, 3, 3) +uniform 20 float 1 +todo draw quad +probe all rgba (1, 1, 1, 1)