/* Depth buffer compression and fast clear. */
struct r600_resource *htile_buffer;
+ bool depth_cleared; /* if it was cleared at least once */
float depth_clear_value;
bool non_disp_tiling; /* R600-Cayman only */
zsbuf->u.tex.level == 0 &&
zsbuf->u.tex.first_layer == 0 &&
zsbuf->u.tex.last_layer == util_max_layer(&zstex->resource.b.b, 0)) {
+ /* Need to disable EXPCLEAR temporarily if clearing
+ * to a new value. */
+ if (zstex->depth_cleared && zstex->depth_clear_value != depth) {
+ sctx->db_depth_disable_expclear = true;
+ }
+
zstex->depth_clear_value = depth;
sctx->framebuffer.atom.dirty = true; /* updates DB_DEPTH_CLEAR */
sctx->db_depth_clear = true;
buffers, color, depth, stencil);
si_blitter_end(ctx);
- sctx->db_depth_clear = false;
+ if (sctx->db_depth_clear) {
+ sctx->db_depth_clear = false;
+ sctx->db_depth_disable_expclear = false;
+ zstex->depth_cleared = true;
+ }
}
static void si_clear_render_target(struct pipe_context *ctx,
unsigned dbcb_copy_sample;
bool db_inplace_flush_enabled;
bool db_depth_clear;
+ bool db_depth_disable_expclear;
};
/* si_blit.c */
/* HiZ aka depth buffer htile */
/* use htile only for first level */
if (rtex->htile_buffer && !level) {
- z_info |= S_028040_TILE_SURFACE_ENABLE(1);
+ z_info |= S_028040_TILE_SURFACE_ENABLE(1) |
+ S_028040_ALLOW_EXPCLEAR(1);
/* This is optimal for the clear value of 1.0 and using
* the LESS and LEQUAL test functions. Set this to 0
si_pm4_set_reg(pm4, R_028000_DB_RENDER_CONTROL, 0);
}
+ /* DB_RENDER_OVERRIDE2 */
+ if (sctx->db_depth_disable_expclear) {
+ si_pm4_set_reg(pm4, R_028010_DB_RENDER_OVERRIDE2,
+ S_028010_DISABLE_ZMASK_EXPCLEAR_OPTIMIZATION(1));
+ } else {
+ si_pm4_set_reg(pm4, R_028010_DB_RENDER_OVERRIDE2, 0);
+ }
+
if (info->count_from_stream_output) {
struct r600_so_target *t =
(struct r600_so_target*)info->count_from_stream_output;