ac/nir/ngg: Move emitting GS vertex param exports to if.

On GFX10-10.3 (when no attribute ring is present), only emit
the GS vertex parameter exports on the vertex export threads.
Other threads don't have anything to export.

Move this code around to make it a bit easier to follow.
Also add some comments to better explain what's what.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Acked-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/32640>
This commit is contained in:
Timur Kristóf 2024-12-20 12:47:07 -06:00
parent 68dbcdd935
commit edde762b56

View file

@ -3252,26 +3252,30 @@ ngg_gs_export_vertices(nir_builder *b, nir_def *max_num_out_vtx, nir_def *tid_in
s->options->force_vrs, !wait_attr_ring,
export_outputs, &s->out, NULL);
if (s->options->has_param_exports && s->options->gfx_level < GFX11) {
/* Emit vertex parameter exports.
* Only the vertex export threads should do this.
*/
ac_nir_export_parameters(b, s->options->vs_output_param_offset,
b->shader->info.outputs_written,
b->shader->info.outputs_written_16bit,
&s->out);
}
nir_pop_if(b, if_vtx_export_thread);
if (s->options->has_param_exports) {
if (s->options->gfx_level >= GFX11) {
create_output_phis(b, b->shader->info.outputs_written, b->shader->info.outputs_written_16bit, &s->out);
if (s->options->has_param_exports && s->options->gfx_level >= GFX11) {
/* Store vertex parameters to attribute ring.
* For optimal attribute ring access, this should happen in top level CF.
*/
create_output_phis(b, b->shader->info.outputs_written, b->shader->info.outputs_written_16bit, &s->out);
ac_nir_store_parameters_to_attr_ring(b, s->options->vs_output_param_offset,
b->shader->info.outputs_written,
b->shader->info.outputs_written_16bit,
&s->out, tid_in_tg, max_num_out_vtx);
ac_nir_store_parameters_to_attr_ring(b, s->options->vs_output_param_offset,
b->shader->info.outputs_written,
b->shader->info.outputs_written_16bit,
&s->out, tid_in_tg, max_num_out_vtx);
if (wait_attr_ring)
export_pos0_wait_attr_ring(b, if_vtx_export_thread, s->out.outputs, s->options);
} else {
b->cursor = nir_after_cf_list(&if_vtx_export_thread->then_list);
ac_nir_export_parameters(b, s->options->vs_output_param_offset,
b->shader->info.outputs_written,
b->shader->info.outputs_written_16bit,
&s->out);
}
if (wait_attr_ring)
export_pos0_wait_attr_ring(b, if_vtx_export_thread, s->out.outputs, s->options);
}
}