Giovanni Mascellani : vkd3d-shader/hlsl: Move the base type equality case in expr_common_base_type.

Alexandre Julliard julliard at winehq.org
Fri Aug 27 14:57:56 CDT 2021


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

Author: Giovanni Mascellani <gmascellani at codeweavers.com>
Date:   Fri Aug 27 12:05:11 2021 +0200

vkd3d-shader/hlsl: Move the base type equality case in expr_common_base_type.

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

---

 libs/vkd3d-shader/hlsl.y | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index cb4fd7c..4c3c067 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -916,6 +916,9 @@ static enum hlsl_base_type expr_common_base_type(enum hlsl_base_type t1, enum hl
     };
     int t1_idx = -1, t2_idx = -1, i;
 
+    if (t1 == t2)
+        return t1;
+
     for (i = 0; i < ARRAY_SIZE(types); ++i)
     {
         /* Always convert away from HLSL_TYPE_HALF */
@@ -981,10 +984,7 @@ static struct hlsl_type *expr_common_type(struct hlsl_ctx *ctx, struct hlsl_type
         return NULL;
     }
 
-    if (t1->base_type == t2->base_type)
-        base = t1->base_type;
-    else
-        base = expr_common_base_type(t1->base_type, t2->base_type);
+    base = expr_common_base_type(t1->base_type, t2->base_type);
 
     if (t1->dimx == 1 && t1->dimy == 1)
     {




More information about the wine-cvs mailing list