summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_blit.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2014-08-23 03:39:08 +0200
committerMarek Olšák <[email protected]>2014-09-01 21:18:51 +0200
commit573313c94e6925598edb5769885fb973cf628e11 (patch)
treee9c0c1a8f05366698799f2f7307e3a4988501361 /src/gallium/drivers/radeonsi/si_blit.c
parent63cb4077e6e7ad761f4aade0095d05d7c06f9f6f (diff)
radeonsi: implement fast depth clear
Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_blit.c')
-rw-r--r--src/gallium/drivers/radeonsi/si_blit.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c
index 87c8fa9c634..4e77d74a79f 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -328,6 +328,9 @@ static void si_clear(struct pipe_context *ctx, unsigned buffers,
{
struct si_context *sctx = (struct si_context *)ctx;
struct pipe_framebuffer_state *fb = &sctx->framebuffer.state;
+ struct pipe_surface *zsbuf = fb->zsbuf;
+ struct r600_texture *zstex =
+ zsbuf ? (struct r600_texture*)zsbuf->texture : NULL;
if (buffers & PIPE_CLEAR_COLOR) {
evergreen_do_fast_color_clear(&sctx->b, fb, &sctx->framebuffer.atom,
@@ -354,11 +357,23 @@ static void si_clear(struct pipe_context *ctx, unsigned buffers,
}
}
+ if (buffers & PIPE_CLEAR_DEPTH &&
+ zstex && zstex->htile_buffer &&
+ zsbuf->u.tex.level == 0 &&
+ zsbuf->u.tex.first_layer == 0 &&
+ zsbuf->u.tex.last_layer == util_max_layer(&zstex->resource.b.b, 0)) {
+ zstex->depth_clear_value = depth;
+ sctx->framebuffer.atom.dirty = true; /* updates DB_DEPTH_CLEAR */
+ sctx->db_depth_clear = true;
+ }
+
si_blitter_begin(ctx, SI_CLEAR);
util_blitter_clear(sctx->blitter, fb->width, fb->height,
util_framebuffer_get_num_layers(fb),
buffers, color, depth, stencil);
si_blitter_end(ctx);
+
+ sctx->db_depth_clear = false;
}
static void si_clear_render_target(struct pipe_context *ctx,