nir: Unconditionally call nir_trim_vector in nir_lower_readonly_images_to_tex

It will already short-circuit if the number of components matches.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19301>
This commit is contained in:
Jason Ekstrand 2022-10-25 11:07:24 -05:00 committed by Marge Bot
parent d9cf6de4a8
commit 5e05d98848

View file

@ -179,11 +179,8 @@ lower_readonly_image_instr(nir_builder *b, nir_instr *instr, void *context)
nir_builder_instr_insert(b, &tex->instr);
nir_ssa_def *res = &tex->dest.ssa;
if (res->num_components != intrin->dest.ssa.num_components) {
unsigned num_components = intrin->dest.ssa.num_components;
res = nir_trim_vector(b, res, num_components);
}
nir_ssa_def *res = nir_trim_vector(b, &tex->dest.ssa,
intrin->dest.ssa.num_components);
nir_ssa_def_rewrite_uses(&intrin->dest.ssa, res);
nir_instr_remove(&intrin->instr);