ac/nir/esgs: Map linked ES/GS I/O based on GS input mask.

With this change, ES/GS	linking	will not rely on driver	locations
anymore (driver locations are considered deprecated in NIR).

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29812>
This commit is contained in:
Timur Kristóf
2024-06-20 17:23:22 +02:00
committed by Marge Bot
parent d758bea8dd
commit 7c009172e3
+5 -2
View File
@@ -160,7 +160,8 @@ lower_es_output_store(nir_builder *b,
const unsigned write_mask = nir_intrinsic_write_mask(intrin);
b->cursor = nir_before_instr(&intrin->instr);
nir_def *io_off = ac_nir_calc_io_offset(b, intrin, nir_imm_int(b, 16u), 4u, st->map_io);
unsigned mapped = ac_nir_map_io_location(io_sem.location, st->gs_inputs_read, st->map_io);
nir_def *io_off = ac_nir_calc_io_offset_mapped(b, intrin, nir_imm_int(b, 16u), 4u, mapped);
nir_def *store_val = intrin->src[0].ssa;
if (st->gfx_level <= GFX8) {
@@ -289,7 +290,9 @@ gs_per_vertex_input_offset(nir_builder *b,
vertex_offset = nir_imul(b, vertex_offset, nir_load_esgs_vertex_stride_amd(b));
unsigned base_stride = st->gfx_level >= GFX9 ? 1 : 64 /* Wave size on GFX6-8 */;
nir_def *io_off = ac_nir_calc_io_offset(b, instr, nir_imm_int(b, base_stride * 4u), base_stride, st->map_io);
const nir_io_semantics io_sem = nir_intrinsic_io_semantics(instr);
unsigned mapped = ac_nir_map_io_location(io_sem.location, st->gs_inputs_read, st->map_io);
nir_def *io_off = ac_nir_calc_io_offset_mapped(b, instr, nir_imm_int(b, base_stride * 4u), base_stride, mapped);
nir_def *off = nir_iadd(b, io_off, vertex_offset);
return nir_imul_imm(b, off, 4u);
}