On Mon, Mar 7, 2022 at 6:33 PM Zebediah Figura zfigura@codeweavers.com wrote:
On 3/7/22 09:09, Francisco Casas wrote:
Hello,
March 4, 2022 10:01 PM, "Zebediah Figura (she/her)" zfigura@codeweavers.com wrote:
On 3/2/22 12:31, Francisco Casas wrote:
Signed-off-by: Francisco Casas fcasas@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@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?
Well, I am not totally sure this patch is actually necessary, I just thought it could be a good default behavior since we are getting rid of hlsl_is_single_reg(), but maybe I am overthinking...
FWIW, I don't know that that instance of type_is_single_reg() necessarily needs to go away. Although given 1/8, we could certainly say that a zero writemask always means the whole variable, and let hlsl_reg_from_deref() deal with that even for scalar and vector types.
I'd move in that direction too (shorter term, at least).