[PATCH vkd3d 3/6] vkd3d-shader/hlsl: Simplify common shape computation.

Giovanni Mascellani gmascellani at codeweavers.com
Thu Oct 14 08:37:09 CDT 2021


When t1 is a vector type, it's already supposed to have dimx == max_dim_1
and dimy == 1, and the same for t2.

Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
---
 libs/vkd3d-shader/hlsl.y | 24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index 05573739..3119380c 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -985,30 +985,14 @@ static bool expr_common_shape(struct hlsl_ctx *ctx, struct hlsl_type *t1, struct
         else if (max_dim_1 <= max_dim_2)
         {
             *type = t1->type;
-            if (*type == HLSL_CLASS_VECTOR)
-            {
-                *dimx = max_dim_1;
-                *dimy = 1;
-            }
-            else
-            {
-                *dimx = t1->dimx;
-                *dimy = t1->dimy;
-            }
+            *dimx = t1->dimx;
+            *dimy = t1->dimy;
         }
         else
         {
             *type = t2->type;
-            if (*type == HLSL_CLASS_VECTOR)
-            {
-                *dimx = max_dim_2;
-                *dimy = 1;
-            }
-            else
-            {
-                *dimx = t2->dimx;
-                *dimy = t2->dimy;
-            }
+            *dimx = t2->dimx;
+            *dimy = t2->dimy;
         }
     }
 
-- 
2.33.0




More information about the wine-devel mailing list