[PATCH vkd3d 2/6] vkd3d-shader/hlsl: Move the common shape computation to expr_common_shape.

Zebediah Figura zfigura at codeweavers.com
Thu Oct 14 11:09:57 CDT 2021


On 10/14/21 8:37 AM, Giovanni Mascellani wrote:
> Function expr_common_shape can be used for boolean operators,
> for which a common shape must be determined even if the base type
> of the result is always bool.
> 
> Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
> ---
>   libs/vkd3d-shader/hlsl.y | 82 +++++++++++++++++++++-------------------
>   1 file changed, 44 insertions(+), 38 deletions(-)
> 
> diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
> index addb9c59..05573739 100644
> --- a/libs/vkd3d-shader/hlsl.y
> +++ b/libs/vkd3d-shader/hlsl.y
> @@ -912,13 +912,9 @@ static enum hlsl_base_type expr_common_base_type(enum hlsl_base_type t1, enum hl
>       return HLSL_TYPE_INT;
>   }
>   
> -static struct hlsl_type *expr_common_type(struct hlsl_ctx *ctx, struct hlsl_type *t1, struct hlsl_type *t2,
> -        struct vkd3d_shader_location *loc)
> +static bool expr_common_shape(struct hlsl_ctx *ctx, struct hlsl_type *t1, struct hlsl_type *t2,
> +        struct vkd3d_shader_location *loc, enum hlsl_type_class *type, unsigned int *dimx, unsigned int *dimy)

Would it make more sense to instead pass the result of 
expr_common_base_type() to expr_common_shape()? I.e. something like

     struct hlsl_type *expr_common_shape(ctx, t1, t2, 
expr_common_base_type(t1, t2));

or

     struct hlsl_type *expr_common_shape(ctx, t1, t2, HLSL_TYPE_BOOL);

One of those things I think of when I see a function with a lot of 
output parameters :-)



More information about the wine-devel mailing list