Mesa (master): r300: check if blitting for given format is supported earlier

Maciej Cencora osiris at kemper.freedesktop.org
Tue Jan 19 23:40:57 UTC 2010


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

Author: Maciej Cencora <m.cencora at gmail.com>
Date:   Sat Jan 16 22:44:30 2010 +0100

r300: check if blitting for given format is supported earlier

Prevents failing assertions at later stage.

---

 src/mesa/drivers/dri/r300/r300_blit.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c
index 4f89a31..9906888 100644
--- a/src/mesa/drivers/dri/r300/r300_blit.c
+++ b/src/mesa/drivers/dri/r300/r300_blit.c
@@ -494,6 +494,27 @@ static void emit_cb_setup(struct r300_context *r300,
     END_BATCH();
 }
 
+static unsigned is_blit_supported(gl_format dst_format)
+{
+    switch (dst_format) {
+        case MESA_FORMAT_RGB565:
+        case MESA_FORMAT_ARGB1555:
+        case MESA_FORMAT_RGBA8888:
+        case MESA_FORMAT_RGBA8888_REV:
+        case MESA_FORMAT_ARGB8888:
+        case MESA_FORMAT_ARGB8888_REV:
+        case MESA_FORMAT_XRGB8888:
+            break;
+        default:
+            return 0;
+    }
+
+    if (_mesa_get_format_bits(dst_format, GL_DEPTH_BITS) > 0)
+        return 0;
+
+    return 1;
+}
+
 /**
  * Copy a region of [@a width x @a height] pixels from source buffer
  * to destination buffer.
@@ -541,7 +562,7 @@ unsigned r300_blit(GLcontext *ctx,
 {
     r300ContextPtr r300 = R300_CONTEXT(ctx);
 
-    if (_mesa_get_format_bits(src_mesaformat, GL_DEPTH_BITS) > 0)
+    if (!is_blit_supported(dst_mesaformat))
         return 0;
 
     /* Make sure that colorbuffer has even width - hw limitation */




More information about the mesa-commit mailing list