From 2c0eb09e391e4998443316b2b35d53cfaad45c5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 13 Jun 2025 14:10:00 -0400 Subject: [PATCH] radeonsi: simplify old_vs & old_ps checking in si_update_shaders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Pierre-Eric Pelloux-Prayer Acked-by: Timur Kristóf Part-of: --- .../drivers/radeonsi/si_state_draw.cpp | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp b/src/gallium/drivers/radeonsi/si_state_draw.cpp index 89154efefa3..029a1ca601f 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.cpp +++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp @@ -53,12 +53,7 @@ static bool si_update_shaders(struct si_context *sctx) struct pipe_context *ctx = (struct pipe_context *)sctx; struct si_shader *old_vs = si_get_vs_inline(sctx, HAS_TESS, HAS_GS)->current; - unsigned old_pa_cl_vs_out_cntl = old_vs ? old_vs->pa_cl_vs_out_cntl : 0; - bool old_uses_gs_state_provoking_vertex = old_vs ? old_vs->info.uses_gs_state_provoking_vtx_first : false; - bool old_uses_gs_state_outprim = old_vs ? old_vs->info.uses_gs_state_outprim : false; struct si_shader *old_ps = sctx->shader.ps.current; - unsigned old_spi_shader_col_format = - old_ps ? old_ps->key.ps.part.epilog.spi_shader_col_format : 0; int r; /* Update TCS and TES. */ @@ -264,15 +259,16 @@ static bool si_update_shaders(struct si_context *sctx) sctx->dirty_atoms |= SI_STATE_BIT(rasterizer); } - if (old_pa_cl_vs_out_cntl != hw_vs->pa_cl_vs_out_cntl || - (!old_vs || - old_vs->info.clipdist_mask != hw_vs->info.clipdist_mask || - old_vs->info.culldist_mask != hw_vs->info.culldist_mask)) + if (!old_vs || + old_vs->pa_cl_vs_out_cntl != hw_vs->pa_cl_vs_out_cntl || + old_vs->info.clipdist_mask != hw_vs->info.clipdist_mask || + old_vs->info.culldist_mask != hw_vs->info.culldist_mask) si_mark_atom_dirty(sctx, &sctx->atoms.s.clip_regs); /* If we start to use any of these, we need to update the SGPR. */ - if ((hw_vs->info.uses_gs_state_provoking_vtx_first && !old_uses_gs_state_provoking_vertex) || - (hw_vs->info.uses_gs_state_outprim && !old_uses_gs_state_outprim)) { + if (!old_vs || + old_vs->info.uses_gs_state_provoking_vtx_first != hw_vs->info.uses_gs_state_provoking_vtx_first || + old_vs->info.uses_gs_state_outprim != hw_vs->info.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); } @@ -309,8 +305,9 @@ static bool si_update_shaders(struct si_context *sctx) if (is_ps_state_changed) { if ((GFX_VERSION >= GFX10_3 || (GFX_VERSION >= GFX9 && sctx->screen->info.rbplus_allowed)) && si_pm4_state_changed(sctx, ps) && - (!old_ps || old_spi_shader_col_format != - sctx->shader.ps.current->key.ps.part.epilog.spi_shader_col_format)) + (!old_ps || + old_ps->key.ps.part.epilog.spi_shader_col_format != + sctx->shader.ps.current->key.ps.part.epilog.spi_shader_col_format)) si_mark_atom_dirty(sctx, &sctx->atoms.s.cb_render_state); if (sctx->smoothing_enabled !=