diff options
author | marha <marha@users.sourceforge.net> | 2014-03-12 16:45:42 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-03-12 16:45:42 +0100 |
commit | cc6db22a772cc52ead6a5c11d7d02e7364f6326c (patch) | |
tree | d80b42172d703ec20ccd99c68a067505e2706899 /mesalib/src/mesa/main | |
parent | 2112b7dec49833ba872bd3ebcd7288930fec0796 (diff) | |
parent | cd8b0d0de3fcb53f6d3ece8ce26d97aaab2c0914 (diff) | |
download | vcxsrv-cc6db22a772cc52ead6a5c11d7d02e7364f6326c.tar.gz vcxsrv-cc6db22a772cc52ead6a5c11d7d02e7364f6326c.tar.bz2 vcxsrv-cc6db22a772cc52ead6a5c11d7d02e7364f6326c.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
mesa xserver xkbcomp git update 12 Mar 2014
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r-- | mesalib/src/mesa/main/format_pack.c | 12 | ||||
-rw-r--r-- | mesalib/src/mesa/main/format_unpack.c | 6 | ||||
-rw-r--r-- | mesalib/src/mesa/main/formats.c | 1613 | ||||
-rw-r--r-- | mesalib/src/mesa/main/formats.h | 505 | ||||
-rw-r--r-- | mesalib/src/mesa/main/mtypes.h | 23 | ||||
-rw-r--r-- | mesalib/src/mesa/main/shaderobj.c | 7 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texstore.c | 4 | ||||
-rw-r--r-- | mesalib/src/mesa/main/uniform_query.cpp | 13 | ||||
-rw-r--r-- | mesalib/src/mesa/main/uniforms.c | 20 | ||||
-rw-r--r-- | mesalib/src/mesa/main/uniforms.h | 67 |
10 files changed, 1017 insertions, 1253 deletions
diff --git a/mesalib/src/mesa/main/format_pack.c b/mesalib/src/mesa/main/format_pack.c index acab6cb8d..9fbd41746 100644 --- a/mesalib/src/mesa/main/format_pack.c +++ b/mesalib/src/mesa/main/format_pack.c @@ -1978,7 +1978,7 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format) table[MESA_FORMAT_Z24_UNORM_S8_UINT] = NULL; table[MESA_FORMAT_Z_UNORM16] = NULL; table[MESA_FORMAT_Z24_UNORM_X8_UINT] = NULL; - table[MESA_FORMAT_X8Z24_UNORM] = NULL; + table[MESA_FORMAT_X8_UINT_Z24_UNORM] = NULL; table[MESA_FORMAT_Z_UNORM32] = NULL; table[MESA_FORMAT_S_UINT8] = NULL; @@ -2144,7 +2144,7 @@ _mesa_get_pack_float_rgba_function(mesa_format format) table[MESA_FORMAT_Z24_UNORM_S8_UINT] = NULL; table[MESA_FORMAT_Z_UNORM16] = NULL; table[MESA_FORMAT_Z24_UNORM_X8_UINT] = NULL; - table[MESA_FORMAT_X8Z24_UNORM] = NULL; + table[MESA_FORMAT_X8_UINT_Z24_UNORM] = NULL; table[MESA_FORMAT_Z_UNORM32] = NULL; table[MESA_FORMAT_S_UINT8] = NULL; @@ -2476,7 +2476,7 @@ _mesa_get_pack_float_z_func(mesa_format format) { switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: - case MESA_FORMAT_X8Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: return pack_float_z_Z24_S8; case MESA_FORMAT_Z24_UNORM_S8_UINT: case MESA_FORMAT_Z24_UNORM_X8_UINT: @@ -2561,7 +2561,7 @@ _mesa_get_pack_uint_z_func(mesa_format format) { switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: - case MESA_FORMAT_X8Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: return pack_uint_z_Z24_S8; case MESA_FORMAT_Z24_UNORM_S8_UINT: case MESA_FORMAT_Z24_UNORM_X8_UINT: @@ -2647,7 +2647,7 @@ _mesa_pack_float_z_row(mesa_format format, GLuint n, { switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: - case MESA_FORMAT_X8Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: { /* don't disturb the stencil values */ GLuint *d = ((GLuint *) dst); @@ -2723,7 +2723,7 @@ _mesa_pack_uint_z_row(mesa_format format, GLuint n, { switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: - case MESA_FORMAT_X8Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: { /* don't disturb the stencil values */ GLuint *d = ((GLuint *) dst); diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c index 2348ef605..f85c875e4 100644 --- a/mesalib/src/mesa/main/format_unpack.c +++ b/mesalib/src/mesa/main/format_unpack.c @@ -2395,7 +2395,7 @@ get_unpack_rgba_function(mesa_format format) table[MESA_FORMAT_Z24_UNORM_S8_UINT] = unpack_S8_Z24; table[MESA_FORMAT_Z_UNORM16] = unpack_Z16; table[MESA_FORMAT_Z24_UNORM_X8_UINT] = unpack_X8_Z24; - table[MESA_FORMAT_X8Z24_UNORM] = unpack_Z24_X8; + table[MESA_FORMAT_X8_UINT_Z24_UNORM] = unpack_Z24_X8; table[MESA_FORMAT_Z_UNORM32] = unpack_Z32; table[MESA_FORMAT_S_UINT8] = unpack_S8; table[MESA_FORMAT_BGR_SRGB8] = unpack_SRGB8; @@ -4012,7 +4012,7 @@ _mesa_unpack_float_z_row(mesa_format format, GLuint n, switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: - case MESA_FORMAT_X8Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: unpack = unpack_float_z_Z24_X8; break; case MESA_FORMAT_Z24_UNORM_S8_UINT: @@ -4117,7 +4117,7 @@ _mesa_unpack_uint_z_row(mesa_format format, GLuint n, switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: - case MESA_FORMAT_X8Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: unpack = unpack_uint_z_Z24_X8; break; case MESA_FORMAT_Z24_UNORM_S8_UINT: diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c index 0cf97fa31..c3e80491d 100644 --- a/mesalib/src/mesa/main/formats.c +++ b/mesalib/src/mesa/main/formats.c @@ -78,6 +78,7 @@ struct gl_format_info */ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = { + /* Packed unorm formats */ { MESA_FORMAT_NONE, /* Name */ "MESA_FORMAT_NONE", /* StrName */ @@ -88,8 +89,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A8B8G8R8_UNORM, /* Name */ - "MESA_FORMAT_A8B8G8R8_UNORM", /* StrName */ + MESA_FORMAT_A8B8G8R8_UNORM, /* Name */ + "MESA_FORMAT_A8B8G8R8_UNORM",/* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ @@ -97,17 +98,17 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_R8G8B8A8_UNORM, /* Name */ - "MESA_FORMAT_R8G8B8A8_UNORM", /* StrName */ - GL_RGBA, /* BaseFormat */ + MESA_FORMAT_X8B8G8R8_UNORM, /* Name */ + "MESA_FORMAT_X8B8G8R8_UNORM",/* StrName */ + GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ - 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ + 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_B8G8R8A8_UNORM, /* Name */ - "MESA_FORMAT_B8G8R8A8_UNORM", /* StrName */ + MESA_FORMAT_R8G8B8A8_UNORM, /* Name */ + "MESA_FORMAT_R8G8B8A8_UNORM",/* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ @@ -115,26 +116,26 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A8R8G8B8_UNORM, /* Name */ - "MESA_FORMAT_A8R8G8B8_UNORM", /* StrName */ - GL_RGBA, /* BaseFormat */ + MESA_FORMAT_R8G8B8X8_UNORM, /* Name */ + "MESA_FORMAT_R8G8B8X8_UNORM",/* StrName */ + GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ - 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ + 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_X8B8G8R8_UNORM, /* Name */ - "MESA_FORMAT_X8B8G8R8_UNORM", /* StrName */ - GL_RGB, /* BaseFormat */ + MESA_FORMAT_B8G8R8A8_UNORM, /* Name */ + "MESA_FORMAT_B8G8R8A8_UNORM",/* StrName */ + GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ - 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ + 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_R8G8B8X8_UNORM, /* Name */ - "MESA_FORMAT_R8G8B8X8_UNORM", /* StrName */ + MESA_FORMAT_B8G8R8X8_UNORM, /* Name */ + "MESA_FORMAT_B8G8R8X8_UNORM",/* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ @@ -142,17 +143,17 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_B8G8R8X8_UNORM, /* Name */ - "MESA_FORMAT_B8G8R8X8_UNORM", /* StrName */ - GL_RGB, /* BaseFormat */ + MESA_FORMAT_A8R8G8B8_UNORM, /* Name */ + "MESA_FORMAT_A8R8G8B8_UNORM",/* StrName */ + GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ - 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ + 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_X8R8G8B8_UNORM, /* Name */ - "MESA_FORMAT_X8R8G8B8_UNORM", /* StrName */ + MESA_FORMAT_X8R8G8B8_UNORM, /* Name */ + "MESA_FORMAT_X8R8G8B8_UNORM",/* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ @@ -160,26 +161,26 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_BGR_UNORM8, /* Name */ - "MESA_FORMAT_BGR_UNORM8", /* StrName */ - GL_RGB, /* BaseFormat */ + MESA_FORMAT_L16A16_UNORM, /* Name */ + "MESA_FORMAT_L16A16_UNORM", /* StrName */ + GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ - 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 3 /* BlockWidth/Height,Bytes */ + 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */ + 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_RGB_UNORM8, /* Name */ - "MESA_FORMAT_RGB_UNORM8", /* StrName */ - GL_RGB, /* BaseFormat */ + MESA_FORMAT_A16L16_UNORM, /* Name */ + "MESA_FORMAT_A16L16_UNORM", /* StrName */ + GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ - 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 3 /* BlockWidth/Height,Bytes */ + 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */ + 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_B5G6R5_UNORM, /* Name */ - "MESA_FORMAT_B5G6R5_UNORM", /* StrName */ + MESA_FORMAT_B5G6R5_UNORM, /* Name */ + "MESA_FORMAT_B5G6R5_UNORM", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 5, 6, 5, 0, /* Red/Green/Blue/AlphaBits */ @@ -187,8 +188,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_R5G6B5_UNORM, /* Name */ - "MESA_FORMAT_R5G6B5_UNORM", /* StrName */ + MESA_FORMAT_R5G6B5_UNORM, /* Name */ + "MESA_FORMAT_R5G6B5_UNORM", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 5, 6, 5, 0, /* Red/Green/Blue/AlphaBits */ @@ -196,8 +197,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_B4G4R4A4_UNORM, /* Name */ - "MESA_FORMAT_B4G4R4A4_UNORM", /* StrName */ + MESA_FORMAT_B4G4R4A4_UNORM, /* Name */ + "MESA_FORMAT_B4G4R4A4_UNORM",/* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 4, 4, 4, 4, /* Red/Green/Blue/AlphaBits */ @@ -205,8 +206,17 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A4R4G4B4_UNORM, /* Name */ - "MESA_FORMAT_A4R4G4B4_UNORM", /* StrName */ + MESA_FORMAT_B4G4R4X4_UNORM, + "MESA_FORMAT_B4G4R4X4_UNORM", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_A4R4G4B4_UNORM, /* Name */ + "MESA_FORMAT_A4R4G4B4_UNORM",/* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 4, 4, 4, 4, /* Red/Green/Blue/AlphaBits */ @@ -214,8 +224,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A1B5G5R5_UNORM, /* Name */ - "MESA_FORMAT_A1B5G5R5_UNORM", /* StrName */ + MESA_FORMAT_A1B5G5R5_UNORM, /* Name */ + "MESA_FORMAT_A1B5G5R5_UNORM",/* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */ @@ -223,8 +233,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_B5G5R5A1_UNORM, /* Name */ - "MESA_FORMAT_B5G5R5A1_UNORM", /* StrName */ + MESA_FORMAT_B5G5R5A1_UNORM, /* Name */ + "MESA_FORMAT_B5G5R5A1_UNORM",/* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */ @@ -232,8 +242,17 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A1R5G5B5_UNORM, /* Name */ - "MESA_FORMAT_A1R5G5B5_UNORM", /* StrName */ + MESA_FORMAT_B5G5R5X1_UNORM, + "MESA_FORMAT_B5G5R5X1_UNORM", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 5, 5, 5, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_A1R5G5B5_UNORM, /* Name */ + "MESA_FORMAT_A1R5G5B5_UNORM",/* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */ @@ -241,17 +260,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_L4A4_UNORM, /* Name */ - "MESA_FORMAT_L4A4_UNORM", /* StrName */ - GL_LUMINANCE_ALPHA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED, /* DataType */ - 0, 0, 0, 4, /* Red/Green/Blue/AlphaBits */ - 4, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 1 /* BlockWidth/Height,Bytes */ - }, - { - MESA_FORMAT_L8A8_UNORM, /* Name */ - "MESA_FORMAT_L8A8_UNORM", /* StrName */ + MESA_FORMAT_L8A8_UNORM, /* Name */ + "MESA_FORMAT_L8A8_UNORM", /* StrName */ GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */ @@ -259,8 +269,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A8L8_UNORM, /* Name */ - "MESA_FORMAT_A8L8_UNORM", /* StrName */ + MESA_FORMAT_A8L8_UNORM, /* Name */ + "MESA_FORMAT_A8L8_UNORM", /* StrName */ GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */ @@ -268,26 +278,35 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_L16A16_UNORM, /* Name */ - "MESA_FORMAT_L16A16_UNORM", /* StrName */ - GL_LUMINANCE_ALPHA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED, /* DataType */ - 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */ - 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 4 /* BlockWidth/Height,Bytes */ + MESA_FORMAT_R8G8_UNORM, + "MESA_FORMAT_R8G8_UNORM", + GL_RG, + GL_UNSIGNED_NORMALIZED, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_G8R8_UNORM, + "MESA_FORMAT_G8R8_UNORM", + GL_RG, + GL_UNSIGNED_NORMALIZED, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 }, { - MESA_FORMAT_A16L16_UNORM, /* Name */ - "MESA_FORMAT_A16L16_UNORM", /* StrName */ + MESA_FORMAT_L4A4_UNORM, /* Name */ + "MESA_FORMAT_L4A4_UNORM", /* StrName */ GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ - 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */ - 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 4 /* BlockWidth/Height,Bytes */ + 0, 0, 0, 4, /* Red/Green/Blue/AlphaBits */ + 4, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_B2G3R3_UNORM, /* Name */ - "MESA_FORMAT_B2G3R3_UNORM", /* StrName */ + MESA_FORMAT_B2G3R3_UNORM, /* Name */ + "MESA_FORMAT_B2G3R3_UNORM", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 3, 3, 2, 0, /* Red/Green/Blue/AlphaBits */ @@ -295,8 +314,118 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A_UNORM8, /* Name */ - "MESA_FORMAT_A_UNORM8", /* StrName */ + MESA_FORMAT_R16G16_UNORM, + "MESA_FORMAT_R16G16_UNORM", + GL_RG, + GL_UNSIGNED_NORMALIZED, + 16, 16, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_G16R16_UNORM, + "MESA_FORMAT_G16R16_UNORM", + GL_RG, + GL_UNSIGNED_NORMALIZED, + 16, 16, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_B10G10R10A2_UNORM, + "MESA_FORMAT_B10G10R10A2_UNORM", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 10, 10, 10, 2, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_B10G10R10X2_UNORM, + "MESA_FORMAT_B10G10R10X2_UNORM", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 10, 10, 10, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_R10G10B10A2_UNORM, + "MESA_FORMAT_R10G10B10A2_UNORM", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 10, 10, 10, 2, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_S8_UINT_Z24_UNORM, /* Name */ + "MESA_FORMAT_S8_UINT_Z24_UNORM", /* StrName */ + GL_DEPTH_STENCIL, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 24, 8, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_X8_UINT_Z24_UNORM, /* Name */ + "MESA_FORMAT_X8_UINT_Z24_UNORM", /* StrName */ + GL_DEPTH_COMPONENT, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_Z24_UNORM_S8_UINT, /* Name */ + "MESA_FORMAT_Z24_UNORM_S8_UINT", /* StrName */ + GL_DEPTH_STENCIL, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 24, 8, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_Z24_UNORM_X8_UINT, /* Name */ + "MESA_FORMAT_Z24_UNORM_X8_UINT", /* StrName */ + GL_DEPTH_COMPONENT, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_YCBCR, /* Name */ + "MESA_FORMAT_YCBCR", /* StrName */ + GL_YCBCR_MESA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_YCBCR_REV, /* Name */ + "MESA_FORMAT_YCBCR_REV", /* StrName */ + GL_YCBCR_MESA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + + /* Array unorm formats */ + { + MESA_FORMAT_DUDV8, + "MESA_FORMAT_DUDV8", + GL_DUDV_ATI, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_A_UNORM8, /* Name */ + "MESA_FORMAT_A_UNORM8", /* StrName */ GL_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */ @@ -304,8 +433,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A_UNORM16, /* Name */ - "MESA_FORMAT_A_UNORM16", /* StrName */ + MESA_FORMAT_A_UNORM16, /* Name */ + "MESA_FORMAT_A_UNORM16", /* StrName */ GL_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */ @@ -313,8 +442,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_L_UNORM8, /* Name */ - "MESA_FORMAT_L_UNORM8", /* StrName */ + MESA_FORMAT_L_UNORM8, /* Name */ + "MESA_FORMAT_L_UNORM8", /* StrName */ GL_LUMINANCE, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -322,8 +451,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_L_UNORM16, /* Name */ - "MESA_FORMAT_L_UNORM16", /* StrName */ + MESA_FORMAT_L_UNORM16, /* Name */ + "MESA_FORMAT_L_UNORM16", /* StrName */ GL_LUMINANCE, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -331,8 +460,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_I_UNORM8, /* Name */ - "MESA_FORMAT_I_UNORM8", /* StrName */ + MESA_FORMAT_I_UNORM8, /* Name */ + "MESA_FORMAT_I_UNORM8", /* StrName */ GL_INTENSITY, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -340,8 +469,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_I_UNORM16, /* Name */ - "MESA_FORMAT_I_UNORM16", /* StrName */ + MESA_FORMAT_I_UNORM16, /* Name */ + "MESA_FORMAT_I_UNORM16", /* StrName */ GL_INTENSITY, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -349,24 +478,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_YCBCR, /* Name */ - "MESA_FORMAT_YCBCR", /* StrName */ - GL_YCBCR_MESA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED, /* DataType */ - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 2 /* BlockWidth/Height,Bytes */ - }, - { - MESA_FORMAT_YCBCR_REV, /* Name */ - "MESA_FORMAT_YCBCR_REV", /* StrName */ - GL_YCBCR_MESA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED, /* DataType */ - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 2 /* BlockWidth/Height,Bytes */ - }, - { MESA_FORMAT_R_UNORM8, "MESA_FORMAT_R_UNORM8", GL_RED, @@ -376,24 +487,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 }, { - MESA_FORMAT_R8G8_UNORM, - "MESA_FORMAT_R8G8_UNORM", - GL_RG, - GL_UNSIGNED_NORMALIZED, - 8, 8, 0, 0, - 0, 0, 0, 0, 0, - 1, 1, 2 - }, - { - MESA_FORMAT_G8R8_UNORM, - "MESA_FORMAT_G8R8_UNORM", - GL_RG, - GL_UNSIGNED_NORMALIZED, - 8, 8, 0, 0, - 0, 0, 0, 0, 0, - 1, 1, 2 - }, - { MESA_FORMAT_R_UNORM16, "MESA_FORMAT_R_UNORM16", GL_RED, @@ -403,53 +496,44 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_R16G16_UNORM, - "MESA_FORMAT_R16G16_UNORM", - GL_RG, - GL_UNSIGNED_NORMALIZED, - 16, 16, 0, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 + MESA_FORMAT_BGR_UNORM8, /* Name */ + "MESA_FORMAT_BGR_UNORM8", /* StrName */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 3 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_G16R16_UNORM, - "MESA_FORMAT_G16R16_UNORM", - GL_RG, - GL_UNSIGNED_NORMALIZED, - 16, 16, 0, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 + MESA_FORMAT_RGB_UNORM8, /* Name */ + "MESA_FORMAT_RGB_UNORM8", /* StrName */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 3 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_B10G10R10A2_UNORM, - "MESA_FORMAT_B10G10R10A2_UNORM", + MESA_FORMAT_RGBA_UNORM16, + "MESA_FORMAT_RGBA_UNORM16", GL_RGBA, GL_UNSIGNED_NORMALIZED, - 10, 10, 10, 2, + 16, 16, 16, 16, 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_S8_UINT_Z24_UNORM, /* Name */ - "MESA_FORMAT_S8_UINT_Z24_UNORM", /* StrName */ - GL_DEPTH_STENCIL, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED, /* DataType */ - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ - 0, 0, 0, 24, 8, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 4 /* BlockWidth/Height,Bytes */ + 1, 1, 8 }, { - MESA_FORMAT_Z24_UNORM_S8_UINT, /* Name */ - "MESA_FORMAT_Z24_UNORM_S8_UINT", /* StrName */ - GL_DEPTH_STENCIL, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED, /* DataType */ - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ - 0, 0, 0, 24, 8, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 4 /* BlockWidth/Height,Bytes */ + MESA_FORMAT_RGBX_UNORM16, + "MESA_FORMAT_RGBX_UNORM16", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 8 }, { - MESA_FORMAT_Z_UNORM16, /* Name */ - "MESA_FORMAT_Z_UNORM16", /* StrName */ + MESA_FORMAT_Z_UNORM16, /* Name */ + "MESA_FORMAT_Z_UNORM16", /* StrName */ GL_DEPTH_COMPONENT, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -457,26 +541,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_Z24_UNORM_X8_UINT, /* Name */ - "MESA_FORMAT_Z24_UNORM_X8_UINT", /* StrName */ - GL_DEPTH_COMPONENT, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED, /* DataType */ - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ - 0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 4 /* BlockWidth/Height,Bytes */ - }, - { - MESA_FORMAT_X8Z24_UNORM, /* Name */ - "MESA_FORMAT_X8Z24_UNORM", /* StrName */ - GL_DEPTH_COMPONENT, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED, /* DataType */ - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ - 0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 4 /* BlockWidth/Height,Bytes */ - }, - { - MESA_FORMAT_Z_UNORM32, /* Name */ - "MESA_FORMAT_Z_UNORM32", /* StrName */ + MESA_FORMAT_Z_UNORM32, /* Name */ + "MESA_FORMAT_Z_UNORM32", /* StrName */ GL_DEPTH_COMPONENT, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -484,206 +550,318 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_S_UINT8, /* Name */ - "MESA_FORMAT_S_UINT8", /* StrName */ + MESA_FORMAT_S_UINT8, /* Name */ + "MESA_FORMAT_S_UINT8", /* StrName */ GL_STENCIL_INDEX, /* BaseFormat */ GL_UNSIGNED_INT, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ 0, 0, 0, 0, 8, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 1 /* BlockWidth/Height,Bytes */ }, + + /* Packed signed/normalized formats */ { - MESA_FORMAT_BGR_SRGB8, - "MESA_FORMAT_BGR_SRGB8", + MESA_FORMAT_A8B8G8R8_SNORM, + "MESA_FORMAT_A8B8G8R8_SNORM", + GL_RGBA, + GL_SIGNED_NORMALIZED, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_X8B8G8R8_SNORM, + "MESA_FORMAT_X8B8G8R8_SNORM", GL_RGB, - GL_UNSIGNED_NORMALIZED, + GL_SIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0, 0, 0, 0, - 1, 1, 3 + 1, 1, 4 /* 4 bpp, but no alpha */ }, { - MESA_FORMAT_A8B8G8R8_SRGB, - "MESA_FORMAT_A8B8G8R8_SRGB", + MESA_FORMAT_R8G8B8A8_SNORM, + "MESA_FORMAT_R8G8B8A8_SNORM", GL_RGBA, - GL_UNSIGNED_NORMALIZED, + GL_SIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 0, 0, 0, 1, 1, 4 }, { - MESA_FORMAT_B8G8R8A8_SRGB, - "MESA_FORMAT_B8G8R8A8_SRGB", - GL_RGBA, - GL_UNSIGNED_NORMALIZED, - 8, 8, 8, 8, + MESA_FORMAT_R8G8B8X8_SNORM, + "MESA_FORMAT_R8G8B8X8_SNORM", + GL_RGB, + GL_SIGNED_NORMALIZED, + 8, 8, 8, 0, 0, 0, 0, 0, 0, 1, 1, 4 }, { - MESA_FORMAT_R8G8B8A8_SRGB, - "MESA_FORMAT_R8G8B8A8_SRGB", - GL_RGBA, - GL_UNSIGNED_NORMALIZED, - 8, 8, 8, 8, + MESA_FORMAT_R16G16_SNORM, + "MESA_FORMAT_R16G16_SNORM", + GL_RG, + GL_SIGNED_NORMALIZED, + 16, 16, 0, 0, 0, 0, 0, 0, 0, 1, 1, 4 }, { - MESA_FORMAT_L_SRGB8, - "MESA_FORMAT_L_SRGB8", - GL_LUMINANCE, - GL_UNSIGNED_NORMALIZED, - 0, 0, 0, 0, - 8, 0, 0, 0, 0, - 1, 1, 1 + MESA_FORMAT_G16R16_SNORM, + "MESA_FORMAT_G16R16_SNORM", + GL_RG, + GL_SIGNED_NORMALIZED, + 16, 16, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 }, { - MESA_FORMAT_L8A8_SRGB, - "MESA_FORMAT_L8A8_SRGB", + MESA_FORMAT_R8G8_SNORM, + "MESA_FORMAT_R8G8_SNORM", + GL_RG, + GL_SIGNED_NORMALIZED, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_G8R8_SNORM, + "MESA_FORMAT_G8R8_SNORM", + GL_RG, + GL_SIGNED_NORMALIZED, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_L8A8_SNORM, + "MESA_FORMAT_L8A8_SNORM", GL_LUMINANCE_ALPHA, - GL_UNSIGNED_NORMALIZED, + GL_SIGNED_NORMALIZED, 0, 0, 0, 8, 8, 0, 0, 0, 0, 1, 1, 2 }, + + /* Array signed/normalized formats */ { - MESA_FORMAT_SRGB_DXT1, /* Name */ - "MESA_FORMAT_SRGB_DXT1", /* StrName */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED, /* DataType */ - 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */ - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 4, 4, 8 /* 8 bytes per 4x4 block */ + MESA_FORMAT_A_SNORM8, + "MESA_FORMAT_A_SNORM8", + GL_ALPHA, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 8, + 0, 0, 0, 0, 0, + 1, 1, 1 }, { - MESA_FORMAT_SRGBA_DXT1, - "MESA_FORMAT_SRGBA_DXT1", - GL_RGBA, - GL_UNSIGNED_NORMALIZED, - 4, 4, 4, 4, + MESA_FORMAT_A_SNORM16, + "MESA_FORMAT_A_SNORM16", + GL_ALPHA, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 16, 0, 0, 0, 0, 0, - 4, 4, 8 /* 8 bytes per 4x4 block */ + 1, 1, 2 }, { - MESA_FORMAT_SRGBA_DXT3, - "MESA_FORMAT_SRGBA_DXT3", - GL_RGBA, - GL_UNSIGNED_NORMALIZED, - 4, 4, 4, 4, - 0, 0, 0, 0, 0, - 4, 4, 16 /* 16 bytes per 4x4 block */ + MESA_FORMAT_L_SNORM8, + "MESA_FORMAT_L_SNORM8", + GL_LUMINANCE, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 0, + 8, 0, 0, 0, 0, + 1, 1, 1 }, { - MESA_FORMAT_SRGBA_DXT5, - "MESA_FORMAT_SRGBA_DXT5", - GL_RGBA, - GL_UNSIGNED_NORMALIZED, - 4, 4, 4, 4, + MESA_FORMAT_L_SNORM16, + "MESA_FORMAT_L_SNORM16", + GL_LUMINANCE, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 0, + 16, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_I_SNORM8, + "MESA_FORMAT_I_SNORM8", + GL_INTENSITY, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 0, + 0, 8, 0, 0, 0, + 1, 1, 1 + }, + { + MESA_FORMAT_I_SNORM16, + "MESA_FORMAT_I_SNORM16", + GL_INTENSITY, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 0, + 0, 16, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_R_SNORM8, /* Name */ + "MESA_FORMAT_R_SNORM8", /* StrName */ + GL_RED, /* BaseFormat */ + GL_SIGNED_NORMALIZED, /* DataType */ + 8, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 1 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_R_SNORM16, + "MESA_FORMAT_R_SNORM16", + GL_RED, + GL_SIGNED_NORMALIZED, + 16, 0, 0, 0, 0, 0, 0, 0, 0, - 4, 4, 16 /* 16 bytes per 4x4 block */ + 1, 1, 2 }, - { - MESA_FORMAT_RGB_FXT1, - "MESA_FORMAT_RGB_FXT1", + MESA_FORMAT_LA_SNORM16, + "MESA_FORMAT_LA_SNORM16", + GL_LUMINANCE_ALPHA, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 16, + 16, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_RGB_SNORM16, + "MESA_FORMAT_RGB_SNORM16", GL_RGB, - GL_UNSIGNED_NORMALIZED, - 4, 4, 4, 0, /* approx Red/Green/BlueBits */ + GL_SIGNED_NORMALIZED, + 16, 16, 16, 0, 0, 0, 0, 0, 0, - 8, 4, 16 /* 16 bytes per 8x4 block */ + 1, 1, 6 }, { - MESA_FORMAT_RGBA_FXT1, - "MESA_FORMAT_RGBA_FXT1", + MESA_FORMAT_RGBA_SNORM16, + "MESA_FORMAT_RGBA_SNORM16", GL_RGBA, - GL_UNSIGNED_NORMALIZED, - 4, 4, 4, 1, /* approx Red/Green/Blue/AlphaBits */ + GL_SIGNED_NORMALIZED, + 16, 16, 16, 16, 0, 0, 0, 0, 0, - 8, 4, 16 /* 16 bytes per 8x4 block */ + 1, 1, 8 }, - { - MESA_FORMAT_RGB_DXT1, /* Name */ - "MESA_FORMAT_RGB_DXT1", /* StrName */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED, /* DataType */ - 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */ - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 4, 4, 8 /* 8 bytes per 4x4 block */ + MESA_FORMAT_RGBX_SNORM16, + "MESA_FORMAT_RGBX_SNORM16", + GL_RGB, + GL_SIGNED_NORMALIZED, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 8 }, + + /* Packed sRGB formats */ { - MESA_FORMAT_RGBA_DXT1, - "MESA_FORMAT_RGBA_DXT1", + MESA_FORMAT_A8B8G8R8_SRGB, + "MESA_FORMAT_A8B8G8R8_SRGB", GL_RGBA, GL_UNSIGNED_NORMALIZED, - 4, 4, 4, 4, + 8, 8, 8, 8, 0, 0, 0, 0, 0, - 4, 4, 8 /* 8 bytes per 4x4 block */ + 1, 1, 4 }, { - MESA_FORMAT_RGBA_DXT3, - "MESA_FORMAT_RGBA_DXT3", + MESA_FORMAT_B8G8R8A8_SRGB, + "MESA_FORMAT_B8G8R8A8_SRGB", GL_RGBA, GL_UNSIGNED_NORMALIZED, - 4, 4, 4, 4, + 8, 8, 8, 8, 0, 0, 0, 0, 0, - 4, 4, 16 /* 16 bytes per 4x4 block */ + 1, 1, 4 }, { - MESA_FORMAT_RGBA_DXT5, - "MESA_FORMAT_RGBA_DXT5", - GL_RGBA, - GL_UNSIGNED_NORMALIZED, - 4, 4, 4, 4, + MESA_FORMAT_B8G8R8X8_SRGB, + "MESA_FORMAT_B8G8R8X8_SRGB", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 0, 0, 0, 0, 0, 0, - 4, 4, 16 /* 16 bytes per 4x4 block */ + 1, 1, 4 }, { - MESA_FORMAT_RGBA_FLOAT32, - "MESA_FORMAT_RGBA_FLOAT32", + MESA_FORMAT_R8G8B8A8_SRGB, + "MESA_FORMAT_R8G8B8A8_SRGB", GL_RGBA, - GL_FLOAT, - 32, 32, 32, 32, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 8, 0, 0, 0, 0, 0, - 1, 1, 16 + 1, 1, 4 }, { - MESA_FORMAT_RGBA_FLOAT16, - "MESA_FORMAT_RGBA_FLOAT16", - GL_RGBA, - GL_FLOAT, - 16, 16, 16, 16, + MESA_FORMAT_R8G8B8X8_SRGB, + "MESA_FORMAT_R8G8B8X8_SRGB", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 0, 0, 0, 0, 0, 0, - 1, 1, 8 + 1, 1, 4 }, { - MESA_FORMAT_RGB_FLOAT32, - "MESA_FORMAT_RGB_FLOAT32", + MESA_FORMAT_L8A8_SRGB, + "MESA_FORMAT_L8A8_SRGB", + GL_LUMINANCE_ALPHA, + GL_UNSIGNED_NORMALIZED, + 0, 0, 0, 8, + 8, 0, 0, 0, 0, + 1, 1, 2 + }, + + /* Array sRGB formats */ + { + MESA_FORMAT_L_SRGB8, + "MESA_FORMAT_L_SRGB8", + GL_LUMINANCE, + GL_UNSIGNED_NORMALIZED, + 0, 0, 0, 0, + 8, 0, 0, 0, 0, + 1, 1, 1 + }, + { + MESA_FORMAT_BGR_SRGB8, + "MESA_FORMAT_BGR_SRGB8", GL_RGB, - GL_FLOAT, - 32, 32, 32, 0, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 0, 0, 0, 0, 0, 0, - 1, 1, 12 + 1, 1, 3 }, + + /* Packed float formats */ { - MESA_FORMAT_RGB_FLOAT16, - "MESA_FORMAT_RGB_FLOAT16", + MESA_FORMAT_R9G9B9E5_FLOAT, + "MESA_FORMAT_RGB9_E5", GL_RGB, GL_FLOAT, - 16, 16, 16, 0, + 9, 9, 9, 0, 0, 0, 0, 0, 0, - 1, 1, 6 + 1, 1, 4 }, { - MESA_FORMAT_A_FLOAT32, - "MESA_FORMAT_A_FLOAT32", - GL_ALPHA, + MESA_FORMAT_R11G11B10_FLOAT, + "MESA_FORMAT_R11G11B10_FLOAT", + GL_RGB, GL_FLOAT, - 0, 0, 0, 32, + 11, 11, 10, 0, 0, 0, 0, 0, 0, 1, 1, 4 }, { + MESA_FORMAT_Z32_FLOAT_S8X24_UINT, /* Name */ + "MESA_FORMAT_Z32_FLOAT_S8X24_UINT", /* StrName */ + GL_DEPTH_STENCIL, /* BaseFormat */ + /* DataType here is used to answer GL_TEXTURE_DEPTH_TYPE queries, and is + * never used for stencil because stencil is always GL_UNSIGNED_INT. + */ + GL_FLOAT, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 32, 8, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 8 /* BlockWidth/Height,Bytes */ + }, + + /* Array float formats */ + { MESA_FORMAT_A_FLOAT16, "MESA_FORMAT_A_FLOAT16", GL_ALPHA, @@ -693,12 +871,12 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_L_FLOAT32, - "MESA_FORMAT_L_FLOAT32", - GL_LUMINANCE, + MESA_FORMAT_A_FLOAT32, + "MESA_FORMAT_A_FLOAT32", + GL_ALPHA, GL_FLOAT, - 0, 0, 0, 0, - 32, 0, 0, 0, 0, + 0, 0, 0, 32, + 0, 0, 0, 0, 0, 1, 1, 4 }, { @@ -711,13 +889,13 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_LA_FLOAT32, - "MESA_FORMAT_LA_FLOAT32", - GL_LUMINANCE_ALPHA, + MESA_FORMAT_L_FLOAT32, + "MESA_FORMAT_L_FLOAT32", + GL_LUMINANCE, GL_FLOAT, - 0, 0, 0, 32, + 0, 0, 0, 0, 32, 0, 0, 0, 0, - 1, 1, 8 + 1, 1, 4 }, { MESA_FORMAT_LA_FLOAT16, @@ -729,6 +907,24 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { + MESA_FORMAT_LA_FLOAT32, + "MESA_FORMAT_LA_FLOAT32", + GL_LUMINANCE_ALPHA, + GL_FLOAT, + 0, 0, 0, 32, + 32, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_I_FLOAT16, + "MESA_FORMAT_I_FLOAT16", + GL_INTENSITY, + GL_FLOAT, + 0, 0, 0, 0, + 0, 16, 0, 0, 0, + 1, 1, 2 + }, + { MESA_FORMAT_I_FLOAT32, "MESA_FORMAT_I_FLOAT32", GL_INTENSITY, @@ -738,12 +934,12 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_I_FLOAT16, - "MESA_FORMAT_I_FLOAT16", - GL_INTENSITY, + MESA_FORMAT_R_FLOAT16, + "MESA_FORMAT_R_FLOAT16", + GL_RED, GL_FLOAT, - 0, 0, 0, 0, - 0, 16, 0, 0, 0, + 16, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 1, 2 }, { @@ -756,13 +952,13 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_R_FLOAT16, - "MESA_FORMAT_R_FLOAT16", - GL_RED, + MESA_FORMAT_RG_FLOAT16, + "MESA_FORMAT_RG_FLOAT16", + GL_RG, GL_FLOAT, - 16, 0, 0, 0, + 16, 16, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 2 + 1, 1, 4 }, { MESA_FORMAT_RG_FLOAT32, @@ -774,17 +970,90 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_RG_FLOAT16, - "MESA_FORMAT_RG_FLOAT16", - GL_RG, + MESA_FORMAT_RGB_FLOAT16, + "MESA_FORMAT_RGB_FLOAT16", + GL_RGB, GL_FLOAT, - 16, 16, 0, 0, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 6 + }, + { + MESA_FORMAT_RGB_FLOAT32, + "MESA_FORMAT_RGB_FLOAT32", + GL_RGB, + GL_FLOAT, + 32, 32, 32, 0, + 0, 0, 0, 0, 0, + 1, 1, 12 + }, + { + MESA_FORMAT_RGBA_FLOAT16, + "MESA_FORMAT_RGBA_FLOAT16", + GL_RGBA, + GL_FLOAT, + 16, 16, 16, 16, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RGBA_FLOAT32, + "MESA_FORMAT_RGBA_FLOAT32", + GL_RGBA, + GL_FLOAT, + 32, 32, 32, 32, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, + { + MESA_FORMAT_RGBX_FLOAT16, + "MESA_FORMAT_RGBX_FLOAT16", + GL_RGB, + GL_FLOAT, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RGBX_FLOAT32, + "MESA_FORMAT_RGBX_FLOAT32", + GL_RGB, + GL_FLOAT, + 32, 32, 32, 0, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, + { + MESA_FORMAT_Z_FLOAT32, /* Name */ + "MESA_FORMAT_Z_FLOAT32", /* StrName */ + GL_DEPTH_COMPONENT, /* BaseFormat */ + GL_FLOAT, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 32, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + + /* Packed signed/unsigned non-normalized integer formats */ + { + MESA_FORMAT_B10G10R10A2_UINT, + "MESA_FORMAT_B10G10R10A2_UINT", + GL_RGBA, + GL_UNSIGNED_INT, + 10, 10, 10, 2, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_R10G10B10A2_UINT, + "MESA_FORMAT_R10G10B10A2_UINT", + GL_RGBA, + GL_UNSIGNED_INT, + 10, 10, 10, 2, 0, 0, 0, 0, 0, 1, 1, 4 }, - /* unnormalized signed int formats */ - /* unnormalized unsigned int formats */ + /* Array signed/unsigned non-normalized integer formats */ { MESA_FORMAT_A_UINT8, "MESA_FORMAT_A_UINT8", @@ -1001,42 +1270,41 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 32, 0, 0, 0, 0, 1, 1, 8 }, - { - MESA_FORMAT_R_SINT8, - "MESA_FORMAT_R_SINT8", + MESA_FORMAT_R_UINT8, + "MESA_FORMAT_R_UINT8", GL_RED, - GL_INT, + GL_UNSIGNED_INT, 8, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1 }, { - MESA_FORMAT_RG_SINT8, - "MESA_FORMAT_RG_SINT8", - GL_RG, - GL_INT, - 8, 8, 0, 0, + MESA_FORMAT_R_UINT16, + "MESA_FORMAT_R_UINT16", + GL_RED, + GL_UNSIGNED_INT, + 16, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2 }, { - MESA_FORMAT_RGB_SINT8, - "MESA_FORMAT_RGB_SINT8", - GL_RGB, - GL_INT, - 8, 8, 8, 0, + MESA_FORMAT_R_UINT32, + "MESA_FORMAT_R_UINT32", + GL_RED, + GL_UNSIGNED_INT, + 32, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 3 + 1, 1, 4 }, { - MESA_FORMAT_RGBA_SINT8, - "MESA_FORMAT_RGBA_SINT8", - GL_RGBA, + MESA_FORMAT_R_SINT8, + "MESA_FORMAT_R_SINT8", + GL_RED, GL_INT, - 8, 8, 8, 8, + 8, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 4 + 1, 1, 1 }, { MESA_FORMAT_R_SINT16, @@ -1048,38 +1316,56 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_RG_SINT16, - "MESA_FORMAT_RG_SINT16", - GL_RG, + MESA_FORMAT_R_SINT32, + "MESA_FORMAT_R_SINT32", + GL_RED, GL_INT, + 32, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_RG_UINT8, + "MESA_FORMAT_RG_UINT8", + GL_RG, + GL_UNSIGNED_INT, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_RG_UINT16, + "MESA_FORMAT_RG_UINT16", + GL_RG, + GL_UNSIGNED_INT, 16, 16, 0, 0, 0, 0, 0, 0, 0, 1, 1, 4 }, { - MESA_FORMAT_RGB_SINT16, - "MESA_FORMAT_RGB_SINT16", - GL_RGB, - GL_INT, - 16, 16, 16, 0, + MESA_FORMAT_RG_UINT32, + "MESA_FORMAT_RG_UINT32", + GL_RG, + GL_UNSIGNED_INT, + 32, 32, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 6 + 1, 1, 8 }, { - MESA_FORMAT_RGBA_SINT16, - "MESA_FORMAT_RGBA_SINT16", - GL_RGBA, + MESA_FORMAT_RG_SINT8, + "MESA_FORMAT_RG_SINT8", + GL_RG, GL_INT, - 16, 16, 16, 16, + 8, 8, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 8 + 1, 1, 2 }, { - MESA_FORMAT_R_SINT32, - "MESA_FORMAT_R_SINT32", - GL_RED, + MESA_FORMAT_RG_SINT16, + "MESA_FORMAT_RG_SINT16", + GL_RG, GL_INT, - 32, 0, 0, 0, + 16, 16, 0, 0, 0, 0, 0, 0, 0, 1, 1, 4 }, @@ -1093,51 +1379,60 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_RGB_SINT32, - "MESA_FORMAT_RGB_SINT32", + MESA_FORMAT_RGB_UINT8, + "MESA_FORMAT_RGB_UINT8", GL_RGB, - GL_INT, - 32, 32, 32, 0, - 0, 0, 0, 0, 0, - 1, 1, 12 - }, - { - MESA_FORMAT_RGBA_SINT32, - "MESA_FORMAT_RGBA_SINT32", - GL_RGBA, - GL_INT, - 32, 32, 32, 32, + GL_UNSIGNED_INT, + 8, 8, 8, 0, 0, 0, 0, 0, 0, - 1, 1, 16 + 1, 1, 3 }, { - MESA_FORMAT_R_UINT8, - "MESA_FORMAT_R_UINT8", - GL_RED, + MESA_FORMAT_RGB_UINT16, + "MESA_FORMAT_RGB_UINT16", + GL_RGB, GL_UNSIGNED_INT, - 8, 0, 0, 0, + 16, 16, 16, 0, 0, 0, 0, 0, 0, - 1, 1, 1 + 1, 1, 6 }, { - MESA_FORMAT_RG_UINT8, - "MESA_FORMAT_RG_UINT8", - GL_RG, + MESA_FORMAT_RGB_UINT32, + "MESA_FORMAT_RGB_UINT32", + GL_RGB, GL_UNSIGNED_INT, - 8, 8, 0, 0, + 32, 32, 32, 0, 0, 0, 0, 0, 0, - 1, 1, 2 + 1, 1, 12 }, { - MESA_FORMAT_RGB_UINT8, - "MESA_FORMAT_RGB_UINT8", + MESA_FORMAT_RGB_SINT8, + "MESA_FORMAT_RGB_SINT8", GL_RGB, - GL_UNSIGNED_INT, + GL_INT, 8, 8, 8, 0, 0, 0, 0, 0, 0, 1, 1, 3 }, { + MESA_FORMAT_RGB_SINT16, + "MESA_FORMAT_RGB_SINT16", + GL_RGB, + GL_INT, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 6 + }, + { + MESA_FORMAT_RGB_SINT32, + "MESA_FORMAT_RGB_SINT32", + GL_RGB, + GL_INT, + 32, 32, 32, 0, + 0, 0, 0, 0, 0, + 1, 1, 12 + }, + { MESA_FORMAT_RGBA_UINT8, "MESA_FORMAT_RGBA_UINT8", GL_RGBA, @@ -1147,182 +1442,202 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_R_UINT16, - "MESA_FORMAT_R_UINT16", - GL_RED, + MESA_FORMAT_RGBA_UINT16, + "MESA_FORMAT_RGBA_UINT16", + GL_RGBA, GL_UNSIGNED_INT, - 16, 0, 0, 0, + 16, 16, 16, 16, 0, 0, 0, 0, 0, - 1, 1, 2 + 1, 1, 8 }, { - MESA_FORMAT_RG_UINT16, - "MESA_FORMAT_RG_UINT16", - GL_RG, + MESA_FORMAT_RGBA_UINT32, + "MESA_FORMAT_RGBA_UINT32", + GL_RGBA, GL_UNSIGNED_INT, - 16, 16, 0, 0, + 32, 32, 32, 32, 0, 0, 0, 0, 0, - 1, 1, 4 + 1, 1, 16 }, { - MESA_FORMAT_RGB_UINT16, - "MESA_FORMAT_RGB_UINT16", - GL_RGB, - GL_UNSIGNED_INT, - 16, 16, 16, 0, + MESA_FORMAT_RGBA_SINT8, + "MESA_FORMAT_RGBA_SINT8", + GL_RGBA, + GL_INT, + 8, 8, 8, 8, 0, 0, 0, 0, 0, - 1, 1, 6 + 1, 1, 4 }, { - MESA_FORMAT_RGBA_UINT16, - "MESA_FORMAT_RGBA_UINT16", + MESA_FORMAT_RGBA_SINT16, + "MESA_FORMAT_RGBA_SINT16", GL_RGBA, - GL_UNSIGNED_INT, + GL_INT, 16, 16, 16, 16, 0, 0, 0, 0, 0, 1, 1, 8 }, { - MESA_FORMAT_R_UINT32, - "MESA_FORMAT_R_UINT32", - GL_RED, + MESA_FORMAT_RGBA_SINT32, + "MESA_FORMAT_RGBA_SINT32", + GL_RGBA, + GL_INT, + 32, 32, 32, 32, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, + { + MESA_FORMAT_RGBX_UINT8, + "MESA_FORMAT_RGBX_UINT8", + GL_RGB, GL_UNSIGNED_INT, - 32, 0, 0, 0, + 8, 8, 8, 0, 0, 0, 0, 0, 0, 1, 1, 4 }, { - MESA_FORMAT_RG_UINT32, - "MESA_FORMAT_RG_UINT32", - GL_RG, + MESA_FORMAT_RGBX_UINT16, + "MESA_FORMAT_RGBX_UINT16", + GL_RGB, GL_UNSIGNED_INT, - 32, 32, 0, 0, + 16, 16, 16, 0, 0, 0, 0, 0, 0, 1, 1, 8 }, { - MESA_FORMAT_RGB_UINT32, - "MESA_FORMAT_RGB_UINT32", + MESA_FORMAT_RGBX_UINT32, + "MESA_FORMAT_RGBX_UINT32", GL_RGB, GL_UNSIGNED_INT, 32, 32, 32, 0, 0, 0, 0, 0, 0, - 1, 1, 12 + 1, 1, 16 }, { - MESA_FORMAT_RGBA_UINT32, - "MESA_FORMAT_RGBA_UINT32", - GL_RGBA, - GL_UNSIGNED_INT, - 32, 32, 32, 32, + MESA_FORMAT_RGBX_SINT8, + "MESA_FORMAT_RGBX_SINT8", + GL_RGB, + GL_INT, + 8, 8, 8, 0, 0, 0, 0, 0, 0, - 1, 1, 16 + 1, 1, 4 }, - - { - MESA_FORMAT_DUDV8, - "MESA_FORMAT_DUDV8", - GL_DUDV_ATI, - GL_SIGNED_NORMALIZED, - 0, 0, 0, 0, + MESA_FORMAT_RGBX_SINT16, + "MESA_FORMAT_RGBX_SINT16", + GL_RGB, + GL_INT, + 16, 16, 16, 0, 0, 0, 0, 0, 0, - 1, 1, 2 + 1, 1, 8 }, - - /* Signed 8 bits / channel */ { - MESA_FORMAT_R_SNORM8, /* Name */ - "MESA_FORMAT_R_SNORM8", /* StrName */ - GL_RED, /* BaseFormat */ - GL_SIGNED_NORMALIZED, /* DataType */ - 8, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 1 /* BlockWidth/Height,Bytes */ + MESA_FORMAT_RGBX_SINT32, + "MESA_FORMAT_RGBX_SINT32", + GL_RGB, + GL_INT, + 32, 32, 32, 0, + 0, 0, 0, 0, 0, + 1, 1, 16 }, + + /* DXT compressed formats */ { - MESA_FORMAT_R8G8_SNORM, - "MESA_FORMAT_R8G8_SNORM", - GL_RG, - GL_SIGNED_NORMALIZED, - 8, 8, 0, 0, - 0, 0, 0, 0, 0, - 1, 1, 2 + MESA_FORMAT_RGB_DXT1, /* Name */ + "MESA_FORMAT_RGB_DXT1", /* StrName */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 4, 4, 8 /* 8 bytes per 4x4 block */ }, { - MESA_FORMAT_X8B8G8R8_SNORM, - "MESA_FORMAT_X8B8G8R8_SNORM", - GL_RGB, - GL_SIGNED_NORMALIZED, - 8, 8, 8, 0, + MESA_FORMAT_RGBA_DXT1, + "MESA_FORMAT_RGBA_DXT1", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, 0, 0, 0, 0, 0, - 1, 1, 4 /* 4 bpp, but no alpha */ + 4, 4, 8 /* 8 bytes per 4x4 block */ }, { - MESA_FORMAT_A8B8G8R8_SNORM, - "MESA_FORMAT_A8B8G8R8_SNORM", + MESA_FORMAT_RGBA_DXT3, + "MESA_FORMAT_RGBA_DXT3", GL_RGBA, - GL_SIGNED_NORMALIZED, - 8, 8, 8, 8, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, 0, 0, 0, 0, 0, - 1, 1, 4 + 4, 4, 16 /* 16 bytes per 4x4 block */ }, { - MESA_FORMAT_R8G8B8A8_SNORM, - "MESA_FORMAT_R8G8B8A8_SNORM", + MESA_FORMAT_RGBA_DXT5, + "MESA_FORMAT_RGBA_DXT5", GL_RGBA, - GL_SIGNED_NORMALIZED, - 8, 8, 8, 8, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, 0, 0, 0, 0, 0, - 1, 1, 4 + 4, 4, 16 /* 16 bytes per 4x4 block */ }, - /* Signed 16 bits / channel */ + /* DXT sRGB compressed formats */ { - MESA_FORMAT_R_SNORM16, - "MESA_FORMAT_R_SNORM16", - GL_RED, - GL_SIGNED_NORMALIZED, - 16, 0, 0, 0, - 0, 0, 0, 0, 0, - 1, 1, 2 + MESA_FORMAT_SRGB_DXT1, /* Name */ + "MESA_FORMAT_SRGB_DXT1", /* StrName */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 4, 4, 8 /* 8 bytes per 4x4 block */ }, { - MESA_FORMAT_R16G16_SNORM, - "MESA_FORMAT_R16G16_SNORM", - GL_RG, - GL_SIGNED_NORMALIZED, - 16, 16, 0, 0, + MESA_FORMAT_SRGBA_DXT1, + "MESA_FORMAT_SRGBA_DXT1", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, 0, 0, 0, 0, 0, - 1, 1, 4 + 4, 4, 8 /* 8 bytes per 4x4 block */ }, { - MESA_FORMAT_RGB_SNORM16, - "MESA_FORMAT_RGB_SNORM16", - GL_RGB, - GL_SIGNED_NORMALIZED, - 16, 16, 16, 0, + MESA_FORMAT_SRGBA_DXT3, + "MESA_FORMAT_SRGBA_DXT3", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, 0, 0, 0, 0, 0, - 1, 1, 6 + 4, 4, 16 /* 16 bytes per 4x4 block */ }, { - MESA_FORMAT_RGBA_SNORM16, - "MESA_FORMAT_RGBA_SNORM16", + MESA_FORMAT_SRGBA_DXT5, + "MESA_FORMAT_SRGBA_DXT5", GL_RGBA, - GL_SIGNED_NORMALIZED, - 16, 16, 16, 16, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, 0, 0, 0, 0, 0, - 1, 1, 8 + 4, 4, 16 /* 16 bytes per 4x4 block */ }, + + /* FXT1 compressed formats */ { - MESA_FORMAT_RGBA_UNORM16, - "MESA_FORMAT_RGBA_UNORM16", + MESA_FORMAT_RGB_FXT1, + "MESA_FORMAT_RGB_FXT1", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 0, /* approx Red/Green/BlueBits */ + 0, 0, 0, 0, 0, + 8, 4, 16 /* 16 bytes per 8x4 block */ + }, + { + MESA_FORMAT_RGBA_FXT1, + "MESA_FORMAT_RGBA_FXT1", GL_RGBA, GL_UNSIGNED_NORMALIZED, - 16, 16, 16, 16, + 4, 4, 4, 1, /* approx Red/Green/Blue/AlphaBits */ 0, 0, 0, 0, 0, - 1, 1, 8 + 8, 4, 16 /* 16 bytes per 8x4 block */ }, + + /* RGTC compressed formats */ { MESA_FORMAT_R_RGTC1_UNORM, "MESA_FORMAT_R_RGTC1_UNORM", @@ -1359,6 +1674,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 16 /* 16 bytes per 4x4 block */ }, + + /* LATC1/2 compressed formats */ { MESA_FORMAT_L_LATC1_UNORM, "MESA_FORMAT_L_LATC1_UNORM", @@ -1396,6 +1713,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 4, 4, 16 /* 16 bytes per 4x4 block */ }, + /* ETC1/2 compressed formats */ { MESA_FORMAT_ETC1_RGB8, "MESA_FORMAT_ETC1_RGB8", @@ -1405,7 +1723,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 8 /* 8 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_RGB8, "MESA_FORMAT_ETC2_RGB8", @@ -1415,7 +1732,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 8 /* 8 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_SRGB8, "MESA_FORMAT_ETC2_SRGB8", @@ -1425,7 +1741,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 8 /* 8 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_RGBA8_EAC, "MESA_FORMAT_ETC2_RGBA8_EAC", @@ -1435,7 +1750,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 16 /* 16 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC, "MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC", @@ -1445,7 +1759,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 16 /* 16 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_R11_EAC, "MESA_FORMAT_ETC2_R11_EAC", @@ -1455,7 +1768,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 8 /* 8 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_RG11_EAC, "MESA_FORMAT_ETC2_RG11_EAC", @@ -1465,7 +1777,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 16 /* 16 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_SIGNED_R11_EAC, "MESA_FORMAT_ETC2_SIGNED_R11_EAC", @@ -1475,7 +1786,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 8 /* 8 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_SIGNED_RG11_EAC, "MESA_FORMAT_ETC2_SIGNED_RG11_EAC", @@ -1485,7 +1795,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 16 /* 16 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1, "MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1", @@ -1495,7 +1804,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 8 /* 8 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1, "MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1", @@ -1505,309 +1813,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 8 /* 8 bytes per 4x4 block */ }, - - /* Signed formats from EXT_texture_snorm that are not in GL3.1 */ - { - MESA_FORMAT_A_SNORM8, - "MESA_FORMAT_A_SNORM8", - GL_ALPHA, - GL_SIGNED_NORMALIZED, - 0, 0, 0, 8, - 0, 0, 0, 0, 0, - 1, 1, 1 - }, - { - MESA_FORMAT_L_SNORM8, - "MESA_FORMAT_L_SNORM8", - GL_LUMINANCE, - GL_SIGNED_NORMALIZED, - 0, 0, 0, 0, - 8, 0, 0, 0, 0, - 1, 1, 1 - }, - { - MESA_FORMAT_L8A8_SNORM, - "MESA_FORMAT_L8A8_SNORM", - GL_LUMINANCE_ALPHA, - GL_SIGNED_NORMALIZED, - 0, 0, 0, 8, - 8, 0, 0, 0, 0, - 1, 1, 2 - }, - { - MESA_FORMAT_I_SNORM8, - "MESA_FORMAT_I_SNORM8", - GL_INTENSITY, - GL_SIGNED_NORMALIZED, - 0, 0, 0, 0, - 0, 8, 0, 0, 0, - 1, 1, 1 - }, - { - MESA_FORMAT_A_SNORM16, - "MESA_FORMAT_A_SNORM16", - GL_ALPHA, - GL_SIGNED_NORMALIZED, - 0, 0, 0, 16, - 0, 0, 0, 0, 0, - 1, 1, 2 - }, - { - MESA_FORMAT_L_SNORM16, - "MESA_FORMAT_L_SNORM16", - GL_LUMINANCE, - GL_SIGNED_NORMALIZED, - 0, 0, 0, 0, - 16, 0, 0, 0, 0, - 1, 1, 2 - }, - { - MESA_FORMAT_LA_SNORM16, - "MESA_FORMAT_LA_SNORM16", - GL_LUMINANCE_ALPHA, - GL_SIGNED_NORMALIZED, - 0, 0, 0, 16, - 16, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_I_SNORM16, - "MESA_FORMAT_I_SNORM16", - GL_INTENSITY, - GL_SIGNED_NORMALIZED, - 0, 0, 0, 0, - 0, 16, 0, 0, 0, - 1, 1, 2 - }, - { - MESA_FORMAT_R9G9B9E5_FLOAT, - "MESA_FORMAT_RGB9_E5", - GL_RGB, - GL_FLOAT, - 9, 9, 9, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_R11G11B10_FLOAT, - "MESA_FORMAT_R11G11B10_FLOAT", - GL_RGB, - GL_FLOAT, - 11, 11, 10, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - /* ARB_depth_buffer_float */ - { - MESA_FORMAT_Z_FLOAT32, /* Name */ - "MESA_FORMAT_Z_FLOAT32", /* StrName */ - GL_DEPTH_COMPONENT, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ - 0, 0, 0, 32, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 4 /* BlockWidth/Height,Bytes */ - }, - { - MESA_FORMAT_Z32_FLOAT_S8X24_UINT, /* Name */ - "MESA_FORMAT_Z32_FLOAT_S8X24_UINT", /* StrName */ - GL_DEPTH_STENCIL, /* BaseFormat */ - /* DataType here is used to answer GL_TEXTURE_DEPTH_TYPE queries, and is - * never used for stencil because stencil is always GL_UNSIGNED_INT. - */ - GL_FLOAT, /* DataType */ - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ - 0, 0, 0, 32, 8, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 8 /* BlockWidth/Height,Bytes */ - }, - { - MESA_FORMAT_B10G10R10A2_UINT, - "MESA_FORMAT_B10G10R10A2_UINT", - GL_RGBA, - GL_UNSIGNED_INT, - 10, 10, 10, 2, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_R10G10B10A2_UINT, - "MESA_FORMAT_R10G10B10A2_UINT", - GL_RGBA, - GL_UNSIGNED_INT, - 10, 10, 10, 2, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_B4G4R4X4_UNORM, - "MESA_FORMAT_B4G4R4X4_UNORM", - GL_RGB, - GL_UNSIGNED_NORMALIZED, - 4, 4, 4, 0, - 0, 0, 0, 0, 0, - 1, 1, 2 - }, - { - MESA_FORMAT_B5G5R5X1_UNORM, - "MESA_FORMAT_B5G5R5X1_UNORM", - GL_RGB, - GL_UNSIGNED_NORMALIZED, - 5, 5, 5, 0, - 0, 0, 0, 0, 0, - 1, 1, 2 - }, - { - MESA_FORMAT_R8G8B8X8_SNORM, - "MESA_FORMAT_R8G8B8X8_SNORM", - GL_RGB, - GL_SIGNED_NORMALIZED, - 8, 8, 8, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_R8G8B8X8_SRGB, - "MESA_FORMAT_R8G8B8X8_SRGB", - GL_RGB, - GL_UNSIGNED_NORMALIZED, - 8, 8, 8, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_RGBX_UINT8, - "MESA_FORMAT_RGBX_UINT8", - GL_RGB, - GL_UNSIGNED_INT, - 8, 8, 8, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_RGBX_SINT8, - "MESA_FORMAT_RGBX_SINT8", - GL_RGB, - GL_INT, - 8, 8, 8, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_B10G10R10X2_UNORM, - "MESA_FORMAT_B10G10R10X2_UNORM", - GL_RGB, - GL_UNSIGNED_NORMALIZED, - 10, 10, 10, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_RGBX_UNORM16, - "MESA_FORMAT_RGBX_UNORM16", - GL_RGB, - GL_UNSIGNED_NORMALIZED, - 16, 16, 16, 0, - 0, 0, 0, 0, 0, - 1, 1, 8 - }, - { - MESA_FORMAT_RGBX_SNORM16, - "MESA_FORMAT_RGBX_SNORM16", - GL_RGB, - GL_SIGNED_NORMALIZED, - 16, 16, 16, 0, - 0, 0, 0, 0, 0, - 1, 1, 8 - }, - { - MESA_FORMAT_RGBX_FLOAT16, - "MESA_FORMAT_RGBX_FLOAT16", - GL_RGB, - GL_FLOAT, - 16, 16, 16, 0, - 0, 0, 0, 0, 0, - 1, 1, 8 - }, - { - MESA_FORMAT_RGBX_UINT16, - "MESA_FORMAT_RGBX_UINT16", - GL_RGB, - GL_UNSIGNED_INT, - 16, 16, 16, 0, - 0, 0, 0, 0, 0, - 1, 1, 8 - }, - { - MESA_FORMAT_RGBX_SINT16, - "MESA_FORMAT_RGBX_SINT16", - GL_RGB, - GL_INT, - 16, 16, 16, 0, - 0, 0, 0, 0, 0, - 1, 1, 8 - }, - { - MESA_FORMAT_RGBX_FLOAT32, - "MESA_FORMAT_RGBX_FLOAT32", - GL_RGB, - GL_FLOAT, - 32, 32, 32, 0, - 0, 0, 0, 0, 0, - 1, 1, 16 - }, - { - MESA_FORMAT_RGBX_UINT32, - "MESA_FORMAT_RGBX_UINT32", - GL_RGB, - GL_UNSIGNED_INT, - 32, 32, 32, 0, - 0, 0, 0, 0, 0, - 1, 1, 16 - }, - { - MESA_FORMAT_RGBX_SINT32, - "MESA_FORMAT_RGBX_SINT32", - GL_RGB, - GL_INT, - 32, 32, 32, 0, - 0, 0, 0, 0, 0, - 1, 1, 16 - }, - { - MESA_FORMAT_R10G10B10A2_UNORM, - "MESA_FORMAT_R10G10B10A2_UNORM", - GL_RGBA, - GL_UNSIGNED_NORMALIZED, - 10, 10, 10, 2, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_G8R8_SNORM, - "MESA_FORMAT_G8R8_SNORM", - GL_RG, - GL_SIGNED_NORMALIZED, - 8, 8, 0, 0, - 0, 0, 0, 0, 0, - 1, 1, 2 - }, - { - MESA_FORMAT_G16R16_SNORM, - "MESA_FORMAT_G16R16_SNORM", - GL_RG, - GL_SIGNED_NORMALIZED, - 16, 16, 0, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_B8G8R8X8_SRGB, - "MESA_FORMAT_B8G8R8X8_SRGB", - GL_RGB, - GL_UNSIGNED_NORMALIZED, - 8, 8, 8, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, }; @@ -2513,7 +2518,7 @@ _mesa_format_to_type_and_comps(mesa_format format, *comps = 1; return; - case MESA_FORMAT_X8Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: *datatype = GL_UNSIGNED_INT; *comps = 1; return; @@ -3155,7 +3160,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, case MESA_FORMAT_S8_UINT_Z24_UNORM: return format == GL_DEPTH_STENCIL && type == GL_UNSIGNED_INT_24_8 && !swapBytes; - case MESA_FORMAT_X8Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: case MESA_FORMAT_Z24_UNORM_S8_UINT: return GL_FALSE; diff --git a/mesalib/src/mesa/main/formats.h b/mesalib/src/mesa/main/formats.h index a12fe4f08..3079f0356 100644 --- a/mesalib/src/mesa/main/formats.h +++ b/mesalib/src/mesa/main/formats.h @@ -166,318 +166,140 @@ typedef enum * SRGB - RGB components, or L are UNORMs in sRGB color space. * Alpha, if present is linear. * - * - * ---------- Type A Format List (based on format_unpack.c): - * BGR_UNORM8 - * RGB_UNORM8 - * A_UNORM8 - * A_UNORM16 - * L_UNORM8 - * L_UNORM16 - * I_UNORM8 - * I_UNOMR16 - * R_UNORM8 - * R_UNORM16 - * Z_UNORM16 - * Z_UNORM32 - * Z_FLOAT32 - * S_UINT8 - * BGR_SRGB8 - * L_SRGB8 - * RGBA_FLOAT32 - * RGBA_FLOAT16 - * RGB_FLOAT32 - * RGB_FLOAT16 - * A_FLOAT32 - * A_FLOAT16 - * L_FLOAT32 - * L_FLOAT16 - * LA_FLOAT32 - * LA_FLOAT16 - * I_FLOAT32 - * I_FLOAT16 - * R_FLOAT32 - * R_FLOAT16 - * RG_FLOAT32 - * RG_FLOAT16 - * A_UINT8 - * A_UINT16 - * A_UINT32 - * A_SINT8 - * A_SINT16 - * A_SINT32 - * I_UINT8 - * I_UINT16 - * I_UINT32 - * I_SINT8 - * I_SINT16 - * I_SINT32 - * L_UINT8 - * L_UINT16 - * L_UINT32 - * L_SINT8 - * L_SINT16 - * L_SINT32 - * LA_UINT8 - * LA_UINT16 - * LA_UINT32 - * LA_SINT8 - * LA_SINT16 - * LA_SINT32 - * R_SINT8 - * RG_SINT8 - * RGB_SINT8 - * RGBA_SINT8 - * R_SINT16 - * RG_SINT16 - * RGB_SINT16 - * RGBA_SINT16 - * R_SINT32 - * RG_SINT32 - * RGB_SINT32 - * RGBA_SINT32 - * R_SINT16 - * R_SINT32 - * R_UINT8 - * RG_UINT8 - * RGB_UINT8 - * RGBA_UINT8 - * R_UINT16 - * RG_UINT16 - * RGB_UINT16 - * RGBA_UINT16 - * R_UINT32 - * RG_UINT32 - * RGB_UINT32 - * RGBA_UINT32 - * R_UINT16 - * R_UINT32 - * R_SNORM8 - * R_SNORM16 - * RGB_SNORM16 - * RGBA_SNORM16 - * RGBA_UNORM16 - * A_SNORM8 - * L_SNORM8 - * I_SNORM8 - * A_SNORM16 - * L_SNORM16 - * LA_SNORM16 - * I_SNORM16 - * RGBX_UINT8 - * RGBX_SINT8 - * RGBX_UNORM16 - * RGBX_SNORM16 - * RGBX_FLOAT16 - * RGBX_UINT16 - * RGBX_SINT16 - * RGBX_FLOAT32 - * RGBX_UINT32 - * RGBX_SINT32 - * - * - * - * ---------- Type P Format List (based on format_unpack.c): - * A8B8G8R8_UNORM - * R8G8B8A8_UNORM - * B8G8R8A8_UNORM - * A8R8G8B8_UNORM - * X8B8G8R8_UNORM - * R8G8B8X8_UNORM - * B8G8R8X8_UNORM - * X8R8G8B8_UNORM - * B5G6R5_UNORM - * R5G6B5_UNORM - * B4G4R4A4_UNORM - * A4R4G4B4_UNORM - * A1B5G5R5_UNORM - * B5G5R5A1_UNORM - * A1R5G5B5_UNORM - * L4A4_UNORM - * L8A8_UNORM - * A8L8_UNORM - * L16A16_UNORM - * A16L16_UNORM - * B2G3R3_UNORM - * YCBCR - * YCBCR_REV - * R8G8_UNORM - * G8R8_UNORM - * R16G16_UNORM - * G16R16_UNORM - * B10G10R10A2_UNORM - * B10G10R10A2_UINT - * R10G10B10A2_UINT - * S8_UINT_Z24_UNORM - * Z24_UNORM_S8_UINT - * Z24_UNORM_X8_UINT - * X8_UINT_Z24_UNORM - * Z32_FLOAT_S8X24_UINT - * A8R8G8B8_SRGB - * B8G8R8A8_SRGB - * L8A8_SRGB - * R8G8_SNORM - * X8B8G8R8_SNORM - * A8B8G8R8_SNORM - * R8G8B8A8_SNORM - * R16G16_SNORM - * L8A8_SNORM - * R9G9B9E5_FLOAT - * R11G11B10_FLOAT - * B4G4R4X4_UNORM - * B5G5R5X1_UNORM - * R8G8_SNORM - * R8G8B8X8_SNORM - * R8G8B8X8_SRGB - * B10G10R10X2_UNORM - * R10G10B10A2_UNORM - * G8R8_SINT - * G16R16_SINT - * B8G8R8X8_SRGB - * */ - /*@{*/ - /* Type P formats */ /* msb <------ TEXEL BITS -----------> lsb */ + /* Packed unorm formats */ /* msb <------ TEXEL BITS -----------> lsb */ /* ---- ---- ---- ---- ---- ---- ---- ---- */ MESA_FORMAT_A8B8G8R8_UNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ - MESA_FORMAT_R8G8B8A8_UNORM, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ - MESA_FORMAT_B8G8R8A8_UNORM, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ - MESA_FORMAT_A8R8G8B8_UNORM, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */ MESA_FORMAT_X8B8G8R8_UNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */ + MESA_FORMAT_R8G8B8A8_UNORM, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ MESA_FORMAT_R8G8B8X8_UNORM, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_B8G8R8A8_UNORM, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ MESA_FORMAT_B8G8R8X8_UNORM, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */ + MESA_FORMAT_A8R8G8B8_UNORM, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */ MESA_FORMAT_X8R8G8B8_UNORM, /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */ - - /* Type A formats */ - MESA_FORMAT_BGR_UNORM8, /* uchar[i * 3] = B, [i * 3 + 1] = G, [i *3 + 2] = R */ - MESA_FORMAT_RGB_UNORM8, /* uchar[i * 3] = R, [i * 3 + 1] = G, [i *3 + 2] = B */ - - /* Type P formats */ + MESA_FORMAT_L16A16_UNORM, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */ + MESA_FORMAT_A16L16_UNORM, /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */ MESA_FORMAT_B5G6R5_UNORM, /* RRRR RGGG GGGB BBBB */ MESA_FORMAT_R5G6B5_UNORM, /* BBBB BGGG GGGR RRRR */ MESA_FORMAT_B4G4R4A4_UNORM, /* AAAA RRRR GGGG BBBB */ + MESA_FORMAT_B4G4R4X4_UNORM, /* xxxx RRRR GGGG BBBB */ MESA_FORMAT_A4R4G4B4_UNORM, /* BBBB GGGG RRRR AAAA */ MESA_FORMAT_A1B5G5R5_UNORM, /* RRRR RGGG GGBB BBBA */ MESA_FORMAT_B5G5R5A1_UNORM, /* ARRR RRGG GGGB BBBB */ + MESA_FORMAT_B5G5R5X1_UNORM, /* xRRR RRGG GGGB BBBB */ MESA_FORMAT_A1R5G5B5_UNORM, /* BBBB BGGG GGRR RRRA */ - MESA_FORMAT_L4A4_UNORM, /* AAAA LLLL */ MESA_FORMAT_L8A8_UNORM, /* AAAA AAAA LLLL LLLL */ MESA_FORMAT_A8L8_UNORM, /* LLLL LLLL AAAA AAAA */ - MESA_FORMAT_L16A16_UNORM, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */ - MESA_FORMAT_A16L16_UNORM, /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */ - MESA_FORMAT_B2G3R3_UNORM, /* RRRG GGBB */ - - /* Type A formats */ - MESA_FORMAT_A_UNORM8, /* uchar[i] = A */ - MESA_FORMAT_A_UNORM16, /* ushort[i] = A */ - MESA_FORMAT_L_UNORM8, /* uchar[i] = L */ - MESA_FORMAT_L_UNORM16, /* ushort[i] = L */ - MESA_FORMAT_I_UNORM8, /* uchar[i] = I */ - MESA_FORMAT_I_UNORM16, /* ushort[i] = I */ - - /* Type P formats */ - MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */ - MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */ - - /* Type A format(s) */ - MESA_FORMAT_R_UNORM8, /* uchar[i] = R */ - - /* Type P formats */ MESA_FORMAT_R8G8_UNORM, /* GGGG GGGG RRRR RRRR */ MESA_FORMAT_G8R8_UNORM, /* RRRR RRRR GGGG GGGG */ + MESA_FORMAT_L4A4_UNORM, /* AAAA LLLL */ + MESA_FORMAT_B2G3R3_UNORM, /* RRRG GGBB */ - /* Type A format(s) */ - MESA_FORMAT_R_UNORM16, /* ushort[i] = R */ - - /* Type P formats */ MESA_FORMAT_R16G16_UNORM, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */ MESA_FORMAT_G16R16_UNORM, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */ MESA_FORMAT_B10G10R10A2_UNORM,/* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ + MESA_FORMAT_B10G10R10X2_UNORM,/* xxRR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ + MESA_FORMAT_R10G10B10A2_UNORM,/* AABB BBBB BBBB GGGG GGGG GGRR RRRR RRRR */ + MESA_FORMAT_S8_UINT_Z24_UNORM,/* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */ + MESA_FORMAT_X8_UINT_Z24_UNORM,/* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */ MESA_FORMAT_Z24_UNORM_S8_UINT,/* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ + MESA_FORMAT_Z24_UNORM_X8_UINT,/* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ - /* Type A format(s) */ - MESA_FORMAT_Z_UNORM16, /* ushort[i] = Z */ + MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */ + MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */ - /* Type P formats */ - MESA_FORMAT_Z24_UNORM_X8_UINT,/* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ - MESA_FORMAT_X8Z24_UNORM, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */ + MESA_FORMAT_DUDV8, /* DUDU DUDU DVDV DVDV */ + + /* Array unorm formats */ + MESA_FORMAT_A_UNORM8, /* ubyte[i] = A */ + MESA_FORMAT_A_UNORM16, /* ushort[i] = A */ + MESA_FORMAT_L_UNORM8, /* ubyte[i] = L */ + MESA_FORMAT_L_UNORM16, /* ushort[i] = L */ + MESA_FORMAT_I_UNORM8, /* ubyte[i] = I */ + MESA_FORMAT_I_UNORM16, /* ushort[i] = I */ + MESA_FORMAT_R_UNORM8, /* ubyte[i] = R */ + MESA_FORMAT_R_UNORM16, /* ushort[i] = R */ + MESA_FORMAT_BGR_UNORM8, /* ubyte[i*3] = B, [i*3+1] = G, [i*3+2] = R */ + MESA_FORMAT_RGB_UNORM8, /* ubyte[i*3] = R, [i*3+1] = G, [i*3+2] = B */ + MESA_FORMAT_RGBA_UNORM16, /* ushort[i] = R, [1] = G, [2] = B, [3] = A */ + MESA_FORMAT_RGBX_UNORM16, - /* Type A formats */ + MESA_FORMAT_Z_UNORM16, /* ushort[i] = Z */ MESA_FORMAT_Z_UNORM32, /* uint[i] = Z */ - MESA_FORMAT_S_UINT8, /* uchar[i] = S */ - /*@}*/ + MESA_FORMAT_S_UINT8, /* ubyte[i] = S */ - /** - * \name 8-bit/channel sRGB formats - */ - /*@{*/ - /* Type A format(s) */ - MESA_FORMAT_BGR_SRGB8, /* uchar[i * 3] = B, [i * 3 + 1] = G, [i *3 + 2] = R */ + /* Packed signed/normalized formats */ + /* msb <------ TEXEL BITS -----------> lsb */ + /* ---- ---- ---- ---- ---- ---- ---- ---- */ + MESA_FORMAT_A8B8G8R8_SNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ + MESA_FORMAT_X8B8G8R8_SNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */ + MESA_FORMAT_R8G8B8A8_SNORM, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_R8G8B8X8_SNORM, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_R16G16_SNORM, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */ + MESA_FORMAT_G16R16_SNORM, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */ + MESA_FORMAT_R8G8_SNORM, /* GGGG GGGG RRRR RRRR */ + MESA_FORMAT_G8R8_SNORM, /* RRRR RRRR GGGG GGGG */ + MESA_FORMAT_L8A8_SNORM, /* AAAA AAAA LLLL LLLL */ - /* Type P formats */ + /* Array signed/normalized formats */ + MESA_FORMAT_A_SNORM8, /* byte[i] = A */ + MESA_FORMAT_A_SNORM16, /* short[i] = A */ + MESA_FORMAT_L_SNORM8, /* byte[i] = L */ + MESA_FORMAT_L_SNORM16, /* short[i] = L */ + MESA_FORMAT_I_SNORM8, /* byte[i] = I */ + MESA_FORMAT_I_SNORM16, /* short[i] = I */ + MESA_FORMAT_R_SNORM8, /* byte[i] = R */ + MESA_FORMAT_R_SNORM16, /* short[i] = R */ + MESA_FORMAT_LA_SNORM16, /* short[i * 2] = L, [i * 2 + 1] = A */ + MESA_FORMAT_RGB_SNORM16, /* short[i*3] = R, [i*3+1] = G, [i*3+2] = B */ + MESA_FORMAT_RGBA_SNORM16, /* ... */ + MESA_FORMAT_RGBX_SNORM16, /* ... */ + + /* Packed sRGB formats */ MESA_FORMAT_A8B8G8R8_SRGB, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ MESA_FORMAT_B8G8R8A8_SRGB, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ + MESA_FORMAT_B8G8R8X8_SRGB, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */ MESA_FORMAT_R8G8B8A8_SRGB, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ - - /* Type A format(s) */ - MESA_FORMAT_L_SRGB8, /* uchar[i] = L */ - - /* Type P formats */ + MESA_FORMAT_R8G8B8X8_SRGB, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ MESA_FORMAT_L8A8_SRGB, /* AAAA AAAA LLLL LLLL */ - /* Type C formats */ - MESA_FORMAT_SRGB_DXT1, - MESA_FORMAT_SRGBA_DXT1, - MESA_FORMAT_SRGBA_DXT3, - MESA_FORMAT_SRGBA_DXT5, - /*@}*/ - - /** - * \name Compressed texture formats. - */ - /*@{*/ - /* Type C formats */ - MESA_FORMAT_RGB_FXT1, - MESA_FORMAT_RGBA_FXT1, - MESA_FORMAT_RGB_DXT1, - MESA_FORMAT_RGBA_DXT1, - MESA_FORMAT_RGBA_DXT3, - MESA_FORMAT_RGBA_DXT5, - /*@}*/ + /* Array sRGB formats */ + MESA_FORMAT_L_SRGB8, /* ubyte[i] = L */ + MESA_FORMAT_BGR_SRGB8, /* ubyte[i*3] = B, [i*3+1] = G, [i*3+2] = R */ - /** - * \name Floating point texture formats. - */ - /*@{*/ + /* Packed float formats */ + MESA_FORMAT_R9G9B9E5_FLOAT, + MESA_FORMAT_R11G11B10_FLOAT, /* BBBB BBBB BBGG GGGG GGGG GRRR RRRR RRRR */ + MESA_FORMAT_Z32_FLOAT_S8X24_UINT, /* (float, x24s8) */ - /* Type A formats */ - MESA_FORMAT_RGBA_FLOAT32, /* float[i * 4] = R, [i * 4 + 1] = G, [i * 4 + 2] = B, [i * 4 + 3] = A */ - MESA_FORMAT_RGBA_FLOAT16, - MESA_FORMAT_RGB_FLOAT32, - MESA_FORMAT_RGB_FLOAT16, - MESA_FORMAT_A_FLOAT32, + /* Array float formats */ MESA_FORMAT_A_FLOAT16, - MESA_FORMAT_L_FLOAT32, + MESA_FORMAT_A_FLOAT32, MESA_FORMAT_L_FLOAT16, - MESA_FORMAT_LA_FLOAT32, + MESA_FORMAT_L_FLOAT32, MESA_FORMAT_LA_FLOAT16, - MESA_FORMAT_I_FLOAT32, + MESA_FORMAT_LA_FLOAT32, MESA_FORMAT_I_FLOAT16, - MESA_FORMAT_R_FLOAT32, + MESA_FORMAT_I_FLOAT32, MESA_FORMAT_R_FLOAT16, - MESA_FORMAT_RG_FLOAT32, + MESA_FORMAT_R_FLOAT32, MESA_FORMAT_RG_FLOAT16, - /*@}*/ + MESA_FORMAT_RG_FLOAT32, + MESA_FORMAT_RGB_FLOAT16, + MESA_FORMAT_RGB_FLOAT32, + MESA_FORMAT_RGBA_FLOAT16, + MESA_FORMAT_RGBA_FLOAT32, /* float[0] = R, [1] = G, [2] = B, [3] = A */ + MESA_FORMAT_RGBX_FLOAT16, + MESA_FORMAT_RGBX_FLOAT32, + MESA_FORMAT_Z_FLOAT32, - /** - * \name Non-normalized signed integer formats. - * XXX Note: these are just stand-ins for some better hardware - * formats TBD such as BGRA or ARGB. - */ + /* Packed signed/unsigned non-normalized integer formats */ + MESA_FORMAT_B10G10R10A2_UINT, /* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ + MESA_FORMAT_R10G10B10A2_UINT, /* AABB BBBB BBBB GGGG GGGG GGRR RRRR RRRR */ - /* Type A formats */ + /* Array signed/unsigned non-normalized integer formats */ MESA_FORMAT_A_UINT8, MESA_FORMAT_A_UINT16, MESA_FORMAT_A_UINT32, @@ -498,6 +320,7 @@ typedef enum MESA_FORMAT_L_SINT8, MESA_FORMAT_L_SINT16, MESA_FORMAT_L_SINT32, + MESA_FORMAT_LA_UINT8, MESA_FORMAT_LA_UINT16, MESA_FORMAT_LA_UINT32, @@ -505,83 +328,70 @@ typedef enum MESA_FORMAT_LA_SINT16, MESA_FORMAT_LA_SINT32, + MESA_FORMAT_R_UINT8, + MESA_FORMAT_R_UINT16, + MESA_FORMAT_R_UINT32, MESA_FORMAT_R_SINT8, - MESA_FORMAT_RG_SINT8, - MESA_FORMAT_RGB_SINT8, - MESA_FORMAT_RGBA_SINT8, MESA_FORMAT_R_SINT16, - MESA_FORMAT_RG_SINT16, - MESA_FORMAT_RGB_SINT16, - MESA_FORMAT_RGBA_SINT16, - MESA_FORMAT_R_SINT32, - MESA_FORMAT_RG_SINT32, - MESA_FORMAT_RGB_SINT32, - MESA_FORMAT_RGBA_SINT32, - /** - * \name Non-normalized unsigned integer formats. - */ - /* Type A format(s) */ - MESA_FORMAT_R_UINT8, MESA_FORMAT_RG_UINT8, - MESA_FORMAT_RGB_UINT8, - MESA_FORMAT_RGBA_UINT8, - - MESA_FORMAT_R_UINT16, MESA_FORMAT_RG_UINT16, - MESA_FORMAT_RGB_UINT16, - MESA_FORMAT_RGBA_UINT16, - - MESA_FORMAT_R_UINT32, MESA_FORMAT_RG_UINT32, - MESA_FORMAT_RGB_UINT32, - MESA_FORMAT_RGBA_UINT32, + MESA_FORMAT_RG_SINT8, + MESA_FORMAT_RG_SINT16, + MESA_FORMAT_RG_SINT32, - /* msb <------ TEXEL BITS -----------> lsb */ - /* ---- ---- ---- ---- ---- ---- ---- ---- */ - /** - * \name Signed fixed point texture formats. - */ - /*@{*/ - MESA_FORMAT_DUDV8, /* DUDU DUDU DVDV DVDV */ + MESA_FORMAT_RGB_UINT8, + MESA_FORMAT_RGB_UINT16, + MESA_FORMAT_RGB_UINT32, + MESA_FORMAT_RGB_SINT8, + MESA_FORMAT_RGB_SINT16, + MESA_FORMAT_RGB_SINT32, - /* Type A format(s) */ - MESA_FORMAT_R_SNORM8, /* char[i] = R */ + MESA_FORMAT_RGBA_UINT8, + MESA_FORMAT_RGBA_UINT16, + MESA_FORMAT_RGBA_UINT32, + MESA_FORMAT_RGBA_SINT8, + MESA_FORMAT_RGBA_SINT16, + MESA_FORMAT_RGBA_SINT32, - /* Type P formats */ - MESA_FORMAT_R8G8_SNORM, /* GGGG GGGG RRRR RRRR */ - MESA_FORMAT_X8B8G8R8_SNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */ - MESA_FORMAT_A8B8G8R8_SNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ - MESA_FORMAT_R8G8B8A8_SNORM, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_RGBX_UINT8, + MESA_FORMAT_RGBX_UINT16, + MESA_FORMAT_RGBX_UINT32, + MESA_FORMAT_RGBX_SINT8, + MESA_FORMAT_RGBX_SINT16, + MESA_FORMAT_RGBX_SINT32, - /* Type A format(s) */ - MESA_FORMAT_R_SNORM16, /* short[i] = R */ + /* DXT compressed formats */ + MESA_FORMAT_RGB_DXT1, + MESA_FORMAT_RGBA_DXT1, + MESA_FORMAT_RGBA_DXT3, + MESA_FORMAT_RGBA_DXT5, - /* Type P format(s) */ - MESA_FORMAT_R16G16_SNORM, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */ + /* DXT sRGB compressed formats */ + MESA_FORMAT_SRGB_DXT1, + MESA_FORMAT_SRGBA_DXT1, + MESA_FORMAT_SRGBA_DXT3, + MESA_FORMAT_SRGBA_DXT5, - /* Type A format(s) */ - MESA_FORMAT_RGB_SNORM16, /* short[i * 3] = R, [i * 3 + 1] = G, [i *3 + 2] = B */ - MESA_FORMAT_RGBA_SNORM16, /* ... */ - MESA_FORMAT_RGBA_UNORM16, /* ... */ - /*@}*/ + /* FXT1 compressed formats */ + MESA_FORMAT_RGB_FXT1, + MESA_FORMAT_RGBA_FXT1, - /*@{*/ - /* Type C formats */ + /* RGTC compressed formats */ MESA_FORMAT_R_RGTC1_UNORM, MESA_FORMAT_R_RGTC1_SNORM, MESA_FORMAT_RG_RGTC2_UNORM, MESA_FORMAT_RG_RGTC2_SNORM, - /*@}*/ - /*@{*/ + /* LATC1/2 compressed formats */ MESA_FORMAT_L_LATC1_UNORM, MESA_FORMAT_L_LATC1_SNORM, MESA_FORMAT_LA_LATC2_UNORM, MESA_FORMAT_LA_LATC2_SNORM, - /*@}*/ + /* ETC1/2 compressed formats */ MESA_FORMAT_ETC1_RGB8, MESA_FORMAT_ETC2_RGB8, MESA_FORMAT_ETC2_SRGB8, @@ -594,63 +404,6 @@ typedef enum MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1, MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1, - /* Type A format(s) */ - MESA_FORMAT_A_SNORM8, /* char[i] = A */ - MESA_FORMAT_L_SNORM8, /* char[i] = L */ - - /* Type P format(s) */ - MESA_FORMAT_L8A8_SNORM, /* AAAA AAAA LLLL LLLL */ - - /* Type A format(s) */ - MESA_FORMAT_I_SNORM8, /* char[i] = I */ - MESA_FORMAT_A_SNORM16, /* short[i] = A */ - MESA_FORMAT_L_SNORM16, /* short[i] = L */ - MESA_FORMAT_LA_SNORM16, /* short[i * 2] = L, [i * 2 + 1] = A */ - MESA_FORMAT_I_SNORM16, /* short[i] = I */ - - /* Type P format(s) */ - MESA_FORMAT_R9G9B9E5_FLOAT, - MESA_FORMAT_R11G11B10_FLOAT, /* BBBB BBBB BBGG GGGG GGGG GRRR RRRR RRRR */ - - /* Type A format(s) */ - MESA_FORMAT_Z_FLOAT32, - - /* Type P formats */ - MESA_FORMAT_Z32_FLOAT_S8X24_UINT, /* (float, x24s8) */ - - MESA_FORMAT_B10G10R10A2_UINT, /* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ - MESA_FORMAT_R10G10B10A2_UINT, /* AABB BBBB BBBB GGGG GGGG GGRR RRRR RRRR */ - - MESA_FORMAT_B4G4R4X4_UNORM, /* xxxx RRRR GGGG BBBB */ - MESA_FORMAT_B5G5R5X1_UNORM, /* xRRR RRGG GGGB BBBB */ - MESA_FORMAT_R8G8B8X8_SNORM, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ - MESA_FORMAT_R8G8B8X8_SRGB, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ - - /* Type A formats */ - MESA_FORMAT_RGBX_UINT8, /* uchar[i * 4] = R, [i * 4 + 1] = G, [i * 4 + 2] = B, [i * 4 + 3] = x */ - MESA_FORMAT_RGBX_SINT8, /* char[i * 4] = R, [i * 4 + 1] = G, [i * 4 + 2] = B, [i * 4 + 3] = x */ - - /* Type P format(s) */ - MESA_FORMAT_B10G10R10X2_UNORM,/* xxRR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ - - /* Type A formats */ - MESA_FORMAT_RGBX_UNORM16, /* ushort[i * 4] = R, [i * 4 + 1] = G, [i * 4 + 2] = B, [i * 4 + 3] = x */ - MESA_FORMAT_RGBX_SNORM16, /* ... */ - MESA_FORMAT_RGBX_FLOAT16, /* ... */ - MESA_FORMAT_RGBX_UINT16, /* ... */ - MESA_FORMAT_RGBX_SINT16, /* ... */ - - MESA_FORMAT_RGBX_FLOAT32, /* float[i * 4] = R, [i * 4 + 1] = G, [i * 4 + 2] = B, [i * 4 + 3] = x */ - MESA_FORMAT_RGBX_UINT32, /* ... */ - MESA_FORMAT_RGBX_SINT32, /* ... */ - - /* Type P formats */ - MESA_FORMAT_R10G10B10A2_UNORM, /* AABB BBBB BBBB GGGG GGGG GGRR RRRR RRRR */ - MESA_FORMAT_G8R8_SNORM, /* RRRR RRRR GGGG GGGG */ - MESA_FORMAT_G16R16_SNORM, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */ - - MESA_FORMAT_B8G8R8X8_SRGB, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */ - MESA_FORMAT_COUNT } mesa_format; diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index e5f10baab..7c83d664f 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2702,6 +2702,14 @@ struct gl_shader_program struct gl_uniform_storage *UniformStorage; /** + * Mapping from GL uniform locations returned by \c glUniformLocation to + * UniformStorage entries. Arrays will have multiple contiguous slots + * in the UniformRemapTable, all pointing to the same UniformStorage entry. + */ + unsigned NumUniformRemapTable; + struct gl_uniform_storage **UniformRemapTable; + + /** * Size of the gl_ClipDistance array that is output from the last pipeline * stage before the fragment shader. */ @@ -2711,21 +2719,6 @@ struct gl_shader_program unsigned NumUniformBlocks; /** - * Scale factor for the uniform base location - * - * This is used to generate locations (returned by \c glGetUniformLocation) - * of uniforms. The base location of the uniform is multiplied by this - * value, and the array index is added. - * - * \note - * Must be >= 1. - * - * \sa - * _mesa_uniform_merge_location_offset, _mesa_uniform_split_location_offset - */ - unsigned UniformLocationBaseScale; - - /** * Indices into the _LinkedShaders's UniformBlocks[] array for each stage * they're used in, or -1. * diff --git a/mesalib/src/mesa/main/shaderobj.c b/mesalib/src/mesa/main/shaderobj.c index d5c3d8099..b0f0bfa91 100644 --- a/mesalib/src/mesa/main/shaderobj.c +++ b/mesalib/src/mesa/main/shaderobj.c @@ -285,7 +285,12 @@ _mesa_clear_shader_program_data(struct gl_context *ctx, ralloc_free(shProg->UniformStorage); shProg->NumUserUniformStorage = 0; shProg->UniformStorage = NULL; - shProg->UniformLocationBaseScale = 0; + } + + if (shProg->UniformRemapTable) { + ralloc_free(shProg->UniformRemapTable); + shProg->NumUniformRemapTable = 0; + shProg->UniformRemapTable = NULL; } if (shProg->UniformHash) { diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index 557703d01..b68ba603e 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -1079,7 +1079,7 @@ _mesa_texstore_z24_x8(TEXSTORE_PARAMS) const GLuint depthScale = 0xffffff; (void) dims; - ASSERT(dstFormat == MESA_FORMAT_X8Z24_UNORM); + ASSERT(dstFormat == MESA_FORMAT_X8_UINT_Z24_UNORM); { /* general path */ @@ -3712,7 +3712,7 @@ _mesa_get_texstore_func(mesa_format format) table[MESA_FORMAT_Z24_UNORM_S8_UINT] = _mesa_texstore_s8_z24; table[MESA_FORMAT_Z_UNORM16] = _mesa_texstore_z16; table[MESA_FORMAT_Z24_UNORM_X8_UINT] = _mesa_texstore_x8_z24; - table[MESA_FORMAT_X8Z24_UNORM] = _mesa_texstore_z24_x8; + table[MESA_FORMAT_X8_UINT_Z24_UNORM] = _mesa_texstore_z24_x8; table[MESA_FORMAT_Z_UNORM32] = _mesa_texstore_z32; table[MESA_FORMAT_S_UINT8] = _mesa_texstore_s8; table[MESA_FORMAT_BGR_SRGB8] = _mesa_texstore_srgb8; diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp index 8cc5da752..fa13ef9fe 100644 --- a/mesalib/src/mesa/main/uniform_query.cpp +++ b/mesalib/src/mesa/main/uniform_query.cpp @@ -40,9 +40,9 @@ extern "C" void GLAPIENTRY -_mesa_GetActiveUniform(GLhandleARB program, GLuint index, - GLsizei maxLength, GLsizei *length, GLint *size, - GLenum *type, GLcharARB *nameOut) +_mesa_GetActiveUniform(GLuint program, GLuint index, + GLsizei maxLength, GLsizei *length, GLint *size, + GLenum *type, GLcharARB *nameOut) { GET_CURRENT_CONTEXT(ctx); struct gl_shader_program *shProg = @@ -246,14 +246,15 @@ validate_uniform_parameters(struct gl_context *ctx, return false; } - _mesa_uniform_split_location_offset(shProg, location, loc, array_index); - - if (*loc >= shProg->NumUserUniformStorage) { + /* Check that the given location is in bounds of uniform remap table. */ + if (location >= (GLint) shProg->NumUniformRemapTable) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)", caller, location); return false; } + _mesa_uniform_split_location_offset(shProg, location, loc, array_index); + if (shProg->UniformStorage[*loc].array_elements == 0 && count > 1) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(count > 1 for non-array, location=%d)", diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c index c25c2df7e..e9b374b0d 100644 --- a/mesalib/src/mesa/main/uniforms.c +++ b/mesalib/src/mesa/main/uniforms.c @@ -822,7 +822,7 @@ _mesa_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, void GLAPIENTRY -_mesa_GetnUniformfvARB(GLhandleARB program, GLint location, +_mesa_GetnUniformfvARB(GLuint program, GLint location, GLsizei bufSize, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -830,14 +830,14 @@ _mesa_GetnUniformfvARB(GLhandleARB program, GLint location, } void GLAPIENTRY -_mesa_GetUniformfv(GLhandleARB program, GLint location, GLfloat *params) +_mesa_GetUniformfv(GLuint program, GLint location, GLfloat *params) { _mesa_GetnUniformfvARB(program, location, INT_MAX, params); } void GLAPIENTRY -_mesa_GetnUniformivARB(GLhandleARB program, GLint location, +_mesa_GetnUniformivARB(GLuint program, GLint location, GLsizei bufSize, GLint *params) { GET_CURRENT_CONTEXT(ctx); @@ -845,7 +845,7 @@ _mesa_GetnUniformivARB(GLhandleARB program, GLint location, } void GLAPIENTRY -_mesa_GetUniformiv(GLhandleARB program, GLint location, GLint *params) +_mesa_GetUniformiv(GLuint program, GLint location, GLint *params) { _mesa_GetnUniformivARB(program, location, INT_MAX, params); } @@ -853,7 +853,7 @@ _mesa_GetUniformiv(GLhandleARB program, GLint location, GLint *params) /* GL3 */ void GLAPIENTRY -_mesa_GetnUniformuivARB(GLhandleARB program, GLint location, +_mesa_GetnUniformuivARB(GLuint program, GLint location, GLsizei bufSize, GLuint *params) { GET_CURRENT_CONTEXT(ctx); @@ -861,7 +861,7 @@ _mesa_GetnUniformuivARB(GLhandleARB program, GLint location, } void GLAPIENTRY -_mesa_GetUniformuiv(GLhandleARB program, GLint location, GLuint *params) +_mesa_GetUniformuiv(GLuint program, GLint location, GLuint *params) { _mesa_GetnUniformuivARB(program, location, INT_MAX, params); } @@ -869,8 +869,8 @@ _mesa_GetUniformuiv(GLhandleARB program, GLint location, GLuint *params) /* GL4 */ void GLAPIENTRY -_mesa_GetnUniformdvARB(GLhandleARB program, GLint location, - GLsizei bufSize, GLdouble *params) +_mesa_GetnUniformdvARB(GLuint program, GLint location, + GLsizei bufSize, GLdouble *params) { GET_CURRENT_CONTEXT(ctx); @@ -887,14 +887,14 @@ _mesa_GetnUniformdvARB(GLhandleARB program, GLint location, } void GLAPIENTRY -_mesa_GetUniformdv(GLhandleARB program, GLint location, GLdouble *params) +_mesa_GetUniformdv(GLuint program, GLint location, GLdouble *params) { _mesa_GetnUniformdvARB(program, location, INT_MAX, params); } GLint GLAPIENTRY -_mesa_GetUniformLocation(GLhandleARB programObj, const GLcharARB *name) +_mesa_GetUniformLocation(GLuint programObj, const GLcharARB *name) { struct gl_shader_program *shProg; GLuint index, offset; diff --git a/mesalib/src/mesa/main/uniforms.h b/mesalib/src/mesa/main/uniforms.h index bd50fd9b8..d7afdc106 100644 --- a/mesalib/src/mesa/main/uniforms.h +++ b/mesalib/src/mesa/main/uniforms.h @@ -195,23 +195,23 @@ _mesa_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); void GLAPIENTRY -_mesa_GetnUniformfvARB(GLhandleARB, GLint, GLsizei, GLfloat *); +_mesa_GetnUniformfvARB(GLuint, GLint, GLsizei, GLfloat *); void GLAPIENTRY -_mesa_GetUniformfv(GLhandleARB, GLint, GLfloat *); +_mesa_GetUniformfv(GLuint, GLint, GLfloat *); void GLAPIENTRY -_mesa_GetnUniformivARB(GLhandleARB, GLint, GLsizei, GLint *); +_mesa_GetnUniformivARB(GLuint, GLint, GLsizei, GLint *); void GLAPIENTRY -_mesa_GetUniformuiv(GLhandleARB, GLint, GLuint *); +_mesa_GetUniformuiv(GLuint, GLint, GLuint *); void GLAPIENTRY -_mesa_GetnUniformuivARB(GLhandleARB, GLint, GLsizei, GLuint *); +_mesa_GetnUniformuivARB(GLuint, GLint, GLsizei, GLuint *); void GLAPIENTRY -_mesa_GetUniformuiv(GLhandleARB program, GLint location, GLuint *params); +_mesa_GetUniformuiv(GLuint program, GLint location, GLuint *params); void GLAPIENTRY -_mesa_GetnUniformdvARB(GLhandleARB, GLint, GLsizei, GLdouble *); +_mesa_GetnUniformdvARB(GLuint, GLint, GLsizei, GLdouble *); void GLAPIENTRY -_mesa_GetUniformdv(GLhandleARB, GLint, GLdouble *); +_mesa_GetUniformdv(GLuint, GLint, GLdouble *); GLint GLAPIENTRY -_mesa_GetUniformLocation(GLhandleARB, const GLcharARB *); +_mesa_GetUniformLocation(GLuint, const GLcharARB *); GLuint GLAPIENTRY _mesa_GetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName); @@ -243,8 +243,8 @@ _mesa_GetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); void GLAPIENTRY -_mesa_GetActiveUniform(GLhandleARB, GLuint, GLsizei, GLsizei *, - GLint *, GLenum *, GLcharARB *); +_mesa_GetActiveUniform(GLuint, GLuint, GLsizei, GLsizei *, + GLint *, GLenum *, GLcharARB *); void GLAPIENTRY _mesa_GetActiveUniformsiv(GLuint program, GLsizei uniformCount, @@ -252,7 +252,7 @@ _mesa_GetActiveUniformsiv(GLuint program, GLenum pname, GLint *params); void GLAPIENTRY -_mesa_GetUniformiv(GLhandleARB, GLint, GLint *); +_mesa_GetUniformiv(GLuint, GLint, GLint *); long _mesa_parse_program_resource_name(const GLchar *name, @@ -340,39 +340,46 @@ struct gl_builtin_uniform_desc { * element. We could insert dummy entries in the list for each array * element after [0] but that causes complications elsewhere. * - * We solve this problem by encoding two values in the location that's - * returned by glGetUniformLocation(): - * a) index into gl_uniform_list::Uniforms[] for the uniform - * b) an array/field offset (0 for simple types) + * We solve this problem by creating multiple entries for uniform arrays + * in the UniformRemapTable so that their elements get sequential locations. + * + * Utility functions below offer functionality to split UniformRemapTable + * location in to location of the uniform in UniformStorage + offset to the + * array element (0 if not an array) and also merge it back again as the + * UniformRemapTable location. * - * These two values are encoded in the high and low halves of a GLint. - * By putting the uniform number in the high part and the offset in the - * low part, we can support the unofficial ability to index into arrays - * by adding offsets to the location value. */ /*@{*/ /** - * Combine the uniform's base location and the offset + * Combine the uniform's storage index and the array index */ static inline GLint _mesa_uniform_merge_location_offset(const struct gl_shader_program *prog, - unsigned base_location, unsigned offset) + unsigned storage_index, + unsigned uniform_array_index) { - assert(prog->UniformLocationBaseScale >= 1); - assert(offset < prog->UniformLocationBaseScale); - return (base_location * prog->UniformLocationBaseScale) + offset; + /* location in remap table + array element offset */ + return prog->UniformStorage[storage_index].remap_location + + uniform_array_index; } /** - * Separate the uniform base location and parameter offset + * Separate the uniform storage index and array index */ static inline void _mesa_uniform_split_location_offset(const struct gl_shader_program *prog, - GLint location, unsigned *base_location, - unsigned *offset) + GLint location, unsigned *storage_index, + unsigned *uniform_array_index) { - *offset = location % prog->UniformLocationBaseScale; - *base_location = location / prog->UniformLocationBaseScale; + *storage_index = prog->UniformRemapTable[location] - prog->UniformStorage; + *uniform_array_index = location - + prog->UniformRemapTable[location]->remap_location; + + /*gl_uniform_storage in UniformStorage with the calculated base_location + * must match with the entry in remap table + */ + assert(&prog->UniformStorage[*storage_index] == + prog->UniformRemapTable[location]); } /*@}*/ |