One of the quirks of NIR is that it has allowed SSA references where the reference uses fewer channels than exist in the SSA value, which surprises new developers and makes some analysis harder. Jason is about to remove that quirk and validate that reference num_components == value num_components, so fix up these passes in preparation.
Reviewed-by: Jason Ekstrand <ja...@jlekstrand.net> --- src/compiler/nir/nir_lower_bitmap.c | 4 +++- src/compiler/nir/nir_lower_drawpixels.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_lower_bitmap.c b/src/compiler/nir/nir_lower_bitmap.c index f08fb9b9c346..a1b4a32a5d4b 100644 --- a/src/compiler/nir/nir_lower_bitmap.c +++ b/src/compiler/nir/nir_lower_bitmap.c @@ -96,7 +96,9 @@ lower_bitmap(nir_shader *shader, nir_builder *b, tex->texture_index = options->sampler; tex->dest_type = nir_type_float; tex->src[0].src_type = nir_tex_src_coord; - tex->src[0].src = nir_src_for_ssa(texcoord); + tex->src[0].src = + nir_src_for_ssa(nir_channels(b, texcoord, + (1 << tex->coord_components) - 1)); nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32, NULL); nir_builder_instr_insert(b, &tex->instr); diff --git a/src/compiler/nir/nir_lower_drawpixels.c b/src/compiler/nir/nir_lower_drawpixels.c index 51c52d038c7e..891f89a45a20 100644 --- a/src/compiler/nir/nir_lower_drawpixels.c +++ b/src/compiler/nir/nir_lower_drawpixels.c @@ -135,7 +135,9 @@ lower_color(lower_drawpixels_state *state, nir_intrinsic_instr *intr) tex->texture_index = state->options->drawpix_sampler; tex->dest_type = nir_type_float; tex->src[0].src_type = nir_tex_src_coord; - tex->src[0].src = nir_src_for_ssa(texcoord); + tex->src[0].src = + nir_src_for_ssa(nir_channels(b, texcoord, + (1 << tex->coord_components) - 1)); nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32, NULL); nir_builder_instr_insert(b, &tex->instr); -- 2.11.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev