brw: Use nir_imul_imm in per-vertex/per-primitive offset calculation
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

This avoids generating some useless math that would need to be cleaned
up later, without complicating things too much.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39250>
This commit is contained in:
Kenneth Graunke 2026-01-09 14:28:51 -08:00 committed by Marge Bot
parent 24c66d3871
commit 41d7debcfe

View file

@ -150,12 +150,12 @@ urb_offset(nir_builder *b,
offset = nir_iadd(b, offset, nir_imul_imm(b, index->ssa, stride)); offset = nir_iadd(b, offset, nir_imul_imm(b, index->ssa, stride));
} else if (index) { } else if (index) {
nir_def *stride = cb_data->dynamic_tes const unsigned unit = cb_data->vec4_access ? 16 : 4;
? intel_nir_tess_field(b, PER_VERTEX_SLOTS) nir_def *index_offset = cb_data->dynamic_tes
: nir_imm_int(b, cb_data->per_vertex_stride / ? nir_imul(b, index->ssa, intel_nir_tess_field(b, PER_VERTEX_SLOTS))
(cb_data->vec4_access ? 16 : 4)); : nir_imul_imm(b, index->ssa, cb_data->per_vertex_stride / unit);
offset = nir_iadd(b, offset, nir_imul(b, index->ssa, stride)); offset = nir_iadd(b, offset, index_offset);
/* In the Tessellation evaluation shader, reposition the offset of /* In the Tessellation evaluation shader, reposition the offset of
* builtins when using separate layout. * builtins when using separate layout.