Module: vkd3d Branch: master Commit: 62bb12f322195ec201b671dc261f49e6c3820e34 URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/62bb12f322195ec201b671dc261f49...
Author: Francisco Casas fcasas@codeweavers.com Date: Mon Mar 4 18:59:31 2024 -0300
vkd3d-shader/hlsl: Use LOGIC_AND instead of MUL in all().
---
libs/vkd3d-shader/hlsl.y | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 11e504ac..efac2505 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -2763,30 +2763,14 @@ static bool add_combine_components(struct hlsl_ctx *ctx, const struct parse_init static bool intrinsic_all(struct hlsl_ctx *ctx, const struct parse_initializer *params, const struct vkd3d_shader_location *loc) { - struct hlsl_ir_node *arg = params->args[0], *mul, *one, *zero, *load; - unsigned int i, count; - - if (!(one = hlsl_new_float_constant(ctx, 1.0f, loc))) - return false; - hlsl_block_add_instr(params->instrs, one); + struct hlsl_ir_node *arg = params->args[0], *cast; + struct hlsl_type *bool_type;
- if (!(zero = hlsl_new_float_constant(ctx, 0.0f, loc))) + bool_type = convert_numeric_type(ctx, arg->data_type, HLSL_TYPE_BOOL); + if (!(cast = add_cast(ctx, params->instrs, arg, bool_type, loc))) return false; - hlsl_block_add_instr(params->instrs, zero); - - mul = one; - - count = hlsl_type_component_count(arg->data_type); - for (i = 0; i < count; ++i) - { - if (!(load = hlsl_add_load_component(ctx, params->instrs, arg, i, loc))) - return false; - - if (!(mul = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, load, mul, loc))) - return false; - }
- return !!add_binary_comparison_expr(ctx, params->instrs, HLSL_OP2_NEQUAL, mul, zero, loc); + return add_combine_components(ctx, params, cast, HLSL_OP2_LOGIC_AND, loc); }
static bool intrinsic_any(struct hlsl_ctx *ctx, const struct parse_initializer *params,