radeonsi: enable NGG passthrough when LDS is used, document the real constraints

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12343>
This commit is contained in:
Marek Olšák
2021-09-01 03:43:34 -04:00
committed by Marge Bot
parent 70c975fd13
commit 7b4427b199
3 changed files with 11 additions and 9 deletions

View File

@@ -1339,7 +1339,7 @@ void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi)
LLVMValueRef is_es_thread = si_is_es_thread(ctx);
LLVMValueRef vtxindex[3];
if (ctx->shader->key.opt.ngg_culling) {
if (ctx->shader->key.opt.ngg_culling || gfx10_is_ngg_passthrough(ctx->shader)) {
for (unsigned i = 0; i < 3; ++i)
vtxindex[i] = si_unpack_param(ctx, ctx->args.gs_vtx_offset[0], 10 * i, 9);
} else {

View File

@@ -896,12 +896,8 @@ bool si_llvm_translate_nir(struct si_shader_context *ctx, struct si_shader *shad
/* Unconditionally declare scratch space base for streamout and
* vertex compaction. Whether space is actually allocated is
* determined during linking / PM4 creation.
*
* Add an extra dword per vertex to ensure an odd stride, which
* avoids bank conflicts for SoA accesses.
*/
if (!gfx10_is_ngg_passthrough(shader))
si_llvm_declare_esgs_ring(ctx);
si_llvm_declare_esgs_ring(ctx);
/* This is really only needed when streamout and / or vertex
* compaction is enabled.

View File

@@ -983,9 +983,15 @@ bool gfx10_is_ngg_passthrough(struct si_shader *shader)
if (sel->screen->use_ngg_culling)
return false;
return sel->info.stage != MESA_SHADER_GEOMETRY && !sel->so.num_outputs && !sel->info.writes_edgeflag &&
!shader->key.opt.ngg_culling &&
(sel->info.stage != MESA_SHADER_VERTEX || !shader->key.mono.u.vs_export_prim_id);
/* The definition of NGG passthrough is:
* - user GS is turned off (no amplification, no GS instancing, and no culling)
* - VGT_ESGS_RING_ITEMSIZE is ignored (behaving as if it was equal to 1)
* - vertex indices are packed into 1 VGPR
* - Dimgrey and later chips can optionally skip the gs_alloc_req message
*
* NGG passthrough still allows the use of LDS.
*/
return sel->info.stage != MESA_SHADER_GEOMETRY && !shader->key.opt.ngg_culling;
}
/* Common tail code for NGG primitive shaders. */