vkd3d-shader/hlsl: Improve handling of builtin alias type "vector".

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov 2023-02-26 15:25:06 +01:00 committed by Alexandre Julliard
parent 5b5c020ade
commit b172f4c257
Notes: Alexandre Julliard 2023-04-03 22:08:33 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/109
2 changed files with 27 additions and 1 deletions

View File

@ -615,6 +615,7 @@ static const char * get_case_insensitive_typename(const char *name)
"dword",
"float",
"matrix",
"vector",
};
unsigned int i;
@ -2845,7 +2846,7 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
{
{"dword", HLSL_CLASS_SCALAR, HLSL_TYPE_UINT, 1, 1},
{"float", HLSL_CLASS_SCALAR, HLSL_TYPE_FLOAT, 1, 1},
{"VECTOR", HLSL_CLASS_VECTOR, HLSL_TYPE_FLOAT, 4, 1},
{"vector", HLSL_CLASS_VECTOR, HLSL_TYPE_FLOAT, 4, 1},
{"matrix", HLSL_CLASS_MATRIX, HLSL_TYPE_FLOAT, 4, 4},
{"STRING", HLSL_CLASS_OBJECT, HLSL_TYPE_STRING, 1, 1},
{"TEXTURE", HLSL_CLASS_OBJECT, HLSL_TYPE_TEXTURE, 1, 1},

View File

@ -3,6 +3,7 @@ typedef float2 Dword;
typedef float3 dWord;
typedef float2 fLoat;
typedef float2 mAtrix;
typedef float2 vEctor;
float4 f()
{
@ -14,6 +15,10 @@ float4 f()
mAtrix v5 = {1, 2};
maTrix v6 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
matrix v7 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
vector v8 = {1, 2, 3, 4};
vEctor v9 = {1, 2};
Vector v10 = {1, 2, 3, 4};
vectoR v11 = {1, 2, 3, 4};
return float4(v1.x, v2.x, v2.y, v4);
}
@ -80,6 +85,18 @@ float4 main() : SV_TARGET
return f();
}
[pixel shader fail]
float4 f()
{
typedef float2 vector;
return float4(0, 0, 0, 0);
}
float4 main() : SV_TARGET
{
return f();
}
[pixel shader fail]
Matrix<float, 2, 2> m;
@ -87,3 +104,11 @@ float4 main() : sv_target
{
return float4(0, 0, 0, 0);
}
[pixel shader fail]
Vector<float, 2> v;
float4 main() : sv_target
{
return float4(0, 0, 0, 0);
}