summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/format_unpack.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2014-03-04 12:18:52 +0800
committerChia-I Wu <[email protected]>2014-03-06 10:59:25 +0800
commit5a27491a760c64e885110605ff0e5c8021382864 (patch)
treee342b91433cf8e2396727a166c11d29b621c270f /src/mesa/main/format_unpack.c
parent48a9094b69db621c4b8a432adc63d6f4439ab3d1 (diff)
mesa: add MESA_FORMAT_B8G8R8X8_SRGB
The format is needed to represent an RGB-only winsys framebuffer that is sRGB-capable. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main/format_unpack.c')
-rw-r--r--src/mesa/main/format_unpack.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
index f9c42e768d6..1a0e7271c8d 100644
--- a/src/mesa/main/format_unpack.c
+++ b/src/mesa/main/format_unpack.c
@@ -2313,6 +2313,19 @@ unpack_SIGNED_RG1616(const void *src, GLfloat dst[][4], GLuint n)
}
}
+static void
+unpack_XRGB8888_SRGB(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 16) & 0xff );
+ dst[i][GCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 8) & 0xff );
+ dst[i][BCOMP] = _mesa_nonlinear_to_linear( (s[i] ) & 0xff );
+ dst[i][ACOMP] = 1.0F;
+ }
+}
+
/**
* Return the unpacker function for the given format.
*/
@@ -2530,6 +2543,8 @@ get_unpack_rgba_function(mesa_format format)
table[MESA_FORMAT_G8R8_SNORM] = unpack_SIGNED_RG88;
table[MESA_FORMAT_G16R16_SNORM] = unpack_SIGNED_RG1616;
+ table[MESA_FORMAT_B8G8R8X8_SRGB] = unpack_XRGB8888_SRGB;
+
initialized = GL_TRUE;
}