Giovanni Mascellani : vkd3d-shader/hlsl: Fix typing rules for logical NOT.
Alexandre Julliard
julliard at winehq.org
Wed Mar 2 14:33:17 CST 2022
Module: vkd3d
Branch: master
Commit: be5668382ea574ec602c3d0c0eab0ba98014fa54
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=be5668382ea574ec602c3d0c0eab0ba98014fa54
Author: Giovanni Mascellani <gmascellani at codeweavers.com>
Date: Thu Feb 24 12:45:21 2022 -0600
vkd3d-shader/hlsl: Fix typing rules for logical NOT.
Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
libs/vkd3d-shader/hlsl.y | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index 328f1bb..92dcb3f 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -1051,6 +1051,21 @@ static struct hlsl_ir_expr *add_unary_bitwise_expr(struct hlsl_ctx *ctx, struct
return add_unary_arithmetic_expr(ctx, instrs, op, arg, loc);
}
+static struct hlsl_ir_expr *add_unary_logical_expr(struct hlsl_ctx *ctx, struct list *instrs,
+ enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg, const struct vkd3d_shader_location *loc)
+{
+ struct hlsl_ir_node *args[HLSL_MAX_OPERANDS] = {0};
+ struct hlsl_type *bool_type;
+
+ bool_type = hlsl_get_numeric_type(ctx, arg->data_type->type, HLSL_TYPE_BOOL,
+ arg->data_type->dimx, arg->data_type->dimy);
+
+ if (!(args[0] = add_implicit_conversion(ctx, instrs, arg, bool_type, loc)))
+ return NULL;
+
+ return add_expr(ctx, instrs, op, args, bool_type, loc);
+}
+
static struct hlsl_ir_expr *add_binary_arithmetic_expr(struct hlsl_ctx *ctx, struct list *instrs,
enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg1, struct hlsl_ir_node *arg2,
const struct vkd3d_shader_location *loc)
@@ -3608,7 +3623,7 @@ unary_expr:
}
| '!' unary_expr
{
- add_unary_arithmetic_expr(ctx, $2, HLSL_OP1_LOGIC_NOT, node_from_list($2), &@1);
+ add_unary_logical_expr(ctx, $2, HLSL_OP1_LOGIC_NOT, node_from_list($2), &@1);
$$ = $2;
}
/* var_modifiers is necessary to avoid shift/reduce conflicts. */
More information about the wine-cvs
mailing list