From 7cb0c4d57ddc67f1786cd3f29f051ab34c9bfa7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 25 Aug 2019 22:48:44 +0200 Subject: [PATCH] Added BC4, BC5, BC6H and BC7 compression formats. Those are now also available under WebGL 1/2 and OpenGL ES 3.O (strangely not OpenGL ES 2.0) under EXT_texture_compression_{rgtc,bptc}. The GL names are extra weird-ass now that all other APIs use the BC names. --- doc/changelog.dox | 12 ++- doc/opengl-support.dox | 4 + src/Magnum/GL/AbstractTexture.cpp | 59 ++++++++++-- src/Magnum/GL/Context.cpp | 2 + src/Magnum/GL/Extensions.h | 34 ++++--- .../compressedPixelFormatMapping.hpp | 19 ++++ src/Magnum/GL/PixelFormat.cpp | 2 + src/Magnum/GL/PixelFormat.h | 90 ++++++++++++++---- src/Magnum/GL/Test/TextureGLTest.cpp | 56 +++++++---- src/Magnum/GL/TextureFormat.h | 94 +++++++++++++++---- src/Magnum/PixelFormat.cpp | 8 ++ src/Magnum/PixelFormat.h | 80 ++++++++++++++++ .../compressedFormatMapping.hpp | 8 ++ .../OpenGL/GLES2/Emscripten/extensions.txt | 2 + .../OpenGL/GLES2/flextGLEmscripten.h | 14 +++ .../OpenGL/GLES3/Emscripten/extensions.txt | 2 + .../OpenGL/GLES3/extensions.txt | 2 + src/MagnumExternal/OpenGL/GLES3/flextGL.h | 14 +++ .../OpenGL/GLES3/flextGLEmscripten.h | 14 +++ .../OpenGL/GLES3/flextGLWindowsDesktop.h | 14 +++ 20 files changed, 451 insertions(+), 79 deletions(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index 028eccfa3..33193ad6b 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -50,9 +50,9 @@ See also: - New @ref BasicMutableImageView "MutableImageView*D" and @ref BasicMutableCompressedImageView "MutableCompressedImageView*D" types for mutable views onto image data -- Added sRGB BCn, ETC2 and EAC formats to @ref CompressedPixelFormat as well - as their conversion to corresponding GL/Vulkan in - @ref GL::compressedPixelFormat() and +- Added sRGB BC1-3, BC4, BC5, BC6G, BC7, ETC2 and EAC formats to + @ref CompressedPixelFormat as well as their conversion to corresponding + GL/Vulkan formats in @ref GL::compressedPixelFormat() and @ref Vk::vkFormat(Magnum::CompressedPixelFormat) @subsubsection changelog-latest-new-audio Audio library @@ -163,6 +163,12 @@ See also: @gl_extension{EXT,texture_compression_s3tc_srgb} ES and @webgl_extension{WEBGL,compressed_texture_s3tc_srgb} WebGL extension to @ref GL::CompressedPixelFormat and @ref GL::TextureFormat +- Added support for @gl_extension{EXT,texture_compression_rgtc} / + @gl_extension{EXT,texture_compression_bptc} OpenGL ES and + @webgl_extension{EXT,texture_compression_rgtc} / + @webgl_extension{EXT,texture_compression_bptc} WebGL extensions, + complementing the desktop support for BC4, BC5, BC6H and BC7 formats in + @ref GL::CompressedPixelFormat and @ref GL::TextureFormat @subsubsection changelog-latest-new-math Math library diff --git a/doc/opengl-support.dox b/doc/opengl-support.dox index cb2fd409e..5627e68bf 100644 --- a/doc/opengl-support.dox +++ b/doc/opengl-support.dox @@ -455,6 +455,8 @@ Extension | Status @gl_extension{EXT,texture_compression_s3tc} | done @gl_extension{EXT,shader_integer_mix} | done (shading language only) @gl_extension{EXT,polygon_offset_clamp} | | +@gl_extension{EXT,texture_compression_rgtc} | done +@gl_extension{EXT,texture_compression_bptc} | done @gl_extension{EXT,texture_compression_s3tc_srgb} | done @gl_extension2{KHR,texture_compression_astc_hdr,KHR_texture_compression_astc_hdr} | done @gl_extension2{KHR,blend_equation_advanced_coherent,KHR_blend_equation_advanced} | done @@ -523,6 +525,8 @@ Extension | Status @webgl_extension{EXT,sRGB} | done @webgl_extension{EXT,disjoint_timer_query} | only time elapsed query @webgl_extension{EXT,color_buffer_float} | | +@gl_extension{EXT,texture_compression_rgtc} | done +@gl_extension{EXT,texture_compression_bptc} | done @webgl_extension{OES,texture_float_linear} | done @webgl_extension{WEBGL,compressed_texture_s3tc} | done @webgl_extension{WEBGL,compressed_texture_s3tc_srgb} | done diff --git a/src/Magnum/GL/AbstractTexture.cpp b/src/Magnum/GL/AbstractTexture.cpp index a6275c8a5..42526b6bf 100644 --- a/src/Magnum/GL/AbstractTexture.cpp +++ b/src/Magnum/GL/AbstractTexture.cpp @@ -560,8 +560,6 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) { #endif #ifndef MAGNUM_TARGET_GLES case TextureFormat::CompressedRed: - case TextureFormat::CompressedRedRgtc1: - case TextureFormat::CompressedSignedRedRgtc1: #endif #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::CompressedR11Eac: @@ -570,6 +568,19 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) { return PixelFormat::Red; #endif + #if !defined(MAGNUM_TARGET_GLES2) || defined(MAGNUM_TARGET_WEBGL) + case TextureFormat::CompressedRedRgtc1: + case TextureFormat::CompressedSignedRedRgtc1: + #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) + return PixelFormat::Red; + #else + /* RGTC is on WebGL 1 but there's no Red pixel format (which is + okay because WebGL doesn't allow compression by upload anyway). + Assert here to have the enum value handled. */ + CORRADE_ASSERT(false, "No single-component pixel format in WebGL 1 for RGTC compression", {}); + #endif + #endif + #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::R8UI: case TextureFormat::R8I: @@ -596,8 +607,6 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) { #endif #ifndef MAGNUM_TARGET_GLES case TextureFormat::CompressedRG: - case TextureFormat::CompressedRGRgtc2: - case TextureFormat::CompressedSignedRGRgtc2: #endif #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::CompressedRG11Eac: @@ -606,6 +615,19 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) { return PixelFormat::RG; #endif + #if !defined(MAGNUM_TARGET_GLES2) || defined(MAGNUM_TARGET_WEBGL) + case TextureFormat::CompressedRGRgtc2: + case TextureFormat::CompressedSignedRGRgtc2: + #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) + return PixelFormat::RG; + #else + /* RGTC is on WebGL 1 but there's no RG pixel format (which is okay + because WebGL doesn't allow compression by upload anyway). + Assert here to have the enum value handled. */ + CORRADE_ASSERT(false, "No two-component pixel format in WebGL 1 for RGTC compression", {}); + #endif + #endif + #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::RG8UI: case TextureFormat::RG8I: @@ -649,6 +671,8 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) { #endif #ifndef MAGNUM_TARGET_GLES case TextureFormat::CompressedRGB: + #endif + #if !defined(MAGNUM_TARGET_GLES2) || defined(MAGNUM_TARGET_WEBGL) case TextureFormat::CompressedRGBBptcUnsignedFloat: case TextureFormat::CompressedRGBBptcSignedFloat: #endif @@ -710,8 +734,9 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) { #endif #ifndef MAGNUM_TARGET_GLES case TextureFormat::CompressedRGBA: + #endif + #if !defined(MAGNUM_TARGET_GLES2) || defined(MAGNUM_TARGET_WEBGL) case TextureFormat::CompressedRGBABptcUnorm: - case TextureFormat::CompressedSRGBAlphaBptcUnorm: #endif #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::CompressedRGB8PunchthroughAlpha1Etc2: @@ -760,6 +785,9 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) { #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) case TextureFormat::SRGB8Alpha8: #endif + #if !defined(MAGNUM_TARGET_GLES2) || defined(MAGNUM_TARGET_WEBGL) + case TextureFormat::CompressedSRGBAlphaBptcUnorm: + #endif case TextureFormat::CompressedSRGBAlphaS3tcDxt1: case TextureFormat::CompressedSRGBAlphaS3tcDxt3: case TextureFormat::CompressedSRGBAlphaS3tcDxt5: @@ -865,6 +893,8 @@ PixelType pixelTypeForInternalFormat(const TextureFormat internalFormat) { case TextureFormat::CompressedRG: case TextureFormat::CompressedRGB: case TextureFormat::CompressedRGBA: + #endif + #if !defined(MAGNUM_TARGET_GLES2) || defined(MAGNUM_TARGET_WEBGL) case TextureFormat::CompressedRedRgtc1: case TextureFormat::CompressedRGRgtc2: case TextureFormat::CompressedRGBABptcUnorm: @@ -931,11 +961,20 @@ PixelType pixelTypeForInternalFormat(const TextureFormat internalFormat) { case TextureFormat::RG8I: case TextureFormat::RGB8I: case TextureFormat::RGBA8I: - #ifndef MAGNUM_TARGET_GLES + return PixelType::Byte; + #endif + + #if !defined(MAGNUM_TARGET_GLES2) || defined(MAGNUM_TARGET_WEBGL) case TextureFormat::CompressedSignedRedRgtc1: case TextureFormat::CompressedSignedRGRgtc2: - #endif + #ifndef MAGNUM_TARGET_GLES2 return PixelType::Byte; + #else + /* RGTC is on WebGL 1 but there's no RG pixel format (which is okay + because WebGL doesn't allow compression by upload anyway). + Assert here to have the enum value handled. */ + CORRADE_ASSERT(false, "No signed pixel type in OpenGL ES 2.0 for RGTC compression", {}); + #endif #endif #ifndef MAGNUM_TARGET_GLES @@ -991,15 +1030,17 @@ PixelType pixelTypeForInternalFormat(const TextureFormat internalFormat) { case TextureFormat::RGB32I: case TextureFormat::RGBA32I: return PixelType::Int; + #endif + #if !defined(MAGNUM_TARGET_GLES2) || defined(MAGNUM_TARGET_WEBGL) + #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::R32F: case TextureFormat::RG32F: case TextureFormat::RGB32F: case TextureFormat::RGBA32F: - #ifndef MAGNUM_TARGET_GLES + #endif case TextureFormat::CompressedRGBBptcUnsignedFloat: case TextureFormat::CompressedRGBBptcSignedFloat: - #endif return PixelType::Float; #endif diff --git a/src/Magnum/GL/Context.cpp b/src/Magnum/GL/Context.cpp index 31c64f955..664855db2 100644 --- a/src/Magnum/GL/Context.cpp +++ b/src/Magnum/GL/Context.cpp @@ -248,6 +248,8 @@ constexpr Extension ExtensionList[]{ #ifndef MAGNUM_TARGET_GLES2 _extension(EXT,color_buffer_float), #endif + _extension(EXT,texture_compression_rgtc), + _extension(EXT,texture_compression_bptc), _extension(OES,texture_float_linear), _extension(WEBGL,compressed_texture_s3tc), _extension(WEBGL,compressed_texture_s3tc_srgb)}; diff --git a/src/Magnum/GL/Extensions.h b/src/Magnum/GL/Extensions.h index 40f64ca87..5da574dcc 100644 --- a/src/Magnum/GL/Extensions.h +++ b/src/Magnum/GL/Extensions.h @@ -279,29 +279,31 @@ namespace ANGLE { /* Replaces WEBGL_color_buffer_float from WebGL 1 */ _extension( 8,EXT,color_buffer_float, GLES300, None) // #31 #endif + _extension( 9,EXT,texture_compression_rgtc, GLES200, None) // #38 + _extension(10,EXT,texture_compression_bptc, GLES200, None) // #39 } namespace OES { #ifdef MAGNUM_TARGET_GLES2 - _extension( 9,OES,texture_float, GLES200, GLES300) // #1 - _extension(10,OES,texture_half_float, GLES200, GLES300) // #2 - _extension(11,OES,standard_derivatives, GLES200, GLES300) // #4 - _extension(12,OES,vertex_array_object, GLES200, GLES300) // #5 - _extension(13,OES,element_index_uint, GLES200, GLES300) // #10 + _extension(15,OES,texture_float, GLES200, GLES300) // #1 + _extension(16,OES,texture_half_float, GLES200, GLES300) // #2 + _extension(17,OES,standard_derivatives, GLES200, GLES300) // #4 + _extension(18,OES,vertex_array_object, GLES200, GLES300) // #5 + _extension(19,OES,element_index_uint, GLES200, GLES300) // #10 #endif - _extension(14,OES,texture_float_linear, GLES200, None) // #20 + _extension(20,OES,texture_float_linear, GLES200, None) // #20 #ifdef MAGNUM_TARGET_GLES2 - _extension(15,OES,texture_half_float_linear, GLES200, GLES300) // #21 - _extension(16,OES,fbo_render_mipmap, GLES200, GLES300) // #28 + _extension(21,OES,texture_half_float_linear, GLES200, GLES300) // #21 + _extension(22,OES,fbo_render_mipmap, GLES200, GLES300) // #28 #endif } namespace WEBGL { - _extension(17,WEBGL,compressed_texture_s3tc, GLES200, None) // #8 + _extension(25,WEBGL,compressed_texture_s3tc, GLES200, None) // #8 #ifdef MAGNUM_TARGET_GLES2 - _extension(18,WEBGL,depth_texture, GLES200, GLES300) // #9 + _extension(26,WEBGL,depth_texture, GLES200, GLES300) // #9 /* Subsumed by the EXT_color_buffer_float extension in WebGL 2, so not exposing it on WebGL 2 builds even though it's not in core */ - _extension(19,WEBGL,color_buffer_float, GLES200, None) // #14 - _extension(20,WEBGL,draw_buffers, GLES200, GLES300) // #18 + _extension(27,WEBGL,color_buffer_float, GLES200, None) // #14 + _extension(28,WEBGL,draw_buffers, GLES200, GLES300) // #18 #endif - _extension(21,WEBGL,compressed_texture_s3tc_srgb, GLES200, None) // #32 + _extension(29,WEBGL,compressed_texture_s3tc_srgb, GLES200, None) // #32 } namespace MAGNUM { _extension(30,MAGNUM,shader_vertex_id, GLES300, GLES300) } @@ -398,7 +400,11 @@ namespace ANDROID { _extension( 60,EXT,primitive_bounding_box, GLES310, GLES320) // #186 #endif _extension( 61,EXT,polygon_offset_clamp, GLES200, None) // #252 - _extension( 62,EXT,texture_compression_s3tc_srgb, GLES200, None) // #289 + #ifndef MAGNUM_TARGET_GLES2 + _extension( 62,EXT,texture_compression_rgtc, GLES300, None) // #286 + _extension( 63,EXT,texture_compression_bptc, GLES300, None) // #287 + #endif + _extension( 64,EXT,texture_compression_s3tc_srgb, GLES200, None) // #289 } namespace KHR { _extension( 70,KHR,texture_compression_astc_ldr,GLES200, GLES320) // #117 _extension( 71,KHR,texture_compression_astc_hdr,GLES200, None) // #117 diff --git a/src/Magnum/GL/Implementation/compressedPixelFormatMapping.hpp b/src/Magnum/GL/Implementation/compressedPixelFormatMapping.hpp index 56c3de6c5..47f7c5e54 100644 --- a/src/Magnum/GL/Implementation/compressedPixelFormatMapping.hpp +++ b/src/Magnum/GL/Implementation/compressedPixelFormatMapping.hpp @@ -33,6 +33,25 @@ _c(Bc2RGBAUnorm, RGBAS3tcDxt3) _c(Bc2RGBASrgb, SRGBAlphaS3tcDxt3) _c(Bc3RGBAUnorm, RGBAS3tcDxt5) _c(Bc3RGBASrgb, SRGBAlphaS3tcDxt5) +#if !defined(MAGNUM_TARGET_GLES2) || defined(MAGNUM_TARGET_WEBGL) +_c(Bc4RUnorm, RedRgtc1) +_c(Bc4RSnorm, SignedRedRgtc1) +_c(Bc5RGUnorm, RGRgtc2) +_c(Bc5RGSnorm, SignedRGRgtc2) +_c(Bc6hRGBUfloat, RGBBptcUnsignedFloat) +_c(Bc6hRGBSfloat, RGBBptcSignedFloat) +_c(Bc7RGBAUnorm, RGBABptcUnorm) +_c(Bc7RGBASrgb, SRGBAlphaBptcUnorm) +#else +_s(Bc4RUnorm) +_s(Bc4RSnorm) +_s(Bc5RGUnorm) +_s(Bc5RGSnorm) +_s(Bc6hRGBUfloat) +_s(Bc6hRGBSfloat) +_s(Bc7RGBAUnorm) +_s(Bc7RGBASrgb) +#endif #ifndef MAGNUM_TARGET_GLES2 _c(EacR11Unorm, R11Eac) _c(EacR11Snorm, SignedR11Eac) diff --git a/src/Magnum/GL/PixelFormat.cpp b/src/Magnum/GL/PixelFormat.cpp index 2d3e1a815..6f084eeae 100644 --- a/src/Magnum/GL/PixelFormat.cpp +++ b/src/Magnum/GL/PixelFormat.cpp @@ -403,6 +403,8 @@ Debug& operator<<(Debug& debug, const CompressedPixelFormat value) { _c(RG) _c(RGB) _c(RGBA) + #endif + #if !defined(MAGNUM_TARGET_GLES2) || defined(MAGNUM_TARGET_WEBGL) _c(RedRgtc1) _c(RGRgtc2) _c(SignedRedRgtc1) diff --git a/src/Magnum/GL/PixelFormat.h b/src/Magnum/GL/PixelFormat.h index 1dfceb087..614b801c1 100644 --- a/src/Magnum/GL/PixelFormat.h +++ b/src/Magnum/GL/PixelFormat.h @@ -710,7 +710,9 @@ enum class CompressedPixelFormat: GLenum { * or WebGL. */ RGBA = GL_COMPRESSED_RGBA, + #endif + #if !defined(MAGNUM_TARGET_GLES2) || defined(MAGNUM_TARGET_WEBGL) /** * RGTC compressed red channel, normalized unsigned. Equivalent to the old * @def_gl{COMPRESSED_LUMINANCE_LATC1_EXT} from @@ -718,10 +720,17 @@ enum class CompressedPixelFormat: GLenum { * instead of all three. **Available only on 2D, 2D array, cube map and * cube map array textures.** * @requires_gl30 Extension @gl_extension{EXT,texture_compression_rgtc} - * @requires_gl RGTC texture compression is not available in OpenGL ES or - * WebGL. + * @requires_es_extension OpenGL ES 3.0 and extension + * @gl_extension{EXT,texture_compression_rgtc} + * @requires_webgl_extension Extension + * @webgl_extension{EXT,texture_compression_rgtc}. Unlike the OpenGL + * ES variant, this extension doesn't require WebGL 2. */ + #ifndef MAGNUM_TARGET_GLES RedRgtc1 = GL_COMPRESSED_RED_RGTC1, + #else + RedRgtc1 = GL_COMPRESSED_RED_RGTC1_EXT, + #endif /** * RGTC compressed red and green channel, normalized unsigned. Equivalent @@ -730,10 +739,17 @@ enum class CompressedPixelFormat: GLenum { * green channel instead of all four. **Available only on 2D, 2D array, * cube map and cube map array textures.** * @requires_gl30 Extension @gl_extension{EXT,texture_compression_rgtc} - * @requires_gl RGTC texture compression is not available in OpenGL ES or - * WebGL. + * @requires_es_extension OpenGL ES 3.0 and extension + * @gl_extension{EXT,texture_compression_rgtc} + * @requires_webgl_extension Extension + * @webgl_extension{EXT,texture_compression_rgtc}. Unlike the OpenGL + * ES variant, this extension doesn't require WebGL 2. */ + #ifndef MAGNUM_TARGET_GLES RGRgtc2 = GL_COMPRESSED_RG_RGTC2, + #else + RGRgtc2 = GL_COMPRESSED_RED_GREEN_RGTC2_EXT, /*?!*/ + #endif /** * RGTC compressed red channel, normalized signed. Equivalent to the old @@ -742,10 +758,17 @@ enum class CompressedPixelFormat: GLenum { * instead of all three. **Available only on 2D, 2D array, cube map and * cube map array textures.** * @requires_gl30 Extension @gl_extension{EXT,texture_compression_rgtc} - * @requires_gl RGTC texture compression is not available in OpenGL ES or - * WebGL. + * @requires_es_extension OpenGL ES 3.0 and extension + * @gl_extension{EXT,texture_compression_rgtc} + * @requires_webgl_extension Extension + * @webgl_extension{EXT,texture_compression_rgtc}. Unlike the OpenGL + * ES variant, this extension doesn't require WebGL 2. */ + #ifndef MAGNUM_TARGET_GLES SignedRedRgtc1 = GL_COMPRESSED_SIGNED_RED_RGTC1, + #else + SignedRedRgtc1 = GL_COMPRESSED_SIGNED_RED_RGTC1_EXT, + #endif /** * RGTC compressed red and green channel, normalized signed. Equivalent @@ -754,46 +777,81 @@ enum class CompressedPixelFormat: GLenum { * green channel instead of all four. **Available only on 2D, 2D array, * cube map and cube map array textures.** * @requires_gl30 Extension @gl_extension{EXT,texture_compression_rgtc} - * @requires_gl RGTC texture compression is not available in OpenGL ES or - * WebGL. + * @requires_es_extension OpenGL ES 3.0 and extension + * @gl_extension{EXT,texture_compression_rgtc} + * @requires_webgl_extension Extension + * @webgl_extension{EXT,texture_compression_rgtc}. Unlike the OpenGL + * ES variant, this extension doesn't require WebGL 2. */ + #ifndef MAGNUM_TARGET_GLES SignedRGRgtc2 = GL_COMPRESSED_SIGNED_RG_RGTC2, + #else + SignedRGRgtc2 = GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, /*?!*/ + #endif /** * BPTC compressed RGB, unsigned float. **Available only on 2D, 3D, 2D * array, cube map and cube map array textures.** * @requires_gl42 Extension @gl_extension{ARB,texture_compression_bptc} - * @requires_gl BPTC texture compression is not available in OpenGL ES or - * WebGL. + * @requires_es_extension OpenGL ES 3.0 and extension + * @gl_extension{EXT,texture_compression_bptc} + * @requires_webgl_extension Extension + * @webgl_extension{EXT,texture_compression_bptc}. Unlike the OpenGL + * ES variant, this extension doesn't require WebGL 2. */ + #ifndef MAGNUM_TARGET_GLES RGBBptcUnsignedFloat = GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, + #else + RGBBptcUnsignedFloat = GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT, + #endif /** * BPTC compressed RGB, signed float. **Available only on 2D, 3D, 2D array, * cube map and cube map array textures.** * @requires_gl42 Extension @gl_extension{ARB,texture_compression_bptc} - * @requires_gl BPTC texture compression is not available in OpenGL ES or - * WebGL. + * @requires_es_extension OpenGL ES 3.0 and extension + * @gl_extension{EXT,texture_compression_bptc} + * @requires_webgl_extension Extension + * @webgl_extension{EXT,texture_compression_bptc}. Unlike the OpenGL + * ES variant, this extension doesn't require WebGL 2. */ + #ifndef MAGNUM_TARGET_GLES RGBBptcSignedFloat = GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT, + #else + RGBBptcSignedFloat = GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, + #endif /** * BPTC compressed RGBA, normalized unsigned. **Available only on 2D, 3D, * 2D array, cube map and cube map array textures.** * @requires_gl42 Extension @gl_extension{ARB,texture_compression_bptc} - * @requires_gl BPTC texture compression is not available in OpenGL ES or - * WebGL. + * @requires_es_extension OpenGL ES 3.0 and extension + * @gl_extension{EXT,texture_compression_bptc} + * @requires_webgl_extension Extension + * @webgl_extension{EXT,texture_compression_bptc}. Unlike the OpenGL + * ES variant, this extension doesn't require WebGL 2. */ + #ifndef MAGNUM_TARGET_GLES RGBABptcUnorm = GL_COMPRESSED_RGBA_BPTC_UNORM, + #else + RGBABptcUnorm = GL_COMPRESSED_RGBA_BPTC_UNORM_EXT, + #endif /** * BPTC compressed sRGBA, normalized unsigned. **Available only on 2D, 3D, * 2D array, cube map and cube map array textures.** * @requires_gl42 Extension @gl_extension{ARB,texture_compression_bptc} - * @requires_gl BPTC texture compression is not available in OpenGL ES or - * WebGL. + * @requires_es_extension OpenGL ES 3.0 and extension + * @gl_extension{EXT,texture_compression_bptc} + * @requires_webgl_extension Extension + * @webgl_extension{EXT,texture_compression_bptc}. Unlike the OpenGL + * ES variant, this extension doesn't require WebGL 2. */ + #ifndef MAGNUM_TARGET_GLES SRGBAlphaBptcUnorm = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, + #else + SRGBAlphaBptcUnorm = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT, + #endif #endif #ifndef MAGNUM_TARGET_GLES2 diff --git a/src/Magnum/GL/Test/TextureGLTest.cpp b/src/Magnum/GL/Test/TextureGLTest.cpp index 07606b371..7f3d92251 100644 --- a/src/Magnum/GL/Test/TextureGLTest.cpp +++ b/src/Magnum/GL/Test/TextureGLTest.cpp @@ -403,17 +403,13 @@ constexpr UnsignedByte CompressedData3D[]{ const struct { const char* name; Containers::ArrayView data; - #ifndef MAGNUM_TARGET_GLES CompressedPixelStorage storage; - #endif Containers::ArrayView dataSparse; std::size_t offset; } CompressedPixelStorage3DData[]{ {"default pixel storage", Containers::arrayView(CompressedData3D).suffix(16*4), - #ifndef MAGNUM_TARGET_GLES {}, - #endif Containers::arrayView(CompressedData3D).suffix(16*4), 0}, #ifndef MAGNUM_TARGET_GLES {"skip Z", @@ -2359,14 +2355,18 @@ void TextureGLTest::subImage3DQueryBuffer() { void TextureGLTest::compressedImage3D() { setTestCaseDescription(CompressedPixelStorage3DData[testCaseInstanceId()].name); - #ifdef MAGNUM_TARGET_GLES - /** @todo ASTC HDR, when available on any ES driver */ - CORRADE_SKIP("No 3D texture compression format available on OpenGL ES."); + #if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) + CORRADE_SKIP("No 3D texture compression format available on OpenGL ES 2.0."); #else + #ifndef MAGNUM_TARGET_GLES if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::ARB::texture_compression_bptc::string() + std::string(" is not supported.")); if(CompressedPixelStorage3DData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported.")); + #else + if(!Context::current().isExtensionSupported()) + CORRADE_SKIP(Extensions::EXT::texture_compression_bptc::string() + std::string(" is not supported.")); + #endif Texture3D texture; texture.setCompressedImage(0, CompressedImageView3D{ @@ -2376,6 +2376,8 @@ void TextureGLTest::compressedImage3D() { MAGNUM_VERIFY_NO_GL_ERROR(); + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES CompressedImage3D image = texture.compressedImage(0, {CompressedPixelStorage3DData[testCaseInstanceId()].storage}); MAGNUM_VERIFY_NO_GL_ERROR(); @@ -2389,20 +2391,22 @@ void TextureGLTest::compressedImage3D() { TestSuite::Compare::Container); } #endif + #endif } #ifndef MAGNUM_TARGET_GLES2 void TextureGLTest::compressedImage3DBuffer() { setTestCaseDescription(CompressedPixelStorage3DData[testCaseInstanceId()].name); - #ifdef MAGNUM_TARGET_GLES - /** @todo ASTC HDR, when available on any ES driver */ - CORRADE_SKIP("No 3D texture compression format available on OpenGL ES."); - #else + #ifndef MAGNUM_TARGET_GLES if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::ARB::texture_compression_bptc::string() + std::string(" is not supported.")); if(CompressedPixelStorage3DData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported.")); + #else + if(!Context::current().isExtensionSupported()) + CORRADE_SKIP(Extensions::EXT::texture_compression_bptc::string() + std::string(" is not supported.")); + #endif Texture3D texture; texture.setCompressedImage(0, CompressedBufferImage3D{ @@ -2413,6 +2417,8 @@ void TextureGLTest::compressedImage3DBuffer() { MAGNUM_VERIFY_NO_GL_ERROR(); + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES CompressedBufferImage3D image = texture.compressedImage(0, {CompressedPixelStorage3DData[testCaseInstanceId()].storage}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); @@ -2464,7 +2470,7 @@ void TextureGLTest::compressedImage3DQueryView() { } #endif -#ifndef MAGNUM_TARGET_GLES +#if !defined(MAGNUM_TARGET_GLES2) || defined(MAGNUM_TARGET_WEBGL) /* Just 12x4x4 zeros compressed using RGBA BPTC Unorm by the driver */ constexpr UnsignedByte CompressedZero3D[3*4*16]{ 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -2482,7 +2488,9 @@ constexpr UnsignedByte CompressedZero3D[3*4*16]{ 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +#endif +#ifndef MAGNUM_TARGET_GLES /* Combination of CompressedZero3D and CompressedData3D. Note that, in contrast to array textures, the data are ordered in "cubes" instead of slices. */ @@ -2511,14 +2519,18 @@ constexpr UnsignedByte CompressedSubData3DComplete[]{ void TextureGLTest::compressedSubImage3D() { setTestCaseDescription(CompressedPixelStorage3DData[testCaseInstanceId()].name); - #ifdef MAGNUM_TARGET_GLES - /** @todo ASTC HDR, when available on any ES driver */ - CORRADE_SKIP("No 3D texture compression format available on OpenGL ES."); + #if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) + CORRADE_SKIP("No 3D texture compression format available on OpenGL ES 2.0."); #else + #ifndef MAGNUM_TARGET_GLES if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::ARB::texture_compression_bptc::string() + std::string(" is not supported.")); if(CompressedPixelStorage3DData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported.")); + #else + if(!Context::current().isExtensionSupported()) + CORRADE_SKIP(Extensions::EXT::texture_compression_bptc::string() + std::string(" is not supported.")); + #endif Texture3D texture; texture.setCompressedImage(0, CompressedImageView3D{CompressedPixelFormat::RGBABptcUnorm, @@ -2529,6 +2541,8 @@ void TextureGLTest::compressedSubImage3D() { MAGNUM_VERIFY_NO_GL_ERROR(); + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES CompressedImage3D image = texture.compressedImage(0, {}); MAGNUM_VERIFY_NO_GL_ERROR(); @@ -2545,20 +2559,22 @@ void TextureGLTest::compressedSubImage3D() { TestSuite::Compare::Container); } #endif + #endif } #ifndef MAGNUM_TARGET_GLES2 void TextureGLTest::compressedSubImage3DBuffer() { setTestCaseDescription(CompressedPixelStorage3DData[testCaseInstanceId()].name); - #ifdef MAGNUM_TARGET_GLES - /** @todo ASTC HDR, when available on any ES driver */ - CORRADE_SKIP("No 3D texture compression format available on OpenGL ES."); - #else + #ifndef MAGNUM_TARGET_GLES if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::ARB::texture_compression_bptc::string() + std::string(" is not supported.")); if(CompressedPixelStorage3DData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported.")); + #else + if(!Context::current().isExtensionSupported()) + CORRADE_SKIP(Extensions::EXT::texture_compression_bptc::string() + std::string(" is not supported.")); + #endif Texture3D texture; texture.setCompressedImage(0, CompressedImageView3D{CompressedPixelFormat::RGBABptcUnorm, @@ -2569,6 +2585,8 @@ void TextureGLTest::compressedSubImage3DBuffer() { MAGNUM_VERIFY_NO_GL_ERROR(); + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES CompressedBufferImage3D image = texture.compressedImage(0, {}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); diff --git a/src/Magnum/GL/TextureFormat.h b/src/Magnum/GL/TextureFormat.h index f3d5cf8ba..62aebe330 100644 --- a/src/Magnum/GL/TextureFormat.h +++ b/src/Magnum/GL/TextureFormat.h @@ -1012,7 +1012,9 @@ enum class TextureFormat: GLenum { * or WebGL. */ CompressedRGBA = GL_COMPRESSED_RGBA, + #endif + #if !defined(MAGNUM_TARGET_GLES2) || defined(MAGNUM_TARGET_WEBGL) /** * RGTC compressed red channel, normalized unsigned. Equivalent to the old * @def_gl{COMPRESSED_LUMINANCE_LATC1_EXT} from @@ -1020,10 +1022,17 @@ enum class TextureFormat: GLenum { * instead of all three. **Available only on 2D, 2D array, cube map and * cube map array textures.** * @requires_gl30 Extension @gl_extension{EXT,texture_compression_rgtc} - * @requires_gl Generic texture compression is not available in OpenGL ES - * or WebGL. + * @requires_es_extension OpenGL ES 3.0 and extension + * @gl_extension{EXT,texture_compression_rgtc} + * @requires_webgl_extension Extension + * @webgl_extension{EXT,texture_compression_rgtc}. Unlike the OpenGL + * ES variant, this extension doesn't require WebGL 2. */ + #ifndef MAGNUM_TARGET_GLES CompressedRedRgtc1 = GL_COMPRESSED_RED_RGTC1, + #else + CompressedRedRgtc1 = GL_COMPRESSED_RED_RGTC1_EXT, + #endif /** * RGTC compressed red and green channel, normalized unsigned. Equivalent @@ -1032,10 +1041,17 @@ enum class TextureFormat: GLenum { * green channel instead of all four. **Available only on 2D, 2D array, * cube map and cube map array textures.** * @requires_gl30 Extension @gl_extension{EXT,texture_compression_rgtc} - * @requires_gl RGTC texture compression is not available in OpenGL ES or - * WebGL. + * @requires_es_extension OpenGL ES 3.0 and extension + * @gl_extension{EXT,texture_compression_rgtc} + * @requires_webgl_extension Extension + * @webgl_extension{EXT,texture_compression_rgtc}. Unlike the OpenGL + * ES variant, this extension doesn't require WebGL 2. */ + #ifndef MAGNUM_TARGET_GLES CompressedRGRgtc2 = GL_COMPRESSED_RG_RGTC2, + #else + CompressedRGRgtc2 = GL_COMPRESSED_RED_GREEN_RGTC2_EXT, /*?!*/ + #endif /** * RGTC compressed red channel, normalized signed. Equivalent to the old @@ -1044,10 +1060,17 @@ enum class TextureFormat: GLenum { * instead of all three. **Available only on 2D, 2D array, cube map and * cube map array textures.** * @requires_gl30 Extension @gl_extension{EXT,texture_compression_rgtc} - * @requires_gl RGTC texture compression is not available in OpenGL ES or - * WebGL. + * @requires_es_extension OpenGL ES 3.0 and extension + * @gl_extension{EXT,texture_compression_rgtc} + * @requires_webgl_extension Extension + * @webgl_extension{EXT,texture_compression_rgtc}. Unlike the OpenGL + * ES variant, this extension doesn't require WebGL 2. */ + #ifndef MAGNUM_TARGET_GLES CompressedSignedRedRgtc1 = GL_COMPRESSED_SIGNED_RED_RGTC1, + #else + CompressedSignedRedRgtc1 = GL_COMPRESSED_SIGNED_RED_RGTC1_EXT, + #endif /** * RGTC compressed red and green channel, normalized signed. Equivalent @@ -1056,46 +1079,81 @@ enum class TextureFormat: GLenum { * green channel instead of all four. **Available only on 2D, 2D array, * cube map and cube map array textures.** * @requires_gl30 Extension @gl_extension{EXT,texture_compression_rgtc} - * @requires_gl RGTC texture compression is not available in OpenGL ES or - * WebGL. + * @requires_es_extension OpenGL ES 3.0 and extension + * @gl_extension{EXT,texture_compression_rgtc} + * @requires_webgl_extension Extension + * @webgl_extension{EXT,texture_compression_rgtc}. Unlike the OpenGL + * ES variant, this extension doesn't require WebGL 2. */ + #ifndef MAGNUM_TARGET_GLES CompressedSignedRGRgtc2 = GL_COMPRESSED_SIGNED_RG_RGTC2, + #else + CompressedSignedRGRgtc2 = GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, /*?!*/ + #endif /** * BPTC compressed RGB, unsigned float. **Available only on 2D, 3D, 2D * array, cube map and cube map array textures.** * @requires_gl42 Extension @gl_extension{ARB,texture_compression_bptc} - * @requires_gl BPTC texture compression is not available in OpenGL ES or - * WebGL. + * @requires_es_extension OpenGL ES 3.0 and extension + * @gl_extension{EXT,texture_compression_bptc} + * @requires_webgl_extension Extension + * @webgl_extension{EXT,texture_compression_bptc}. Unlike the OpenGL + * ES variant, this extension doesn't require WebGL 2. */ + #ifndef MAGNUM_TARGET_GLES CompressedRGBBptcUnsignedFloat = GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, + #else + CompressedRGBBptcUnsignedFloat = GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT, + #endif /** - * BPTC compressed RGB, signed float. **Available only on 2D, 3D, 2D - * array, cube map and cube map array textures.** + * BPTC compressed RGB, signed float. **Available only on 2D, 3D, 2D array, + * cube map and cube map array textures.** * @requires_gl42 Extension @gl_extension{ARB,texture_compression_bptc} - * @requires_gl BPTC texture compression is not available in OpenGL ES or - * WebGL. + * @requires_es_extension OpenGL ES 3.0 and extension + * @gl_extension{EXT,texture_compression_bptc} + * @requires_webgl_extension Extension + * @webgl_extension{EXT,texture_compression_bptc}. Unlike the OpenGL + * ES variant, this extension doesn't require WebGL 2. */ + #ifndef MAGNUM_TARGET_GLES CompressedRGBBptcSignedFloat = GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT, + #else + CompressedRGBBptcSignedFloat = GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, + #endif /** * BPTC compressed RGBA, normalized unsigned. **Available only on 2D, 3D, * 2D array, cube map and cube map array textures.** * @requires_gl42 Extension @gl_extension{ARB,texture_compression_bptc} - * @requires_gl BPTC texture compression is not available in OpenGL ES or - * WebGL. + * @requires_es_extension OpenGL ES 3.0 and extension + * @gl_extension{EXT,texture_compression_bptc} + * @requires_webgl_extension Extension + * @webgl_extension{EXT,texture_compression_bptc}. Unlike the OpenGL + * ES variant, this extension doesn't require WebGL 2. */ + #ifndef MAGNUM_TARGET_GLES CompressedRGBABptcUnorm = GL_COMPRESSED_RGBA_BPTC_UNORM, + #else + CompressedRGBABptcUnorm = GL_COMPRESSED_RGBA_BPTC_UNORM_EXT, + #endif /** * BPTC compressed sRGBA, normalized unsigned. **Available only on 2D, 3D, * 2D array, cube map and cube map array textures.** * @requires_gl42 Extension @gl_extension{ARB,texture_compression_bptc} - * @requires_gl BPTC texture compression is not available in OpenGL ES or - * WebGL. + * @requires_es_extension OpenGL ES 3.0 and extension + * @gl_extension{EXT,texture_compression_bptc} + * @requires_webgl_extension Extension + * @webgl_extension{EXT,texture_compression_bptc}. Unlike the OpenGL + * ES variant, this extension doesn't require WebGL 2. */ + #ifndef MAGNUM_TARGET_GLES CompressedSRGBAlphaBptcUnorm = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, + #else + CompressedSRGBAlphaBptcUnorm = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT, + #endif #endif #ifndef MAGNUM_TARGET_GLES2 diff --git a/src/Magnum/PixelFormat.cpp b/src/Magnum/PixelFormat.cpp index 372e1e2f9..5bbb3ff0e 100644 --- a/src/Magnum/PixelFormat.cpp +++ b/src/Magnum/PixelFormat.cpp @@ -196,6 +196,14 @@ Debug& operator<<(Debug& debug, const CompressedPixelFormat value) { _c(Bc2RGBASrgb) _c(Bc3RGBAUnorm) _c(Bc3RGBASrgb) + _c(Bc4RUnorm) + _c(Bc4RSnorm) + _c(Bc5RGUnorm) + _c(Bc5RGSnorm) + _c(Bc6hRGBUfloat) + _c(Bc6hRGBSfloat) + _c(Bc7RGBAUnorm) + _c(Bc7RGBASrgb) _c(EacR11Unorm) _c(EacR11Snorm) _c(EacRG11Unorm) diff --git a/src/Magnum/PixelFormat.h b/src/Magnum/PixelFormat.h index 8db894d7e..4fa314172 100644 --- a/src/Magnum/PixelFormat.h +++ b/src/Magnum/PixelFormat.h @@ -650,6 +650,86 @@ enum class CompressedPixelFormat: UnsignedInt { */ Bc3RGBASrgb, + /** + * [3Dc+](https://en.wikipedia.org/wiki/3Dc#3Dc+) BC4 compressed red + * component, unsigned normalized. Also known as RGTC1 or LATC1. + * + * Corresponds to @ref GL::CompressedPixelFormat::RedRgtc1 / + * @ref GL::TextureFormat::CompressedRedRgtc1 / + * @def_vk_keyword{FORMAT_BC4_UNORM_BLOCK,Format}. + */ + Bc4RUnorm, + + /** + * [3Dc+](https://en.wikipedia.org/wiki/3Dc#3Dc+) BC4 compressed red + * component, signed normalized. Also known as RGTC1 or LATC1. + * + * Corresponds to @ref GL::CompressedPixelFormat::SignedRedRgtc1 / + * @ref GL::TextureFormat::CompressedSignedRedRgtc1 / + * @def_vk_keyword{FORMAT_BC4_SNORM_BLOCK,Format}. + */ + Bc4RSnorm, + + /** + * [3Dc](https://en.wikipedia.org/wiki/3Dc) BC5 compressed red and green + * component, unsigned normalized. Also known as RGTC2 or LATC2. + * + * Corresponds to @ref GL::CompressedPixelFormat::RGRgtc2 / + * @ref GL::TextureFormat::CompressedRGRgtc2 / + * @def_vk_keyword{FORMAT_BC5_UNORM_BLOCK,Format}. + */ + Bc5RGUnorm, + + /** + * [3Dc](https://en.wikipedia.org/wiki/3Dc) BC5 compressed red and green + * component, signed normalized. Also known as RGTC2 or LATC2. + * + * Corresponds to @ref GL::CompressedPixelFormat::SignedRGRgtc2 / + * @ref GL::TextureFormat::CompressedSignedRGRgtc2 / + * @def_vk_keyword{FORMAT_BC5_SNORM_BLOCK,Format}. + */ + Bc5RGSnorm, + + /** + * [BC6H](https://docs.microsoft.com/en-us/windows/win32/direct3d11/bc6h-format) + * compressed RGB, unsigned float. Also known as BPTC. + * + * Corresponds to @ref GL::CompressedPixelFormat::RGBBptcUnsignedFloat / + * @ref GL::TextureFormat::CompressedRGBBptcUnsignedFloat / + * @def_vk_keyword{FORMAT_BC6H_UFLOAT_BLOCK,Format}. + */ + Bc6hRGBUfloat, + + /** + * [BC6H](https://docs.microsoft.com/en-us/windows/win32/direct3d11/bc6h-format) + * compressed RGB, signed float. Also known as BPTC. + * + * Corresponds to @ref GL::CompressedPixelFormat::RGBBptcSignedFloat / + * @ref GL::TextureFormat::CompressedRGBBptcSignedFloat / + * @def_vk_keyword{FORMAT_BC6H_SFLOAT_BLOCK,Format}. + */ + Bc6hRGBSfloat, + + /** + * [BC7](https://docs.microsoft.com/en-us/windows/win32/direct3d11/bc7-format), + * compressed RGBA, unsigned normalized. Also known as BPTC. + * + * Corresponds to @ref GL::CompressedPixelFormat::RGBABptcUnorm / + * @ref GL::TextureFormat::CompressedRGBABptcUnorm / + * @def_vk_keyword{FORMAT_BC7_UNORM_BLOCK,Format}. + */ + Bc7RGBAUnorm, + + /** + * [BC7](https://docs.microsoft.com/en-us/windows/win32/direct3d11/bc7-format), + * compressed sRGB + linear alpha, unsigned normalized. Also known as BPTC. + * + * Corresponds to @ref GL::CompressedPixelFormat::SRGBAlphaBptcUnorm / + * @ref GL::TextureFormat::CompressedSRGBAlphaBptcUnorm / + * @def_vk_keyword{FORMAT_BC7_SRGB_BLOCK,Format}. + */ + Bc7RGBASrgb, + /** * [EAC](https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC2_and_EAC) * compressed red component, normalized unsigned 11-bit. diff --git a/src/Magnum/Vk/Implementation/compressedFormatMapping.hpp b/src/Magnum/Vk/Implementation/compressedFormatMapping.hpp index b155a3332..732d52042 100644 --- a/src/Magnum/Vk/Implementation/compressedFormatMapping.hpp +++ b/src/Magnum/Vk/Implementation/compressedFormatMapping.hpp @@ -33,6 +33,14 @@ _c(Bc2RGBAUnorm, BC2_UNORM_BLOCK) _c(Bc2RGBASrgb, BC2_SRGB_BLOCK) _c(Bc3RGBAUnorm, BC3_UNORM_BLOCK) _c(Bc3RGBASrgb, BC3_SRGB_BLOCK) +_c(Bc4RUnorm, BC4_UNORM_BLOCK) +_c(Bc4RSnorm, BC4_SNORM_BLOCK) +_c(Bc5RGUnorm, BC5_UNORM_BLOCK) +_c(Bc5RGSnorm, BC5_SNORM_BLOCK) +_c(Bc6hRGBUfloat, BC6H_UFLOAT_BLOCK) +_c(Bc6hRGBSfloat, BC6H_SFLOAT_BLOCK) +_c(Bc7RGBAUnorm, BC7_UNORM_BLOCK) +_c(Bc7RGBASrgb, BC7_SRGB_BLOCK) _c(EacR11Unorm, EAC_R11_UNORM_BLOCK) _c(EacR11Snorm, EAC_R11_SNORM_BLOCK) _c(EacRG11Unorm, EAC_R11G11_UNORM_BLOCK) diff --git a/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt b/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt index 7299f679b..baa7f786b 100644 --- a/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt @@ -22,6 +22,8 @@ extension EXT_draw_buffers optional extension EXT_texture_filter_anisotropic optional extension EXT_disjoint_timer_query optional +extension EXT_texture_compression_rgtc optional +extension EXT_texture_compression_bptc optional # These are used as a base for WEBGL_* extensions extension EXT_color_buffer_float optional extension EXT_texture_compression_s3tc optional diff --git a/src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h b/src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h index fa7dea997..5454983ef 100644 --- a/src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h +++ b/src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h @@ -492,6 +492,20 @@ typedef khronos_uint64_t GLuint64; #define GL_TIMESTAMP_EXT 0x8E28 #define GL_GPU_DISJOINT_EXT 0x8FBB +/* GL_EXT_texture_compression_rgtc */ + +#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC +#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD +#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE + +/* GL_EXT_texture_compression_bptc */ + +#define GL_COMPRESSED_RGBA_BPTC_UNORM_EXT 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT 0x8E8F + /* GL_EXT_texture_compression_s3tc */ #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 diff --git a/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt b/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt index 89fb75cde..183278414 100644 --- a/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt @@ -6,6 +6,8 @@ version 3.0 es extension EXT_texture_filter_anisotropic optional extension EXT_disjoint_timer_query optional extension EXT_color_buffer_float optional +extension EXT_texture_compression_rgtc optional +extension EXT_texture_compression_bptc optional # These are used as a base for WEBGL_* extensions extension EXT_texture_compression_s3tc optional extension EXT_texture_compression_s3tc_srgb optional diff --git a/src/MagnumExternal/OpenGL/GLES3/extensions.txt b/src/MagnumExternal/OpenGL/GLES3/extensions.txt index ccc96d3bc..37633991c 100644 --- a/src/MagnumExternal/OpenGL/GLES3/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES3/extensions.txt @@ -47,6 +47,8 @@ extension EXT_sRGB_write_control optional extension EXT_texture_compression_s3tc optional extension EXT_shader_integer_mix optional extension EXT_polygon_offset_clamp optional +extension EXT_texture_compression_rgtc optional +extension EXT_texture_compression_bptc optional extension EXT_texture_compression_s3tc_srgb optional extension KHR_texture_compression_astc_hdr optional extension KHR_blend_equation_advanced_coherent optional diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGL.h b/src/MagnumExternal/OpenGL/GLES3/flextGL.h index ece5f1a6c..4063b5443 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGL.h +++ b/src/MagnumExternal/OpenGL/GLES3/flextGL.h @@ -1530,6 +1530,20 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B +/* GL_EXT_texture_compression_rgtc */ + +#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC +#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD +#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE + +/* GL_EXT_texture_compression_bptc */ + +#define GL_COMPRESSED_RGBA_BPTC_UNORM_EXT 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT 0x8E8F + /* GL_EXT_texture_compression_s3tc_srgb */ #define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h b/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h index c051aae43..bb735428c 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h @@ -731,6 +731,20 @@ typedef struct __GLsync *GLsync; #define GL_TIMESTAMP_EXT 0x8E28 #define GL_GPU_DISJOINT_EXT 0x8FBB +/* GL_EXT_texture_compression_rgtc */ + +#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC +#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD +#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE + +/* GL_EXT_texture_compression_bptc */ + +#define GL_COMPRESSED_RGBA_BPTC_UNORM_EXT 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT 0x8E8F + /* GL_EXT_texture_compression_s3tc */ #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h b/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h index 6bfaa0f0f..4511db1b5 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h @@ -1522,6 +1522,20 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B +/* GL_EXT_texture_compression_rgtc */ + +#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC +#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD +#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE + +/* GL_EXT_texture_compression_bptc */ + +#define GL_COMPRESSED_RGBA_BPTC_UNORM_EXT 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT 0x8E8F + /* GL_EXT_texture_compression_s3tc_srgb */ #define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C