diff options
author | Jordan Justen <[email protected]> | 2012-06-09 12:14:26 -0700 |
---|---|---|
committer | Jordan Justen <[email protected]> | 2012-07-21 16:49:42 -0700 |
commit | 749c9060aca85277c388377d15fd6323ba20b78e (patch) | |
tree | 56faf569c5a61012b7e3a6824f38f83b761dc951 /src/mesa/main/format_pack.c | |
parent | 1c8812c244d74dd562a3db7c9226405bd6333735 (diff) |
mesa formats: add MESA_FORMAT_ABGR2101010_UINT
Signed-off-by: Jordan Justen <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main/format_pack.c')
-rw-r--r-- | src/mesa/main/format_pack.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c index 7f0bda1278d..be6c026e8c2 100644 --- a/src/mesa/main/format_pack.c +++ b/src/mesa/main/format_pack.c @@ -1005,6 +1005,32 @@ pack_float_ARGB2101010(const GLfloat src[4], void *dst) } +/* MESA_FORMAT_ABGR2101010_UINT */ + +static void +pack_ubyte_ABGR2101010_UINT(const GLubyte src[4], void *dst) +{ + GLuint *d = ((GLuint *) dst); + GLushort r = UBYTE_TO_USHORT(src[RCOMP]); + GLushort g = UBYTE_TO_USHORT(src[GCOMP]); + GLushort b = UBYTE_TO_USHORT(src[BCOMP]); + GLushort a = UBYTE_TO_USHORT(src[ACOMP]); + *d = PACK_COLOR_2101010_US(a, b, g, r); +} + +static void +pack_float_ABGR2101010_UINT(const GLfloat src[4], void *dst) +{ + GLuint *d = ((GLuint *) dst); + GLushort r, g, b, a; + UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]); + UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]); + UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]); + UNCLAMPED_FLOAT_TO_USHORT(a, src[ACOMP]); + *d = PACK_COLOR_2101010_US(a, b, g, r); +} + + /* MESA_FORMAT_SRGB8 */ static void @@ -1696,6 +1722,7 @@ _mesa_get_pack_ubyte_rgba_function(gl_format format) table[MESA_FORMAT_RG1616] = pack_ubyte_RG1616; table[MESA_FORMAT_RG1616_REV] = pack_ubyte_RG1616_REV; table[MESA_FORMAT_ARGB2101010] = pack_ubyte_ARGB2101010; + table[MESA_FORMAT_ABGR2101010_UINT] = pack_ubyte_ABGR2101010_UINT; /* should never convert RGBA to these formats */ table[MESA_FORMAT_Z24_S8] = NULL; @@ -1841,6 +1868,7 @@ _mesa_get_pack_float_rgba_function(gl_format format) table[MESA_FORMAT_RG1616] = pack_float_RG1616; table[MESA_FORMAT_RG1616_REV] = pack_float_RG1616_REV; table[MESA_FORMAT_ARGB2101010] = pack_float_ARGB2101010; + table[MESA_FORMAT_ABGR2101010_UINT] = pack_float_ABGR2101010_UINT; /* should never convert RGBA to these formats */ table[MESA_FORMAT_Z24_S8] = NULL; |