From 693e89c74e7cc1c2321827f2532c39d3ad6e9550 Mon Sep 17 00:00:00 2001 From: Victor Chiletto Date: Mon, 22 Jul 2024 17:39:30 -0300 Subject: [PATCH] vkd3d-shader/hlsl: Push a new scope when compiling internal functions. This allows for typedef usage without interfering with user code. Thanks Zeb for the suggestion. --- libs/vkd3d-shader/hlsl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 230c84d2..5c07e574 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -4259,6 +4259,7 @@ struct hlsl_ir_function_decl *hlsl_compile_internal_function(struct hlsl_ctx *ct /* Save and restore everything that matters. * Note that saving the scope stack is hard, and shouldn't be necessary. */ + hlsl_push_scope(ctx); ctx->scanner = NULL; ctx->internal_func_name = internal_name->buffer; ctx->cur_function = NULL; @@ -4266,6 +4267,7 @@ struct hlsl_ir_function_decl *hlsl_compile_internal_function(struct hlsl_ctx *ct ctx->scanner = saved_scanner; ctx->internal_func_name = saved_internal_func_name; ctx->cur_function = saved_cur_function; + hlsl_pop_scope(ctx); if (ret) { ERR("Failed to compile intrinsic, error %u.\n", ret);