[cogl] Add support for X101010 and 2101010 pixel formats to fallback OpenGL rendering
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl] Add support for X101010 and 2101010 pixel formats to fallback OpenGL rendering
- Date: Mon, 20 Feb 2012 23:26:30 +0000 (UTC)
commit c8674ef2bc9aef5f8375fb8f291b895219d1777e
Author: Damien Leone <dleone nvidia com>
Date: Mon Nov 21 15:41:40 2011 -0800
Add support for X101010 and 2101010 pixel formats to fallback OpenGL rendering
https://bugzilla.gnome.org/show_bug.cgi?id=660188
edit: tweaked the internal format returned by pixel_format_to_gl();
handled 1010102 formats and rebased -- Robert Bragg
Reviewed-by: Robert Bragg <robert linux intel com>
Reviewed-by: Neil Roberts <neil linux intel com>
cogl/cogl-util.c | 5 +++++
cogl/driver/gl/cogl-texture-driver-gl.c | 24 ++++++++++++++++++++++++
2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/cogl/cogl-util.c b/cogl/cogl-util.c
index 6f56555..0b1b4b7 100644
--- a/cogl/cogl-util.c
+++ b/cogl/cogl-util.c
@@ -167,6 +167,11 @@ _cogl_util_pixel_format_from_masks_real (unsigned long r_mask,
{
return COGL_PIXEL_FORMAT_ARGB_8888_PRE;
}
+ else if ((depth == 30 || depth == 32) &&
+ r_mask == 0x3ff00000 && g_mask == 0xffc00 && b_mask == 0x3ff)
+ {
+ return COGL_PIXEL_FORMAT_ARGB_2101010_PRE;
+ }
else if (depth == 16 && bpp == 16 &&
r_mask == 0xf800 && g_mask == 0x7e0 && b_mask == 0x1f)
{
diff --git a/cogl/driver/gl/cogl-texture-driver-gl.c b/cogl/driver/gl/cogl-texture-driver-gl.c
index deda4c6..2724811 100644
--- a/cogl/driver/gl/cogl-texture-driver-gl.c
+++ b/cogl/driver/gl/cogl-texture-driver-gl.c
@@ -466,6 +466,30 @@ _cogl_texture_driver_pixel_format_to_gl (CoglPixelFormat format,
#endif
break;
+ case COGL_PIXEL_FORMAT_RGBA_1010102:
+ glintformat = GL_RGBA;
+ glformat = GL_RGBA;
+ gltype = GL_UNSIGNED_INT_10_10_10_2;
+ break;
+
+ case COGL_PIXEL_FORMAT_BGRA_1010102:
+ glintformat = GL_RGBA;
+ glformat = GL_BGRA;
+ gltype = GL_UNSIGNED_INT_10_10_10_2;
+ break;
+
+ case COGL_PIXEL_FORMAT_ABGR_2101010:
+ glintformat = GL_RGBA;
+ glformat = GL_RGBA;
+ gltype = GL_UNSIGNED_INT_2_10_10_10_REV;
+ break;
+
+ case COGL_PIXEL_FORMAT_ARGB_2101010:
+ glintformat = GL_RGBA;
+ glformat = GL_BGRA;
+ gltype = GL_UNSIGNED_INT_2_10_10_10_REV;
+ break;
+
/* The following three types of channel ordering
* are always defined using system word byte
* ordering (even according to GLES spec) */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]