summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Cencora <m.cencora@gmail.com>2010-01-16 22:44:30 +0100
committerMaciej Cencora <m.cencora@gmail.com>2010-01-19 23:38:33 +0100
commitf54e96c5976f0997dd3163ef027a44a3d79c43e2 (patch)
treee4c3279c0b37fd14152768824b4aef9dac56fc83
parentacac99e35ac28e3d7209b6891dd197bf94055793 (diff)
r300: check if blitting for given format is supported earlier
Prevents failing assertions at later stage.
-rw-r--r--src/mesa/drivers/dri/r300/r300_blit.c23
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 4f89a31472..99068886b7 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 */