summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2011-02-03 13:19:30 +1000
committerDave Airlie <[email protected]>2011-02-03 14:18:01 +1000
commit5730d565498cb8b4608fb7ed526172bc4bd84cb9 (patch)
treec3ab789309024ef70a0ccaebba69b2be84b95d35
parentb13b7b86b2e1165b24a2df20cb67f9f3baa17b13 (diff)
r600g: only set depth bit for hw accessible depth buffers.
If we get a sw accessible buffer like the S8 texture we end up doing depth tracking on it when there is no need since we won't ever bind it to the hardware. This leads to a sw fallback in the transfer destruction which leads to and endless recusion loop of fail in transfer destroy. Signed-off-by: Dave Airlie <[email protected]>
-rw-r--r--src/gallium/drivers/r600/r600_texture.c82
1 files changed, 41 insertions, 41 deletions
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index 7b38337eda5..1d0e482253e 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -278,6 +278,45 @@ static void r600_setup_miptree(struct pipe_screen *screen,
rtex->size = offset;
}
+/* Figure out whether u_blitter will fallback to a transfer operation.
+ * If so, don't use a staging resource.
+ */
+static boolean permit_hardware_blit(struct pipe_screen *screen,
+ const struct pipe_resource *res)
+{
+ unsigned bind;
+
+ if (util_format_is_depth_or_stencil(res->format))
+ bind = PIPE_BIND_DEPTH_STENCIL;
+ else
+ bind = PIPE_BIND_RENDER_TARGET;
+
+ /* See r600_resource_copy_region: there is something wrong
+ * with depth resource copies at the moment so avoid them for
+ * now.
+ */
+ if (util_format_get_component_bits(res->format,
+ UTIL_FORMAT_COLORSPACE_ZS,
+ 0) != 0)
+ return FALSE;
+
+ if (!screen->is_format_supported(screen,
+ res->format,
+ res->target,
+ res->nr_samples,
+ bind, 0))
+ return FALSE;
+
+ if (!screen->is_format_supported(screen,
+ res->format,
+ res->target,
+ res->nr_samples,
+ PIPE_BIND_SAMPLER_VIEW, 0))
+ return FALSE;
+
+ return TRUE;
+}
+
static struct r600_resource_texture *
r600_texture_create_object(struct pipe_screen *screen,
const struct pipe_resource *base,
@@ -301,8 +340,8 @@ r600_texture_create_object(struct pipe_screen *screen,
resource->base.b.screen = screen;
resource->bo = bo;
rtex->pitch_override = pitch_in_bytes_override;
-
- if (util_format_is_depth_or_stencil(base->format))
+ /* only mark depth textures the HW can hit as depth textures */
+ if (util_format_is_depth_or_stencil(base->format) && permit_hardware_blit(screen, base))
rtex->depth = 1;
if (array_mode)
@@ -324,45 +363,6 @@ r600_texture_create_object(struct pipe_screen *screen,
return rtex;
}
-/* Figure out whether u_blitter will fallback to a transfer operation.
- * If so, don't use a staging resource.
- */
-static boolean permit_hardware_blit(struct pipe_screen *screen,
- const struct pipe_resource *res)
-{
- unsigned bind;
-
- if (util_format_is_depth_or_stencil(res->format))
- bind = PIPE_BIND_DEPTH_STENCIL;
- else
- bind = PIPE_BIND_RENDER_TARGET;
-
- /* See r600_resource_copy_region: there is something wrong
- * with depth resource copies at the moment so avoid them for
- * now.
- */
- if (util_format_get_component_bits(res->format,
- UTIL_FORMAT_COLORSPACE_ZS,
- 0) != 0)
- return FALSE;
-
- if (!screen->is_format_supported(screen,
- res->format,
- res->target,
- res->nr_samples,
- bind, 0))
- return FALSE;
-
- if (!screen->is_format_supported(screen,
- res->format,
- res->target,
- res->nr_samples,
- PIPE_BIND_SAMPLER_VIEW, 0))
- return FALSE;
-
- return TRUE;
-}
-
struct pipe_resource *r600_texture_create(struct pipe_screen *screen,
const struct pipe_resource *templ)
{