Zebediah Figura : vkd3d-shader/hlsl: Write SM4 bitwise AND instructions.

Alexandre Julliard julliard at winehq.org
Fri Mar 18 16:38:45 CDT 2022


Module: vkd3d
Branch: master
Commit: ccb3326516867659ac28b3ccb45072b15ecb91d0
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=ccb3326516867659ac28b3ccb45072b15ecb91d0

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Tue Mar  8 17:58:16 2022 -0600

vkd3d-shader/hlsl: Write SM4 bitwise AND instructions.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/vkd3d-shader/hlsl_sm4.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/libs/vkd3d-shader/hlsl_sm4.c b/libs/vkd3d-shader/hlsl_sm4.c
index 38220b18..41ea4c7f 100644
--- a/libs/vkd3d-shader/hlsl_sm4.c
+++ b/libs/vkd3d-shader/hlsl_sm4.c
@@ -1412,6 +1412,20 @@ static void write_sm4_sample(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer
     write_sm4_instruction(buffer, &instr);
 }
 
+static bool type_is_integer(const struct hlsl_type *type)
+{
+    switch (type->base_type)
+    {
+        case HLSL_TYPE_BOOL:
+        case HLSL_TYPE_INT:
+        case HLSL_TYPE_UINT:
+            return true;
+
+        default:
+            return false;
+    }
+}
+
 static bool type_is_float(const struct hlsl_type *type)
 {
     return type->base_type == HLSL_TYPE_FLOAT || type->base_type == HLSL_TYPE_HALF;
@@ -1613,6 +1627,11 @@ static void write_sm4_expr(struct hlsl_ctx *ctx,
             }
             break;
 
+        case HLSL_OP2_BIT_AND:
+            assert(type_is_integer(dst_type));
+            write_sm4_binary_op(buffer, VKD3D_SM4_OP_AND, &expr->node, arg1, arg2);
+            break;
+
         case HLSL_OP2_DIV:
             switch (dst_type->base_type)
             {




More information about the wine-cvs mailing list