diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index bb25e0ea..96e73d23 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -136,7 +136,11 @@ struct hlsl_ir_var *hlsl_get_var(struct hlsl_scope *scope, const char *name) static void free_state_block_entry(struct hlsl_state_block_entry *entry) { + unsigned int i; + vkd3d_free(entry->name); + for (i = 0; i < entry->args_count; ++i) + hlsl_src_remove(&entry->args[i]); vkd3d_free(entry->args); hlsl_block_cleanup(entry->instrs); vkd3d_free(entry->instrs); diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 4a8e3524..556d6b5f 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -483,7 +483,7 @@ struct hlsl_state_block_entry struct hlsl_block *instrs; /* For assignments, arguments of the rhs initializer. */ - struct hlsl_ir_node **args; + struct hlsl_src *args; unsigned int args_count; }; diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 266ed50c..79317bb0 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -6912,6 +6912,7 @@ state_block: | state_block stateblock_lhs_identifier state_block_index_opt '=' complex_initializer ';' { struct hlsl_state_block_entry *entry; + unsigned int i; if (!(entry = hlsl_alloc(ctx, sizeof(*entry)))) YYABORT; @@ -6921,8 +6922,13 @@ state_block: entry->lhs_index = $3.index; entry->instrs = $5.instrs; - entry->args = $5.args; + entry->args_count = $5.args_count; + if (!(entry->args = hlsl_alloc(ctx, sizeof(*entry->args) * entry->args_count))) + YYABORT; + for (i = 0; i < entry->args_count; ++i) + hlsl_src_from_node(&entry->args[i], $5.args[i]); + vkd3d_free($5.args); $$ = $1; state_block_add_entry($$, entry);