mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-08 02:00:21 +01:00
radeonsi: add _once suffix to depth_cleared_level_mask
And add a new variable to disambiguate between "has been cleared once" and "is cleared". Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10979>
This commit is contained in:
parent
eb0fa78b68
commit
ff8a930cf7
4 changed files with 18 additions and 9 deletions
|
|
@ -799,7 +799,7 @@ static void si_fast_clear(struct si_context *sctx, unsigned *buffers,
|
||||||
/* Z-only clear. */
|
/* Z-only clear. */
|
||||||
clear_value = si_get_htile_clear_value(zstex, depth);
|
clear_value = si_get_htile_clear_value(zstex, depth);
|
||||||
*buffers &= ~PIPE_CLEAR_DEPTH;
|
*buffers &= ~PIPE_CLEAR_DEPTH;
|
||||||
zstex->depth_cleared_level_mask |= BITFIELD_BIT(level);
|
zstex->depth_cleared_level_mask_once |= BITFIELD_BIT(level);
|
||||||
update_db_depth_clear = true;
|
update_db_depth_clear = true;
|
||||||
}
|
}
|
||||||
} else if ((*buffers & PIPE_BIND_DEPTH_STENCIL) == PIPE_BIND_DEPTH_STENCIL) {
|
} else if ((*buffers & PIPE_BIND_DEPTH_STENCIL) == PIPE_BIND_DEPTH_STENCIL) {
|
||||||
|
|
@ -808,7 +808,7 @@ static void si_fast_clear(struct si_context *sctx, unsigned *buffers,
|
||||||
/* Combined Z+S clear. */
|
/* Combined Z+S clear. */
|
||||||
clear_value = si_get_htile_clear_value(zstex, depth);
|
clear_value = si_get_htile_clear_value(zstex, depth);
|
||||||
*buffers &= ~PIPE_CLEAR_DEPTHSTENCIL;
|
*buffers &= ~PIPE_CLEAR_DEPTHSTENCIL;
|
||||||
zstex->depth_cleared_level_mask |= BITFIELD_BIT(level);
|
zstex->depth_cleared_level_mask_once |= BITFIELD_BIT(level);
|
||||||
zstex->stencil_cleared_level_mask |= BITFIELD_BIT(level);
|
zstex->stencil_cleared_level_mask |= BITFIELD_BIT(level);
|
||||||
update_db_depth_clear = true;
|
update_db_depth_clear = true;
|
||||||
update_db_stencil_clear = true;
|
update_db_stencil_clear = true;
|
||||||
|
|
@ -872,7 +872,7 @@ static void si_fast_clear(struct si_context *sctx, unsigned *buffers,
|
||||||
htile_size, si_get_htile_clear_value(zstex, depth));
|
htile_size, si_get_htile_clear_value(zstex, depth));
|
||||||
clear_types |= SI_CLEAR_TYPE_HTILE;
|
clear_types |= SI_CLEAR_TYPE_HTILE;
|
||||||
*buffers &= ~PIPE_CLEAR_DEPTH;
|
*buffers &= ~PIPE_CLEAR_DEPTH;
|
||||||
zstex->depth_cleared_level_mask |= BITFIELD_BIT(level);
|
zstex->depth_cleared_level_mask_once |= BITFIELD_BIT(level);
|
||||||
update_db_depth_clear = true;
|
update_db_depth_clear = true;
|
||||||
}
|
}
|
||||||
} else if ((*buffers & PIPE_BIND_DEPTH_STENCIL) == PIPE_BIND_DEPTH_STENCIL) {
|
} else if ((*buffers & PIPE_BIND_DEPTH_STENCIL) == PIPE_BIND_DEPTH_STENCIL) {
|
||||||
|
|
@ -885,7 +885,7 @@ static void si_fast_clear(struct si_context *sctx, unsigned *buffers,
|
||||||
htile_size, si_get_htile_clear_value(zstex, depth));
|
htile_size, si_get_htile_clear_value(zstex, depth));
|
||||||
clear_types |= SI_CLEAR_TYPE_HTILE;
|
clear_types |= SI_CLEAR_TYPE_HTILE;
|
||||||
*buffers &= ~PIPE_CLEAR_DEPTHSTENCIL;
|
*buffers &= ~PIPE_CLEAR_DEPTHSTENCIL;
|
||||||
zstex->depth_cleared_level_mask |= BITFIELD_BIT(level);
|
zstex->depth_cleared_level_mask_once |= BITFIELD_BIT(level);
|
||||||
zstex->stencil_cleared_level_mask |= BITFIELD_BIT(level);
|
zstex->stencil_cleared_level_mask |= BITFIELD_BIT(level);
|
||||||
update_db_depth_clear = true;
|
update_db_depth_clear = true;
|
||||||
update_db_stencil_clear = true;
|
update_db_stencil_clear = true;
|
||||||
|
|
@ -910,7 +910,7 @@ static void si_fast_clear(struct si_context *sctx, unsigned *buffers,
|
||||||
htile_depth_writemask);
|
htile_depth_writemask);
|
||||||
clear_types |= SI_CLEAR_TYPE_HTILE;
|
clear_types |= SI_CLEAR_TYPE_HTILE;
|
||||||
*buffers &= ~PIPE_CLEAR_DEPTH;
|
*buffers &= ~PIPE_CLEAR_DEPTH;
|
||||||
zstex->depth_cleared_level_mask |= BITFIELD_BIT(level);
|
zstex->depth_cleared_level_mask_once |= BITFIELD_BIT(level);
|
||||||
update_db_depth_clear = true;
|
update_db_depth_clear = true;
|
||||||
} else if (htile_size &&
|
} else if (htile_size &&
|
||||||
!(*buffers & PIPE_CLEAR_DEPTH) &&
|
!(*buffers & PIPE_CLEAR_DEPTH) &&
|
||||||
|
|
@ -968,6 +968,9 @@ static void si_clear(struct pipe_context *ctx, unsigned buffers,
|
||||||
else if (!util_format_has_stencil(util_format_description(zsbuf->format)))
|
else if (!util_format_has_stencil(util_format_description(zsbuf->format)))
|
||||||
buffers &= ~PIPE_CLEAR_STENCIL;
|
buffers &= ~PIPE_CLEAR_STENCIL;
|
||||||
|
|
||||||
|
if (buffers & PIPE_CLEAR_DEPTH)
|
||||||
|
zstex->depth_cleared_level_mask |= BITFIELD_BIT(zsbuf->u.tex.level);
|
||||||
|
|
||||||
si_fast_clear(sctx, &buffers, color, depth, stencil);
|
si_fast_clear(sctx, &buffers, color, depth, stencil);
|
||||||
if (!buffers)
|
if (!buffers)
|
||||||
return; /* all buffers have been cleared */
|
return; /* all buffers have been cleared */
|
||||||
|
|
@ -990,7 +993,7 @@ static void si_clear(struct pipe_context *ctx, unsigned buffers,
|
||||||
if (si_can_fast_clear_depth(zstex, level, depth, buffers)) {
|
if (si_can_fast_clear_depth(zstex, level, depth, buffers)) {
|
||||||
/* Need to disable EXPCLEAR temporarily if clearing
|
/* Need to disable EXPCLEAR temporarily if clearing
|
||||||
* to a new value. */
|
* to a new value. */
|
||||||
if (!(zstex->depth_cleared_level_mask & BITFIELD_BIT(level)) ||
|
if (!(zstex->depth_cleared_level_mask_once & BITFIELD_BIT(level)) ||
|
||||||
zstex->depth_clear_value[level] != depth) {
|
zstex->depth_clear_value[level] != depth) {
|
||||||
sctx->db_depth_disable_expclear = true;
|
sctx->db_depth_disable_expclear = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1049,7 +1052,7 @@ static void si_clear(struct pipe_context *ctx, unsigned buffers,
|
||||||
if (sctx->db_depth_clear) {
|
if (sctx->db_depth_clear) {
|
||||||
sctx->db_depth_clear = false;
|
sctx->db_depth_clear = false;
|
||||||
sctx->db_depth_disable_expclear = false;
|
sctx->db_depth_disable_expclear = false;
|
||||||
zstex->depth_cleared_level_mask |= BITFIELD_BIT(zsbuf->u.tex.level);
|
zstex->depth_cleared_level_mask_once |= BITFIELD_BIT(zsbuf->u.tex.level);
|
||||||
si_mark_atom_dirty(sctx, &sctx->atoms.s.db_render_state);
|
si_mark_atom_dirty(sctx, &sctx->atoms.s.db_render_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -366,7 +366,8 @@ struct si_texture {
|
||||||
/* Depth buffer compression and fast clear. */
|
/* Depth buffer compression and fast clear. */
|
||||||
float depth_clear_value[RADEON_SURF_MAX_LEVELS];
|
float depth_clear_value[RADEON_SURF_MAX_LEVELS];
|
||||||
uint8_t stencil_clear_value[RADEON_SURF_MAX_LEVELS];
|
uint8_t stencil_clear_value[RADEON_SURF_MAX_LEVELS];
|
||||||
uint16_t depth_cleared_level_mask; /* if it was cleared at least once */
|
uint16_t depth_cleared_level_mask_once; /* if it was cleared at least once */
|
||||||
|
uint16_t depth_cleared_level_mask; /* track if it was cleared (not 100% accurate) */
|
||||||
uint16_t stencil_cleared_level_mask; /* if it was cleared at least once */
|
uint16_t stencil_cleared_level_mask; /* if it was cleared at least once */
|
||||||
uint16_t dirty_level_mask; /* each bit says if that mipmap is compressed */
|
uint16_t dirty_level_mask; /* each bit says if that mipmap is compressed */
|
||||||
uint16_t stencil_dirty_level_mask; /* each bit says if that mipmap is compressed */
|
uint16_t stencil_dirty_level_mask; /* each bit says if that mipmap is compressed */
|
||||||
|
|
|
||||||
|
|
@ -2280,6 +2280,11 @@ static void si_draw_vbo(struct pipe_context *ctx,
|
||||||
sctx->num_prim_restart_calls++;
|
sctx->num_prim_restart_calls++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!sctx->blitter_running && sctx->framebuffer.state.zsbuf) {
|
||||||
|
struct si_texture *zstex = (struct si_texture *)sctx->framebuffer.state.zsbuf->texture;
|
||||||
|
zstex->depth_cleared_level_mask &= ~BITFIELD_BIT(sctx->framebuffer.state.zsbuf->u.tex.level);
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO: Set displayable_dcc_dirty if image stores are used. */
|
/* TODO: Set displayable_dcc_dirty if image stores are used. */
|
||||||
|
|
||||||
DRAW_CLEANUP;
|
DRAW_CLEANUP;
|
||||||
|
|
|
||||||
|
|
@ -482,7 +482,7 @@ static void si_reallocate_texture_inplace(struct si_context *sctx, struct si_tex
|
||||||
tex->db_render_format = new_tex->db_render_format;
|
tex->db_render_format = new_tex->db_render_format;
|
||||||
memcpy(tex->stencil_clear_value, new_tex->stencil_clear_value, sizeof(tex->stencil_clear_value));
|
memcpy(tex->stencil_clear_value, new_tex->stencil_clear_value, sizeof(tex->stencil_clear_value));
|
||||||
tex->tc_compatible_htile = new_tex->tc_compatible_htile;
|
tex->tc_compatible_htile = new_tex->tc_compatible_htile;
|
||||||
tex->depth_cleared_level_mask = new_tex->depth_cleared_level_mask;
|
tex->depth_cleared_level_mask_once = new_tex->depth_cleared_level_mask_once;
|
||||||
tex->stencil_cleared_level_mask = new_tex->stencil_cleared_level_mask;
|
tex->stencil_cleared_level_mask = new_tex->stencil_cleared_level_mask;
|
||||||
tex->upgraded_depth = new_tex->upgraded_depth;
|
tex->upgraded_depth = new_tex->upgraded_depth;
|
||||||
tex->db_compatible = new_tex->db_compatible;
|
tex->db_compatible = new_tex->db_compatible;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue