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

This commit is contained in:
Zebediah Figura
2022-11-11 19:14:39 -06:00
committed by Alexandre Julliard
parent 39bbac3cca
commit da7670f7c8
Notes: Alexandre Julliard 2023-05-09 22:25:23 +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/196
3 changed files with 17 additions and 21 deletions

View File

@@ -2689,9 +2689,8 @@ static bool intrinsic_floor(struct hlsl_ctx *ctx,
static bool intrinsic_fmod(struct hlsl_ctx *ctx, const struct parse_initializer *params,
const struct vkd3d_shader_location *loc)
{
struct hlsl_ir_node *x, *y, *div, *abs, *frac, *neg_frac, *ge;
struct hlsl_ir_node *x, *y, *div, *abs, *frac, *neg_frac, *ge, *select;
struct hlsl_ir_constant *zero;
struct hlsl_ir_load *select;
unsigned int count, i;
if (!(x = intrinsic_float_convert_arg(ctx, params, params->args[0], loc)))
@@ -2726,7 +2725,7 @@ static bool intrinsic_fmod(struct hlsl_ctx *ctx, const struct parse_initializer
if (!(select = hlsl_add_conditional(ctx, params->instrs, ge, frac, neg_frac)))
return false;
return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, &select->node, y, loc);
return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, select, y, loc);
}
static bool intrinsic_frac(struct hlsl_ctx *ctx,
@@ -2817,12 +2816,12 @@ static struct hlsl_ir_node * add_pow_expr(struct hlsl_ctx *ctx,
static bool intrinsic_lit(struct hlsl_ctx *ctx,
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
{
struct hlsl_ir_node *n_l_neg, *n_h_neg, *specular_or, *specular_pow;
struct hlsl_ir_node *n_l_neg, *n_h_neg, *specular_or, *specular_pow, *load;
struct hlsl_ir_node *n_l, *n_h, *m, *diffuse, *zero, *store;
struct hlsl_ir_constant *init;
struct hlsl_ir_load *var_load;
struct hlsl_deref var_deref;
struct hlsl_type *ret_type;
struct hlsl_ir_load *load;
struct hlsl_ir_var *var;
struct hlsl_block block;
@@ -2889,13 +2888,13 @@ static bool intrinsic_lit(struct hlsl_ctx *ctx,
if (!(load = hlsl_add_conditional(ctx, params->instrs, specular_or, zero, specular_pow)))
return false;
if (!hlsl_new_store_component(ctx, &block, &var_deref, 2, &load->node))
if (!hlsl_new_store_component(ctx, &block, &var_deref, 2, load))
return false;
list_move_tail(params->instrs, &block.instrs);
if (!(load = hlsl_new_var_load(ctx, var, loc)))
if (!(var_load = hlsl_new_var_load(ctx, var, loc)))
return false;
list_add_tail(params->instrs, &load->node.entry);
list_add_tail(params->instrs, &var_load->node.entry);
return true;
}