mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 02:20:11 +01:00
radeonsi: enable NGG culling for non-monolithic TES and GS
It doesn't enable back face culling and small line culling. Those can only be enabled for monolithic shaders. It only enables view culling and small triangle culling. Doing this has these minor advantages: 1. We can enable at least some culling immediately instead of when the first monolithic shader finishes compilation. 2. If back face culling and clip planes are disabled, we no longer compile monolithic TES and GS shader variants to get only view culling and small triangle culling. 3. shader-db will show culling code changes for TES and GS. Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32257>
This commit is contained in:
parent
d75df43b5f
commit
7e959864b2
2 changed files with 14 additions and 6 deletions
|
|
@ -1152,7 +1152,15 @@ static inline bool si_shader_uses_discard(struct si_shader *shader)
|
|||
|
||||
static inline bool si_shader_culling_enabled(struct si_shader *shader)
|
||||
{
|
||||
return !!shader->key.ge.opt.ngg_culling;
|
||||
if (shader->key.ge.opt.ngg_culling)
|
||||
return true;
|
||||
|
||||
unsigned output_prim = si_get_output_prim_simplified(shader->selector, &shader->key);
|
||||
|
||||
/* This enables NGG culling for non-monolithic TES and GS. */
|
||||
return shader->key.ge.as_ngg && !shader->key.ge.as_es &&
|
||||
shader->selector->ngg_cull_vert_threshold == 0 &&
|
||||
(output_prim == MESA_PRIM_TRIANGLES || output_prim == MESA_PRIM_LINES);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -2255,12 +2255,12 @@ static void si_draw(struct pipe_context *ctx,
|
|||
|
||||
if (util_prim_is_lines(sctx->current_rast_prim)) {
|
||||
/* Overwrite it to mask out face cull flags. */
|
||||
ngg_culling = rs->ngg_cull_flags_lines;
|
||||
ngg_culling |= SI_NGG_CULL_VS_LINES;
|
||||
ngg_culling = rs->ngg_cull_flags_lines |
|
||||
(!HAS_TESS && !HAS_GS ? SI_NGG_CULL_VS_LINES : 0);
|
||||
} else {
|
||||
ngg_culling = sctx->viewport0_y_inverted ? rs->ngg_cull_flags_tris_y_inverted :
|
||||
rs->ngg_cull_flags_tris;
|
||||
ngg_culling |= SI_NGG_CULL_VS_TRIANGLES;
|
||||
ngg_culling = (sctx->viewport0_y_inverted ? rs->ngg_cull_flags_tris_y_inverted :
|
||||
rs->ngg_cull_flags_tris) |
|
||||
(!HAS_TESS && !HAS_GS ? SI_NGG_CULL_VS_TRIANGLES : 0);
|
||||
}
|
||||
|
||||
if (ngg_culling != old_ngg_culling) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue