radeonsi: check last_dirty_buf_counter and dirty_tex_counter
Check both counters in draw and compute, otherwise compute dispatches may miss buffers invalidation. This fixes the test case from https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/702 (both with and without GALLIUM_THREAD=0). cc: mesa-stable Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17394>
This commit is contained in:
parent
da9feae735
commit
af7c2ff842
|
@ -948,6 +948,8 @@ static void si_launch_grid(struct pipe_context *ctx, const struct pipe_grid_info
|
|||
if (program->ir_type != PIPE_SHADER_IR_NATIVE && program->shader.compilation_failed)
|
||||
return;
|
||||
|
||||
si_check_dirty_buffers_textures(sctx);
|
||||
|
||||
if (sctx->has_graphics) {
|
||||
if (sctx->last_num_draw_calls != sctx->num_draw_calls) {
|
||||
si_update_fb_dirtiness_after_rendering(sctx);
|
||||
|
|
|
@ -2065,6 +2065,28 @@ static inline unsigned si_num_vbos_in_user_sgprs(struct si_screen *sscreen)
|
|||
return si_num_vbos_in_user_sgprs_inline(sscreen->info.gfx_level);
|
||||
}
|
||||
|
||||
static inline
|
||||
void si_check_dirty_buffers_textures(struct si_context *sctx)
|
||||
{
|
||||
/* Recompute and re-emit the texture resource states if needed. */
|
||||
unsigned dirty_tex_counter = p_atomic_read(&sctx->screen->dirty_tex_counter);
|
||||
if (unlikely(dirty_tex_counter != sctx->last_dirty_tex_counter)) {
|
||||
sctx->last_dirty_tex_counter = dirty_tex_counter;
|
||||
sctx->framebuffer.dirty_cbufs |= ((1 << sctx->framebuffer.state.nr_cbufs) - 1);
|
||||
sctx->framebuffer.dirty_zsbuf = true;
|
||||
si_mark_atom_dirty(sctx, &sctx->atoms.s.framebuffer);
|
||||
si_update_all_texture_descriptors(sctx);
|
||||
}
|
||||
|
||||
unsigned dirty_buf_counter = p_atomic_read(&sctx->screen->dirty_buf_counter);
|
||||
if (unlikely(dirty_buf_counter != sctx->last_dirty_buf_counter)) {
|
||||
sctx->last_dirty_buf_counter = dirty_buf_counter;
|
||||
/* Rebind all buffers unconditionally. */
|
||||
si_rebind_buffer(sctx, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define PRINT_ERR(fmt, args...) \
|
||||
fprintf(stderr, "EE %s:%d %s - " fmt, __FILE__, __LINE__, __func__, ##args)
|
||||
|
||||
|
|
|
@ -2179,22 +2179,7 @@ static void si_draw(struct pipe_context *ctx,
|
|||
*/
|
||||
struct si_context *sctx = (struct si_context *)ctx;
|
||||
|
||||
/* Recompute and re-emit the texture resource states if needed. */
|
||||
unsigned dirty_tex_counter = p_atomic_read(&sctx->screen->dirty_tex_counter);
|
||||
if (unlikely(dirty_tex_counter != sctx->last_dirty_tex_counter)) {
|
||||
sctx->last_dirty_tex_counter = dirty_tex_counter;
|
||||
sctx->framebuffer.dirty_cbufs |= ((1 << sctx->framebuffer.state.nr_cbufs) - 1);
|
||||
sctx->framebuffer.dirty_zsbuf = true;
|
||||
si_mark_atom_dirty(sctx, &sctx->atoms.s.framebuffer);
|
||||
si_update_all_texture_descriptors(sctx);
|
||||
}
|
||||
|
||||
unsigned dirty_buf_counter = p_atomic_read(&sctx->screen->dirty_buf_counter);
|
||||
if (unlikely(dirty_buf_counter != sctx->last_dirty_buf_counter)) {
|
||||
sctx->last_dirty_buf_counter = dirty_buf_counter;
|
||||
/* Rebind all buffers unconditionally. */
|
||||
si_rebind_buffer(sctx, NULL);
|
||||
}
|
||||
si_check_dirty_buffers_textures(sctx);
|
||||
|
||||
si_decompress_textures(sctx, u_bit_consecutive(0, SI_NUM_GRAPHICS_SHADERS));
|
||||
si_need_gfx_cs_space(sctx, num_draws);
|
||||
|
|
Loading…
Reference in New Issue