mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d-shader/hlsl: Inline add_pow_expr().
The helper is used in one place.
This commit is contained in:
committed by
Henri Verbeet
parent
439652f023
commit
e830cdee71
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
@@ -4303,21 +4303,6 @@ static bool intrinsic_lerp(struct hlsl_ctx *ctx,
|
||||
return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_ADD, params->args[0], mul, loc);
|
||||
}
|
||||
|
||||
static struct hlsl_ir_node * add_pow_expr(struct hlsl_ctx *ctx,
|
||||
struct hlsl_block *instrs, struct hlsl_ir_node *arg1, struct hlsl_ir_node *arg2,
|
||||
const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
struct hlsl_ir_node *log, *mul;
|
||||
|
||||
if (!(log = add_unary_arithmetic_expr(ctx, instrs, HLSL_OP1_LOG2, arg1, loc)))
|
||||
return NULL;
|
||||
|
||||
if (!(mul = add_binary_arithmetic_expr(ctx, instrs, HLSL_OP2_MUL, arg2, log, loc)))
|
||||
return NULL;
|
||||
|
||||
return add_unary_arithmetic_expr(ctx, instrs, HLSL_OP1_EXP2, mul, loc);
|
||||
}
|
||||
|
||||
static bool intrinsic_lit(struct hlsl_ctx *ctx,
|
||||
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
@@ -4586,10 +4571,18 @@ static bool intrinsic_normalize(struct hlsl_ctx *ctx,
|
||||
static bool intrinsic_pow(struct hlsl_ctx *ctx,
|
||||
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
struct hlsl_ir_node *log, *mul;
|
||||
|
||||
if (!elementwise_intrinsic_float_convert_args(ctx, params, loc))
|
||||
return false;
|
||||
|
||||
return !!add_pow_expr(ctx, params->instrs, params->args[0], params->args[1], loc);
|
||||
if (!(log = add_unary_arithmetic_expr(ctx, params->instrs, HLSL_OP1_LOG2, params->args[0], loc)))
|
||||
return NULL;
|
||||
|
||||
if (!(mul = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, params->args[1], log, loc)))
|
||||
return NULL;
|
||||
|
||||
return add_unary_arithmetic_expr(ctx, params->instrs, HLSL_OP1_EXP2, mul, loc);
|
||||
}
|
||||
|
||||
static bool intrinsic_radians(struct hlsl_ctx *ctx,
|
||||
|
Reference in New Issue
Block a user