[PATCH vkd3d 4/5] vkd3d-shader/hlsl: Merge the "type" and "base_type" rules.

Giovanni Mascellani gmascellani at codeweavers.com
Tue Aug 31 02:01:46 CDT 2021


Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>

Il 30/08/21 19:21, Zebediah Figura ha scritto:
> 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 at codeweavers.com>
> ---
>   libs/vkd3d-shader/hlsl.y | 13 +++----------
>   1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
> index 7906356f..6a472c10 100644
> --- a/libs/vkd3d-shader/hlsl.y
> +++ b/libs/vkd3d-shader/hlsl.y
> @@ -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;
>           }
> 



More information about the wine-devel mailing list