Signed-off-by: Zebediah Figura zfigura@codeweavers.com ---
This depends on 220151.
libs/vkd3d-shader/hlsl_codegen.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index d9f78601d..2c620c7d7 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -233,6 +233,11 @@ static void replace_node(struct hlsl_ir_node *old, struct hlsl_ir_node *new) hlsl_src_remove(src); hlsl_src_from_node(src, new); } +} + +static void replace_and_remove_node(struct hlsl_ir_node *old, struct hlsl_ir_node *new) +{ + replace_node(old, new); list_remove(&old->entry); hlsl_free_instr(old); } @@ -413,7 +418,7 @@ static bool copy_propagation_analyze_load(struct hlsl_ctx *ctx, struct hlsl_ir_l return false; list_add_before(&node->entry, &swizzle_node->node.entry);
- replace_node(node, &swizzle_node->node); + replace_and_remove_node(node, &swizzle_node->node);
return true; } @@ -503,7 +508,7 @@ static bool fold_redundant_casts(struct hlsl_ctx *ctx, struct hlsl_ir_node *inst if (hlsl_types_are_equal(src_type, dst_type) || (src_type->base_type == dst_type->base_type && is_vec1(src_type) && is_vec1(dst_type))) { - replace_node(&expr->node, expr->operands[0].node); + replace_and_remove_node(&expr->node, expr->operands[0].node); return true; } } @@ -718,7 +723,7 @@ static bool fold_constants(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, voi }
list_add_before(&expr->node.entry, &res->node.entry); - replace_node(&expr->node, &res->node); + replace_and_remove_node(&expr->node, &res->node); return true; }
@@ -738,7 +743,7 @@ static bool remove_trivial_swizzles(struct hlsl_ctx *ctx, struct hlsl_ir_node *i if (((swizzle->swizzle >> (2 * i)) & 3) != i) return false;
- replace_node(instr, swizzle->val.node); + replace_and_remove_node(instr, swizzle->val.node);
return true; }