diff options
author | Neil Roberts <[email protected]> | 2014-07-17 14:18:27 +0100 |
---|---|---|
committer | Neil Roberts <[email protected]> | 2014-08-12 18:23:50 +0100 |
commit | 7e78033c11858b34e274be91586fdfa750c1db11 (patch) | |
tree | ea5788bd36a172b27d040f6073aa63344827a650 /src/mesa/main/formats.c | |
parent | cc9c30b8a746691316ae7757b68cea1b1cd3ea84 (diff) |
mesa: Add the format enums for BPTC-compressed images
This adds the following four Mesa image format enums which correspond to the
four BPTC compressed texture formats:
MESA_FORMAT_BPTC_RGBA_UNORM
MESA_FORMAT_BPTC_SRGB_ALPHA_UNORM
MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT
MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT
It also updates the format information functions to handle these and the
corresponding GL enums.
v2: Also modify _mesa_get_format_color_encoding, _mesa_get_srgb_format_linear
and _mesa_get_uncompressed_format
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/main/formats.c')
-rw-r--r-- | src/mesa/main/formats.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index a4ddbd66963..db22a45c46d 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -369,6 +369,7 @@ _mesa_get_format_color_encoding(mesa_format format) case MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC: case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1: case MESA_FORMAT_B8G8R8X8_SRGB: + case MESA_FORMAT_BPTC_SRGB_ALPHA_UNORM: return GL_SRGB; default: return GL_LINEAR; @@ -451,6 +452,9 @@ _mesa_get_srgb_format_linear(mesa_format format) case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1: format = MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1; break; + case MESA_FORMAT_BPTC_SRGB_ALPHA_UNORM: + format = MESA_FORMAT_BPTC_RGBA_UNORM; + break; case MESA_FORMAT_B8G8R8X8_SRGB: format = MESA_FORMAT_B8G8R8X8_UNORM; break; @@ -516,6 +520,12 @@ _mesa_get_uncompressed_format(mesa_format format) case MESA_FORMAT_ETC2_RG11_EAC: case MESA_FORMAT_ETC2_SIGNED_RG11_EAC: return MESA_FORMAT_R16G16_UNORM; + case MESA_FORMAT_BPTC_RGBA_UNORM: + case MESA_FORMAT_BPTC_SRGB_ALPHA_UNORM: + return MESA_FORMAT_A8B8G8R8_UNORM; + case MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT: + case MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT: + return MESA_FORMAT_RGB_FLOAT32; default: #ifdef DEBUG assert(!_mesa_is_format_compressed(format)); @@ -993,6 +1003,10 @@ _mesa_format_to_type_and_comps(mesa_format format, case MESA_FORMAT_ETC2_SIGNED_RG11_EAC: case MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1: case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1: + case MESA_FORMAT_BPTC_RGBA_UNORM: + case MESA_FORMAT_BPTC_SRGB_ALPHA_UNORM: + case MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT: + case MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT: /* XXX generate error instead? */ *datatype = GL_UNSIGNED_BYTE; *comps = 0; @@ -1549,6 +1563,12 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, case MESA_FORMAT_RGBA_DXT5: return GL_FALSE; + case MESA_FORMAT_BPTC_RGBA_UNORM: + case MESA_FORMAT_BPTC_SRGB_ALPHA_UNORM: + case MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT: + case MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT: + return GL_FALSE; + case MESA_FORMAT_RGBA_FLOAT32: return format == GL_RGBA && type == GL_FLOAT && !swapBytes; case MESA_FORMAT_RGBA_FLOAT16: |