diff options
author | Brian Paul <[email protected]> | 2014-03-06 10:56:27 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2014-03-06 18:17:14 -0700 |
commit | 0f0c16b238886f5bf08991109e88eb7bd507e1e6 (patch) | |
tree | bb83a56637221e62b89314d27881b8d5d0ec0d29 /src/mesa/main/format_unpack.c | |
parent | 8d3f739383fbdf671752fdec707f1c2b9b2aa6a3 (diff) |
mesa: add MESA_FORMAT_R8G8B8A8_SRGB
To match PIPE_FORMAT_R8G8B8A8_SRGB.
v2: fix component name copy&paste bugs
Reviewed-by: José Fonseca <[email protected]>
Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/mesa/main/format_unpack.c')
-rw-r--r-- | src/mesa/main/format_unpack.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c index 1a0e7271c8d..2348ef60583 100644 --- a/src/mesa/main/format_unpack.c +++ b/src/mesa/main/format_unpack.c @@ -797,6 +797,19 @@ unpack_SARGB8(const void *src, GLfloat dst[][4], GLuint n) } static void +unpack_SABGR8(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] ) & 0xff ); + dst[i][GCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 8) & 0xff ); + dst[i][BCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 16) & 0xff ); + dst[i][ACOMP] = UBYTE_TO_FLOAT( s[i] >> 24 ); /* linear! */ + } +} + +static void unpack_SL8(const void *src, GLfloat dst[][4], GLuint n) { const GLubyte *s = ((const GLubyte *) src); @@ -2388,6 +2401,7 @@ get_unpack_rgba_function(mesa_format format) table[MESA_FORMAT_BGR_SRGB8] = unpack_SRGB8; table[MESA_FORMAT_A8B8G8R8_SRGB] = unpack_SRGBA8; table[MESA_FORMAT_B8G8R8A8_SRGB] = unpack_SARGB8; + table[MESA_FORMAT_R8G8B8A8_SRGB] = unpack_SABGR8; table[MESA_FORMAT_L_SRGB8] = unpack_SL8; table[MESA_FORMAT_L8A8_SRGB] = unpack_SLA8; table[MESA_FORMAT_SRGB_DXT1] = unpack_SRGB_DXT1; |