vkd3d-shader/hlsl: Allow empty parameter lists to be specified as "(void)".

This commit is contained in:
Zebediah Figura 2023-02-13 17:38:03 -06:00 committed by Alexandre Julliard
parent 58445da64b
commit cd6e8b5540
Notes: Alexandre Julliard 2023-02-14 22:23:01 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
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/91
2 changed files with 16 additions and 8 deletions

View File

@ -3721,6 +3721,7 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
%type <type> unnamed_struct_spec %type <type> unnamed_struct_spec
%type <type> struct_spec %type <type> struct_spec
%type <type> type %type <type> type
%type <type> type_no_void
%type <type> typedef_type %type <type> typedef_type
%type <variable_def> type_spec %type <variable_def> type_spec
@ -4233,6 +4234,10 @@ parameters:
{ {
memset(&$$, 0, sizeof($$)); memset(&$$, 0, sizeof($$));
} }
| scope_start KW_VOID
{
memset(&$$, 0, sizeof($$));
}
| scope_start param_list | scope_start param_list
{ {
$$ = $2; $$ = $2;
@ -4260,7 +4265,7 @@ param_list:
} }
parameter: parameter:
var_modifiers type any_identifier colon_attribute var_modifiers type_no_void any_identifier colon_attribute
{ {
struct hlsl_type *type; struct hlsl_type *type;
unsigned int modifiers = $1; unsigned int modifiers = $1;
@ -4321,7 +4326,7 @@ uav_type:
$$ = HLSL_SAMPLER_DIM_3D; $$ = HLSL_SAMPLER_DIM_3D;
} }
type: type_no_void:
KW_VECTOR '<' type ',' C_INTEGER '>' KW_VECTOR '<' type ',' C_INTEGER '>'
{ {
if ($3->type != HLSL_CLASS_SCALAR) if ($3->type != HLSL_CLASS_SCALAR)
@ -4382,10 +4387,6 @@ type:
{ {
$$ = hlsl_get_matrix_type(ctx, HLSL_TYPE_FLOAT, 4, 4); $$ = hlsl_get_matrix_type(ctx, HLSL_TYPE_FLOAT, 4, 4);
} }
| KW_VOID
{
$$ = ctx->builtin_types.Void;
}
| KW_SAMPLER | KW_SAMPLER
{ {
$$ = ctx->builtin_types.sampler[HLSL_SAMPLER_DIM_GENERIC]; $$ = ctx->builtin_types.sampler[HLSL_SAMPLER_DIM_GENERIC];
@ -4467,6 +4468,13 @@ type:
vkd3d_free($2); vkd3d_free($2);
} }
type:
type_no_void
| KW_VOID
{
$$ = ctx->builtin_types.Void;
}
declaration_statement: declaration_statement:
declaration declaration
| struct_declaration | struct_declaration

View File

@ -149,7 +149,7 @@ void func()
{ {
} }
[pixel shader todo] [pixel shader]
/* This is something of an internal test: we need to make sure that we use the /* This is something of an internal test: we need to make sure that we use the
* correct variables for a function's arguments and returns regardless of * correct variables for a function's arguments and returns regardless of
@ -176,7 +176,7 @@ float4 main() : sv_target
} }
[test] [test]
todo draw quad draw quad
todo probe all rgba (0.1, 0.2, 0.3, 0.4) todo probe all rgba (0.1, 0.2, 0.3, 0.4)
[pixel shader] [pixel shader]