radeonsi: split si_update_ngg_prim_state_sgpr into 2 functions

GS_STATE_PROVOKING_VTX_FIRST no longer depends on the primitive type,
so we don't have to call it in si_set_rasterized_prim anymore.

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26917>
This commit is contained in:
Marek Olšák 2023-12-31 00:43:06 -05:00 committed by Marge Bot
parent b3326bb947
commit 8eed352e05
4 changed files with 14 additions and 12 deletions

View file

@ -2152,19 +2152,19 @@ static inline void si_set_clip_discard_distance(struct si_context *sctx, float d
* It's expected that hw_vs and ngg are inline constants in draw_vbo after optimizations.
*/
static inline void
si_update_ngg_prim_state_sgpr(struct si_context *sctx, struct si_shader *hw_vs, bool ngg)
si_update_ngg_sgpr_state_provoking_vtx(struct si_context *sctx, struct si_shader *hw_vs, bool ngg)
{
if (!ngg || !hw_vs)
return;
if (hw_vs->uses_vs_state_provoking_vertex) {
if (ngg && hw_vs && hw_vs->uses_vs_state_provoking_vertex) {
SET_FIELD(sctx->current_gs_state, GS_STATE_PROVOKING_VTX_FIRST,
sctx->queued.named.rasterizer->flatshade_first);
}
}
if (hw_vs->uses_gs_state_outprim) {
static inline void
si_update_ngg_sgpr_state_out_prim(struct si_context *sctx, struct si_shader *hw_vs, bool ngg)
{
if (ngg && hw_vs && hw_vs->uses_gs_state_outprim)
SET_FIELD(sctx->current_gs_state, GS_STATE_OUTPRIM, sctx->gs_out_prim);
}
}
/* Set the primitive type seen by the rasterizer. GS and tessellation affect this.
@ -2195,7 +2195,7 @@ si_set_rasterized_prim(struct si_context *sctx, enum mesa_prim rast_prim,
sctx->current_rast_prim = rast_prim;
si_vs_ps_key_update_rast_prim_smooth_stipple(sctx);
si_update_ngg_prim_state_sgpr(sctx, hw_vs, ngg);
si_update_ngg_sgpr_state_out_prim(sctx, hw_vs, ngg);
}
}

View file

@ -1330,7 +1330,7 @@ static void si_bind_rs_state(struct pipe_context *ctx, void *state)
si_update_vrs_flat_shading(sctx);
if (old_rs->flatshade_first != rs->flatshade_first)
si_update_ngg_prim_state_sgpr(sctx, si_get_vs(sctx)->current, sctx->ngg);
si_update_ngg_sgpr_state_provoking_vtx(sctx, si_get_vs(sctx)->current, sctx->ngg);
}
static void si_delete_rs_state(struct pipe_context *ctx, void *state)

View file

@ -247,8 +247,10 @@ static bool si_update_shaders(struct si_context *sctx)
/* If we start to use any of these, we need to update the SGPR. */
if ((hw_vs->uses_vs_state_provoking_vertex && !old_uses_vs_state_provoking_vertex) ||
(hw_vs->uses_gs_state_outprim && !old_uses_gs_state_outprim))
si_update_ngg_prim_state_sgpr(sctx, hw_vs, NGG);
(hw_vs->uses_gs_state_outprim && !old_uses_gs_state_outprim)) {
si_update_ngg_sgpr_state_out_prim(sctx, hw_vs, NGG);
si_update_ngg_sgpr_state_provoking_vtx(sctx, hw_vs, NGG);
}
r = si_shader_select(ctx, &sctx->shader.ps);
if (r)

View file

@ -3484,7 +3484,7 @@ static void si_update_rasterized_prim(struct si_context *sctx)
}
/* This must be done unconditionally because it also depends on si_shader fields. */
si_update_ngg_prim_state_sgpr(sctx, hw_vs, sctx->ngg);
si_update_ngg_sgpr_state_out_prim(sctx, hw_vs, sctx->ngg);
}
static void si_update_common_shader_state(struct si_context *sctx, struct si_shader_selector *sel,