vkd3d-shader/hlsl: Free static initializers after functions.

We need users of a value to be freed before the value itself is.
Due to copy propagation or use of the pre-allocated error instruction,
static_initializers can contain values that will be used in function blocks.
This commit is contained in:
Elizabeth Figura 2024-09-23 13:43:28 -05:00 committed by Henri Verbeet
parent ae27fded1a
commit 67093c5833
Notes: Henri Verbeet 2024-10-03 19:34:42 +02:00
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1110

View File

@ -4408,8 +4408,6 @@ static void hlsl_ctx_cleanup(struct hlsl_ctx *ctx)
struct hlsl_type *type, *next_type; struct hlsl_type *type, *next_type;
unsigned int i; unsigned int i;
hlsl_block_cleanup(&ctx->static_initializers);
for (i = 0; i < ctx->source_files_count; ++i) for (i = 0; i < ctx->source_files_count; ++i)
vkd3d_free((void *)ctx->source_files[i]); vkd3d_free((void *)ctx->source_files[i]);
vkd3d_free(ctx->source_files); vkd3d_free(ctx->source_files);
@ -4417,6 +4415,8 @@ static void hlsl_ctx_cleanup(struct hlsl_ctx *ctx)
rb_destroy(&ctx->functions, free_function_rb, NULL); rb_destroy(&ctx->functions, free_function_rb, NULL);
hlsl_block_cleanup(&ctx->static_initializers);
/* State blocks must be free before the variables, because they contain instructions that may /* State blocks must be free before the variables, because they contain instructions that may
* refer to them. */ * refer to them. */
LIST_FOR_EACH_ENTRY_SAFE(scope, next_scope, &ctx->scopes, struct hlsl_scope, entry) LIST_FOR_EACH_ENTRY_SAFE(scope, next_scope, &ctx->scopes, struct hlsl_scope, entry)