Mesa (master): r600g: flush differences back to DB copy.

Dave Airlie airlied at kemper.freedesktop.org
Thu Feb 3 04:17:30 UTC 2011


Module: Mesa
Branch: master
Commit: aa31a5cbc7b52eb1d03c6eab414479249830eabf
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=aa31a5cbc7b52eb1d03c6eab414479249830eabf

Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Feb  3 13:43:37 2011 +1000

r600g: flush differences back to DB copy.

---

 src/gallium/drivers/r600/r600_blit.c    |   20 ++++++++++++++++++++
 src/gallium/drivers/r600/r600_pipe.h    |    1 +
 src/gallium/drivers/r600/r600_texture.c |    8 ++++++++
 3 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c
index c200dd7..bf21ab4 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -219,3 +219,23 @@ void r600_init_blit_functions(struct r600_pipe_context *rctx)
 	rctx->context.clear_depth_stencil = r600_clear_depth_stencil;
 	rctx->context.resource_copy_region = r600_resource_copy_region;
 }
+
+void r600_blit_push_depth(struct pipe_context *ctx, struct r600_resource_texture *texture)
+{
+	struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+	struct pipe_surface *zsurf, *cbsurf, surf_tmpl;
+	int level = 0;
+	float depth = 1.0f;
+	struct pipe_box sbox;
+
+	sbox.x = sbox.y = sbox.z = 0;
+	sbox.width = texture->resource.base.b.width0;
+	sbox.height = texture->resource.base.b.height0;
+	/* XXX that might be wrong */
+	sbox.depth = 1;
+
+	r600_hw_copy_region(ctx, (struct pipe_resource *)texture, 0,
+			    0, 0, 0,
+			    (struct pipe_resource *)texture->flushed_depth_texture, 0,
+			    &sbox);
+}
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index beb4db1..0d31780 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -198,6 +198,7 @@ void evergreen_pipe_add_vertex_attrib(struct r600_pipe_context *rctx,
 /* r600_blit.c */
 void r600_init_blit_functions(struct r600_pipe_context *rctx);
 void r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture);
+void r600_blit_push_depth(struct pipe_context *ctx, struct r600_resource_texture *texture);
 void r600_flush_depth_textures(struct r600_pipe_context *rctx);
 
 /* r600_buffer.c */
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index c773c4b..eac4096 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -630,6 +630,8 @@ void r600_texture_transfer_destroy(struct pipe_context *ctx,
 				   struct pipe_transfer *transfer)
 {
 	struct r600_transfer *rtransfer = (struct r600_transfer*)transfer;
+	struct pipe_resource *texture = transfer->resource;
+	struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture;
 
 	if (rtransfer->staging_texture) {
 		if (transfer->usage & PIPE_TRANSFER_WRITE) {
@@ -637,6 +639,12 @@ void r600_texture_transfer_destroy(struct pipe_context *ctx,
 		}
 		pipe_resource_reference(&rtransfer->staging_texture, NULL);
 	}
+
+	if (rtex->depth && !rtex->is_flushing_texture) {
+		if ((transfer->usage & PIPE_TRANSFER_WRITE) && rtex->flushed_depth_texture)
+			r600_blit_push_depth(ctx, rtex);
+	}
+
 	pipe_resource_reference(&transfer->resource, NULL);
 	FREE(transfer);
 }




More information about the mesa-commit mailing list