diff options
author | Richard Sandiford <[email protected]> | 2014-07-22 10:51:17 +0100 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2014-09-17 13:17:47 +1000 |
commit | df14091c5857dc398521aaa9ff43bbbaee2d6116 (patch) | |
tree | f4e07d9d59dbb70a1d5e2e999092072d479ab6ab /src/mesa/main/format_unpack.c | |
parent | 234d194b49f392f9b5d55dc7f8a8b16eb8f07925 (diff) |
mesa: Add MESA_FORMAT_A8L8_{SNORM,SRGB}
The associated UNORM format already existed.
This means that each LnAn format has a reversed counterpart,
which is necessary for handling big-endian mesa<->gallium mappings.
[airlied: rebased onto current master]
Signed-off-by: Richard Sandiford <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/main/format_unpack.c')
-rw-r--r-- | src/mesa/main/format_unpack.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c index 032efe2d7f3..cfa6a60becc 100644 --- a/src/mesa/main/format_unpack.c +++ b/src/mesa/main/format_unpack.c @@ -809,6 +809,19 @@ unpack_L8A8_SRGB(const void *src, GLfloat dst[][4], GLuint n) } static void +unpack_A8L8_SRGB(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLushort *s = (const GLushort *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = util_format_srgb_8unorm_to_linear_float(s[i] >> 8); + dst[i][ACOMP] = UBYTE_TO_FLOAT(s[i] & 0xff); /* linear! */ + } +} + +static void unpack_SRGB_DXT1(const void *src, GLfloat dst[][4], GLuint n) { } @@ -1965,6 +1978,20 @@ unpack_L8A8_SNORM(const void *src, GLfloat dst[][4], GLuint n) } } + +static void +unpack_A8L8_SNORM(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLshort *s = ((const GLshort *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) ); + dst[i][ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] & 0xff) ); + } +} + static void unpack_I_SNORM8(const void *src, GLfloat dst[][4], GLuint n) { @@ -2364,6 +2391,7 @@ get_unpack_rgba_function(mesa_format format) table[MESA_FORMAT_R8G8B8A8_SRGB] = unpack_R8G8B8A8_SRGB; table[MESA_FORMAT_L_SRGB8] = unpack_L_SRGB8; table[MESA_FORMAT_L8A8_SRGB] = unpack_L8A8_SRGB; + table[MESA_FORMAT_A8L8_SRGB] = unpack_A8L8_SRGB; table[MESA_FORMAT_SRGB_DXT1] = unpack_SRGB_DXT1; table[MESA_FORMAT_SRGBA_DXT1] = unpack_SRGBA_DXT1; table[MESA_FORMAT_SRGBA_DXT3] = unpack_SRGBA_DXT3; @@ -2483,6 +2511,7 @@ get_unpack_rgba_function(mesa_format format) table[MESA_FORMAT_A_SNORM8] = unpack_A_SNORM8; table[MESA_FORMAT_L_SNORM8] = unpack_L_SNORM8; table[MESA_FORMAT_L8A8_SNORM] = unpack_L8A8_SNORM; + table[MESA_FORMAT_A8L8_SNORM] = unpack_A8L8_SNORM; table[MESA_FORMAT_I_SNORM8] = unpack_I_SNORM8; table[MESA_FORMAT_A_SNORM16] = unpack_A_SNORM16; table[MESA_FORMAT_L_SNORM16] = unpack_L_SNORM16; |