mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Allow more implicit conversions between matrices and vectors.
HLSL seems to treat matrices 1xN or Nx1 as vectors when looking for implicit conversions. Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com> Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ce9a86975f
commit
fc053b1c08
@ -240,14 +240,22 @@ static bool implicit_compatible_data_types(struct hlsl_type *t1, struct hlsl_typ
|
||||
|
||||
if (t1->type == HLSL_CLASS_MATRIX || t2->type == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
if (t1->type == HLSL_CLASS_MATRIX && t2->type == HLSL_CLASS_MATRIX
|
||||
&& t1->dimx >= t2->dimx && t1->dimy >= t2->dimy)
|
||||
return true;
|
||||
if (t1->type == HLSL_CLASS_MATRIX && t2->type == HLSL_CLASS_MATRIX)
|
||||
return t1->dimx >= t2->dimx && t1->dimy >= t2->dimy;
|
||||
|
||||
/* Matrix-vector conversion is apparently allowed if they have
|
||||
* the same components count, or if the matrix is 1xN or Nx1
|
||||
* and we are reducing the component count */
|
||||
if (t1->type == HLSL_CLASS_VECTOR || t2->type == HLSL_CLASS_VECTOR)
|
||||
{
|
||||
if (hlsl_type_component_count(t1) == hlsl_type_component_count(t2))
|
||||
return true;
|
||||
|
||||
if ((t1->type == HLSL_CLASS_VECTOR || t1->dimx == 1 || t1->dimy == 1) &&
|
||||
(t2->type == HLSL_CLASS_VECTOR || t2->dimx == 1 || t2->dimy == 1))
|
||||
return hlsl_type_component_count(t1) >= hlsl_type_component_count(t2);
|
||||
}
|
||||
|
||||
/* Matrix-vector conversion is apparently allowed if they have the same components count */
|
||||
if ((t1->type == HLSL_CLASS_VECTOR || t2->type == HLSL_CLASS_VECTOR)
|
||||
&& hlsl_type_component_count(t1) == hlsl_type_component_count(t2))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user