From 0cea4d352e5f04fe6837702b91ce993928a37566 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sun, 16 Apr 2023 19:38:58 +0200 Subject: [PATCH] vkd3d-shader/hlsl: Handle uppercase regset names in register(). --- libs/vkd3d-shader/hlsl.y | 2 +- tests/cbuffer.shader_test | 21 +++++++++++++++++++-- tests/uav.shader_test | 14 ++++++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 2eed17af..c9c9495b 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -1014,7 +1014,7 @@ static struct hlsl_reg_reservation parse_reg_reservation(const char *reg_string) FIXME("Unsupported register reservation syntax.\n"); return reservation; } - reservation.reg_type = reg_string[0]; + reservation.reg_type = ascii_tolower(reg_string[0]); return reservation; } diff --git a/tests/cbuffer.shader_test b/tests/cbuffer.shader_test index 9cf42d9d..86e03607 100644 --- a/tests/cbuffer.shader_test +++ b/tests/cbuffer.shader_test @@ -1,3 +1,21 @@ +% Uppercase register set names +[pixel shader] +cbuffer Constants : register(B1) +{ +}; +Texture2D tex : register(T1); +float4 foo : register(C0); + +float4 main() : sv_target +{ + return foo; +} + +[test] +uniform 0 float4 1.0 2.0 3.0 4.0 +draw quad +probe all rgba (1.0, 2.0, 3.0, 4.0) + [pixel shader] // Test empty constant buffer. cbuffer Constants : register(b1) @@ -16,7 +34,6 @@ uniform 0 float4 1.0 2.0 3.0 4.0 draw quad probe all rgba (1.0, 2.0, 3.0, 4.0) - % SM1 buffer offset allocation follows different rules than SM4. % Those would have to be tested separately. [require] @@ -611,7 +628,7 @@ float4 main() : sv_target cbuffer buffer { float4 foo : packoffset(c0); - Texture2D tex : register(t1); + Texture2D tex : register(T1); } float4 main() : sv_target diff --git a/tests/uav.shader_test b/tests/uav.shader_test index 0c690f8e..f0eade4d 100644 --- a/tests/uav.shader_test +++ b/tests/uav.shader_test @@ -121,6 +121,20 @@ float4 main() : sv_target1 draw quad probe uav 3 (0, 0) rgba (0.9, 0.8, 0.7, 0.6) +% Uppercase register set name +[pixel shader] +RWTexture2D u : register(U3); + +float4 main() : sv_target1 +{ + u[uint2(0, 0)] = float4(0.9, 0.8, 0.7, 0.6); + return 0; +} + +[test] +draw quad +probe uav 3 (0, 0) rgba (0.9, 0.8, 0.7, 0.6) + % Test that we can declare and use an array of UAVs. [uav 2]