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 <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13060>
This commit is contained in:
Boris Brezillon 2021-09-27 18:37:34 +02:00
parent 641bed3103
commit 637cd5ac00

View file

@ -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;