anv: use imm-helpers

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23855>
This commit is contained in:
Erik Faye-Lund 2023-06-16 15:45:17 +02:00 committed by Marge Bot
parent c4b6b0d949
commit 6520b3e726
2 changed files with 6 additions and 5 deletions

View file

@ -723,8 +723,9 @@ build_surface_index_for_binding(nir_builder *b,
/* With bindless indexes are offsets in the descriptor buffer */
surface_index =
nir_iadd(b, nir_imm_int(b, bind_layout->descriptor_offset),
nir_imul_imm(b, array_index, bind_layout->descriptor_stride));
nir_iadd_imm(b,
nir_imul_imm(b, array_index, bind_layout->descriptor_stride),
bind_layout->descriptor_offset);
if (plane != 0) {
assert(plane < bind_layout->max_plane_count);
surface_index = nir_iadd_imm(b, surface_index,

View file

@ -109,7 +109,7 @@ build_view_index(struct lower_multiview_state *state)
remap |= (uint64_t)bit << (i++ * 4);
}
nir_ssa_def *shift = nir_imul(b, compacted, nir_imm_int(b, 4));
nir_ssa_def *shift = nir_imul_imm(b, compacted, 4);
/* One of these days, when we have int64 everywhere, this will be
* easier.
@ -122,11 +122,11 @@ build_view_index(struct lower_multiview_state *state)
nir_ushr(b, nir_imm_int(b, remap), shift);
nir_ssa_def *shifted_high =
nir_ushr(b, nir_imm_int(b, remap >> 32),
nir_isub(b, shift, nir_imm_int(b, 32)));
nir_iadd_imm(b, shift, -32));
shifted = nir_bcsel(b, nir_ilt_imm(b, shift, 32),
shifted_low, shifted_high);
}
state->view_index = nir_iand(b, shifted, nir_imm_int(b, 0xf));
state->view_index = nir_iand_imm(b, shifted, 0xf);
}
} else {
const struct glsl_type *type = glsl_int_type();