vkd3d-shader/hlsl: Use replace_ir() for hlsl_fold_constant_exprs().

This commit is contained in:
Elizabeth Figura
2025-08-20 17:50:53 -05:00
committed by Henri Verbeet
parent 6e8eeb8f7a
commit 1f40222a0d
Notes: Henri Verbeet 2025-10-28 16:58:15 +01:00
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1794
3 changed files with 9 additions and 12 deletions

View File

@@ -1434,11 +1434,11 @@ static bool fold_rshift(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, c
return true;
}
bool hlsl_fold_constant_exprs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
struct hlsl_ir_node *hlsl_fold_constant_exprs(struct hlsl_ctx *ctx,
struct hlsl_ir_node *instr, struct hlsl_block *block)
{
struct hlsl_ir_constant *arg1, *arg2 = NULL, *arg3 = NULL;
struct hlsl_constant_value res = {0};
struct hlsl_ir_node *res_node;
struct hlsl_ir_expr *expr;
unsigned int i;
bool success;
@@ -1638,13 +1638,9 @@ bool hlsl_fold_constant_exprs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
}
if (success)
{
if (!(res_node = hlsl_new_constant(ctx, instr->data_type, &res, &instr->loc)))
return false;
list_add_before(&expr->node.entry, &res_node->entry);
hlsl_replace_node(&expr->node, res_node);
}
return success;
return hlsl_block_add_constant(ctx, block, instr->data_type, &res, &instr->loc);
return NULL;
}
struct hlsl_ir_node *hlsl_fold_constant_identities(struct hlsl_ctx *ctx,