diff options
author | marha <marha@users.sourceforge.net> | 2013-02-07 10:17:56 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-02-07 10:17:56 +0100 |
commit | 956c20498738c242726b5a42ed28db8572a90bed (patch) | |
tree | bf663b89417d0d9d7b37575eb0260d5a10af0e12 /mesalib/src/mesa/main | |
parent | 76c527be60066b647468ad66f8e4d7dd18fa1769 (diff) | |
download | vcxsrv-956c20498738c242726b5a42ed28db8572a90bed.tar.gz vcxsrv-956c20498738c242726b5a42ed28db8572a90bed.tar.bz2 vcxsrv-956c20498738c242726b5a42ed28db8572a90bed.zip |
mesa fontconfig git update 7 Feb 2013
fontconfig commit 96220a5ed9d1d761b14a7ac516ac6786c132f280
mesa commit 9ba1e23647c09290c98cc7133fb73dd1df1da8ab
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r-- | mesalib/src/mesa/main/format_pack.c | 202 | ||||
-rw-r--r-- | mesalib/src/mesa/main/format_unpack.c | 303 | ||||
-rw-r--r-- | mesalib/src/mesa/main/formats.c | 223 | ||||
-rw-r--r-- | mesalib/src/mesa/main/formats.h | 20 | ||||
-rw-r--r-- | mesalib/src/mesa/main/renderbuffer.h | 8 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texformat.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/teximage.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texstore.c | 220 |
8 files changed, 904 insertions, 76 deletions
diff --git a/mesalib/src/mesa/main/format_pack.c b/mesalib/src/mesa/main/format_pack.c index 051fb40b9..1a14b98b7 100644 --- a/mesalib/src/mesa/main/format_pack.c +++ b/mesalib/src/mesa/main/format_pack.c @@ -934,10 +934,10 @@ pack_float_R16(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_RG1616 */ +/* MESA_FORMAT_GR1616 */ static void -pack_ubyte_RG1616(const GLubyte src[4], void *dst) +pack_ubyte_GR1616(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort r = UBYTE_TO_USHORT(src[RCOMP]); @@ -946,7 +946,7 @@ pack_ubyte_RG1616(const GLubyte src[4], void *dst) } static void -pack_float_RG1616(const GLfloat src[4], void *dst) +pack_float_GR1616(const GLfloat src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort r, g; @@ -956,10 +956,10 @@ pack_float_RG1616(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_RG1616_REV */ +/* MESA_FORMAT_RG1616 */ static void -pack_ubyte_RG1616_REV(const GLubyte src[4], void *dst) +pack_ubyte_RG1616(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort r = UBYTE_TO_USHORT(src[RCOMP]); @@ -969,7 +969,7 @@ pack_ubyte_RG1616_REV(const GLubyte src[4], void *dst) static void -pack_float_RG1616_REV(const GLfloat src[4], void *dst) +pack_float_RG1616(const GLfloat src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort r, g; @@ -1669,6 +1669,160 @@ pack_float_R11_G11_B10_FLOAT(const GLfloat src[4], void *dst) } +/* + * MESA_FORMAT_XRGB4444_UNORM + */ + +static void +pack_ubyte_XRGB4444_UNORM(const GLubyte src[4], void *dst) +{ + GLushort *d = ((GLushort *) dst); + *d = PACK_COLOR_4444(255, src[RCOMP], src[GCOMP], src[BCOMP]); +} + +static void +pack_float_XRGB4444_UNORM(const GLfloat src[4], void *dst) +{ + GLubyte v[4]; + _mesa_unclamped_float_rgba_to_ubyte(v, src); + pack_ubyte_XRGB4444_UNORM(v, dst); +} + + +/* + * MESA_FORMAT_XRGB1555_UNORM + */ + +static void +pack_ubyte_XRGB1555_UNORM(const GLubyte src[4], void *dst) +{ + GLushort *d = ((GLushort *) dst); + *d = PACK_COLOR_1555(255, src[RCOMP], src[GCOMP], src[BCOMP]); +} + +static void +pack_float_XRGB1555_UNORM(const GLfloat src[4], void *dst) +{ + GLubyte v[4]; + _mesa_unclamped_float_rgba_to_ubyte(v, src); + pack_ubyte_XRGB1555_UNORM(v, dst); +} + + +/* + * MESA_FORMAT_XBGR8888_SNORM + */ + +static void +pack_float_XBGR8888_SNORM(const GLfloat src[4], void *dst) +{ + GLuint *d = (GLuint *) dst; + GLbyte r = FLOAT_TO_BYTE(CLAMP(src[RCOMP], -1.0f, 1.0f)); + GLbyte g = FLOAT_TO_BYTE(CLAMP(src[GCOMP], -1.0f, 1.0f)); + GLbyte b = FLOAT_TO_BYTE(CLAMP(src[BCOMP], -1.0f, 1.0f)); + *d = PACK_COLOR_8888(127, b, g, r); +} + + +/* + * MESA_FORMAT_XBGR8888_SRGB + */ + +static void +pack_float_XBGR8888_SRGB(const GLfloat src[4], void *dst) +{ + GLuint *d = (GLuint *) dst; + GLubyte r = linear_float_to_srgb_ubyte(src[RCOMP]); + GLubyte g = linear_float_to_srgb_ubyte(src[GCOMP]); + GLubyte b = linear_float_to_srgb_ubyte(src[BCOMP]); + *d = PACK_COLOR_8888(127, b, g, r); +} + + +/* MESA_FORMAT_XRGB2101010_UNORM */ + +static void +pack_ubyte_XRGB2101010_UNORM(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]); + *d = PACK_COLOR_2101010_US(3, r, g, b); +} + +static void +pack_float_XRGB2101010_UNORM(const GLfloat src[4], void *dst) +{ + GLuint *d = ((GLuint *) dst); + GLushort r, g, b; + UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]); + UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]); + UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]); + *d = PACK_COLOR_2101010_US(3, r, g, b); +} + + +/* MESA_FORMAT_XBGR16161616_UNORM */ + +static void +pack_ubyte_XBGR16161616_UNORM(const GLubyte src[4], void *dst) +{ + GLushort *d = ((GLushort *) dst); + d[0] = UBYTE_TO_USHORT(src[RCOMP]); + d[1] = UBYTE_TO_USHORT(src[GCOMP]); + d[2] = UBYTE_TO_USHORT(src[BCOMP]); + d[3] = 65535; +} + +static void +pack_float_XBGR16161616_UNORM(const GLfloat src[4], void *dst) +{ + GLushort *d = ((GLushort *) dst); + UNCLAMPED_FLOAT_TO_USHORT(d[0], src[RCOMP]); + UNCLAMPED_FLOAT_TO_USHORT(d[1], src[GCOMP]); + UNCLAMPED_FLOAT_TO_USHORT(d[2], src[BCOMP]); + d[3] = 65535; +} + + +/* MESA_FORMAT_XBGR16161616_SNORM */ + +static void +pack_float_XBGR16161616_SNORM(const GLfloat src[4], void *dst) +{ + GLushort *d = ((GLushort *) dst); + UNCLAMPED_FLOAT_TO_SHORT(d[0], src[RCOMP]); + UNCLAMPED_FLOAT_TO_SHORT(d[1], src[GCOMP]); + UNCLAMPED_FLOAT_TO_SHORT(d[2], src[BCOMP]); + d[3] = 32767; +} + + +/* MESA_FORMAT_XBGR16161616_FLOAT */ + +static void +pack_float_XBGR16161616_FLOAT(const GLfloat src[4], void *dst) +{ + GLushort *d = ((GLushort *) dst); + d[0] = _mesa_float_to_half(src[RCOMP]); + d[1] = _mesa_float_to_half(src[GCOMP]); + d[2] = _mesa_float_to_half(src[BCOMP]); + d[3] = _mesa_float_to_half(1.0); +} + +/* MESA_FORMAT_XBGR32323232_FLOAT */ + +static void +pack_float_XBGR32323232_FLOAT(const GLfloat src[4], void *dst) +{ + GLfloat *d = ((GLfloat *) dst); + d[0] = src[RCOMP]; + d[1] = src[GCOMP]; + d[2] = src[BCOMP]; + d[3] = 1.0; +} + /** * Return a function that can pack a GLubyte rgba[4] color. @@ -1719,8 +1873,8 @@ _mesa_get_pack_ubyte_rgba_function(gl_format format) table[MESA_FORMAT_GR88] = pack_ubyte_GR88; table[MESA_FORMAT_RG88] = pack_ubyte_RG88; table[MESA_FORMAT_R16] = pack_ubyte_R16; + table[MESA_FORMAT_GR1616] = pack_ubyte_GR1616; 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; @@ -1807,6 +1961,22 @@ _mesa_get_pack_ubyte_rgba_function(gl_format format) table[MESA_FORMAT_RGB9_E5_FLOAT] = pack_ubyte_RGB9_E5_FLOAT; table[MESA_FORMAT_R11_G11_B10_FLOAT] = pack_ubyte_R11_G11_B10_FLOAT; + table[MESA_FORMAT_XRGB4444_UNORM] = pack_ubyte_XRGB4444_UNORM; + table[MESA_FORMAT_XRGB1555_UNORM] = pack_ubyte_XRGB1555_UNORM; + table[MESA_FORMAT_XBGR8888_SNORM] = NULL; + table[MESA_FORMAT_XBGR8888_SRGB] = NULL; + table[MESA_FORMAT_XBGR8888_UINT] = NULL; + table[MESA_FORMAT_XBGR8888_SINT] = NULL; + table[MESA_FORMAT_XRGB2101010_UNORM] = pack_ubyte_XRGB2101010_UNORM; + table[MESA_FORMAT_XBGR16161616_UNORM] = pack_ubyte_XBGR16161616_UNORM; + table[MESA_FORMAT_XBGR16161616_SNORM] = NULL; + table[MESA_FORMAT_XBGR16161616_FLOAT] = NULL; + table[MESA_FORMAT_XBGR16161616_UINT] = NULL; + table[MESA_FORMAT_XBGR16161616_SINT] = NULL; + table[MESA_FORMAT_XBGR32323232_FLOAT] = NULL; + table[MESA_FORMAT_XBGR32323232_UINT] = NULL; + table[MESA_FORMAT_XBGR32323232_SINT] = NULL; + initialized = GL_TRUE; } @@ -1865,8 +2035,8 @@ _mesa_get_pack_float_rgba_function(gl_format format) table[MESA_FORMAT_GR88] = pack_float_GR88; table[MESA_FORMAT_RG88] = pack_float_RG88; table[MESA_FORMAT_R16] = pack_float_R16; + table[MESA_FORMAT_GR1616] = pack_float_GR1616; 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; @@ -1949,6 +2119,22 @@ _mesa_get_pack_float_rgba_function(gl_format format) table[MESA_FORMAT_RGB9_E5_FLOAT] = pack_float_RGB9_E5_FLOAT; table[MESA_FORMAT_R11_G11_B10_FLOAT] = pack_float_R11_G11_B10_FLOAT; + table[MESA_FORMAT_XRGB4444_UNORM] = pack_float_XRGB4444_UNORM; + table[MESA_FORMAT_XRGB1555_UNORM] = pack_float_XRGB1555_UNORM; + table[MESA_FORMAT_XBGR8888_SNORM] = pack_float_XBGR8888_SNORM; + table[MESA_FORMAT_XBGR8888_SRGB] = pack_float_XBGR8888_SRGB; + table[MESA_FORMAT_XBGR8888_UINT] = NULL; + table[MESA_FORMAT_XBGR8888_SINT] = NULL; + table[MESA_FORMAT_XRGB2101010_UNORM] = pack_float_XRGB2101010_UNORM; + table[MESA_FORMAT_XBGR16161616_UNORM] = pack_float_XBGR16161616_UNORM; + table[MESA_FORMAT_XBGR16161616_SNORM] = pack_float_XBGR16161616_SNORM; + table[MESA_FORMAT_XBGR16161616_FLOAT] = pack_float_XBGR16161616_FLOAT; + table[MESA_FORMAT_XBGR16161616_UINT] = NULL; + table[MESA_FORMAT_XBGR16161616_SINT] = NULL; + table[MESA_FORMAT_XBGR32323232_FLOAT] = pack_float_XBGR32323232_FLOAT; + table[MESA_FORMAT_XBGR32323232_UINT] = NULL; + table[MESA_FORMAT_XBGR32323232_SINT] = NULL; + initialized = GL_TRUE; } diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c index 92ce86908..0933b4e87 100644 --- a/mesalib/src/mesa/main/format_unpack.c +++ b/mesalib/src/mesa/main/format_unpack.c @@ -570,7 +570,7 @@ unpack_R16(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_RG1616(const void *src, GLfloat dst[][4], GLuint n) +unpack_GR1616(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -583,7 +583,7 @@ unpack_RG1616(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_RG1616_REV(const void *src, GLfloat dst[][4], GLuint n) +unpack_RG1616(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -1524,6 +1524,201 @@ unpack_R11_G11_B10_FLOAT(const void *src, GLfloat dst[][4], GLuint n) } } +static void +unpack_XRGB4444_UNORM(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] = ((s[i] >> 8) & 0xf) * (1.0F / 15.0F); + dst[i][GCOMP] = ((s[i] >> 4) & 0xf) * (1.0F / 15.0F); + dst[i][BCOMP] = ((s[i] ) & 0xf) * (1.0F / 15.0F); + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_XRGB1555_UNORM(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] = ((s[i] >> 10) & 0x1f) * (1.0F / 31.0F); + dst[i][GCOMP] = ((s[i] >> 5) & 0x1f) * (1.0F / 31.0F); + dst[i][BCOMP] = ((s[i] >> 0) & 0x1f) * (1.0F / 31.0F); + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_XBGR8888_SNORM(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] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] ) ); + dst[i][GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) ); + dst[i][BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 16) ); + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_XBGR8888_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] ) & 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_XBGR8888_UINT(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLbyte *s = (const GLbyte *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = s[i*4+0]; + dst[i][GCOMP] = s[i*4+1]; + dst[i][BCOMP] = s[i*4+2]; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_XBGR8888_SINT(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLbyte *s = (const GLbyte *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = s[i*4+0]; + dst[i][GCOMP] = s[i*4+1]; + dst[i][BCOMP] = s[i*4+2]; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_XRGB2101010_UNORM(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] = ((s[i] >> 20) & 0x3ff) * (1.0F / 1023.0F); + dst[i][GCOMP] = ((s[i] >> 10) & 0x3ff) * (1.0F / 1023.0F); + dst[i][BCOMP] = ((s[i] >> 0) & 0x3ff) * (1.0F / 1023.0F); + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_XBGR16161616_UNORM(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] = USHORT_TO_FLOAT( s[i*4+0] ); + dst[i][GCOMP] = USHORT_TO_FLOAT( s[i*4+1] ); + dst[i][BCOMP] = USHORT_TO_FLOAT( s[i*4+2] ); + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_XBGR16161616_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] = SHORT_TO_FLOAT_TEX( s[i*4+0] ); + dst[i][GCOMP] = SHORT_TO_FLOAT_TEX( s[i*4+1] ); + dst[i][BCOMP] = SHORT_TO_FLOAT_TEX( s[i*4+2] ); + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_XBGR16161616_FLOAT(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] = _mesa_half_to_float(s[i*4+0]); + dst[i][GCOMP] = _mesa_half_to_float(s[i*4+1]); + dst[i][BCOMP] = _mesa_half_to_float(s[i*4+2]); + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_XBGR16161616_UINT(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] = (GLfloat) s[i*4+0]; + dst[i][GCOMP] = (GLfloat) s[i*4+1]; + dst[i][BCOMP] = (GLfloat) s[i*4+2]; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_XBGR16161616_SINT(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] = (GLfloat) s[i*4+0]; + dst[i][GCOMP] = (GLfloat) s[i*4+1]; + dst[i][BCOMP] = (GLfloat) s[i*4+2]; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_XBGR32323232_FLOAT(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLfloat *s = (const GLfloat *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = s[i*4+0]; + dst[i][GCOMP] = s[i*4+1]; + dst[i][BCOMP] = s[i*4+2]; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_XBGR32323232_UINT(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] = (GLfloat) s[i*4+0]; + dst[i][GCOMP] = (GLfloat) s[i*4+1]; + dst[i][BCOMP] = (GLfloat) s[i*4+2]; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_XBGR32323232_SINT(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLint *s = (const GLint *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat) s[i*4+0]; + dst[i][GCOMP] = (GLfloat) s[i*4+1]; + dst[i][BCOMP] = (GLfloat) s[i*4+2]; + dst[i][ACOMP] = 1.0; + } +} + /** * Return the unpacker function for the given format. @@ -1572,8 +1767,8 @@ get_unpack_rgba_function(gl_format format) table[MESA_FORMAT_GR88] = unpack_GR88; table[MESA_FORMAT_RG88] = unpack_RG88; table[MESA_FORMAT_R16] = unpack_R16; + table[MESA_FORMAT_GR1616] = unpack_GR1616; table[MESA_FORMAT_RG1616] = unpack_RG1616; - table[MESA_FORMAT_RG1616_REV] = unpack_RG1616_REV; table[MESA_FORMAT_ARGB2101010] = unpack_ARGB2101010; table[MESA_FORMAT_ABGR2101010_UINT] = unpack_ABGR2101010_UINT; table[MESA_FORMAT_Z24_S8] = unpack_Z24_S8; @@ -1674,6 +1869,22 @@ get_unpack_rgba_function(gl_format format) table[MESA_FORMAT_Z32_FLOAT] = unpack_Z32_FLOAT; table[MESA_FORMAT_Z32_FLOAT_X24S8] = unpack_Z32_FLOAT_X24S8; + table[MESA_FORMAT_XRGB4444_UNORM] = unpack_XRGB4444_UNORM; + table[MESA_FORMAT_XRGB1555_UNORM] = unpack_XRGB1555_UNORM; + table[MESA_FORMAT_XBGR8888_SNORM] = unpack_XBGR8888_SNORM; + table[MESA_FORMAT_XBGR8888_SRGB] = unpack_XBGR8888_SRGB; + table[MESA_FORMAT_XBGR8888_UINT] = unpack_XBGR8888_UINT; + table[MESA_FORMAT_XBGR8888_SINT] = unpack_XBGR8888_SINT; + table[MESA_FORMAT_XRGB2101010_UNORM] = unpack_XRGB2101010_UNORM; + table[MESA_FORMAT_XBGR16161616_UNORM] = unpack_XBGR16161616_UNORM; + table[MESA_FORMAT_XBGR16161616_SNORM] = unpack_XBGR16161616_SNORM; + table[MESA_FORMAT_XBGR16161616_FLOAT] = unpack_XBGR16161616_FLOAT; + table[MESA_FORMAT_XBGR16161616_UINT] = unpack_XBGR16161616_UINT; + table[MESA_FORMAT_XBGR16161616_SINT] = unpack_XBGR16161616_SINT; + table[MESA_FORMAT_XBGR32323232_FLOAT] = unpack_XBGR32323232_FLOAT; + table[MESA_FORMAT_XBGR32323232_UINT] = unpack_XBGR32323232_UINT; + table[MESA_FORMAT_XBGR32323232_SINT] = unpack_XBGR32323232_SINT; + initialized = GL_TRUE; } @@ -2710,6 +2921,71 @@ unpack_int_rgba_ARGB2101010(const GLuint *src, GLuint dst[][4], GLuint n) } } +static void +unpack_int_rgba_XBGR8888_UINT(const GLubyte *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 4 + 0]; + dst[i][1] = src[i * 4 + 1]; + dst[i][2] = src[i * 4 + 2]; + dst[i][3] = 1; + } +} + +static void +unpack_int_rgba_XBGR8888_SINT(const GLbyte *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 4 + 0]; + dst[i][1] = src[i * 4 + 1]; + dst[i][2] = src[i * 4 + 2]; + dst[i][3] = 1; + } +} + +static void +unpack_int_rgba_XBGR16161616_UINT(const GLushort *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 4 + 0]; + dst[i][1] = src[i * 4 + 1]; + dst[i][2] = src[i * 4 + 2]; + dst[i][3] = 1; + } +} + +static void +unpack_int_rgba_XBGR16161616_SINT(const GLshort *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 4 + 0]; + dst[i][1] = src[i * 4 + 1]; + dst[i][2] = src[i * 4 + 2]; + dst[i][3] = 1; + } +} + +static void +unpack_int_rgba_XBGR32323232_UINT(const GLuint *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 4 + 0]; + dst[i][1] = src[i * 4 + 1]; + dst[i][2] = src[i * 4 + 2]; + dst[i][3] = 1; + } +} + void _mesa_unpack_uint_rgba_row(gl_format format, GLuint n, const void *src, GLuint dst[][4]) @@ -2889,6 +3165,27 @@ _mesa_unpack_uint_rgba_row(gl_format format, GLuint n, unpack_int_rgba_ARGB2101010(src, dst, n); break; + case MESA_FORMAT_XBGR8888_UINT: + unpack_int_rgba_XBGR8888_UINT(src, dst, n); + break; + + case MESA_FORMAT_XBGR8888_SINT: + unpack_int_rgba_XBGR8888_SINT(src, dst, n); + break; + + case MESA_FORMAT_XBGR16161616_UINT: + unpack_int_rgba_XBGR16161616_UINT(src, dst, n); + break; + + case MESA_FORMAT_XBGR16161616_SINT: + unpack_int_rgba_XBGR16161616_SINT(src, dst, n); + break; + + case MESA_FORMAT_XBGR32323232_UINT: + case MESA_FORMAT_XBGR32323232_SINT: + unpack_int_rgba_XBGR32323232_UINT(src, dst, n); + break; + default: _mesa_problem(NULL, "%s: bad format %s", __FUNCTION__, _mesa_get_format_name(format)); diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c index 1c9e63377..176067d53 100644 --- a/mesalib/src/mesa/main/formats.c +++ b/mesalib/src/mesa/main/formats.c @@ -404,8 +404,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_RG1616, - "MESA_FORMAT_RG1616", + MESA_FORMAT_GR1616, + "MESA_FORMAT_GR1616", GL_RG, GL_UNSIGNED_NORMALIZED, 16, 16, 0, 0, @@ -413,8 +413,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_RG1616_REV, - "MESA_FORMAT_RG1616_REV", + MESA_FORMAT_RG1616, + "MESA_FORMAT_RG1616", GL_RG, GL_UNSIGNED_NORMALIZED, 16, 16, 0, 0, @@ -1629,6 +1629,141 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 1, 1, 4 }, + { + MESA_FORMAT_XRGB4444_UNORM, + "MESA_FORMAT_XRGB4444_UNORM", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_XRGB1555_UNORM, + "MESA_FORMAT_XRGB1555_UNORM", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 5, 5, 5, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_XBGR8888_SNORM, + "MESA_FORMAT_XBGR8888_SNORM", + GL_RGB, + GL_SIGNED_NORMALIZED, + 8, 8, 8, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_XBGR8888_SRGB, + "MESA_FORMAT_XBGR8888_SRGB", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_XBGR8888_UINT, + "MESA_FORMAT_XBGR8888_UINT", + GL_RGB, + GL_UNSIGNED_INT, + 8, 8, 8, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_XBGR8888_SINT, + "MESA_FORMAT_XBGR8888_SINT", + GL_RGB, + GL_INT, + 8, 8, 8, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_XRGB2101010_UNORM, + "MESA_FORMAT_XRGB2101010_UNORM", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 10, 10, 10, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_XBGR16161616_UNORM, + "MESA_FORMAT_XBGR16161616_UNORM", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_XBGR16161616_SNORM, + "MESA_FORMAT_XBGR16161616_SNORM", + GL_RGB, + GL_SIGNED_NORMALIZED, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_XBGR16161616_FLOAT, + "MESA_FORMAT_XBGR16161616_FLOAT", + GL_RGB, + GL_FLOAT, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_XBGR16161616_UINT, + "MESA_FORMAT_XBGR16161616_UINT", + GL_RGB, + GL_UNSIGNED_INT, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_XBGR16161616_SINT, + "MESA_FORMAT_XBGR16161616_SINT", + GL_RGB, + GL_INT, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_XBGR32323232_FLOAT, + "MESA_FORMAT_XBGR32323232_FLOAT", + GL_RGB, + GL_FLOAT, + 32, 32, 32, 0, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, + { + MESA_FORMAT_XBGR32323232_UINT, + "MESA_FORMAT_XBGR32323232_UINT", + GL_RGB, + GL_UNSIGNED_INT, + 32, 32, 32, 0, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, + { + MESA_FORMAT_XBGR32323232_SINT, + "MESA_FORMAT_XBGR32323232_SINT", + GL_RGB, + GL_INT, + 32, 32, 32, 0, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, }; @@ -1850,6 +1985,7 @@ _mesa_get_format_color_encoding(gl_format format) case MESA_FORMAT_SRGBA_DXT1: case MESA_FORMAT_SRGBA_DXT3: case MESA_FORMAT_SRGBA_DXT5: + case MESA_FORMAT_XBGR8888_SRGB: return GL_SRGB; default: return GL_LINEAR; @@ -1892,6 +2028,9 @@ _mesa_get_srgb_format_linear(gl_format format) case MESA_FORMAT_SRGBA_DXT5: format = MESA_FORMAT_RGBA_DXT5; break; + case MESA_FORMAT_XBGR8888_SRGB: + format = MESA_FORMAT_RGBX8888_REV; + break; default: break; } @@ -1953,7 +2092,7 @@ _mesa_get_uncompressed_format(gl_format format) return MESA_FORMAT_R16; case MESA_FORMAT_ETC2_RG11_EAC: case MESA_FORMAT_ETC2_SIGNED_RG11_EAC: - return MESA_FORMAT_RG1616; + return MESA_FORMAT_GR1616; default: #ifdef DEBUG assert(!_mesa_is_format_compressed(format)); @@ -2199,12 +2338,14 @@ _mesa_format_to_type_and_comps(gl_format format, case MESA_FORMAT_ARGB4444: case MESA_FORMAT_ARGB4444_REV: + case MESA_FORMAT_XRGB4444_UNORM: *datatype = GL_UNSIGNED_SHORT_4_4_4_4; *comps = 4; return; case MESA_FORMAT_ARGB1555: case MESA_FORMAT_ARGB1555_REV: + case MESA_FORMAT_XRGB1555_UNORM: *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV; *comps = 4; return; @@ -2234,8 +2375,8 @@ _mesa_format_to_type_and_comps(gl_format format, case MESA_FORMAT_AL1616: case MESA_FORMAT_AL1616_REV: + case MESA_FORMAT_GR1616: case MESA_FORMAT_RG1616: - case MESA_FORMAT_RG1616_REV: *datatype = GL_UNSIGNED_SHORT; *comps = 2; return; @@ -2632,6 +2773,55 @@ _mesa_format_to_type_and_comps(gl_format format, *comps = 4; return; + case MESA_FORMAT_XBGR8888_SRGB: + case MESA_FORMAT_XBGR8888_UINT: + *datatype = GL_UNSIGNED_BYTE; + *comps = 4; + return; + + case MESA_FORMAT_XBGR8888_SNORM: + case MESA_FORMAT_XBGR8888_SINT: + *datatype = GL_BYTE; + *comps = 4; + return; + + case MESA_FORMAT_XRGB2101010_UNORM: + *datatype = GL_UNSIGNED_INT_2_10_10_10_REV; + *comps = 4; + return; + + case MESA_FORMAT_XBGR16161616_UNORM: + case MESA_FORMAT_XBGR16161616_UINT: + *datatype = GL_UNSIGNED_SHORT; + *comps = 4; + return; + + case MESA_FORMAT_XBGR16161616_SNORM: + case MESA_FORMAT_XBGR16161616_SINT: + *datatype = GL_SHORT; + *comps = 4; + return; + + case MESA_FORMAT_XBGR16161616_FLOAT: + *datatype = GL_HALF_FLOAT; + *comps = 4; + return; + + case MESA_FORMAT_XBGR32323232_FLOAT: + *datatype = GL_FLOAT; + *comps = 4; + return; + + case MESA_FORMAT_XBGR32323232_UINT: + *datatype = GL_UNSIGNED_INT; + *comps = 4; + return; + + case MESA_FORMAT_XBGR32323232_SINT: + *datatype = GL_INT; + *comps = 4; + return; + case MESA_FORMAT_COUNT: assert(0); return; @@ -2839,10 +3029,10 @@ _mesa_format_matches_format_and_type(gl_format gl_format, case MESA_FORMAT_R16: return format == GL_RED && type == GL_UNSIGNED_SHORT && littleEndian && !swapBytes; - case MESA_FORMAT_RG1616: + case MESA_FORMAT_GR1616: return format == GL_RG && type == GL_UNSIGNED_SHORT && littleEndian && !swapBytes; - case MESA_FORMAT_RG1616_REV: + case MESA_FORMAT_RG1616: return GL_FALSE; case MESA_FORMAT_ARGB2101010: @@ -3081,6 +3271,23 @@ _mesa_format_matches_format_and_type(gl_format gl_format, case MESA_FORMAT_Z32_FLOAT_X24S8: return GL_FALSE; + + case MESA_FORMAT_XRGB4444_UNORM: + case MESA_FORMAT_XRGB1555_UNORM: + case MESA_FORMAT_XBGR8888_SNORM: + case MESA_FORMAT_XBGR8888_SRGB: + case MESA_FORMAT_XBGR8888_UINT: + case MESA_FORMAT_XBGR8888_SINT: + case MESA_FORMAT_XRGB2101010_UNORM: + case MESA_FORMAT_XBGR16161616_UNORM: + case MESA_FORMAT_XBGR16161616_SNORM: + case MESA_FORMAT_XBGR16161616_FLOAT: + case MESA_FORMAT_XBGR16161616_UINT: + case MESA_FORMAT_XBGR16161616_SINT: + case MESA_FORMAT_XBGR32323232_FLOAT: + case MESA_FORMAT_XBGR32323232_UINT: + case MESA_FORMAT_XBGR32323232_SINT: + return GL_FALSE; } return GL_FALSE; diff --git a/mesalib/src/mesa/main/formats.h b/mesalib/src/mesa/main/formats.h index 050fce96c..2961ffa9f 100644 --- a/mesalib/src/mesa/main/formats.h +++ b/mesalib/src/mesa/main/formats.h @@ -102,8 +102,8 @@ typedef enum MESA_FORMAT_GR88, /* GGGG GGGG RRRR RRRR */ MESA_FORMAT_RG88, /* RRRR RRRR GGGG GGGG */ MESA_FORMAT_R16, /* RRRR RRRR RRRR RRRR */ - MESA_FORMAT_RG1616, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */ - MESA_FORMAT_RG1616_REV, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */ + MESA_FORMAT_GR1616, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */ + MESA_FORMAT_RG1616, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */ MESA_FORMAT_ARGB2101010, /* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ MESA_FORMAT_Z24_S8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */ MESA_FORMAT_S8_Z24, /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ @@ -288,6 +288,22 @@ typedef enum MESA_FORMAT_ARGB2101010_UINT, MESA_FORMAT_ABGR2101010_UINT, + MESA_FORMAT_XRGB4444_UNORM, + MESA_FORMAT_XRGB1555_UNORM, + MESA_FORMAT_XBGR8888_SNORM, + MESA_FORMAT_XBGR8888_SRGB, + MESA_FORMAT_XBGR8888_UINT, + MESA_FORMAT_XBGR8888_SINT, + MESA_FORMAT_XRGB2101010_UNORM, + MESA_FORMAT_XBGR16161616_UNORM, + MESA_FORMAT_XBGR16161616_SNORM, + MESA_FORMAT_XBGR16161616_FLOAT, + MESA_FORMAT_XBGR16161616_UINT, + MESA_FORMAT_XBGR16161616_SINT, + MESA_FORMAT_XBGR32323232_FLOAT, + MESA_FORMAT_XBGR32323232_UINT, + MESA_FORMAT_XBGR32323232_SINT, + MESA_FORMAT_COUNT } gl_format; diff --git a/mesalib/src/mesa/main/renderbuffer.h b/mesalib/src/mesa/main/renderbuffer.h index 5495ae150..c450b33cb 100644 --- a/mesalib/src/mesa/main/renderbuffer.h +++ b/mesalib/src/mesa/main/renderbuffer.h @@ -29,6 +29,10 @@ #include "glheader.h" #include "mtypes.h" +#ifdef __cplusplus +extern "C" { +#endif + struct gl_context; struct gl_framebuffer; struct gl_renderbuffer; @@ -62,6 +66,8 @@ _mesa_reference_renderbuffer(struct gl_renderbuffer **ptr, _mesa_reference_renderbuffer_(ptr, rb); } - +#ifdef __cplusplus +} +#endif #endif /* RENDERBUFFER_H */ diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c index 75b1021d4..6f22a4f5f 100644 --- a/mesalib/src/mesa/main/texformat.c +++ b/mesalib/src/mesa/main/texformat.c @@ -812,7 +812,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, break; case GL_RG16: - RETURN_IF_SUPPORTED(MESA_FORMAT_RG1616); + RETURN_IF_SUPPORTED(MESA_FORMAT_GR1616); break; default: diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index ff3c92c5e..9283ece8a 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -3917,7 +3917,7 @@ get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) case GL_RG8: return MESA_FORMAT_GR88; case GL_RG16: - return MESA_FORMAT_RG1616; + return MESA_FORMAT_GR1616; case GL_RG16F: return MESA_FORMAT_RG_FLOAT16; case GL_RG32F: diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index a5c7712e0..6e7ce237f 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -1688,9 +1688,8 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_argb2101010(TEXSTORE_PARAMS) { - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - - ASSERT(dstFormat == MESA_FORMAT_ARGB2101010); + ASSERT(dstFormat == MESA_FORMAT_ARGB2101010 || + dstFormat == MESA_FORMAT_XRGB2101010_UNORM); ASSERT(_mesa_get_format_bytes(dstFormat) == 4); if (!ctx->_ImageTransferState && @@ -1706,15 +1705,16 @@ _mesa_texstore_argb2101010(TEXSTORE_PARAMS) } else { /* general path */ + /* Hardcode GL_RGBA as the base format, which forces alpha to 1.0 + * if the internal format is RGB. */ const GLfloat *tempImage = _mesa_make_temp_float_image(ctx, dims, baseInternalFormat, - baseFormat, + GL_RGBA, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking, ctx->_ImageTransferState); const GLfloat *src = tempImage; - const GLushort aMask = (srcFormat == GL_RGB) ? 0xffff : 0; GLint img, row, col; if (!tempImage) return GL_FALSE; @@ -1727,7 +1727,6 @@ _mesa_texstore_argb2101010(TEXSTORE_PARAMS) GLushort a,r,g,b; UNCLAMPED_FLOAT_TO_USHORT(a, src[ACOMP]); - a = a | aMask; UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]); UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]); UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]); @@ -1915,8 +1914,8 @@ _mesa_texstore_unorm1616(TEXSTORE_PARAMS) ASSERT(dstFormat == MESA_FORMAT_AL1616 || dstFormat == MESA_FORMAT_AL1616_REV || - dstFormat == MESA_FORMAT_RG1616 || - dstFormat == MESA_FORMAT_RG1616_REV); + dstFormat == MESA_FORMAT_GR1616 || + dstFormat == MESA_FORMAT_RG1616); ASSERT(_mesa_get_format_bytes(dstFormat) == 4); if (!ctx->_ImageTransferState && @@ -1924,7 +1923,7 @@ _mesa_texstore_unorm1616(TEXSTORE_PARAMS) ((dstFormat == MESA_FORMAT_AL1616 && baseInternalFormat == GL_LUMINANCE_ALPHA && srcFormat == GL_LUMINANCE_ALPHA) || - (dstFormat == MESA_FORMAT_RG1616 && + (dstFormat == MESA_FORMAT_GR1616 && baseInternalFormat == srcFormat)) && srcType == GL_UNSIGNED_SHORT && littleEndian) { @@ -1953,7 +1952,7 @@ _mesa_texstore_unorm1616(TEXSTORE_PARAMS) for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; if (dstFormat == MESA_FORMAT_AL1616 || - dstFormat == MESA_FORMAT_RG1616) { + dstFormat == MESA_FORMAT_GR1616) { for (col = 0; col < srcWidth; col++) { GLushort l, a; @@ -2043,9 +2042,8 @@ _mesa_texstore_unorm16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_16(TEXSTORE_PARAMS) { - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - - ASSERT(dstFormat == MESA_FORMAT_RGBA_16); + ASSERT(dstFormat == MESA_FORMAT_RGBA_16 || + dstFormat == MESA_FORMAT_XBGR16161616_UNORM); ASSERT(_mesa_get_format_bytes(dstFormat) == 8); if (!ctx->_ImageTransferState && @@ -2062,17 +2060,21 @@ _mesa_texstore_rgba_16(TEXSTORE_PARAMS) } else { /* general path */ + /* Hardcode GL_RGBA as the base format, which forces alpha to 1.0 + * if the internal format is RGB. */ const GLfloat *tempImage = _mesa_make_temp_float_image(ctx, dims, baseInternalFormat, - baseFormat, + GL_RGBA, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking, ctx->_ImageTransferState); const GLfloat *src = tempImage; GLint img, row, col; + if (!tempImage) return GL_FALSE; + for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { @@ -2105,7 +2107,8 @@ _mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS) const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_SIGNED_RGB_16 || - dstFormat == MESA_FORMAT_SIGNED_RGBA_16); + dstFormat == MESA_FORMAT_SIGNED_RGBA_16 || + dstFormat == MESA_FORMAT_XBGR16161616_SNORM); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -2154,7 +2157,22 @@ _mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS) } dstRow += dstRowStride; src += 4 * srcWidth; - } else { + } + else if (dstFormat == MESA_FORMAT_XBGR16161616_SNORM) { + for (col = 0; col < srcWidth; col++) { + GLuint c; + + for (c = 0; c < 3; c++) { + GLshort p; + UNCLAMPED_FLOAT_TO_SHORT(p, src[col * 3 + c]); + dstRowS[col * comps + c] = p; + } + dstRowS[col * comps + 3] = 32767; + } + dstRow += dstRowStride; + src += 3 * srcWidth; + } + else { for (col = 0; col < srcWidth; col++) { GLuint c; for (c = 0; c < comps; c++) { @@ -2641,14 +2659,16 @@ _mesa_texstore_snorm1616(TEXSTORE_PARAMS) } /** - * Store a texture in MESA_FORMAT_SIGNED_RGBX8888. + * Store a texture in MESA_FORMAT_SIGNED_RGBX8888 or + * MESA_FORMAT_XBGR8888_SNORM. */ static GLboolean _mesa_texstore_signed_rgbx8888(TEXSTORE_PARAMS) { const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_SIGNED_RGBX8888); + ASSERT(dstFormat == MESA_FORMAT_SIGNED_RGBX8888 || + dstFormat == MESA_FORMAT_XBGR8888_SNORM); ASSERT(_mesa_get_format_bytes(dstFormat) == 4); { @@ -2668,13 +2688,25 @@ _mesa_texstore_signed_rgbx8888(TEXSTORE_PARAMS) GLbyte *dstRow = (GLbyte *) dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLbyte *dst = dstRow; - for (col = 0; col < srcWidth; col++) { - dst[3] = FLOAT_TO_BYTE_TEX(srcRow[RCOMP]); - dst[2] = FLOAT_TO_BYTE_TEX(srcRow[GCOMP]); - dst[1] = FLOAT_TO_BYTE_TEX(srcRow[BCOMP]); - dst[0] = 127; - srcRow += 3; - dst += 4; + if (dstFormat == MESA_FORMAT_SIGNED_RGBX8888) { + for (col = 0; col < srcWidth; col++) { + dst[3] = FLOAT_TO_BYTE_TEX(srcRow[RCOMP]); + dst[2] = FLOAT_TO_BYTE_TEX(srcRow[GCOMP]); + dst[1] = FLOAT_TO_BYTE_TEX(srcRow[BCOMP]); + dst[0] = 127; + srcRow += 3; + dst += 4; + } + } + else { + for (col = 0; col < srcWidth; col++) { + dst[0] = FLOAT_TO_BYTE_TEX(srcRow[RCOMP]); + dst[1] = FLOAT_TO_BYTE_TEX(srcRow[GCOMP]); + dst[2] = FLOAT_TO_BYTE_TEX(srcRow[BCOMP]); + dst[3] = 127; + srcRow += 3; + dst += 4; + } } dstRow += dstRowStride; } @@ -3004,8 +3036,14 @@ _mesa_texstore_s8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) { - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - const GLint components = _mesa_components_in_format(baseFormat); + GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + GLint components = _mesa_components_in_format(baseFormat); + + /* this forces alpha to 1 in _mesa_make_temp_float_image */ + if (dstFormat == MESA_FORMAT_XBGR32323232_FLOAT) { + baseFormat = GL_RGBA; + components = 4; + } ASSERT(dstFormat == MESA_FORMAT_RGBA_FLOAT32 || dstFormat == MESA_FORMAT_RGB_FLOAT32 || @@ -3014,7 +3052,8 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32 || dstFormat == MESA_FORMAT_INTENSITY_FLOAT32 || dstFormat == MESA_FORMAT_R_FLOAT32 || - dstFormat == MESA_FORMAT_RG_FLOAT32); + dstFormat == MESA_FORMAT_RG_FLOAT32 || + dstFormat == MESA_FORMAT_XBGR32323232_FLOAT); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_ALPHA || @@ -3074,8 +3113,14 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) { - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - const GLint components = _mesa_components_in_format(baseFormat); + GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + GLint components = _mesa_components_in_format(baseFormat); + + /* this forces alpha to 1 in _mesa_make_temp_float_image */ + if (dstFormat == MESA_FORMAT_XBGR16161616_FLOAT) { + baseFormat = GL_RGBA; + components = 4; + } ASSERT(dstFormat == MESA_FORMAT_RGBA_FLOAT16 || dstFormat == MESA_FORMAT_RGB_FLOAT16 || @@ -3084,7 +3129,8 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16 || dstFormat == MESA_FORMAT_INTENSITY_FLOAT16 || dstFormat == MESA_FORMAT_R_FLOAT16 || - dstFormat == MESA_FORMAT_RG_FLOAT16); + dstFormat == MESA_FORMAT_RG_FLOAT16 || + dstFormat == MESA_FORMAT_XBGR16161616_FLOAT); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_ALPHA || @@ -3143,8 +3189,14 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_int8(TEXSTORE_PARAMS) { - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - const GLint components = _mesa_components_in_format(baseFormat); + GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + GLint components = _mesa_components_in_format(baseFormat); + + /* this forces alpha to 1 in make_temp_uint_image */ + if (dstFormat == MESA_FORMAT_XBGR8888_SINT) { + baseFormat = GL_RGBA; + components = 4; + } ASSERT(dstFormat == MESA_FORMAT_R_INT8 || dstFormat == MESA_FORMAT_RG_INT8 || @@ -3153,7 +3205,8 @@ _mesa_texstore_rgba_int8(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_ALPHA_INT8 || dstFormat == MESA_FORMAT_INTENSITY_INT8 || dstFormat == MESA_FORMAT_LUMINANCE_INT8 || - dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_INT8); + dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_INT8 || + dstFormat == MESA_FORMAT_XBGR8888_SINT); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_RG || @@ -3220,8 +3273,14 @@ _mesa_texstore_rgba_int8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_int16(TEXSTORE_PARAMS) { - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - const GLint components = _mesa_components_in_format(baseFormat); + GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + GLint components = _mesa_components_in_format(baseFormat); + + /* this forces alpha to 1 in make_temp_uint_image */ + if (dstFormat == MESA_FORMAT_XBGR16161616_SINT) { + baseFormat = GL_RGBA; + components = 4; + } ASSERT(dstFormat == MESA_FORMAT_R_INT16 || dstFormat == MESA_FORMAT_RG_INT16 || @@ -3230,7 +3289,8 @@ _mesa_texstore_rgba_int16(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_ALPHA_INT16 || dstFormat == MESA_FORMAT_LUMINANCE_INT16 || dstFormat == MESA_FORMAT_INTENSITY_INT16 || - dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_INT16); + dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_INT16 || + dstFormat == MESA_FORMAT_XBGR16161616_SINT); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_RG || @@ -3297,8 +3357,14 @@ _mesa_texstore_rgba_int16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_int32(TEXSTORE_PARAMS) { - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - const GLint components = _mesa_components_in_format(baseFormat); + GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + GLint components = _mesa_components_in_format(baseFormat); + + /* this forces alpha to 1 in make_temp_uint_image */ + if (dstFormat == MESA_FORMAT_XBGR32323232_SINT) { + baseFormat = GL_RGBA; + components = 4; + } ASSERT(dstFormat == MESA_FORMAT_R_INT32 || dstFormat == MESA_FORMAT_RG_INT32 || @@ -3307,7 +3373,8 @@ _mesa_texstore_rgba_int32(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_ALPHA_INT32 || dstFormat == MESA_FORMAT_INTENSITY_INT32 || dstFormat == MESA_FORMAT_LUMINANCE_INT32 || - dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_INT32); + dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_INT32 || + dstFormat == MESA_FORMAT_XBGR32323232_SINT); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_RG || @@ -3374,8 +3441,14 @@ _mesa_texstore_rgba_int32(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS) { - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - const GLint components = _mesa_components_in_format(baseFormat); + GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + GLint components = _mesa_components_in_format(baseFormat); + + /* this forces alpha to 1 in make_temp_uint_image */ + if (dstFormat == MESA_FORMAT_XBGR8888_UINT) { + baseFormat = GL_RGBA; + components = 4; + } ASSERT(dstFormat == MESA_FORMAT_R_UINT8 || dstFormat == MESA_FORMAT_RG_UINT8 || @@ -3384,7 +3457,8 @@ _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_ALPHA_UINT8 || dstFormat == MESA_FORMAT_INTENSITY_UINT8 || dstFormat == MESA_FORMAT_LUMINANCE_UINT8 || - dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_UINT8); + dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_UINT8 || + dstFormat == MESA_FORMAT_XBGR8888_UINT); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_RG || @@ -3448,8 +3522,14 @@ _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS) { - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - const GLint components = _mesa_components_in_format(baseFormat); + GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + GLint components = _mesa_components_in_format(baseFormat); + + /* this forces alpha to 1 in make_temp_uint_image */ + if (dstFormat == MESA_FORMAT_XBGR16161616_UINT) { + baseFormat = GL_RGBA; + components = 4; + } ASSERT(dstFormat == MESA_FORMAT_R_UINT16 || dstFormat == MESA_FORMAT_RG_UINT16 || @@ -3458,7 +3538,8 @@ _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_ALPHA_UINT16 || dstFormat == MESA_FORMAT_INTENSITY_UINT16 || dstFormat == MESA_FORMAT_LUMINANCE_UINT16 || - dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_UINT16); + dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_UINT16 || + dstFormat == MESA_FORMAT_XBGR16161616_UINT); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_RG || @@ -3522,8 +3603,14 @@ _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_uint32(TEXSTORE_PARAMS) { - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - const GLint components = _mesa_components_in_format(baseFormat); + GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + GLint components = _mesa_components_in_format(baseFormat); + + /* this forces alpha to 1 in make_temp_uint_image */ + if (dstFormat == MESA_FORMAT_XBGR32323232_UINT) { + baseFormat = GL_RGBA; + components = 4; + } ASSERT(dstFormat == MESA_FORMAT_R_UINT32 || dstFormat == MESA_FORMAT_RG_UINT32 || @@ -3532,7 +3619,8 @@ _mesa_texstore_rgba_uint32(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_ALPHA_UINT32 || dstFormat == MESA_FORMAT_INTENSITY_UINT32 || dstFormat == MESA_FORMAT_LUMINANCE_UINT32 || - dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_UINT32); + dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_UINT32 || + dstFormat == MESA_FORMAT_XBGR32323232_UINT); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_RG || @@ -3619,10 +3707,21 @@ _mesa_texstore_srgba8(TEXSTORE_PARAMS) gl_format newDstFormat; GLboolean k; - ASSERT(dstFormat == MESA_FORMAT_SRGBA8); + ASSERT(dstFormat == MESA_FORMAT_SRGBA8 || + dstFormat == MESA_FORMAT_XBGR8888_SRGB); /* reuse normal rgba texstore code */ - newDstFormat = MESA_FORMAT_RGBA8888; + if (dstFormat == MESA_FORMAT_SRGBA8) { + newDstFormat = MESA_FORMAT_RGBA8888; + } + else if (dstFormat == MESA_FORMAT_XBGR8888_SRGB) { + newDstFormat = MESA_FORMAT_RGBX8888_REV; + } + else { + ASSERT(0); + return GL_TRUE; + } + k = _mesa_texstore_rgba8888(ctx, dims, baseInternalFormat, newDstFormat, dstRowStride, dstSlices, @@ -4051,8 +4150,8 @@ _mesa_get_texstore_func(gl_format format) table[MESA_FORMAT_GR88] = _mesa_texstore_unorm88; table[MESA_FORMAT_RG88] = _mesa_texstore_unorm88; table[MESA_FORMAT_R16] = _mesa_texstore_unorm16; + table[MESA_FORMAT_GR1616] = _mesa_texstore_unorm1616; table[MESA_FORMAT_RG1616] = _mesa_texstore_unorm1616; - table[MESA_FORMAT_RG1616_REV] = _mesa_texstore_unorm1616; table[MESA_FORMAT_ARGB2101010] = _mesa_texstore_argb2101010; table[MESA_FORMAT_Z24_S8] = _mesa_texstore_z24_s8; table[MESA_FORMAT_S8_Z24] = _mesa_texstore_s8_z24; @@ -4193,6 +4292,23 @@ _mesa_get_texstore_func(gl_format format) table[MESA_FORMAT_ARGB2101010_UINT] = _mesa_texstore_argb2101010_uint; table[MESA_FORMAT_ABGR2101010_UINT] = _mesa_texstore_abgr2101010_uint; + + table[MESA_FORMAT_XRGB4444_UNORM] = store_ubyte_texture; + table[MESA_FORMAT_XRGB1555_UNORM] = store_ubyte_texture; + table[MESA_FORMAT_XBGR8888_SNORM] = _mesa_texstore_signed_rgbx8888; + table[MESA_FORMAT_XBGR8888_SRGB] = _mesa_texstore_srgba8; + table[MESA_FORMAT_XBGR8888_UINT] = _mesa_texstore_rgba_uint8; + table[MESA_FORMAT_XBGR8888_SINT] = _mesa_texstore_rgba_int8; + table[MESA_FORMAT_XRGB2101010_UNORM] = _mesa_texstore_argb2101010; + table[MESA_FORMAT_XBGR16161616_UNORM] = _mesa_texstore_rgba_16; + table[MESA_FORMAT_XBGR16161616_SNORM] = _mesa_texstore_signed_rgba_16; + table[MESA_FORMAT_XBGR16161616_FLOAT] = _mesa_texstore_rgba_float16; + table[MESA_FORMAT_XBGR16161616_UINT] = _mesa_texstore_rgba_uint16; + table[MESA_FORMAT_XBGR16161616_SINT] = _mesa_texstore_rgba_int16; + table[MESA_FORMAT_XBGR32323232_FLOAT] = _mesa_texstore_rgba_float32; + table[MESA_FORMAT_XBGR32323232_UINT] = _mesa_texstore_rgba_uint32; + table[MESA_FORMAT_XBGR32323232_SINT] = _mesa_texstore_rgba_int32; + initialized = GL_TRUE; } |