diff options
author | Francisco Jerez <[email protected]> | 2013-11-22 19:49:29 -0800 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2014-01-15 16:42:07 +0100 |
commit | 87942749a327725014b0d160b3e48d6d83723ac2 (patch) | |
tree | b946728e01d45243a7f86fa1cd2e872d5d451675 /src/mesa/main/format_pack.c | |
parent | 16070716bca77da0d33ac2b5ae9f83c10993d912 (diff) |
mesa: Add MESA_FORMAT_ABGR2101010.
Including pack/unpack and texstore code. This texture format is a
requirement for ARB_shader_image_load_store.
Acked-by: Chris Forbes <[email protected]>
Reviewed-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/mesa/main/format_pack.c')
-rw-r--r-- | src/mesa/main/format_pack.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c index 826fc10a604..9b6929d4486 100644 --- a/src/mesa/main/format_pack.c +++ b/src/mesa/main/format_pack.c @@ -1824,6 +1824,31 @@ pack_float_XBGR32323232_FLOAT(const GLfloat src[4], void *dst) d[3] = 1.0; } +/* MESA_FORMAT_ABGR2101010 */ + +static void +pack_ubyte_ABGR2101010(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(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); +} + /** * Return a function that can pack a GLubyte rgba[4] color. @@ -1978,6 +2003,8 @@ _mesa_get_pack_ubyte_rgba_function(gl_format format) table[MESA_FORMAT_XBGR32323232_UINT] = NULL; table[MESA_FORMAT_XBGR32323232_SINT] = NULL; + table[MESA_FORMAT_ABGR2101010] = pack_ubyte_ABGR2101010; + initialized = GL_TRUE; } @@ -2136,6 +2163,8 @@ _mesa_get_pack_float_rgba_function(gl_format format) table[MESA_FORMAT_XBGR32323232_UINT] = NULL; table[MESA_FORMAT_XBGR32323232_SINT] = NULL; + table[MESA_FORMAT_ABGR2101010] = pack_float_ABGR2101010; + initialized = GL_TRUE; } |