mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d-shader/hlsl: Parse array types in function parameters.
This commit is contained in:
committed by
Alexandre Julliard
parent
9df54851c9
commit
d279d34801
Notes:
Alexandre Julliard
2023-02-20 22:45:40 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Zebediah Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/99
@ -4317,10 +4317,11 @@ param_list:
|
|||||||
}
|
}
|
||||||
|
|
||||||
parameter:
|
parameter:
|
||||||
var_modifiers type_no_void any_identifier colon_attribute
|
var_modifiers type_no_void any_identifier arrays colon_attribute
|
||||||
{
|
{
|
||||||
struct hlsl_type *type;
|
|
||||||
unsigned int modifiers = $1;
|
unsigned int modifiers = $1;
|
||||||
|
struct hlsl_type *type;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
if (!(type = apply_type_modifiers(ctx, $2, &modifiers, @1)))
|
if (!(type = apply_type_modifiers(ctx, $2, &modifiers, @1)))
|
||||||
YYABORT;
|
YYABORT;
|
||||||
@ -4328,10 +4329,21 @@ parameter:
|
|||||||
$$.modifiers = modifiers;
|
$$.modifiers = modifiers;
|
||||||
if (!($$.modifiers & (HLSL_STORAGE_IN | HLSL_STORAGE_OUT)))
|
if (!($$.modifiers & (HLSL_STORAGE_IN | HLSL_STORAGE_OUT)))
|
||||||
$$.modifiers |= HLSL_STORAGE_IN;
|
$$.modifiers |= HLSL_STORAGE_IN;
|
||||||
|
|
||||||
|
for (i = 0; i < $4.count; ++i)
|
||||||
|
{
|
||||||
|
if ($4.sizes[i] == HLSL_ARRAY_ELEMENTS_COUNT_IMPLICIT)
|
||||||
|
{
|
||||||
|
hlsl_error(ctx, &@3, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
|
||||||
|
"Implicit size arrays not allowed in function parameters.");
|
||||||
|
}
|
||||||
|
type = hlsl_new_array_type(ctx, type, $4.sizes[i]);
|
||||||
|
}
|
||||||
$$.type = type;
|
$$.type = type;
|
||||||
|
|
||||||
$$.name = $3;
|
$$.name = $3;
|
||||||
$$.semantic = $4.semantic;
|
$$.semantic = $5.semantic;
|
||||||
$$.reg_reservation = $4.reg_reservation;
|
$$.reg_reservation = $5.reg_reservation;
|
||||||
}
|
}
|
||||||
|
|
||||||
texture_type:
|
texture_type:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[pixel shader todo]
|
[pixel shader]
|
||||||
float fun(float a[2])
|
float fun(float a[2])
|
||||||
{
|
{
|
||||||
return 10 * a[0] + a[1];
|
return 10 * a[0] + a[1];
|
||||||
@ -12,8 +12,8 @@ float4 main() : sv_target
|
|||||||
}
|
}
|
||||||
|
|
||||||
[test]
|
[test]
|
||||||
todo draw quad
|
draw quad
|
||||||
todo probe all rgba (25.0, 25.0, 25.0, 25.0)
|
probe all rgba (25.0, 25.0, 25.0, 25.0)
|
||||||
|
|
||||||
|
|
||||||
[pixel shader fail]
|
[pixel shader fail]
|
||||||
@ -58,7 +58,7 @@ float4 main() : sv_target
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[pixel shader todo]
|
[pixel shader]
|
||||||
float4 fun(float a[2][4])
|
float4 fun(float a[2][4])
|
||||||
{
|
{
|
||||||
float4 res;
|
float4 res;
|
||||||
@ -78,8 +78,22 @@ float4 main() : sv_target
|
|||||||
}
|
}
|
||||||
|
|
||||||
[test]
|
[test]
|
||||||
todo draw quad
|
draw quad
|
||||||
todo probe all rgba (15.0, 26.0, 37.0, 48.0)
|
probe all rgba (15.0, 26.0, 37.0, 48.0)
|
||||||
|
|
||||||
|
|
||||||
|
[pixel shader fail]
|
||||||
|
float fun(float a[2])
|
||||||
|
{
|
||||||
|
return a[2]; // out of bounds.
|
||||||
|
}
|
||||||
|
|
||||||
|
float4 main() : sv_target
|
||||||
|
{
|
||||||
|
float f[2] = {1, 2};
|
||||||
|
|
||||||
|
return fun(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
[pixel shader fail]
|
[pixel shader fail]
|
||||||
|
Reference in New Issue
Block a user