Module: vkd3d
Branch: master
Commit: ce9a86975fbefead7b510da848dc1c6cbda5b5ed
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=ce9a86975fbefead7b510da…
Author: Giovanni Mascellani <gmascellani(a)codeweavers.com>
Date: Mon Oct 25 09:06:28 2021 +0200
vkd3d-shader/hlsl: Return the shape of the left operand when appropriate.
The assumption about the size of matrices is not correct: it is
legitimate to compose a matrix 2x2 with a vector of length 4, in which
case it appears that the result has the shape of the first (leftmost)
operand. Even for matrices 1xN or Nx1, the result is not always a
vector: in general it has the shape of the first operand again.
Signed-off-by: Giovanni Mascellani <gmascellani(a)codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
libs/vkd3d-shader/hlsl.y | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index d2cc187..249d1bf 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -971,18 +971,7 @@ static bool expr_common_shape(struct hlsl_ctx *ctx, struct hlsl_type *t1, struct
}
else
{
- /* Two vectors or a vector and a matrix (matrix must be 1xn or nx1) */
- unsigned int max_dim_1, max_dim_2;
-
- max_dim_1 = max(t1->dimx, t1->dimy);
- max_dim_2 = max(t2->dimx, t2->dimy);
- if (t1->dimx * t1->dimy == t2->dimx * t2->dimy)
- {
- *type = HLSL_CLASS_VECTOR;
- *dimx = max(t1->dimx, t2->dimx);
- *dimy = 1;
- }
- else if (max_dim_1 <= max_dim_2)
+ if (t1->dimx * t1->dimy <= t2->dimx * t2->dimy)
{
*type = t1->type;
*dimx = t1->dimx;