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;
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)
if (!tex->depth)
continue;
- if (tex->tile_type == 0)
- continue;
-
r600_blit_uncompress_depth(&rctx->context, tex);
}
}
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
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;
}
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 */
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);
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:
*/
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