[Mesa-dev] [PATCH 6/6] radeonsi: Use explicit stencil mipmap level offsets.

Michel Dänzer michel at daenzer.net
Thu Nov 22 09:57:37 PST 2012


From: Michel Dänzer <michel.daenzer at amd.com>

Extracted from r600g commit 428e37c2da420f7dc14a2ea265f2387270f9bee1.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/gallium/drivers/radeonsi/r600_texture.c |    6 ++++--
 src/gallium/drivers/radeonsi/si_state.c     |    7 ++-----
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/r600_texture.c b/src/gallium/drivers/radeonsi/r600_texture.c
index 64d4b0e..3a62898 100644
--- a/src/gallium/drivers/radeonsi/r600_texture.c
+++ b/src/gallium/drivers/radeonsi/r600_texture.c
@@ -157,7 +157,8 @@ static int r600_init_surface(struct r600_screen *rscreen,
 		surface->flags |= RADEON_SURF_ZBUFFER;
 
 		if (is_stencil) {
-			surface->flags |= RADEON_SURF_SBUFFER;
+			surface->flags |= RADEON_SURF_SBUFFER |
+				RADEON_SURF_HAS_SBUFFER_MIPTREE;
 		}
 	}
 	return 0;
@@ -183,7 +184,8 @@ static int r600_setup_surface(struct pipe_screen *screen,
 		rtex->surface.level[0].pitch_bytes = pitch_in_bytes_override;
 		rtex->surface.level[0].slice_size = pitch_in_bytes_override * rtex->surface.level[0].nblk_y;
 		if (rtex->surface.flags & RADEON_SURF_SBUFFER) {
-			rtex->surface.stencil_offset = rtex->surface.level[0].slice_size;
+			rtex->surface.stencil_offset =
+			rtex->surface.stencil_level[0].offset = rtex->surface.level[0].slice_size;
 		}
 	}
 	return 0;
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 0994861..95ea860 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -1694,12 +1694,9 @@ static void si_db(struct r600_context *rctx, struct si_pm4_state *pm4,
 		R600_ERR("Invalid DB format: %d, disabling DB.\n", rtex->real_format);
 	}
 
-	z_offs = r600_resource_va(rctx->context.screen, surf->base.texture);
+	s_offs = z_offs = r600_resource_va(rctx->context.screen, surf->base.texture);
 	z_offs += rtex->surface.level[level].offset;
-
-	s_offs = r600_resource_va(rctx->context.screen, surf->base.texture);
-	s_offs += rtex->surface.stencil_offset;
-	z_offs += rtex->surface.level[level].offset / 4;
+	s_offs += rtex->surface.stencil_level[level].offset;
 
 	z_offs >>= 8;
 	s_offs >>= 8;
-- 
1.7.10.4



More information about the mesa-dev mailing list