vkd3d-shader/hlsl: Return an hlsl_ir_node pointer from hlsl_new_float_constant().

This commit is contained in:
Zebediah Figura
2022-11-10 19:45:51 -06:00
committed by Alexandre Julliard
parent b23ef3ca3b
commit dc7514afc9
Notes: Alexandre Julliard 2023-04-18 22:35:06 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/153
4 changed files with 34 additions and 43 deletions

View File

@ -1844,9 +1844,8 @@ static bool lower_sqrt(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *c
/* Lower DP2 to MUL + ADD */
static bool lower_dot(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
{
struct hlsl_ir_node *arg1, *arg2, *mul, *replacement;
struct hlsl_ir_node *arg1, *arg2, *mul, *replacement, *zero;
struct hlsl_ir_swizzle *add_x, *add_y;
struct hlsl_ir_constant *zero;
struct hlsl_ir_expr *expr;
if (instr->type != HLSL_IR_EXPR)
@ -1865,11 +1864,11 @@ static bool lower_dot(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *co
if (!(zero = hlsl_new_float_constant(ctx, 0.0f, &expr->node.loc)))
return false;
list_add_before(&instr->entry, &zero->node.entry);
list_add_before(&instr->entry, &zero->entry);
operands[0] = arg1;
operands[1] = arg2;
operands[2] = &zero->node;
operands[2] = zero;
if (!(replacement = hlsl_new_expr(ctx, HLSL_OP3_DP2ADD, operands, instr->data_type, &expr->node.loc)))
return false;