ac/nir: gs and nogs use ac_nir_export_primitive

Mesh shader primitive export is left unchanged because it needs
extra changes for per primitive output export when export
primitive.

Mesh shader will use second channel of primitive export.

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20691>
This commit is contained in:
Qiang Yu 2022-12-19 16:01:15 +08:00 committed by Marge Bot
parent 8331842258
commit e9268b2c06
3 changed files with 17 additions and 2 deletions

View file

@ -22,6 +22,7 @@
*/
#include "ac_nir.h"
#include "sid.h"
#include "nir_builder.h"
#include "nir_xfb_info.h"
@ -44,6 +45,17 @@ ac_nir_unpack_arg(nir_builder *b, const struct ac_shader_args *ac_args, struct a
return nir_ubfe_imm(b, value, rshift, bitwidth);
}
void
ac_nir_export_primitive(nir_builder *b, nir_ssa_def *prim)
{
unsigned write_mask = BITFIELD_MASK(prim->num_components);
nir_export_amd(b, nir_pad_vec4(b, prim),
.base = V_008DFC_SQ_EXP_PRIM,
.flags = AC_EXP_FLAG_DONE,
.write_mask = write_mask);
}
/**
* This function takes an I/O intrinsic like load/store_input,
* and emits a sequence that calculates the full offset of that instruction,

View file

@ -73,6 +73,9 @@ nir_ssa_def *
ac_nir_unpack_arg(nir_builder *b, const struct ac_shader_args *ac_args, struct ac_arg arg,
unsigned rshift, unsigned bitwidth);
void
ac_nir_export_primitive(nir_builder *b, nir_ssa_def *prim);
nir_ssa_def *
ac_nir_calc_io_offset(nir_builder *b,
nir_intrinsic_instr *intrin,

View file

@ -545,7 +545,7 @@ emit_ngg_nogs_prim_export(nir_builder *b, lower_ngg_nogs_state *st, nir_ssa_def
nir_pop_if(b, if_shader_query);
}
nir_export_primitive_amd(b, arg);
ac_nir_export_primitive(b, arg);
}
nir_pop_if(b, if_gs_thread);
}
@ -2840,7 +2840,7 @@ ngg_gs_export_primitives(nir_builder *b, nir_ssa_def *max_num_out_prims, nir_ssa
}
nir_ssa_def *arg = emit_pack_ngg_prim_exp_arg(b, s->num_vertices_per_primitive, vtx_indices, is_null_prim, false);
nir_export_primitive_amd(b, arg);
ac_nir_export_primitive(b, arg);
nir_pop_if(b, if_prim_export_thread);
}