From aab9886021914385dc5ec55da042258e8d7005e1 Mon Sep 17 00:00:00 2001 From: Francisco Casas Date: Mon, 5 Dec 2022 15:13:57 -0300 Subject: [PATCH] vkd3d-shader/hlsl: Allow uninitialized static objects. validate_static_object_references() validates that uninitialized static objects are not referenced in the shader. In case a static variable contains both numeric and object types, the "Static variables cannot have both numeric and resource components." error should preempt uninitialized numeric values to reach further compilation steps. --- libs/vkd3d-shader/hlsl.y | 1 - tests/hlsl-static-initializer.shader_test | 14 +++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 73266006..7d3b23cf 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -2184,7 +2184,6 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t if (type_has_object_components(var->data_type, false)) { - hlsl_fixme(ctx, &var->loc, "Uninitialized static objects."); vkd3d_free(v); continue; } diff --git a/tests/hlsl-static-initializer.shader_test b/tests/hlsl-static-initializer.shader_test index 480eae19..6dc874f9 100644 --- a/tests/hlsl-static-initializer.shader_test +++ b/tests/hlsl-static-initializer.shader_test @@ -65,7 +65,7 @@ size (1, 1) 1.0 2.0 3.0 4.0 -[pixel shader fail todo] +[pixel shader fail] static Texture2D tex; sampler sam; @@ -75,7 +75,7 @@ float4 main() : sv_target } -[pixel shader todo] +[pixel shader] // This is allowed in 10.0.10011.16384 but not in 9.29.952.3111 static Texture2D tex; @@ -113,7 +113,7 @@ float4 main() : sv_target } -[pixel shader fail todo] +[pixel shader fail] static Texture2D tex1; sampler sam; @@ -124,7 +124,7 @@ float4 main() : sv_target } -[pixel shader fail todo] +[pixel shader fail] static Texture2D tex1; sampler sam; @@ -150,7 +150,7 @@ draw quad probe all rgba (1, 2, 3, 4) -[pixel shader todo] +[pixel shader] Texture2D real_tex; static Texture2D tex; sampler sam; @@ -162,8 +162,8 @@ float4 main() : sv_target } [test] -todo draw quad -todo probe all rgba (1, 2, 3, 4) +draw quad +probe all rgba (1, 2, 3, 4) [require]