diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c index 35a9fd0114b..ee249d94228 100644 --- a/src/gallium/drivers/radeonsi/si_compute.c +++ b/src/gallium/drivers/radeonsi/si_compute.c @@ -1186,20 +1186,24 @@ static void si_launch_grid(struct pipe_context *ctx, const struct pipe_grid_info si_check_dirty_buffers_textures(sctx); if (sctx->has_graphics) { - if (sctx->last_num_draw_calls != sctx->num_draw_calls) { + if (sctx->num_draw_calls_sh_coherent.with_cb != sctx->num_draw_calls || + sctx->num_draw_calls_sh_coherent.with_db != sctx->num_draw_calls) { si_update_fb_dirtiness_after_rendering(sctx); - sctx->last_num_draw_calls = sctx->num_draw_calls; if (sctx->force_shader_coherency.with_cb || - si_check_needs_implicit_sync(sctx, RADEON_USAGE_CB_NEEDS_IMPLICIT_SYNC)) + si_check_needs_implicit_sync(sctx, RADEON_USAGE_CB_NEEDS_IMPLICIT_SYNC)) { + sctx->num_draw_calls_sh_coherent.with_cb = sctx->num_draw_calls; si_make_CB_shader_coherent(sctx, 0, sctx->framebuffer.CB_has_shader_readable_metadata, sctx->framebuffer.all_DCC_pipe_aligned); + } - if (sctx->gfx_level == GFX12 && - (sctx->force_shader_coherency.with_db || - si_check_needs_implicit_sync(sctx, RADEON_USAGE_DB_NEEDS_IMPLICIT_SYNC))) - si_make_DB_shader_coherent(sctx, 0, false, false); + if (sctx->gfx_level == GFX12 && + (sctx->force_shader_coherency.with_db || + si_check_needs_implicit_sync(sctx, RADEON_USAGE_DB_NEEDS_IMPLICIT_SYNC))) { + sctx->num_draw_calls_sh_coherent.with_db = sctx->num_draw_calls; + si_make_DB_shader_coherent(sctx, 0, false, false); + } } if (sctx->gfx_level < GFX11) diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index abcc6236f6e..c07ba4276e1 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -1020,7 +1020,10 @@ struct si_context { unsigned last_dirty_tex_counter; unsigned last_dirty_buf_counter; unsigned last_compressed_colortex_counter; - unsigned last_num_draw_calls; + struct { + unsigned with_cb; + unsigned with_db; + } num_draw_calls_sh_coherent; unsigned flags; /* flush flags */ /* Atoms (state emit functions). */