[PATCH vkd3d v2 6/7] vkd3d-shader/hlsl: Fix typing rules for bitwise NOT.

Zebediah Figura zfigura at codeweavers.com
Thu Feb 24 12:45:20 CST 2022


From: Giovanni Mascellani <gmascellani at codeweavers.com>

Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
v2: Use check_integer_type(); constify the "loc" parameter.

 libs/vkd3d-shader/hlsl.y | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index c1c229a6f..328f1bbb1 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -1043,6 +1043,14 @@ static struct hlsl_ir_expr *add_unary_arithmetic_expr(struct hlsl_ctx *ctx, stru
     return add_expr(ctx, instrs, op, args, arg->data_type, loc);
 }
 
+static struct hlsl_ir_expr *add_unary_bitwise_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)
+{
+    check_integer_type(ctx, arg);
+
+    return add_unary_arithmetic_expr(ctx, instrs, op, arg, 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)
@@ -3595,7 +3603,7 @@ unary_expr:
         }
     | '~' unary_expr
         {
-            add_unary_arithmetic_expr(ctx, $2, HLSL_OP1_BIT_NOT, node_from_list($2), &@1);
+            add_unary_bitwise_expr(ctx, $2, HLSL_OP1_BIT_NOT, node_from_list($2), &@1);
             $$ = $2;
         }
     | '!' unary_expr
-- 
2.35.1




More information about the wine-devel mailing list