diff --git a/doc/changelog.dox b/doc/changelog.dox index 6d755430d..7c0031997 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -116,6 +116,12 @@ See also: - @webgl_extension{WEBGL,multi_draw} - @webgl_extension{WEBGL,draw_instanced_base_vertex_base_instance} - @webgl_extension{WEBGL,multi_draw_instanced_base_vertex_base_instance} +- Recognizing @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + OpenGL ES and @webgl_extension{WEBGL,compressed_texture_etc} WebGL + extensions, making ETC and EAC @ref GL::CompressedPixelFormat and + @ref GL::TextureFormat values available also on OpenGL ES 2.0 and WebGL. + The values were already present in WebGL 2.0 builds by accident before, + without documenting corresponding extension requirements. - Added a @ref GL::AbstractTexture::target() getter to simplify interaction with raw GL code - Exposed @gl_extension{ARB,buffer_storage} as diff --git a/doc/opengl-support.dox b/doc/opengl-support.dox index 5fa2e2252..2c955aab4 100644 --- a/doc/opengl-support.dox +++ b/doc/opengl-support.dox @@ -391,6 +391,7 @@ Extension | Status @gl_extension{ANGLE,framebuffer_multisample} | done @gl_extension{ANGLE,instanced_arrays} | done @gl_extension{ANGLE,depth_texture} | done +@m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) (unlisted) | done @gl_extension{APPLE,framebuffer_multisample} | done (ES 3.0 subset) @gl_extension{APPLE,texture_max_level} | done @gl_extension{ARM,rgba8} | done @@ -570,6 +571,7 @@ Extension | Status @webgl_extension{WEBGL,debug_shaders} | | @webgl_extension{WEBGL,compressed_texture_s3tc} | done @webgl_extension{WEBGL,compressed_texture_pvrtc} | done +@webgl_extension{WEBGL,compressed_texture_etc} | done @webgl_extension{WEBGL,compressed_texture_astc} | done @webgl_extension{WEBGL,compressed_texture_s3tc_srgb} | done @webgl_extension{WEBGL,multi_draw} | done diff --git a/src/Magnum/GL/AbstractTexture.cpp b/src/Magnum/GL/AbstractTexture.cpp index 51294a550..81d616521 100644 --- a/src/Magnum/GL/AbstractTexture.cpp +++ b/src/Magnum/GL/AbstractTexture.cpp @@ -574,10 +574,9 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) { #ifndef MAGNUM_TARGET_GLES case TextureFormat::CompressedRed: #endif - #ifndef MAGNUM_TARGET_GLES2 + /* for WebGL 1 these two are in the Luminance case instead */ case TextureFormat::CompressedR11Eac: case TextureFormat::CompressedSignedR11Eac: - #endif return PixelFormat::Red; #endif @@ -624,10 +623,9 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) { #ifndef MAGNUM_TARGET_GLES case TextureFormat::CompressedRG: #endif - #ifndef MAGNUM_TARGET_GLES2 + /* for WebGL 1 these two are in the LuminanceAlpha case instead */ case TextureFormat::CompressedRG11Eac: case TextureFormat::CompressedSignedRG11Eac: - #endif return PixelFormat::RG; #endif @@ -692,9 +690,7 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) { case TextureFormat::CompressedRGBBptcUnsignedFloat: case TextureFormat::CompressedRGBBptcSignedFloat: #endif - #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::CompressedRGB8Etc2: - #endif case TextureFormat::CompressedRGBS3tcDxt1: #ifdef MAGNUM_TARGET_GLES case TextureFormat::CompressedRGBPvrtc2bppV1: @@ -708,9 +704,7 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) { #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::SRGB8: #endif - #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::CompressedSRGB8Etc2: - #endif case TextureFormat::CompressedSRGBS3tcDxt1: #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) case TextureFormat::CompressedSRGBPvrtc2bppV1: @@ -764,10 +758,8 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) { #if !defined(MAGNUM_TARGET_GLES2) || defined(MAGNUM_TARGET_WEBGL) case TextureFormat::CompressedRGBABptcUnorm: #endif - #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::CompressedRGB8PunchthroughAlpha1Etc2: case TextureFormat::CompressedRGBA8Etc2Eac: - #endif case TextureFormat::CompressedRGBAS3tcDxt1: case TextureFormat::CompressedRGBAS3tcDxt3: case TextureFormat::CompressedRGBAS3tcDxt5: @@ -800,10 +792,8 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) { #if !defined(MAGNUM_TARGET_GLES2) || defined(MAGNUM_TARGET_WEBGL) case TextureFormat::CompressedSRGBAlphaBptcUnorm: #endif - #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::CompressedSRGB8PunchthroughAlpha1Etc2: case TextureFormat::CompressedSRGB8Alpha8Etc2Eac: - #endif case TextureFormat::CompressedSRGBAlphaS3tcDxt1: case TextureFormat::CompressedSRGBAlphaS3tcDxt3: case TextureFormat::CompressedSRGBAlphaS3tcDxt5: @@ -850,8 +840,22 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) { #ifdef MAGNUM_TARGET_GLES2 case TextureFormat::Luminance: + #ifdef MAGNUM_TARGET_WEBGL + /* Not sure if this is the right place, as neither of the + {ANGLE,WEBGL}_compressed_texture_etc specifications says what the corresponding pixel format is meant to be. For desktop, ES and + WebGL 2 these two are in the Red case instead. */ + case TextureFormat::CompressedR11Eac: + case TextureFormat::CompressedSignedR11Eac: + #endif return PixelFormat::Luminance; case TextureFormat::LuminanceAlpha: + #ifdef MAGNUM_TARGET_WEBGL + /* Not sure if this is the right place, as neither of the + {ANGLE,WEBGL}_compressed_texture_etc specifications says what the corresponding pixel format is meant to be. For desktop, ES and + WebGL 2 these two are in the RG case instead. */ + case TextureFormat::CompressedRG11Eac: + case TextureFormat::CompressedSignedRG11Eac: + #endif return PixelFormat::LuminanceAlpha; #endif @@ -950,7 +954,6 @@ PixelType pixelTypeForInternalFormat(const TextureFormat internalFormat) { case TextureFormat::CompressedRGBABptcUnorm: case TextureFormat::CompressedSRGBAlphaBptcUnorm: #endif - #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::CompressedRGB8Etc2: case TextureFormat::CompressedSRGB8Etc2: case TextureFormat::CompressedRGB8PunchthroughAlpha1Etc2: @@ -961,7 +964,6 @@ PixelType pixelTypeForInternalFormat(const TextureFormat internalFormat) { case TextureFormat::CompressedSignedR11Eac: case TextureFormat::CompressedRG11Eac: case TextureFormat::CompressedSignedRG11Eac: - #endif case TextureFormat::CompressedRGBS3tcDxt1: case TextureFormat::CompressedSRGBS3tcDxt1: case TextureFormat::CompressedRGBAS3tcDxt1: diff --git a/src/Magnum/GL/Context.cpp b/src/Magnum/GL/Context.cpp index de9a3e1c1..8bc85dc43 100644 --- a/src/Magnum/GL/Context.cpp +++ b/src/Magnum/GL/Context.cpp @@ -295,6 +295,7 @@ constexpr Extension ExtensionList[]{ #endif Extensions::WEBGL::blend_equation_advanced_coherent{}, Extensions::WEBGL::compressed_texture_astc{}, + Extensions::WEBGL::compressed_texture_etc{}, Extensions::WEBGL::compressed_texture_pvrtc{}, Extensions::WEBGL::compressed_texture_s3tc{}, Extensions::WEBGL::compressed_texture_s3tc_srgb{}, @@ -341,6 +342,7 @@ constexpr Extension ExtensionList[]{ #ifndef MAGNUM_TARGET_GLES2 Extensions::ANGLE::base_vertex_base_instance{}, #endif + Extensions::ANGLE::compressed_texture_etc{}, Extensions::ANGLE::multi_draw{}, Extensions::ANGLE::texture_compression_dxt1{}, Extensions::ANGLE::texture_compression_dxt3{}, diff --git a/src/Magnum/GL/Extensions.h b/src/Magnum/GL/Extensions.h index b245e59f3..9709b6c6a 100644 --- a/src/Magnum/GL/Extensions.h +++ b/src/Magnum/GL/Extensions.h @@ -337,17 +337,18 @@ namespace ANGLE { _extension(37,WEBGL,color_buffer_float, GLES200, None) // #14 _extension(38,WEBGL,draw_buffers, GLES200, GLES300) // #18 #endif - _extension(39,WEBGL,compressed_texture_astc, GLES200, None) // #30 - _extension(40,WEBGL,compressed_texture_s3tc_srgb, GLES200, None) // #32 - _extension(41,WEBGL,multi_draw, GLES200, None) // #40 - _extension(42,WEBGL,blend_equation_advanced_coherent,GLES200,None) // #42 + _extension(39,WEBGL,compressed_texture_etc, GLES200, None) // #29 + _extension(40,WEBGL,compressed_texture_astc, GLES200, None) // #30 + _extension(41,WEBGL,compressed_texture_s3tc_srgb, GLES200, None) // #32 + _extension(42,WEBGL,multi_draw, GLES200, None) // #40 + _extension(43,WEBGL,blend_equation_advanced_coherent,GLES200,None) // #42 #ifndef MAGNUM_TARGET_GLES2 - _extension(43,WEBGL,draw_instanced_base_vertex_base_instance,GLES300,None) // #46 - _extension(44,WEBGL,multi_draw_instanced_base_vertex_base_instance,GLES300,None) // #47 + _extension(44,WEBGL,draw_instanced_base_vertex_base_instance,GLES300,None) // #46 + _extension(45,WEBGL,multi_draw_instanced_base_vertex_base_instance,GLES300,None) // #47 #endif } namespace MAGNUM { #ifndef MAGNUM_TARGET_GLES2 - _extension(45,MAGNUM,shader_vertex_id, GLES300, GLES300) + _extension(46,MAGNUM,shader_vertex_id, GLES300, GLES300) #endif } #else @@ -377,21 +378,22 @@ namespace ANDROID { and this is THE ONLY SINGLE IMPLEMENTER so what gives?! */ _extension( 10,ANGLE,base_vertex_base_instance, GLES300, None) // #??? #endif + _extension( 11,ANGLE,compressed_texture_etc, GLES200, None) // #??? } namespace APPLE { #ifdef MAGNUM_TARGET_GLES2 - _extension( 11,APPLE,framebuffer_multisample, GLES200, GLES300) // #78 + _extension( 12,APPLE,framebuffer_multisample, GLES200, GLES300) // #78 #endif - _extension( 12,APPLE,texture_format_BGRA8888, GLES200, None) // #79 + _extension( 13,APPLE,texture_format_BGRA8888, GLES200, None) // #79 #ifdef MAGNUM_TARGET_GLES2 - _extension( 13,APPLE,texture_max_level, GLES200, GLES300) // #80 + _extension( 14,APPLE,texture_max_level, GLES200, GLES300) // #80 #endif - _extension( 14,APPLE,clip_distance, GLES200, None) // #193 + _extension( 15,APPLE,clip_distance, GLES200, None) // #193 } namespace ARM { #ifdef MAGNUM_TARGET_GLES2 - _extension( 15,ARM,rgba8, GLES200, GLES300) // #82 + _extension( 16,ARM,rgba8, GLES200, GLES300) // #82 #endif - _extension( 16,ARM,shader_framebuffer_fetch, GLES200, None) // #165 - _extension( 17,ARM,shader_framebuffer_fetch_depth_stencil, GLES200, None) // #166 + _extension( 17,ARM,shader_framebuffer_fetch, GLES200, None) // #165 + _extension( 18,ARM,shader_framebuffer_fetch_depth_stencil, GLES200, None) // #166 } namespace EXT { _extension( 19,EXT,texture_filter_anisotropic, GLES200, None) // #41 #ifdef MAGNUM_TARGET_GLES2 diff --git a/src/Magnum/GL/Implementation/compressedPixelFormatMapping.hpp b/src/Magnum/GL/Implementation/compressedPixelFormatMapping.hpp index 9365a1817..016c53f14 100644 --- a/src/Magnum/GL/Implementation/compressedPixelFormatMapping.hpp +++ b/src/Magnum/GL/Implementation/compressedPixelFormatMapping.hpp @@ -52,7 +52,6 @@ _s(Bc6hRGBSfloat) _s(Bc7RGBAUnorm) _s(Bc7RGBASrgb) #endif -#ifndef MAGNUM_TARGET_GLES2 _c(EacR11Unorm, R11Eac) _c(EacR11Snorm, SignedR11Eac) _c(EacRG11Unorm, RG11Eac) @@ -63,18 +62,6 @@ _c(Etc2RGB8A1Unorm, RGB8PunchthroughAlpha1Etc2) _c(Etc2RGB8A1Srgb, SRGB8PunchthroughAlpha1Etc2) _c(Etc2RGBA8Unorm, RGBA8Etc2Eac) _c(Etc2RGBA8Srgb, SRGB8Alpha8Etc2Eac) -#else -_s(EacR11Unorm) -_s(EacR11Snorm) -_s(EacRG11Unorm) -_s(EacRG11Snorm) -_s(Etc2RGB8Unorm) -_s(Etc2RGB8Srgb) -_s(Etc2RGB8A1Unorm) -_s(Etc2RGB8A1Srgb) -_s(Etc2RGBA8Unorm) -_s(Etc2RGBA8Srgb) -#endif _c(Astc4x4RGBAUnorm, RGBAAstc4x4) _c(Astc4x4RGBASrgb, SRGB8Alpha8Astc4x4) _c(Astc4x4RGBAF, RGBAAstc4x4) diff --git a/src/Magnum/GL/PixelFormat.cpp b/src/Magnum/GL/PixelFormat.cpp index 155629a41..9b869ba85 100644 --- a/src/Magnum/GL/PixelFormat.cpp +++ b/src/Magnum/GL/PixelFormat.cpp @@ -481,7 +481,6 @@ Debug& operator<<(Debug& debug, const CompressedPixelFormat value) { _c(RGBABptcUnorm) _c(SRGBAlphaBptcUnorm) #endif - #ifndef MAGNUM_TARGET_GLES2 _c(RGB8Etc2) _c(SRGB8Etc2) _c(RGB8PunchthroughAlpha1Etc2) @@ -492,7 +491,6 @@ Debug& operator<<(Debug& debug, const CompressedPixelFormat value) { _c(SignedR11Eac) _c(RG11Eac) _c(SignedRG11Eac) - #endif _c(RGBS3tcDxt1) _c(SRGBS3tcDxt1) _c(RGBAS3tcDxt1) diff --git a/src/Magnum/GL/PixelFormat.h b/src/Magnum/GL/PixelFormat.h index 11902026b..0e4e1f984 100644 --- a/src/Magnum/GL/PixelFormat.h +++ b/src/Magnum/GL/PixelFormat.h @@ -885,98 +885,166 @@ enum class CompressedPixelFormat: GLenum { #endif #endif - #ifndef MAGNUM_TARGET_GLES2 /** * ETC2 compressed RGB, normalized unsigned. **Available only on 2D, 2D * array, cube map and cube map array textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * on OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 RGB8Etc2 = GL_COMPRESSED_RGB8_ETC2, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + RGB8Etc2 = 0x9274, + #endif /** * ETC2 compressed sRGB, normalized unsigned. **Available only on 2D, 2D * array, cube map and cube map array textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * in OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 SRGB8Etc2 = GL_COMPRESSED_SRGB8_ETC2, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + SRGB8Etc2 = 0x9275, + #endif /** * ETC2 compressed RGB with punchthrough (single-bit) alpha, normalized * unsigned. **Available only on 2D, 2D array, cube map and cube map array * textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * in OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 RGB8PunchthroughAlpha1Etc2 = GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + RGB8PunchthroughAlpha1Etc2 = 0x9276, + #endif /** * ETC2 compressed sRGB with punchthrough (single-bit) alpha, normalized * unsigned. **Available only on 2D, 2D array, cube map and cube map array * textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * in OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 SRGB8PunchthroughAlpha1Etc2 = GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + SRGB8PunchthroughAlpha1Etc2 = 0x9277, + #endif /** * ETC2/EAC compressed RGBA, normalized unsigned. **Available only on 2D, * 2D array, cube map and cube map array textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * in OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 RGBA8Etc2Eac = GL_COMPRESSED_RGBA8_ETC2_EAC, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + RGBA8Etc2Eac = 0x9278, + #endif /** * ETC2/EAC compressed sRGB with alpha, normalized unsigned. **Available * only on 2D, 2D array, cube map and cube map array textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * in OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 SRGB8Alpha8Etc2Eac = GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + SRGB8Alpha8Etc2Eac = 0x9279, + #endif /** * EAC compressed red channel, normalized unsigned. **Available only on 2D, * 2D array, cube map and cube map array textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * in OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 R11Eac = GL_COMPRESSED_R11_EAC, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + R11Eac = 0x9270, + #endif /** * EAC compressed red channel, normalized signed. **Available only on 2D, * 2D array, cube map and cube map array textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * in OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 SignedR11Eac = GL_COMPRESSED_SIGNED_R11_EAC, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + SignedR11Eac = 0x9271, + #endif /** * EAC compressed red and green channel, normalized unsigned. **Available * only on 2D, 2D array, cube map and cube map array textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * in OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 RG11Eac = GL_COMPRESSED_RG11_EAC, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + RG11Eac = 0x9272, + #endif /** * EAC compressed red and green channel, normalized signed. **Available * only on 2D, 2D array, cube map and cube map array textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * in OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 SignedRG11Eac = GL_COMPRESSED_SIGNED_RG11_EAC, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + SignedRG11Eac = 0x9273, #endif /** diff --git a/src/Magnum/GL/Test/PixelFormatTest.cpp b/src/Magnum/GL/Test/PixelFormatTest.cpp index bf6dcf58b..173f0d074 100644 --- a/src/Magnum/GL/Test/PixelFormatTest.cpp +++ b/src/Magnum/GL/Test/PixelFormatTest.cpp @@ -441,12 +441,12 @@ void PixelFormatTest::mapCompressedFormatUnsupported() { #endif #ifdef MAGNUM_TARGET_GLES2 - CORRADE_VERIFY(!hasCompressedPixelFormat(Magnum::CompressedPixelFormat::Etc2RGB8Unorm)); + CORRADE_VERIFY(!hasCompressedPixelFormat(Magnum::CompressedPixelFormat::Astc3x3x3RGBAUnorm)); std::ostringstream out; Error redirectError{&out}; - compressedPixelFormat(Magnum::CompressedPixelFormat::Etc2RGB8Unorm); - CORRADE_COMPARE(out.str(), "GL::compressedPixelFormat(): format CompressedPixelFormat::Etc2RGB8Unorm is not supported on this target\n"); + compressedPixelFormat(Magnum::CompressedPixelFormat::Astc3x3x3RGBAUnorm); + CORRADE_COMPARE(out.str(), "GL::compressedPixelFormat(): format CompressedPixelFormat::Astc3x3x3RGBAUnorm is not supported on this target\n"); #elif !defined(MAGNUM_TARGET_GLES) CORRADE_VERIFY(!hasCompressedPixelFormat(Magnum::CompressedPixelFormat::PvrtcRGB2bppUnorm)); @@ -490,12 +490,12 @@ void PixelFormatTest::mapCompressedTextureFormatUnsupported() { #endif #ifdef MAGNUM_TARGET_GLES2 - CORRADE_VERIFY(!hasTextureFormat(Magnum::CompressedPixelFormat::Etc2RGB8Unorm)); + CORRADE_VERIFY(!hasTextureFormat(Magnum::CompressedPixelFormat::Astc3x3x3RGBAUnorm)); std::ostringstream out; Error redirectError{&out}; - textureFormat(Magnum::CompressedPixelFormat::Etc2RGB8Unorm); - CORRADE_COMPARE(out.str(), "GL::textureFormat(): format CompressedPixelFormat::Etc2RGB8Unorm is not supported on this target\n"); + textureFormat(Magnum::CompressedPixelFormat::Astc3x3x3RGBAUnorm); + CORRADE_COMPARE(out.str(), "GL::textureFormat(): format CompressedPixelFormat::Astc3x3x3RGBAUnorm is not supported on this target\n"); #elif !defined(MAGNUM_TARGET_GLES) CORRADE_VERIFY(!hasTextureFormat(Magnum::CompressedPixelFormat::PvrtcRGB2bppUnorm)); diff --git a/src/Magnum/GL/TextureFormat.cpp b/src/Magnum/GL/TextureFormat.cpp index 435eabed3..38d0d3457 100644 --- a/src/Magnum/GL/TextureFormat.cpp +++ b/src/Magnum/GL/TextureFormat.cpp @@ -183,7 +183,6 @@ Debug& operator<<(Debug& debug, const TextureFormat value) { _c(CompressedRGBABptcUnorm) _c(CompressedSRGBAlphaBptcUnorm) #endif - #ifndef MAGNUM_TARGET_GLES2 _c(CompressedRGB8Etc2) _c(CompressedSRGB8Etc2) _c(CompressedRGB8PunchthroughAlpha1Etc2) @@ -194,7 +193,6 @@ Debug& operator<<(Debug& debug, const TextureFormat value) { _c(CompressedSignedR11Eac) _c(CompressedRG11Eac) _c(CompressedSignedRG11Eac) - #endif _c(CompressedRGBS3tcDxt1) _c(CompressedSRGBS3tcDxt1) _c(CompressedRGBAS3tcDxt1) diff --git a/src/Magnum/GL/TextureFormat.h b/src/Magnum/GL/TextureFormat.h index b7a36bb0c..dfcb4f882 100644 --- a/src/Magnum/GL/TextureFormat.h +++ b/src/Magnum/GL/TextureFormat.h @@ -1306,98 +1306,166 @@ enum class TextureFormat: GLenum { #endif #endif - #ifndef MAGNUM_TARGET_GLES2 /** * ETC2 compressed RGB, normalized unsigned. **Available only on 2D, 2D * array, cube map and cube map array textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * in OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 CompressedRGB8Etc2 = GL_COMPRESSED_RGB8_ETC2, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + CompressedRGB8Etc2 = 0x9274, + #endif /** * ETC2 compressed sRGB, normalized unsigned. **Available only on 2D, 2D * array, cube map and cube map array textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * in OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 CompressedSRGB8Etc2 = GL_COMPRESSED_SRGB8_ETC2, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + CompressedSRGB8Etc2 = 0x9275, + #endif /** * ETC2 compressed RGB with punchthrough (single-bit) alpha, normalized * unsigned. **Available only on 2D, 2D array, cube map and cube map array * textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * in OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 CompressedRGB8PunchthroughAlpha1Etc2 = GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + CompressedRGB8PunchthroughAlpha1Etc2 = 0x9276, + #endif /** * ETC2 compressed sRGB with punchthrough (single-bit) alpha, normalized * unsigned. **Available only on 2D, 2D array, cube map and cube map array * textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * in OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 CompressedSRGB8PunchthroughAlpha1Etc2 = GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + CompressedSRGB8PunchthroughAlpha1Etc2 = 0x9277, + #endif /** * ETC2/EAC compressed RGBA, normalized unsigned. **Available only on 2D, * 2D array, cube map and cube map array textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * in OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 CompressedRGBA8Etc2Eac = GL_COMPRESSED_RGBA8_ETC2_EAC, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + CompressedRGBA8Etc2Eac = 0x9278, + #endif /** * ETC2/EAC compressed sRGB with alpha, normalized unsigned. **Available * only on 2D, 2D array, cube map and cube map array textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * in OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 CompressedSRGB8Alpha8Etc2Eac = GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + CompressedSRGB8Alpha8Etc2Eac = 0x9279, + #endif /** * EAC compressed red channel, normalized unsigned. **Available only on 2D, * 2D array, cube map and cube map array textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * in OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 CompressedR11Eac = GL_COMPRESSED_R11_EAC, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + CompressedR11Eac = 0x9270, + #endif /** * EAC compressed red channel, normalized signed. **Available only on 2D, * 2D array, cube map and cube map array textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * in OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 CompressedSignedR11Eac = GL_COMPRESSED_SIGNED_R11_EAC, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + CompressedSignedR11Eac = 0x9271, + #endif /** * EAC compressed red and green channel, normalized unsigned. **Available * only on 2D, 2D array, cube map and cube map array textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * in OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 CompressedRG11Eac = GL_COMPRESSED_RG11_EAC, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + CompressedRG11Eac = 0x9272, + #endif /** * EAC compressed red and green channel, normalized signed. **Available * only on 2D, 2D array, cube map and cube map array textures.** * @requires_gl43 Extension @gl_extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. + * @requires_gles30 Extension @m_class{m-doc-external} [ANGLE_compressed_texture_etc](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_compressed_texture_etc.txt) + * in OpenGL ES 2.0. + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_etc} */ + #ifndef MAGNUM_TARGET_GLES2 CompressedSignedRG11Eac = GL_COMPRESSED_SIGNED_RG11_EAC, + #else + /* ANGLE_compressed_texture_etc is not listed in gl_angle_ext.xml so we + have to hardcode; on ES3 (and thus WebGL 2) it's in the core header */ + CompressedSignedRG11Eac = 0x9273, #endif /** diff --git a/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt b/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt index dfb959d2b..1c9250f82 100644 --- a/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt @@ -42,6 +42,10 @@ extension KHR_blend_equation_advanced optional extension ANGLE_multi_draw optional # Base for WEBGL_{multi_,}draw_instanced_base_vertex_base_instance extension ANGLE_base_vertex_base_instance optional +# Base for WEBGL_compressed_texture_etc. Haha you wish, OF COURSE it's not +# included in gl_angle_ext.xml so I have to hardcode the numeric values there. +# GOOGLE!!! +# extension ANGLE_compressed_texture_etc optional begin functions blacklist # Not present in WEBGL_blend_equation_advanced_coherent diff --git a/src/MagnumExternal/OpenGL/GLES2/extensions.txt b/src/MagnumExternal/OpenGL/GLES2/extensions.txt index 8dc4dae15..fff42a6ef 100644 --- a/src/MagnumExternal/OpenGL/GLES2/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES2/extensions.txt @@ -113,6 +113,9 @@ extension OES_draw_elements_base_vertex optional # From the gl_angle_ext file extension ANGLE_multi_draw optional +# Haha you wish, OF COURSE it's not included in gl_angle_ext.xml so I have to +# hardcode the numeric values there. GOOGLE!!! +# extension ANGLE_compressed_texture_etc optional begin functions blacklist # These are listed in EXT_separate_shader_objects with only the comment diff --git a/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt b/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt index b51f38b25..47594844b 100644 --- a/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt @@ -31,6 +31,9 @@ extension KHR_blend_equation_advanced optional # From the gl_angle_ext file, base for WEBGL_multi_draw etc extension ANGLE_multi_draw optional extension ANGLE_base_vertex_base_instance optional +# Haha you wish, OF COURSE it's not included in gl_angle_ext.xml. But +# fortunately ES3 defines these constants on its own so I don't need it anyway. +# extension ANGLE_compressed_texture_etc optional begin functions blacklist # Not present in WEBGL_blend_equation_advanced_coherent diff --git a/src/MagnumExternal/OpenGL/GLES3/extensions.txt b/src/MagnumExternal/OpenGL/GLES3/extensions.txt index 9183fe213..a18dada00 100644 --- a/src/MagnumExternal/OpenGL/GLES3/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES3/extensions.txt @@ -93,5 +93,8 @@ extension OVR_multiview2 optional # From the gl_angle_ext file extension ANGLE_multi_draw optional extension ANGLE_base_vertex_base_instance optional +# Haha you wish, OF COURSE it's not included in gl_angle_ext.xml. But +# fortunately ES3 defines these constants on its own so I don't need it anyway. +# extension ANGLE_compressed_texture_etc optional # kate: hl python