Mesa (master): r300g: Fallback on surfaces we can't render to or from.

Corbin Simpson csimpson at kemper.freedesktop.org
Tue Oct 13 07:12:40 UTC 2009


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

Author: Corbin Simpson <MostAwesomeDude at gmail.com>
Date:   Mon Oct 12 20:47:00 2009 -0700

r300g: Fallback on surfaces we can't render to or from.

Still not sure why st keeps handing down things we can't render to.

---

 src/gallium/drivers/r300/r300_surface.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c
index cc6288c..4d0ccd6 100644
--- a/src/gallium/drivers/r300/r300_surface.c
+++ b/src/gallium/drivers/r300/r300_surface.c
@@ -113,9 +113,10 @@ static void r300_surface_fill(struct pipe_context* pipe,
         dest, x, y, w, h, pixpitch, color);
 
     /* Fallback? */
-    if (FALSE) {
+    if (!pipe->screen->is_format_supported(pipe->screen, dest->format,
+        PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) {
 fallback:
-        debug_printf("r300: Falling back on surface clear...");
+        debug_printf("r300: Falling back on surface clear...\n");
         util_surface_fill(pipe, dest, x, y, w, h, color);
         return;
     }
@@ -245,10 +246,18 @@ static void r300_surface_copy(struct pipe_context* pipe,
     if ((srctex->buffer == desttex->buffer) &&
             ((destx < srcx + w) || (srcx < destx + w)) &&
             ((desty < srcy + h) || (srcy < desty + h))) {
+        goto fallback;
+    }
+
+    if (!pipe->screen->is_format_supported(pipe->screen, src->format,
+            PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER, 0) ||
+            !pipe->screen->is_format_supported(pipe->screen, dest->format,
+            PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) {
 fallback:
         debug_printf("r300: Falling back on surface_copy\n");
         util_surface_copy(pipe, FALSE, dest, destx, desty, src,
                 srcx, srcy, w, h);
+        return;
     }
 
     /* Add our target BOs to the list. */




More information about the mesa-commit mailing list