From 2179c79c91a0a81aaab0463820a27421739c38a7 Mon Sep 17 00:00:00 2001 From: Francisco Casas Date: Wed, 5 Jun 2024 14:56:05 -0400 Subject: [PATCH] tests: Test register reservations on unused variables. --- .../register-reservations-numeric.shader_test | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/hlsl/register-reservations-numeric.shader_test b/tests/hlsl/register-reservations-numeric.shader_test index b03bf07d..84752361 100644 --- a/tests/hlsl/register-reservations-numeric.shader_test +++ b/tests/hlsl/register-reservations-numeric.shader_test @@ -10,6 +10,39 @@ float4 main() : sv_target } +[pixel shader todo(sm<4)] +// Overlapping reservations when both variables are unused. +float4 a : register(c3); +float4 b : register(c3); + +float4 main() : sv_target +{ + return 42; +} + +[pixel shader fail(sm>=4 & sm<6) todo(sm<4)] +// Overlapping reservations when only one variable is used. +float4 a : register(c3); +float4 b : register(c3); + +float4 main() : sv_target +{ + return b; +} + + +[pixel shader fail(sm>=4 & sm<6) todo(sm<4)] +// Overlapping reservations when both variables are used, but their bind_count (used size) doesn't +// cause an overlap. +float4 a[2] : register(c3); // bind count: 1 +float4 b : register(c4); + +float4 main() : sv_target +{ + return a[0] + b; +} + + [pixel shader] // It is not required to provide a register(cX) for all elements in the $Globals buffer. float4 a; // will get register(c1)