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.
This commit is contained in:
Victor Chiletto 2024-07-22 17:39:30 -03:00 committed by Henri Verbeet
parent 016be7e591
commit 693e89c74e
Notes: Henri Verbeet 2024-08-08 23:47:42 +02:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/954

View File

@ -4259,6 +4259,7 @@ struct hlsl_ir_function_decl *hlsl_compile_internal_function(struct hlsl_ctx *ct
/* Save and restore everything that matters. /* Save and restore everything that matters.
* Note that saving the scope stack is hard, and shouldn't be necessary. */ * Note that saving the scope stack is hard, and shouldn't be necessary. */
hlsl_push_scope(ctx);
ctx->scanner = NULL; ctx->scanner = NULL;
ctx->internal_func_name = internal_name->buffer; ctx->internal_func_name = internal_name->buffer;
ctx->cur_function = NULL; 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->scanner = saved_scanner;
ctx->internal_func_name = saved_internal_func_name; ctx->internal_func_name = saved_internal_func_name;
ctx->cur_function = saved_cur_function; ctx->cur_function = saved_cur_function;
hlsl_pop_scope(ctx);
if (ret) if (ret)
{ {
ERR("Failed to compile intrinsic, error %u.\n", ret); ERR("Failed to compile intrinsic, error %u.\n", ret);