From d95962068a615c3bc02e66c7bd215d78277a0810 Mon Sep 17 00:00:00 2001 From: Elizabeth Figura Date: Thu, 29 Aug 2024 12:48:23 -0500 Subject: [PATCH] vkd3d-shader/hlsl: Handle error expressions in initializers. --- libs/vkd3d-shader/hlsl.y | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index b43e21f7..b97423b3 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -2512,6 +2512,14 @@ static void initialize_var(struct hlsl_ctx *ctx, struct hlsl_ir_var *dst, { unsigned int store_index = 0; + /* If any of the elements has an error type, then initializer_size() is not + * meaningful. */ + for (unsigned int i = 0; i < initializer->args_count; ++i) + { + if (initializer->args[i]->data_type->class == HLSL_CLASS_ERROR) + return; + } + if (initializer_size(initializer) != hlsl_type_component_count(dst->data_type)) { hlsl_error(ctx, &initializer->loc, VKD3D_SHADER_ERROR_HLSL_WRONG_PARAMETER_COUNT,