[PATCH vkd3d 4/6] vkd3d-shader/hlsl: Use cached vector types in more places.

Giovanni Mascellani gmascellani at codeweavers.com
Tue Sep 28 03:41:09 CDT 2021


Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
---
Just FTR, eventually I'll propose a helper for accessing builtin numeric 
types[1].

  [1] 
https://repo.or.cz/vkd3d/zf.git/commitdiff/f4af1b6a0486dd4dc692795170dedfa06aa9ba3c

Il 28/09/21 03:51, Zebediah Figura ha scritto:
> Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
> ---
>   libs/vkd3d-shader/hlsl.c | 2 +-
>   libs/vkd3d-shader/hlsl.y | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
> index c546bf06f..8a531d627 100644
> --- a/libs/vkd3d-shader/hlsl.c
> +++ b/libs/vkd3d-shader/hlsl.c
> @@ -608,7 +608,7 @@ struct hlsl_ir_swizzle *hlsl_new_swizzle(struct hlsl_ctx *ctx, DWORD s, unsigned
>       if (!(swizzle = hlsl_alloc(ctx, sizeof(*swizzle))))
>           return NULL;
>       init_node(&swizzle->node, HLSL_IR_SWIZZLE,
> -            hlsl_new_type(ctx, NULL, HLSL_CLASS_VECTOR, val->data_type->base_type, components, 1), *loc);
> +            ctx->builtin_types.vector[val->data_type->base_type][components - 1], *loc);
>       hlsl_src_from_node(&swizzle->val, val);
>       swizzle->swizzle = s;
>       return swizzle;
> diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
> index 21e1cb455..56b996991 100644
> --- a/libs/vkd3d-shader/hlsl.y
> +++ b/libs/vkd3d-shader/hlsl.y
> @@ -2397,7 +2397,7 @@ type:
>                   YYABORT;
>               }
>   
> -            $$ = hlsl_new_type(ctx, NULL, HLSL_CLASS_VECTOR, $3->base_type, $5, 1);
> +            $$ = ctx->builtin_types.vector[$3->base_type][$5 - 1];
>           }
>       | KW_MATRIX '<' type ',' C_INTEGER ',' C_INTEGER '>'
>           {
> 



More information about the wine-devel mailing list