vkd3d-shader/hlsl: Support case-insensitive lookup for builtin 'float' type.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov 2023-02-21 23:59:04 +01:00 committed by Alexandre Julliard
parent df2d6d35e2
commit dd36215a00
Notes: Alexandre Julliard 2023-02-23 22:20:00 +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/101
2 changed files with 18 additions and 4 deletions

View File

@ -609,6 +609,7 @@ static const char * get_case_insensitive_typename(const char *name)
static const char *const names[] = static const char *const names[] =
{ {
"dword", "dword",
"float",
}; };
unsigned int i; unsigned int i;
@ -2838,7 +2839,7 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
effect_types[] = effect_types[] =
{ {
{"dword", HLSL_CLASS_SCALAR, HLSL_TYPE_UINT, 1, 1}, {"dword", HLSL_CLASS_SCALAR, HLSL_TYPE_UINT, 1, 1},
{"FLOAT", HLSL_CLASS_SCALAR, HLSL_TYPE_FLOAT, 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}, {"MATRIX", HLSL_CLASS_MATRIX, HLSL_TYPE_FLOAT, 4, 4},
{"STRING", HLSL_CLASS_OBJECT, HLSL_TYPE_STRING, 1, 1}, {"STRING", HLSL_CLASS_OBJECT, HLSL_TYPE_STRING, 1, 1},

View File

@ -1,20 +1,25 @@
[pixel shader] [pixel shader]
typedef float2 Dword; typedef float2 Dword;
typedef float3 dWord; typedef float3 dWord;
typedef float2 fLoat;
float4 f() float4 f()
{ {
typedef Dword dword; typedef Dword dword;
typedef fLoat float;
dword v1 = {1, 2}; dword v1 = {1, 2};
float v2 = {2, 3};
DWORD v4 = 4; DWORD v4 = 4;
return float4(v1.x, v1.y, 3, v4); return float4(v1.x, v2.x, v2.y, v4);
} }
float4 f2() float4 f2()
{ {
typedef dword dword; typedef dword dword;
dword v = 1; typedef float float;
return float4(v, v, v, v); dword v1 = 1;
float v2 = 1;
return float4(v1, v2, v1, v1);
} }
float4 main() : SV_TARGET float4 main() : SV_TARGET
@ -42,3 +47,11 @@ float4 main() : sv_target
{ {
return float4(0, 0, 0, 0); return float4(0, 0, 0, 0);
} }
[pixel shader fail]
typedef float2 float;
float4 main() : sv_target
{
return float4(0, 0, 0, 0);
}