From bbc6b56ab07f19bb904342760a770081b7758932 Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Wed, 18 Sep 2024 00:07:31 -0400 Subject: [PATCH] vkd3d-shader/hlsl: Clone static_initializers for each entry function. --- libs/vkd3d-shader/hlsl_codegen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 3af0ea73..a5856aa6 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -7577,10 +7577,13 @@ static void process_entry_function(struct hlsl_ctx *ctx, struct hlsl_ir_function const struct hlsl_profile_info *profile = ctx->profile; struct hlsl_block *const body = &entry_func->body; struct recursive_call_ctx recursive_call_ctx; + struct hlsl_block static_initializers; struct hlsl_ir_var *var; unsigned int i; - list_move_head(&body->instrs, &ctx->static_initializers.instrs); + if (!hlsl_clone_block(ctx, &static_initializers, &ctx->static_initializers)) + return; + list_move_head(&body->instrs, &static_initializers.instrs); memset(&recursive_call_ctx, 0, sizeof(recursive_call_ctx)); hlsl_transform_ir(ctx, find_recursive_calls, body, &recursive_call_ctx);