vkd3d-shader/hlsl: Add a hlsl_block_add_unary_expr() helper.

This commit is contained in:
Elizabeth Figura
2024-12-08 21:56:32 -06:00
committed by Henri Verbeet
parent b7ea23303e
commit 2e09257d94
Notes: Henri Verbeet 2025-02-24 16:27:47 +01:00
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1386
4 changed files with 63 additions and 148 deletions

View File

@@ -474,9 +474,7 @@ static bool append_conditional_break(struct hlsl_ctx *ctx, struct hlsl_block *co
if (!(cast = add_cast(ctx, cond_block, condition, bool_type, &condition->loc)))
return false;
if (!(not = hlsl_new_unary_expr(ctx, HLSL_OP1_LOGIC_NOT, cast, &condition->loc)))
return false;
hlsl_block_add_instr(cond_block, not);
not = hlsl_block_add_unary_expr(ctx, cond_block, HLSL_OP1_LOGIC_NOT, cast, &condition->loc);
hlsl_block_init(&then_block);
@@ -3793,9 +3791,7 @@ static bool intrinsic_cross(struct hlsl_ctx *ctx,
if (!(mul1 = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, arg1_swzl1, arg2_swzl1, loc)))
return false;
if (!(mul1_neg = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, mul1, loc)))
return false;
hlsl_block_add_instr(params->instrs, mul1_neg);
mul1_neg = hlsl_block_add_unary_expr(ctx, params->instrs, HLSL_OP1_NEG, mul1, loc);
if (!(arg1_swzl2 = hlsl_new_swizzle(ctx, HLSL_SWIZZLE(Y, Z, X, Y), 3, arg1_cast, loc)))
return false;