vkd3d-shader/hlsl: Add constants to the block for log()/log10() builtins.

This commit is contained in:
Nikolay Sivov 2023-11-16 01:14:09 +01:00 committed by Alexandre Julliard
parent aed2d142cf
commit e55b6a7fa1
Notes: Alexandre Julliard 2023-11-20 22:31:59 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Francisco Casas (@fcasas)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/476

View File

@ -3171,6 +3171,7 @@ static bool intrinsic_log(struct hlsl_ctx *ctx,
/* ln(2) */ /* ln(2) */
if (!(coeff = hlsl_new_float_constant(ctx, 0.69314718055f, loc))) if (!(coeff = hlsl_new_float_constant(ctx, 0.69314718055f, loc)))
return false; return false;
hlsl_block_add_instr(params->instrs, coeff);
return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, log, coeff, loc); return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, log, coeff, loc);
} }
@ -3189,6 +3190,7 @@ static bool intrinsic_log10(struct hlsl_ctx *ctx,
/* 1 / log2(10) */ /* 1 / log2(10) */
if (!(coeff = hlsl_new_float_constant(ctx, 0.301029996f, loc))) if (!(coeff = hlsl_new_float_constant(ctx, 0.301029996f, loc)))
return false; return false;
hlsl_block_add_instr(params->instrs, coeff);
return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, log, coeff, loc); return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, log, coeff, loc);
} }