Mesa (master): radeonsi: Fix sampler views for depth textures.

Michel Dänzer daenzer at kemper.freedesktop.org
Wed Nov 28 12:53:41 UTC 2012


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

Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Tue Nov 20 17:33:19 2012 +0100

radeonsi: Fix sampler views for depth textures.

Consistently reference the flushed depth texture in the sampler view, not the
original one.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>

---

 src/gallium/drivers/radeonsi/radeonsi_pipe.h |    1 +
 src/gallium/drivers/radeonsi/si_state.c      |   10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.h b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
index 1bd8bfb..1ccf952 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.h
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
@@ -71,6 +71,7 @@ struct r600_screen {
 
 struct si_pipe_sampler_view {
 	struct pipe_sampler_view	base;
+	struct si_resource		*resource;
 	uint32_t			state[8];
 };
 
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 0683b67..0994861 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2086,8 +2086,11 @@ static struct pipe_sampler_view *si_create_sampler_view(struct pipe_context *ctx
 	if (tmp->depth && !tmp->is_flushing_texture) {
 		r600_texture_depth_flush(ctx, texture, TRUE);
 		tmp = tmp->flushed_depth_texture;
+		texture = &tmp->resource.b.b;
 	}
 
+	view->resource = &tmp->resource;
+
 	/* not supported any more */
 	//endian = si_colorformat_endian_swap(format);
 
@@ -2252,11 +2255,8 @@ static struct si_pm4_state *si_set_sampler_view(struct r600_context *rctx,
 			(struct pipe_sampler_view **)&samplers->views[i],
 			views[i]);
 
-		if (views[i]) {
-			struct r600_resource_texture *tex = (void *)resource[i]->base.texture;
-
-			si_pm4_add_bo(pm4, &tex->resource, RADEON_USAGE_READ);
-		}
+		if (views[i])
+			si_pm4_add_bo(pm4, resource[i]->resource, RADEON_USAGE_READ);
 
 		for (j = 0; j < Elements(resource[i]->state); ++j) {
 			si_pm4_sh_data_add(pm4, resource[i] ? resource[i]->state[j] : 0);




More information about the mesa-commit mailing list