52 lines
2.1 KiB
Diff
52 lines
2.1 KiB
Diff
From 01524a55da752146ece2e6bf345fb0a01f2ed656 Mon Sep 17 00:00:00 2001
|
|
From: Owen Taylor <otaylor@fresnel.(none)>
|
|
Date: Thu, 29 Apr 2010 19:47:56 -0400
|
|
Subject: [PATCH] Use a native format for atlas textures
|
|
|
|
Since we create frame buffer objects for atlas textures, we should use
|
|
a format that can be used as a rendering target. For this reason, use
|
|
an internal format of ARGB instead of RGBA when creating the texture.
|
|
|
|
(We don't actually render to it, but the Radeon Mesa drivers aren't
|
|
sophisticated enough to deal with a FBO that can be read from but
|
|
can't be rendered to. On other hardware, this is probably pretty much
|
|
neutral for efficiency.)
|
|
|
|
http://bugzilla.openedhand.com/show_bug.cgi?id=2100
|
|
---
|
|
clutter/cogl/cogl/cogl-atlas-texture.c | 11 ++++++++++-
|
|
1 files changed, 10 insertions(+), 1 deletions(-)
|
|
|
|
diff --git a/clutter/cogl/cogl/cogl-atlas-texture.c b/clutter/cogl/cogl/cogl-atlas-texture.c
|
|
index b9219e4..3fafb58 100644
|
|
--- a/clutter/cogl/cogl/cogl-atlas-texture.c
|
|
+++ b/clutter/cogl/cogl/cogl-atlas-texture.c
|
|
@@ -70,6 +70,15 @@
|
|
#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
|
|
#endif
|
|
|
|
+/* Best guess at native frame buffer formats; using these makes the
|
|
+ * Mesa framebuffer support happier on Radeon cards that can't
|
|
+ * render to arbitrarily ordered pixels */
|
|
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
|
+#define NATIVE_PIXEL_FORMAT COGL_PIXEL_FORMAT_BGRA_8888_PRE
|
|
+#else
|
|
+#define NATIVE_PIXEL_FORMAT COGL_PIXEL_FORMAT_ARGB_8888_PRE
|
|
+#endif
|
|
+
|
|
static void _cogl_atlas_texture_free (CoglAtlasTexture *sub_tex);
|
|
|
|
COGL_HANDLE_DEFINE (AtlasTexture, atlas_texture);
|
|
@@ -868,7 +877,7 @@ _cogl_atlas_texture_reserve_space (CoglAtlasTexture *new_sub_tex,
|
|
_cogl_texture_2d_new_with_size (_cogl_atlas_get_width (new_atlas),
|
|
_cogl_atlas_get_height (new_atlas),
|
|
COGL_TEXTURE_NONE,
|
|
- COGL_PIXEL_FORMAT_RGBA_8888)) ==
|
|
+ NATIVE_PIXEL_FORMAT)) ==
|
|
COGL_INVALID_HANDLE)
|
|
{
|
|
COGL_NOTE (ATLAS, "Could not create a CoglTexture2D");
|
|
--
|
|
1.7.0.1
|
|
|