From 637cd5ac005cd3604f3aa64d920354bbe41c0660 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Mon, 27 Sep 2021 18:37:34 +0200 Subject: [PATCH] nir/lower_blend: Pad src to a 4-component vector nir_ssa_for_src() is not supposed to pad the src vector if dst->num_components > src->num_components. Let's pad things explicitly with nir_pad_vector(). Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir_lower_blend.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_lower_blend.c b/src/compiler/nir/nir_lower_blend.c index 05245337240..e22cc52837e 100644 --- a/src/compiler/nir/nir_lower_blend.c +++ b/src/compiler/nir/nir_lower_blend.c @@ -347,7 +347,9 @@ nir_lower_blend_instr(nir_builder *b, nir_instr *instr, void *data) b->cursor = nir_before_instr(instr); /* Grab the input color */ - nir_ssa_def *src = nir_ssa_for_src(b, intr->src[1], 4); + unsigned src_num_comps = nir_src_num_components(intr->src[1]); + nir_ssa_def *src = + nir_pad_vector(b, nir_ssa_for_src(b, intr->src[1], src_num_comps), 4); /* Grab the previous fragment color */ var->data.fb_fetch_output = true;