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 <airlied@redhat.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user