From 4ab663194967fa6da2f98eb6b748bd2e2d969f24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Pi=C3=B1eiro?= Date: Tue, 25 Jan 2022 13:59:45 +0100 Subject: [PATCH] vc4/nir_lower_blend: update write mask when we update num components As explained at the header of the lowering: "Once this pass is done, the color write will either have one component (for single sample) with packed argb8888, or 4 components with the per-sample argb8888 result." So in several cases the lowering was updating the number of components, so we need to update the writemask too. Reviewed-by: Juan A. Suarez Reviewed-by: Jose Maria Casanova Crespo Part-of: --- src/gallium/drivers/vc4/vc4_nir_lower_blend.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c index d01a4c20749..20a4e864471 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c @@ -562,7 +562,11 @@ vc4_nir_lower_blend_instr(struct vc4_compile *c, nir_builder *b, nir_instr_rewrite_src(&intr->instr, &intr->src[0], nir_src_for_ssa(blend_output)); - intr->num_components = blend_output->num_components; + if (intr->num_components != blend_output->num_components) { + unsigned component_mask = BITFIELD_MASK(blend_output->num_components); + nir_intrinsic_set_write_mask(intr, component_mask); + intr->num_components = blend_output->num_components; + } } static bool