vkd3d-shader/hlsl: Merge the "type" and "base_type" rules.

It's certainly invalid to declare a vector of non-scalars, but it doesn't need
to result in a syntax error. Indeed native d3dcompiler does not emit a syntax
error in this case.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-08-30 12:21:25 -05:00 committed by Alexandre Julliard
parent 7e353ce62b
commit 6ee423a21b

View File

@ -1731,7 +1731,6 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
%type <semantic> semantic
%type <type> base_type
%type <type> field_type
%type <type> named_struct_spec
%type <type> unnamed_struct_spec
@ -2145,11 +2144,7 @@ input_mod:
}
type:
base_type
{
$$ = $1;
}
| KW_VECTOR '<' base_type ',' C_INTEGER '>'
KW_VECTOR '<' type ',' C_INTEGER '>'
{
if ($3->type != HLSL_CLASS_SCALAR)
{
@ -2171,7 +2166,7 @@ type:
$$ = hlsl_new_type(ctx, NULL, HLSL_CLASS_VECTOR, $3->base_type, $5, 1);
}
| KW_MATRIX '<' base_type ',' C_INTEGER ',' C_INTEGER '>'
| KW_MATRIX '<' type ',' C_INTEGER ',' C_INTEGER '>'
{
if ($3->type != HLSL_CLASS_SCALAR)
{
@ -2199,9 +2194,7 @@ type:
$$ = hlsl_new_type(ctx, NULL, HLSL_CLASS_MATRIX, $3->base_type, $7, $5);
}
base_type:
KW_VOID
| KW_VOID
{
$$ = ctx->builtin_types.Void;
}