summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/r600_texture.c
diff options
context:
space:
mode:
authorMichel Dänzer <[email protected]>2012-11-13 17:57:07 +0100
committerMichel Dänzer <[email protected]>2012-11-28 13:35:17 +0100
commit20f651d003e344e82503af5ce77af8d9f945cfda (patch)
tree063e5b5d02230874b431bf7cfe70b4d78267c4a4 /src/gallium/drivers/radeonsi/r600_texture.c
parent1a616c10095473538f4d26d32afb4de95263a7e5 (diff)
radeonsi: Depth/stencil fixes.
Adapted from r600g commit 018e3f75d69490598d61059ece56d379867f3995. Signed-off-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/r600_texture.c')
-rw-r--r--src/gallium/drivers/radeonsi/r600_texture.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/gallium/drivers/radeonsi/r600_texture.c b/src/gallium/drivers/radeonsi/r600_texture.c
index 183827bfd04..3050be73dbc 100644
--- a/src/gallium/drivers/radeonsi/r600_texture.c
+++ b/src/gallium/drivers/radeonsi/r600_texture.c
@@ -75,8 +75,16 @@ static unsigned r600_texture_get_offset(struct r600_resource_texture *rtex,
static int r600_init_surface(struct radeon_surface *surface,
const struct pipe_resource *ptex,
- unsigned array_mode, bool is_transfer)
+ unsigned array_mode,
+ bool is_transfer, bool is_flushed_depth)
{
+ const struct util_format_description *desc =
+ util_format_description(ptex->format);
+ bool is_depth, is_stencil;
+
+ is_depth = util_format_has_depth(desc);
+ is_stencil = util_format_has_stencil(desc);
+
surface->npix_x = ptex->width0;
surface->npix_y = ptex->height0;
surface->npix_z = ptex->depth0;
@@ -136,11 +144,14 @@ static int r600_init_surface(struct radeon_surface *surface,
if (ptex->bind & PIPE_BIND_SCANOUT) {
surface->flags |= RADEON_SURF_SCANOUT;
}
- if (util_format_is_depth_and_stencil(ptex->format) && !is_transfer) {
+
+ if (!is_transfer && !is_flushed_depth && is_depth) {
surface->flags |= RADEON_SURF_ZBUFFER;
- surface->flags |= RADEON_SURF_SBUFFER;
- }
+ if (is_stencil) {
+ surface->flags |= RADEON_SURF_SBUFFER;
+ }
+ }
return 0;
}
@@ -510,7 +521,8 @@ struct pipe_resource *si_texture_create(struct pipe_screen *screen,
#endif
r = r600_init_surface(&surface, templ, array_mode,
- templ->flags & R600_RESOURCE_FLAG_TRANSFER);
+ templ->flags & R600_RESOURCE_FLAG_TRANSFER,
+ templ->flags & R600_RESOURCE_FLAG_FLUSHED_DEPTH);
if (r) {
return NULL;
}
@@ -591,7 +603,7 @@ struct pipe_resource *si_texture_from_handle(struct pipe_screen *screen,
else
array_mode = V_009910_ARRAY_LINEAR_ALIGNED;
- r = r600_init_surface(&surface, templ, array_mode, 0);
+ r = r600_init_surface(&surface, templ, array_mode, false, false);
if (r) {
return NULL;
}
@@ -618,7 +630,7 @@ int r600_texture_depth_flush(struct pipe_context *ctx,
resource.nr_samples = texture->nr_samples;
resource.usage = PIPE_USAGE_DYNAMIC;
resource.bind = texture->bind | PIPE_BIND_DEPTH_STENCIL;
- resource.flags = R600_RESOURCE_FLAG_TRANSFER | texture->flags;
+ resource.flags = R600_RESOURCE_FLAG_TRANSFER | R600_RESOURCE_FLAG_FLUSHED_DEPTH | texture->flags;
rtex->flushed_depth_texture = (struct r600_resource_texture *)ctx->screen->resource_create(ctx->screen, &resource);
if (rtex->flushed_depth_texture == NULL) {