diff options
author | Dave Airlie <[email protected]> | 2011-02-03 13:12:35 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2011-02-03 14:17:05 +1000 |
commit | b13b7b86b2e1165b24a2df20cb67f9f3baa17b13 (patch) | |
tree | e984009ca1abccc8643dff5623d885cb443bc85b /src/gallium/drivers/r600 | |
parent | d0293290ad620084d490b51693d97731a8935094 (diff) |
r600g: rework dirty / depth texture tracking.
this adds a flag to keep track of whether the depth texture structure
is the flushed texture or not, so we can avoid doing flushes when
we do a hw rendering from one to the other.
it also renames flushed to dirty_db which tracks if the DB copy
has been dirtied by being bound to the hw.
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r-- | src/gallium/drivers/r600/r600_blit.c | 9 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_resource.h | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state_common.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_texture.c | 3 |
5 files changed, 10 insertions, 12 deletions
diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index a8e85df3c48..ca032811048 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -85,7 +85,8 @@ void r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_t int level = 0; float depth = 1.0f; - if (texture->flushed) return; + if (!texture->dirty_db) + return; surf_tmpl.format = texture->resource.base.b.format; surf_tmpl.u.tex.level = level; @@ -107,10 +108,11 @@ void r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_t r600_blitter_begin(ctx, R600_CLEAR_SURFACE); util_blitter_custom_depth_stencil(rctx->blitter, zsurf, cbsurf, rctx->custom_dsa_flush, depth); r600_blitter_end(ctx); - texture->flushed = true; pipe_surface_reference(&zsurf, NULL); pipe_surface_reference(&cbsurf, NULL); + + texture->dirty_db = FALSE; } void r600_flush_depth_textures(struct r600_pipe_context *rctx) @@ -132,9 +134,6 @@ void r600_flush_depth_textures(struct r600_pipe_context *rctx) if (!tex->depth) continue; - if (tex->tile_type == 0) - continue; - r600_blit_uncompress_depth(&rctx->context, tex); } } diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index 5b5df5a5bac..8d34b864f82 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -61,9 +61,9 @@ struct r600_resource_texture { unsigned tiled; unsigned tile_type; unsigned depth; - unsigned dirty; + unsigned dirty_db; struct r600_resource_texture *flushed_depth_texture; - bool flushed; + boolean is_flushing_texture; }; #define R600_BUFFER_MAGIC 0xabcd1600 diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 6adbbd9eabe..354d38ec234 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -429,7 +429,7 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c R600_ERR("unknow format %d\n", state->format); } tmp = (struct r600_resource_texture *)texture; - if (tmp->depth && tmp->tile_type == 1) { + if (tmp->depth && !tmp->is_flushing_texture) { r600_texture_depth_flush(ctx, texture); tmp = tmp->flushed_depth_texture; } @@ -760,8 +760,6 @@ static void r600_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta surf = (struct r600_surface *)state->zsbuf; rtex = (struct r600_resource_texture*)state->zsbuf->texture; - rtex->tile_type = 1; - rbuffer = &rtex->resource; /* XXX quite sure for dx10+ hw don't need any offset hacks */ diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index d82985e1b1f..3b037f8c8c2 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -602,7 +602,7 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) if (rctx->framebuffer.zsbuf) { struct pipe_resource *tex = rctx->framebuffer.zsbuf->texture; - ((struct r600_resource_texture *)tex)->flushed = false; + ((struct r600_resource_texture *)tex)->dirty_db = TRUE; } pipe_resource_reference(&draw.index_buffer, NULL); diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 14422bbfe41..7b38337eda5 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -513,6 +513,7 @@ int r600_texture_depth_flush(struct pipe_context *ctx, return -ENOMEM; } + ((struct r600_resource_texture *)rtex->flushed_depth_texture)->is_flushing_texture = TRUE; out: /* XXX: only do this if the depth texture has actually changed: */ @@ -574,7 +575,7 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx, trans->transfer.level = level; trans->transfer.usage = usage; trans->transfer.box = *box; - if (rtex->depth && rtex->tile_type == 1) { + if (rtex->depth) { /* XXX: only readback the rectangle which is being mapped? */ /* XXX: when discard is true, no need to read back from depth texture |