From ebc039d1285db0d481a3536e524a92e25e364284 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 14 Aug 2024 17:07:21 +0200 Subject: [PATCH] vkd3d-shader/fx: Resolve NULL values for SamplerState.Texture field. Signed-off-by: Nikolay Sivov --- libs/vkd3d-shader/fx.c | 8 +++++++- tests/hlsl/effect-variables-fx_5.shader_test | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/fx.c b/libs/vkd3d-shader/fx.c index 1d4db215..7e98b6d5 100644 --- a/libs/vkd3d-shader/fx.c +++ b/libs/vkd3d-shader/fx.c @@ -1774,6 +1774,12 @@ static void resolve_fx_4_state_block_values(struct hlsl_ir_var *var, struct hlsl { NULL } }; + static const struct rhs_named_value null_values[] = + { + { "NULL", 0 }, + { NULL } + }; + static const struct state { const char *name; @@ -1835,7 +1841,7 @@ static void resolve_fx_4_state_block_values(struct hlsl_ir_var *var, struct hlsl { "BorderColor", HLSL_CLASS_SAMPLER, HLSL_CLASS_VECTOR, FX_FLOAT, 4, 1, 52 }, { "MinLOD", HLSL_CLASS_SAMPLER, HLSL_CLASS_SCALAR, FX_FLOAT, 1, 1, 53 }, { "MaxLOD", HLSL_CLASS_SAMPLER, HLSL_CLASS_SCALAR, FX_FLOAT, 1, 1, 54 }, - { "Texture", HLSL_CLASS_SAMPLER, HLSL_CLASS_SCALAR, FX_TEXTURE, 1, 1, 55 }, + { "Texture", HLSL_CLASS_SAMPLER, HLSL_CLASS_SCALAR, FX_TEXTURE, 1, 1, 55, null_values }, { "HullShader", HLSL_CLASS_PASS, HLSL_CLASS_SCALAR, FX_HULLSHADER, 1, 1, 56 }, { "DomainShader", HLSL_CLASS_PASS, HLSL_CLASS_SCALAR, FX_DOMAINSHADER, 1, 1, 57 }, diff --git a/tests/hlsl/effect-variables-fx_5.shader_test b/tests/hlsl/effect-variables-fx_5.shader_test index 2735cab6..d6672aee 100644 --- a/tests/hlsl/effect-variables-fx_5.shader_test +++ b/tests/hlsl/effect-variables-fx_5.shader_test @@ -40,6 +40,8 @@ SamplerState sampler7 { Texture = t7; }; SamplerState sampler8 { Texture = t8; }; SamplerState sampler9 { Texture = t9; }; SamplerState sampler10 { Texture = t10; }; +SamplerState sampler11 { Texture = NULL; }; +SamplerState sampler12 { Texture = nUll; }; [effect] BlendState bs