[PATCH vkd3d v3 2/8] vkd3d-shader/hlsl: Add default writemask for matrix stores.
Zebediah Figura (she/her)
zfigura at codeweavers.com
Fri Mar 4 19:01:37 CST 2022
On 3/2/22 12:31, Francisco Casas wrote:
> Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
>
> ---
> v3:
> - This patch is new.
> - While we don't use the default writemask for matrices (yet),
> I think it is good for consistency, since we are getting rid
> of the type_is_single_reg() function.
>
> Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
> ---
> libs/vkd3d-shader/hlsl.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
> index 00a374b4..5152aec4 100644
> --- a/libs/vkd3d-shader/hlsl.c
> +++ b/libs/vkd3d-shader/hlsl.c
> @@ -527,9 +527,13 @@ struct hlsl_ir_var *hlsl_new_synthetic_var(struct hlsl_ctx *ctx, const char *nam
> return var;
> }
>
> -static bool type_is_single_reg(const struct hlsl_type *type)
> +static unsigned int type_default_writemask(const struct hlsl_type *type)
> - return type->type == HLSL_CLASS_SCALAR || type->type == HLSL_CLASS_VECTOR;
> + if (type->type == HLSL_CLASS_MATRIX && hlsl_type_is_row_major(type))
> + return (1 << type->dimy) - 1;
I don't understand the logic here. A nonzero writemask should encompass
the whole type, which this does not. Why do we need this?
> + if (type->type <= HLSL_CLASS_LAST_NUMERIC)
> + return (1 << type->dimx) - 1;
> + return 0;
> }
>
> struct hlsl_ir_store *hlsl_new_store(struct hlsl_ctx *ctx, struct hlsl_ir_var *var, struct hlsl_ir_node *offset,
> @@ -537,8 +541,8 @@ struct hlsl_ir_store *hlsl_new_store(struct hlsl_ctx *ctx, struct hlsl_ir_var *v
> {
> struct hlsl_ir_store *store;
>
> - if (!writemask && type_is_single_reg(rhs->data_type))
> - writemask = (1 << rhs->data_type->dimx) - 1;
> + if (!writemask)
> + writemask = type_default_writemask(rhs->data_type);
>
> if (!(store = hlsl_alloc(ctx, sizeof(*store))))
> return NULL;
More information about the wine-devel
mailing list