vkd3d-shader/hlsl: Use mul only for two scalars for dot().

This commit is contained in:
Nikolay Sivov 2023-02-12 21:53:28 +01:00 committed by Alexandre Julliard
parent 0e60f4cc69
commit 99acf5038e
Notes: Alexandre Julliard 2023-02-15 22:19:57 +01:00
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/90
2 changed files with 16 additions and 1 deletions

View File

@ -1638,7 +1638,7 @@ static struct hlsl_ir_node *add_binary_dot_expr(struct hlsl_ctx *ctx, struct lis
if (arg1->data_type->type == HLSL_CLASS_SCALAR)
dim = arg2->data_type->dimx;
else if (arg1->data_type->type == HLSL_CLASS_SCALAR)
else if (arg2->data_type->type == HLSL_CLASS_SCALAR)
dim = arg1->data_type->dimx;
else
dim = min(arg1->data_type->dimx, arg2->data_type->dimx);

View File

@ -43,6 +43,21 @@ uniform 4 float4 10.0 11.0 12.0 13.0
draw quad
probe all rgba (92.0, 92.0, 92.0, 92.0)
[pixel shader]
uniform float4 x;
uniform float y;
float4 main() : SV_TARGET
{
return dot(x, y);
}
[test]
uniform 0 float4 10.0 11.0 12.0 13.0
uniform 4 float4 2.0 0.0 0.0 0.0
draw quad
probe all rgba (92.0, 92.0, 92.0, 92.0)
[pixel shader]
uniform float x;
uniform float y;