From 8e57060f39725edac75cdf01d3df9e3d48b090e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 26 Aug 2019 02:26:48 +0200 Subject: [PATCH] Support for PVRTC compressed pixel format. --- doc/changelog.dox | 5 +- doc/opengl-support.dox | 6 ++ src/Magnum/GL/AbstractTexture.cpp | 34 +++++++ src/Magnum/GL/Context.cpp | 3 + src/Magnum/GL/Context.h | 2 +- src/Magnum/GL/Extensions.h | 50 +++++----- .../compressedPixelFormatMapping.hpp | 35 +++++++ src/Magnum/GL/PixelFormat.cpp | 18 ++++ src/Magnum/GL/PixelFormat.h | 91 ++++++++++++++++++- src/Magnum/GL/TextureFormat.h | 89 ++++++++++++++++++ src/Magnum/PixelFormat.cpp | 8 ++ src/Magnum/PixelFormat.h | 88 +++++++++++++++++- .../compressedFormatMapping.hpp | 9 ++ .../OpenGL/GLES2/Emscripten/extensions.txt | 1 + .../OpenGL/GLES2/extensions.txt | 2 + src/MagnumExternal/OpenGL/GLES2/flextGL.h | 16 ++++ .../OpenGL/GLES2/flextGLEmscripten.h | 7 ++ .../OpenGL/GLES2/flextGLWindowsDesktop.h | 16 ++++ .../OpenGL/GLES3/Emscripten/extensions.txt | 1 + .../OpenGL/GLES3/extensions.txt | 2 + src/MagnumExternal/OpenGL/GLES3/flextGL.h | 16 ++++ .../OpenGL/GLES3/flextGLEmscripten.h | 7 ++ .../OpenGL/GLES3/flextGLWindowsDesktop.h | 16 ++++ src/MagnumExternal/Vulkan/extensions.txt | 2 + src/MagnumExternal/Vulkan/flextVk.h | 15 ++- 25 files changed, 512 insertions(+), 27 deletions(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index 0beb9db0c..d587ed5fe 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -50,7 +50,7 @@ See also: - New @ref BasicMutableImageView "MutableImageView*D" and @ref BasicMutableCompressedImageView "MutableCompressedImageView*D" types for mutable views onto image data -- Added sRGB BC1-3, BC4, BC5, BC6G, BC7, ETC2, EAC and ASTC formats to +- Added sRGB BC1-3, BC4, BC5, BC6G, BC7, ETC2, EAC, ASTC and PVRTC formats to @ref CompressedPixelFormat as well as their conversion to corresponding GL/Vulkan formats in @ref GL::compressedPixelFormat() and @ref Vk::vkFormat(Magnum::CompressedPixelFormat) @@ -96,6 +96,9 @@ See also: complementing the desktop support for BC4, BC5, BC6H and BC7 formats - @webgl_extension{WEBGL,texture_compression_astc} WebGL extension, complementing the desktop and ES support for ASTC + - PVRTC formats defined by the @gl_extension{IMG,texture_compression_pvrtc} + / @gl_extension{IMG,pvrtc_sRGB} OpenGL ES and + @webgl_extension{WEBGL,compressed_texture_pvrtc} WebGL extensions - New @ref GL::AbstractFramebuffer::implementationColorReadFormat() and @ref GL::AbstractFramebuffer::implementationColorReadType() queries for more robust checks when doing framebuffer readbacks; together with three diff --git a/doc/opengl-support.dox b/doc/opengl-support.dox index 1ab2a7068..802e924e3 100644 --- a/doc/opengl-support.dox +++ b/doc/opengl-support.dox @@ -453,11 +453,13 @@ Extension | Status @gl_extension{EXT,texture_sRGB_decode} | done @gl_extension{EXT,sRGB_write_control} | done @gl_extension{EXT,texture_compression_s3tc} | done +@gl_extension{EXT,pvrtc_sRGB} | 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_extension{IMG,texture_compression_pvrtc} | 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 @gl_extension{KHR,context_flush_control} | | @@ -529,6 +531,7 @@ Extension | Status @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_pvrtc} | done @webgl_extension{WEBGL,compressed_texture_astc} | done @webgl_extension{WEBGL,compressed_texture_s3tc_srgb} | done @@ -595,6 +598,9 @@ add any performance gains, is not supported in Magnum. See also - @gl_extension{NV,draw_texture} can be done with framebuffer blitting and doesn't make any full-screen postprocessing easier, as shaders are excluded. +- @gl_extension{IMG,texture_compression_pvrtc2} OpenGL ES extension is not + supported as there is no equivalent in WebGL nor Metal and + [all hardware having support for it suppors other formats as well](https://forums.developer.apple.com/thread/38454). */ /** @page opengl-deprecated Deprecated OpenGL API list diff --git a/src/Magnum/GL/AbstractTexture.cpp b/src/Magnum/GL/AbstractTexture.cpp index 8a4d0367f..3320dced9 100644 --- a/src/Magnum/GL/AbstractTexture.cpp +++ b/src/Magnum/GL/AbstractTexture.cpp @@ -681,6 +681,10 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) { case TextureFormat::CompressedSRGB8Etc2: #endif case TextureFormat::CompressedRGBS3tcDxt1: + #ifdef MAGNUM_TARGET_GLES + case TextureFormat::CompressedRGBPvrtc2bppV1: + case TextureFormat::CompressedRGBPvrtc4bppV1: + #endif return PixelFormat::RGB; #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2) @@ -690,6 +694,10 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) { case TextureFormat::SRGB8: #endif case TextureFormat::CompressedSRGBS3tcDxt1: + #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) + case TextureFormat::CompressedSRGBPvrtc2bppV1: + case TextureFormat::CompressedSRGBPvrtc4bppV1: + #endif #ifndef MAGNUM_TARGET_GLES2 return PixelFormat::RGB; #else @@ -761,6 +769,10 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) { case TextureFormat::CompressedRGBAAstc10x10: case TextureFormat::CompressedRGBAAstc12x10: case TextureFormat::CompressedRGBAAstc12x12: + #ifdef MAGNUM_TARGET_GLES + case TextureFormat::CompressedRGBAPvrtc2bppV1: + case TextureFormat::CompressedRGBAPvrtc4bppV1: + #endif return PixelFormat::RGBA; #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2) @@ -789,6 +801,10 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) { case TextureFormat::CompressedSRGB8Alpha8Astc10x10: case TextureFormat::CompressedSRGB8Alpha8Astc12x10: case TextureFormat::CompressedSRGB8Alpha8Astc12x12: + #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) + case TextureFormat::CompressedSRGBAlphaPvrtc2bppV1: + case TextureFormat::CompressedSRGBAlphaPvrtc4bppV1: + #endif #ifndef MAGNUM_TARGET_GLES2 return PixelFormat::RGBA; #else @@ -946,6 +962,24 @@ PixelType pixelTypeForInternalFormat(const TextureFormat internalFormat) { case TextureFormat::CompressedSRGB8Alpha8Astc12x10: case TextureFormat::CompressedRGBAAstc12x12: case TextureFormat::CompressedSRGB8Alpha8Astc12x12: + #ifdef MAGNUM_TARGET_GLES + case TextureFormat::CompressedRGBPvrtc2bppV1: + #ifndef MAGNUM_TARGET_WEBGL + case TextureFormat::CompressedSRGBPvrtc2bppV1: + #endif + case TextureFormat::CompressedRGBAPvrtc2bppV1: + #ifndef MAGNUM_TARGET_WEBGL + case TextureFormat::CompressedSRGBAlphaPvrtc2bppV1: + #endif + case TextureFormat::CompressedRGBPvrtc4bppV1: + #ifndef MAGNUM_TARGET_WEBGL + case TextureFormat::CompressedSRGBPvrtc4bppV1: + #endif + case TextureFormat::CompressedRGBAPvrtc4bppV1: + #ifndef MAGNUM_TARGET_WEBGL + case TextureFormat::CompressedSRGBAlphaPvrtc4bppV1: + #endif + #endif return PixelType::UnsignedByte; #ifndef MAGNUM_TARGET_GLES2 diff --git a/src/Magnum/GL/Context.cpp b/src/Magnum/GL/Context.cpp index 3b774857b..6db3cdbb3 100644 --- a/src/Magnum/GL/Context.cpp +++ b/src/Magnum/GL/Context.cpp @@ -252,6 +252,7 @@ constexpr Extension ExtensionList[]{ _extension(EXT,texture_compression_bptc), _extension(OES,texture_float_linear), _extension(WEBGL,compressed_texture_s3tc), + _extension(WEBGL,compressed_texture_pvrtc), _extension(WEBGL,compressed_texture_astc), _extension(WEBGL,compressed_texture_s3tc_srgb)}; constexpr Extension ExtensionListES300[]{ @@ -298,11 +299,13 @@ constexpr Extension ExtensionList[]{ _extension(EXT,texture_sRGB_decode), _extension(EXT,sRGB_write_control), _extension(EXT,texture_compression_s3tc), + _extension(EXT,pvrtc_sRGB), #ifndef MAGNUM_TARGET_GLES2 _extension(EXT,shader_integer_mix), #endif _extension(EXT,polygon_offset_clamp), _extension(EXT,texture_compression_s3tc_srgb), + _extension(IMG,texture_compression_pvrtc), _extension(KHR,texture_compression_astc_hdr), _extension(KHR,blend_equation_advanced_coherent), _extension(KHR,context_flush_control), diff --git a/src/Magnum/GL/Context.h b/src/Magnum/GL/Context.h index 08ba4e363..94c1ef09f 100644 --- a/src/Magnum/GL/Context.h +++ b/src/Magnum/GL/Context.h @@ -60,7 +60,7 @@ namespace Implementation { #elif !defined(MAGNUM_TARGET_WEBGL) 144 #else - 32 + 48 #endif }; } diff --git a/src/Magnum/GL/Extensions.h b/src/Magnum/GL/Extensions.h index 9f8afb95e..08120f62e 100644 --- a/src/Magnum/GL/Extensions.h +++ b/src/Magnum/GL/Extensions.h @@ -298,15 +298,18 @@ namespace ANGLE { _extension(25,WEBGL,compressed_texture_s3tc, GLES200, None) // #8 #ifdef MAGNUM_TARGET_GLES2 _extension(26,WEBGL,depth_texture, GLES200, GLES300) // #9 + #endif + _extension(27,WEBGL,compressed_texture_pvrtc, GLES200, None) // #13 + #ifdef MAGNUM_TARGET_GLES2 /* 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(27,WEBGL,color_buffer_float, GLES200, None) // #14 - _extension(28,WEBGL,draw_buffers, GLES200, GLES300) // #18 + _extension(28,WEBGL,color_buffer_float, GLES200, None) // #14 + _extension(29,WEBGL,draw_buffers, GLES200, GLES300) // #18 #endif - _extension(29,WEBGL,compressed_texture_astc, GLES200, None) // #30 - _extension(30,WEBGL,compressed_texture_s3tc_srgb, GLES200, None) // #32 + _extension(30,WEBGL,compressed_texture_astc, GLES200, None) // #30 + _extension(31,WEBGL,compressed_texture_s3tc_srgb, GLES200, None) // #32 } namespace MAGNUM { - _extension(31,MAGNUM,shader_vertex_id, GLES300, GLES300) + _extension(40,MAGNUM,shader_vertex_id, GLES300, GLES300) } #else namespace ANDROID { @@ -379,33 +382,36 @@ namespace ANDROID { _extension( 45,EXT,texture_sRGB_decode, GLES200, None) // #152 _extension( 46,EXT,sRGB_write_control, GLES200, None) // #153 _extension( 47,EXT,texture_compression_s3tc, GLES200, None) // #154 + _extension( 48,EXT,pvrtc_sRGB, GLES200, None) // #155 #ifdef MAGNUM_TARGET_GLES2 - _extension( 48,EXT,instanced_arrays, GLES200, GLES300) // #156 - _extension( 49,EXT,draw_instanced, GLES200, GLES300) // #157 + _extension( 49,EXT,instanced_arrays, GLES200, GLES300) // #156 + _extension( 50,EXT,draw_instanced, GLES200, GLES300) // #157 #endif #ifndef MAGNUM_TARGET_GLES2 - _extension( 50,EXT,shader_integer_mix, GLES300, None) // #161 - _extension( 51,EXT,copy_image, GLES300, GLES320) // #175 + _extension( 51,EXT,shader_integer_mix, GLES300, None) // #161 + _extension( 52,EXT,copy_image, GLES300, GLES320) // #175 #endif - _extension( 52,EXT,draw_buffers_indexed, GLES200, GLES320) // #176 + _extension( 53,EXT,draw_buffers_indexed, GLES200, GLES320) // #176 #ifndef MAGNUM_TARGET_GLES2 - _extension( 53,EXT,geometry_shader, GLES310, GLES320) // #177 - _extension( 54,EXT,gpu_shader5, GLES310, GLES320) // #178 - _extension( 55,EXT,shader_io_blocks, GLES310, GLES320) // #180 - _extension( 56,EXT,tessellation_shader, GLES310, GLES320) // #181 + _extension( 54,EXT,geometry_shader, GLES310, GLES320) // #177 + _extension( 55,EXT,gpu_shader5, GLES310, GLES320) // #178 + _extension( 56,EXT,shader_io_blocks, GLES310, GLES320) // #180 + _extension( 57,EXT,tessellation_shader, GLES310, GLES320) // #181 #endif - _extension( 57,EXT,texture_border_clamp, GLES200, GLES320) // #182 + _extension( 58,EXT,texture_border_clamp, GLES200, GLES320) // #182 #ifndef MAGNUM_TARGET_GLES2 - _extension( 58,EXT,texture_buffer, GLES310, GLES320) // #183 - _extension( 59,EXT,texture_cube_map_array, GLES310, GLES320) // #184 - _extension( 60,EXT,primitive_bounding_box, GLES310, GLES320) // #186 + _extension( 59,EXT,texture_buffer, GLES310, GLES320) // #183 + _extension( 60,EXT,texture_cube_map_array, GLES310, GLES320) // #184 + _extension( 61,EXT,primitive_bounding_box, GLES310, GLES320) // #186 #endif - _extension( 61,EXT,polygon_offset_clamp, GLES200, None) // #252 + _extension( 62,EXT,polygon_offset_clamp, GLES200, None) // #252 #ifndef MAGNUM_TARGET_GLES2 - _extension( 62,EXT,texture_compression_rgtc, GLES300, None) // #286 - _extension( 63,EXT,texture_compression_bptc, GLES300, None) // #287 + _extension( 63,EXT,texture_compression_rgtc, GLES300, None) // #286 + _extension( 64,EXT,texture_compression_bptc, GLES300, None) // #287 #endif - _extension( 64,EXT,texture_compression_s3tc_srgb, GLES200, None) // #289 + _extension( 65,EXT,texture_compression_s3tc_srgb, GLES200, None) // #289 +} namespace IMG { + _extension( 66,IMG,texture_compression_pvrtc, GLES200, None) // #54 } 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 2f1bb1f08..70aa87c66 100644 --- a/src/Magnum/GL/Implementation/compressedPixelFormatMapping.hpp +++ b/src/Magnum/GL/Implementation/compressedPixelFormatMapping.hpp @@ -103,4 +103,39 @@ _c(Astc12x10RGBAUnorm, RGBAAstc12x10) _c(Astc12x10RGBASrgb, SRGB8Alpha8Astc12x10) _c(Astc12x12RGBAUnorm, RGBAAstc12x12) _c(Astc12x12RGBASrgb, SRGB8Alpha8Astc12x12) +#ifdef MAGNUM_TARGET_GLES +_c(PvrtcRGB2bppUnorm, RGBPvrtc2bppV1) +#ifndef MAGNUM_TARGET_WEBGL +_c(PvrtcRGB2bppSrgb, SRGBPvrtc2bppV1) +#else +_s(PvrtcRGB2bppSrgb) +#endif +_c(PvrtcRGBA2bppUnorm, RGBAPvrtc2bppV1) +#ifndef MAGNUM_TARGET_WEBGL +_c(PvrtcRGBA2bppSrgb, SRGBAlphaPvrtc2bppV1) +#else +_s(PvrtcRGBA2bppSrgb) +#endif +_c(PvrtcRGB4bppUnorm, RGBPvrtc4bppV1) +#ifndef MAGNUM_TARGET_WEBGL +_c(PvrtcRGB4bppSrgb, SRGBPvrtc4bppV1) +#else +_s(PvrtcRGB4bppSrgb) +#endif +_c(PvrtcRGBA4bppUnorm, RGBAPvrtc4bppV1) +#ifndef MAGNUM_TARGET_WEBGL +_c(PvrtcRGBA4bppSrgb, SRGBAlphaPvrtc4bppV1) +#else +_s(PvrtcRGBA4bppSrgb) +#endif +#else +_s(PvrtcRGB2bppUnorm) +_s(PvrtcRGB2bppSrgb) +_s(PvrtcRGBA2bppUnorm) +_s(PvrtcRGBA2bppSrgb) +_s(PvrtcRGB4bppUnorm) +_s(PvrtcRGB4bppSrgb) +_s(PvrtcRGBA4bppUnorm) +_s(PvrtcRGBA4bppSrgb) +#endif #endif diff --git a/src/Magnum/GL/PixelFormat.cpp b/src/Magnum/GL/PixelFormat.cpp index fb629382d..74b145cf8 100644 --- a/src/Magnum/GL/PixelFormat.cpp +++ b/src/Magnum/GL/PixelFormat.cpp @@ -462,6 +462,24 @@ Debug& operator<<(Debug& debug, const CompressedPixelFormat value) { _c(SRGB8Alpha8Astc12x10) _c(RGBAAstc12x12) _c(SRGB8Alpha8Astc12x12) + #ifdef MAGNUM_TARGET_GLES + _c(RGBPvrtc2bppV1) + #ifndef MAGNUM_TARGET_WEBGL + _c(SRGBPvrtc2bppV1) + #endif + _c(RGBAPvrtc2bppV1) + #ifndef MAGNUM_TARGET_WEBGL + _c(SRGBAlphaPvrtc2bppV1) + #endif + _c(RGBPvrtc4bppV1) + #ifndef MAGNUM_TARGET_WEBGL + _c(SRGBPvrtc4bppV1) + #endif + _c(RGBAPvrtc4bppV1) + #ifndef MAGNUM_TARGET_WEBGL + _c(SRGBAlphaPvrtc4bppV1) + #endif + #endif #undef _c /* LCOV_EXCL_STOP */ } diff --git a/src/Magnum/GL/PixelFormat.h b/src/Magnum/GL/PixelFormat.h index bb595672e..449a9b4a7 100644 --- a/src/Magnum/GL/PixelFormat.h +++ b/src/Magnum/GL/PixelFormat.h @@ -1410,7 +1410,96 @@ enum class CompressedPixelFormat: GLenum { * for 3D textures and HDR profile ** @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_astc} */ - SRGB8Alpha8Astc12x12 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR + SRGB8Alpha8Astc12x12 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, + + #if defined(DOXYGEN_GENERATING_OUTPUT) || defined(MAGNUM_TARGET_GLES) + /** + * PVRTC compressed RGB, normalized unsigned byte with 2 bits per pixel. + * **Available only on 2D, 3D, 2D array, cube map and cube map array + * textures.** + * @requires_gles Not available on desktop OpenGL. + * @requires_es_extension Extension @gl_extension{IMG,texture_compression_pvrtc} + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_pvrtc} + */ + RGBPvrtc2bppV1 = GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG, + + #ifndef MAGNUM_TARGET_WEBGL + /** + * PVRTC compressed sRGB, normalized unsigned byte with 2 bits per pixel. + * **Available only on 2D, 3D, 2D array, cube map and cube map array + * textures.** + * @requires_gles Not available on desktop OpenGL or WebGL. + * @requires_es_extension Extension @gl_extension{EXT,pvrtc_sRGB} + */ + SRGBPvrtc2bppV1 = GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT, + #endif + + /** + * PVRTC compressed RGBA, normalized unsigned byte with 2 bits per pixel. + * **Available only on 2D, 3D, 2D array, cube map and cube map array + * textures.** + * @requires_gles Not available on desktop OpenGL. + * @requires_es_extension Extension @gl_extension{IMG,texture_compression_pvrtc} + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_pvrtc} + */ + RGBAPvrtc2bppV1 = GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, + + #ifndef MAGNUM_TARGET_WEBGL + /** + * PVRTC compressed sRGB + linear alpha, normalized unsigned byte with 2 + * bits per pixel. **Available only on 2D, 3D, 2D array, cube map and cube + * map array textures.** + * @requires_gles Not available on desktop OpenGL or WebGL. + * @requires_es_extension Extension @gl_extension{EXT,pvrtc_sRGB} + */ + SRGBAlphaPvrtc2bppV1 = GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT, + #endif + + /** + * PVRTC compressed RGB, normalized unsigned byte with 4 bits per pixel. + * **Available only on 2D, 3D, 2D array, cube map and cube map array + * textures.** + * @requires_gles Not available on desktop OpenGL. + * @requires_es_extension Extension @gl_extension{IMG,texture_compression_pvrtc} + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_pvrtc} + */ + RGBPvrtc4bppV1 = GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, + + #ifndef MAGNUM_TARGET_WEBGL + /** + * PVRTC compressed sRGB, normalized unsigned byte with 4 bits per pixel. + * **Available only on 2D, 3D, 2D array, cube map and cube map array + * textures.** + * @requires_gles Not available on desktop OpenGL or WebGL. + * @requires_es_extension Extension @gl_extension{EXT,pvrtc_sRGB} + */ + SRGBPvrtc4bppV1 = GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT, + #endif + + /** + * PVRTC compressed RGBA, normalized unsigned byte with 4 bits per pixel. + * **Available only on 2D, 3D, 2D array, cube map and cube map array + * textures.** + * @requires_gles Not available on desktop OpenGL. + * @requires_es_extension Extension @gl_extension{IMG,texture_compression_pvrtc} + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_pvrtc} + */ + RGBAPvrtc4bppV1 = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, + + #ifndef MAGNUM_TARGET_WEBGL + /** + * PVRTC compressed sRGB + linear alpha, normalized unsigned byte with 4 + * bits per pixel. **Available only on 2D, 3D, 2D array, cube map and cube + * map array textures.** + * @requires_gles Not available on desktop OpenGL or WebGL. + * @requires_es_extension Extension @gl_extension{EXT,pvrtc_sRGB} + */ + SRGBAlphaPvrtc4bppV1 = GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT + #endif + + /* PVRTC2 variants not listed as PVRTC is mainly on Apple hardware but + Metal doesn't support it and it doesn't have a WebGL equiv either. */ + #endif }; /** diff --git a/src/Magnum/GL/TextureFormat.h b/src/Magnum/GL/TextureFormat.h index fe012215c..9e6726695 100644 --- a/src/Magnum/GL/TextureFormat.h +++ b/src/Magnum/GL/TextureFormat.h @@ -1714,6 +1714,95 @@ enum class TextureFormat: GLenum { */ CompressedSRGB8Alpha8Astc12x12 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, + #if defined(DOXYGEN_GENERATING_OUTPUT) || defined(MAGNUM_TARGET_GLES) + /** + * PVRTC compressed RGB, normalized unsigned byte with 2 bits per pixel. + * **Available only on 2D, 3D, 2D array, cube map and cube map array + * textures.** + * @requires_gles Not available on desktop OpenGL. + * @requires_es_extension Extension @gl_extension{IMG,texture_compression_pvrtc} + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_pvrtc} + */ + CompressedRGBPvrtc2bppV1 = GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG, + + #ifndef MAGNUM_TARGET_WEBGL + /** + * PVRTC compressed sRGB, normalized unsigned byte with 2 bits per pixel. + * **Available only on 2D, 3D, 2D array, cube map and cube map array + * textures.** + * @requires_gles Not available on desktop OpenGL or WebGL. + * @requires_es_extension Extension @gl_extension{EXT,pvrtc_sRGB} + */ + CompressedSRGBPvrtc2bppV1 = GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT, + #endif + + /** + * PVRTC compressed RGBA, normalized unsigned byte with 2 bits per pixel. + * **Available only on 2D, 3D, 2D array, cube map and cube map array + * textures.** + * @requires_gles Not available on desktop OpenGL. + * @requires_es_extension Extension @gl_extension{IMG,texture_compression_pvrtc} + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_pvrtc} + */ + CompressedRGBAPvrtc2bppV1 = GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, + + #ifndef MAGNUM_TARGET_WEBGL + /** + * PVRTC compressed sRGB + linear alpha, normalized unsigned byte with 2 + * bits per pixel. **Available only on 2D, 3D, 2D array, cube map and cube + * map array textures.** + * @requires_gles Not available on desktop OpenGL or WebGL. + * @requires_es_extension Extension @gl_extension{EXT,pvrtc_sRGB} + */ + CompressedSRGBAlphaPvrtc2bppV1 = GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT, + #endif + + /** + * PVRTC compressed RGB, normalized unsigned byte with 4 bits per pixel. + * **Available only on 2D, 3D, 2D array, cube map and cube map array + * textures.** + * @requires_gles Not available on desktop OpenGL. + * @requires_es_extension Extension @gl_extension{IMG,texture_compression_pvrtc} + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_pvrtc} + */ + CompressedRGBPvrtc4bppV1 = GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, + + #ifndef MAGNUM_TARGET_WEBGL + /** + * PVRTC compressed sRGB, normalized unsigned byte with 4 bits per pixel. + * **Available only on 2D, 3D, 2D array, cube map and cube map array + * textures.** + * @requires_gles Not available on desktop OpenGL or WebGL. + * @requires_es_extension Extension @gl_extension{EXT,pvrtc_sRGB} + */ + CompressedSRGBPvrtc4bppV1 = GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT, + #endif + + /** + * PVRTC compressed RGBA, normalized unsigned byte with 4 bits per pixel. + * **Available only on 2D, 3D, 2D array, cube map and cube map array + * textures.** + * @requires_gles Not available on desktop OpenGL. + * @requires_es_extension Extension @gl_extension{IMG,texture_compression_pvrtc} + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_pvrtc} + */ + CompressedRGBAPvrtc4bppV1 = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, + + #ifndef MAGNUM_TARGET_WEBGL + /** + * PVRTC compressed sRGB + linear alpha, normalized unsigned byte with 4 + * bits per pixel. **Available only on 2D, 3D, 2D array, cube map and cube + * map array textures.** + * @requires_gles Not available on desktop OpenGL or WebGL. + * @requires_es_extension Extension @gl_extension{EXT,pvrtc_sRGB} + */ + CompressedSRGBAlphaPvrtc4bppV1 = GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT, + #endif + + /* PVRTC2 variants not listed as PVRTC is mainly on Apple hardware but + Metal doesn't support it and it doesn't have a WebGL equiv either. */ + #endif + /** * Depth component, size implementation-dependent. Not supported in 3D * textures. Not allowed in unemulated @ref Texture::setStorage() diff --git a/src/Magnum/PixelFormat.cpp b/src/Magnum/PixelFormat.cpp index e4d084713..905b89717 100644 --- a/src/Magnum/PixelFormat.cpp +++ b/src/Magnum/PixelFormat.cpp @@ -242,6 +242,14 @@ Debug& operator<<(Debug& debug, const CompressedPixelFormat value) { _c(Astc12x10RGBASrgb) _c(Astc12x12RGBAUnorm) _c(Astc12x12RGBASrgb) + _c(PvrtcRGB2bppUnorm) + _c(PvrtcRGB2bppSrgb) + _c(PvrtcRGBA2bppUnorm) + _c(PvrtcRGBA2bppSrgb) + _c(PvrtcRGB4bppUnorm) + _c(PvrtcRGB4bppSrgb) + _c(PvrtcRGBA4bppUnorm) + _c(PvrtcRGBA4bppSrgb) #undef _c /* LCOV_EXCL_STOP */ } diff --git a/src/Magnum/PixelFormat.h b/src/Magnum/PixelFormat.h index abb55f46e..9992eb133 100644 --- a/src/Magnum/PixelFormat.h +++ b/src/Magnum/PixelFormat.h @@ -1122,7 +1122,93 @@ enum class CompressedPixelFormat: UnsignedInt { * @ref GL::TextureFormat::CompressedSRGB8Alpha8Astc12x12 / * @def_vk_keyword{FORMAT_ASTC_12x12_SRGB_BLOCK,Format}. */ - Astc12x12RGBASrgb + Astc12x12RGBASrgb, + + /* See https://github.com/KhronosGroup/Vulkan-Docs/issues/512#issuecomment-307768667 + for Vulkan mapping. Ugh. */ + + /** + * [PVRTC](https://en.wikipedia.org/wiki/PVRTC) compressed RGB, normalized + * unsigned byte with 2 bits per pixel. + * + * Corresponds to @ref GL::CompressedPixelFormat::RGBPvrtc2bppV1, + * @ref GL::TextureFormat::CompressedRGBPvrtc2bppV1 / + * @def_vk_keyword{FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG,Format}. + */ + PvrtcRGB2bppUnorm, + + /** + * [PVRTC](https://en.wikipedia.org/wiki/PVRTC) compressed sRGB, normalized + * unsigned byte with 2 bits per pixel. + * + * Corresponds to @ref GL::CompressedPixelFormat::SRGBPvrtc2bppV1, + * @ref GL::TextureFormat::CompressedSRGBPvrtc2bppV1 / + * @def_vk_keyword{FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG,Format}. + */ + PvrtcRGB2bppSrgb, + + /** + * [PVRTC](https://en.wikipedia.org/wiki/PVRTC) compressed RGBA, normalized + * unsigned byte with 2 bits per pixel. + * + * Corresponds to @ref GL::CompressedPixelFormat::RGBAPvrtc2bppV1, + * @ref GL::TextureFormat::CompressedRGBAPvrtc2bppV1 / + * @def_vk_keyword{FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG,Format}. + */ + PvrtcRGBA2bppUnorm, + + /** + * [PVRTC](https://en.wikipedia.org/wiki/PVRTC) compressed sRGB + linear + * alpha, normalized unsigned byte with 2 bits per pixel. + * + * Corresponds to @ref GL::CompressedPixelFormat::SRGBAlphaPvrtc2bppV1, + * @ref GL::TextureFormat::CompressedSRGBAlphaPvrtc2bppV1 / + * @def_vk_keyword{FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG,Format}. + */ + PvrtcRGBA2bppSrgb, + + /** + * [PVRTC](https://en.wikipedia.org/wiki/PVRTC) compressed RGB, normalized + * unsigned byte with 4 bits per pixel. + * + * Corresponds to @ref GL::CompressedPixelFormat::RGBPvrtc4bppV1, + * @ref GL::TextureFormat::CompressedRGBPvrtc4bppV1 / + * @def_vk_keyword{FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG,Format}. + */ + PvrtcRGB4bppUnorm, + + /** + * [PVRTC](https://en.wikipedia.org/wiki/PVRTC) compressed sRGB, normalized + * unsigned byte with 4 bits per pixel. + * + * Corresponds to @ref GL::CompressedPixelFormat::SRGBPvrtc4bppV1, + * @ref GL::TextureFormat::CompressedSRGBPvrtc4bppV1 / + * @def_vk_keyword{FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG,Format}. + */ + PvrtcRGB4bppSrgb, + + /** + * [PVRTC](https://en.wikipedia.org/wiki/PVRTC) compressed RGBA, normalized + * unsigned byte with 4 bits per pixel. + * + * Corresponds to @ref GL::CompressedPixelFormat::RGBAPvrtc4bppV1, + * @ref GL::TextureFormat::CompressedRGBAPvrtc4bppV1 / + * @def_vk_keyword{FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG,Format}. + */ + PvrtcRGBA4bppUnorm, + + /** + * [PVRTC](https://en.wikipedia.org/wiki/PVRTC) compressed sRGB + linear + * alpha, normalized unsigned byte with 4 bits per pixel. + * + * Corresponds to @ref GL::CompressedPixelFormat::SRGBAlphaPvrtc4bppV1, + * @ref GL::TextureFormat::CompressedSRGBAlphaPvrtc4bppV1 / + * @def_vk_keyword{FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG,Format}. + */ + PvrtcRGBA4bppSrgb + + /* PVRTC2 variants not listed as PVRTC is mainly on Apple hardware but + Metal doesn't support it and it doesn't have a WebGL equiv either. */ }; /** @debugoperatorenum{CompressedPixelFormat} */ diff --git a/src/Magnum/Vk/Implementation/compressedFormatMapping.hpp b/src/Magnum/Vk/Implementation/compressedFormatMapping.hpp index f902ef60c..b967f6136 100644 --- a/src/Magnum/Vk/Implementation/compressedFormatMapping.hpp +++ b/src/Magnum/Vk/Implementation/compressedFormatMapping.hpp @@ -79,4 +79,13 @@ _c(Astc12x10RGBAUnorm, ASTC_12x10_UNORM_BLOCK) _c(Astc12x10RGBASrgb, ASTC_12x10_SRGB_BLOCK) _c(Astc12x12RGBAUnorm, ASTC_12x12_UNORM_BLOCK) _c(Astc12x12RGBASrgb, ASTC_12x12_SRGB_BLOCK) +/* https://github.com/KhronosGroup/Vulkan-Docs/issues/512 */ +_c(PvrtcRGB2bppUnorm, PVRTC1_2BPP_UNORM_BLOCK_IMG) +_c(PvrtcRGB2bppSrgb, PVRTC1_2BPP_SRGB_BLOCK_IMG) +_c(PvrtcRGBA2bppUnorm, PVRTC1_2BPP_UNORM_BLOCK_IMG) +_c(PvrtcRGBA2bppSrgb, PVRTC1_2BPP_SRGB_BLOCK_IMG) +_c(PvrtcRGB4bppUnorm, PVRTC1_4BPP_UNORM_BLOCK_IMG) +_c(PvrtcRGB4bppSrgb, PVRTC1_4BPP_SRGB_BLOCK_IMG) +_c(PvrtcRGBA4bppUnorm, PVRTC1_4BPP_UNORM_BLOCK_IMG) +_c(PvrtcRGBA4bppSrgb, PVRTC1_4BPP_SRGB_BLOCK_IMG) #endif diff --git a/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt b/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt index 5ce34c88d..116caf5e1 100644 --- a/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt @@ -28,4 +28,5 @@ extension EXT_texture_compression_bptc optional extension EXT_color_buffer_float optional extension EXT_texture_compression_s3tc optional extension EXT_texture_compression_s3tc_srgb optional +extension IMG_texture_compression_pvrtc optional extension KHR_texture_compression_astc_ldr optional diff --git a/src/MagnumExternal/OpenGL/GLES2/extensions.txt b/src/MagnumExternal/OpenGL/GLES2/extensions.txt index b1985999d..028b3aba1 100644 --- a/src/MagnumExternal/OpenGL/GLES2/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES2/extensions.txt @@ -80,8 +80,10 @@ extension EXT_disjoint_timer_query optional extension EXT_texture_sRGB_decode optional extension EXT_sRGB_write_control optional extension EXT_texture_compression_s3tc optional +extension EXT_pvrtc_sRGB optional extension EXT_polygon_offset_clamp optional extension EXT_texture_compression_s3tc_srgb optional +extension IMG_texture_compression_pvrtc optional extension KHR_texture_compression_astc_hdr optional extension KHR_blend_equation_advanced_coherent optional extension KHR_context_flush_control optional diff --git a/src/MagnumExternal/OpenGL/GLES2/flextGL.h b/src/MagnumExternal/OpenGL/GLES2/flextGL.h index 58a290738..9c57c46e6 100644 --- a/src/MagnumExternal/OpenGL/GLES2/flextGL.h +++ b/src/MagnumExternal/OpenGL/GLES2/flextGL.h @@ -987,6 +987,15 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 #define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +/* GL_EXT_pvrtc_sRGB */ + +#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54 +#define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG 0x93F0 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG 0x93F1 + /* GL_EXT_polygon_offset_clamp */ #define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B @@ -998,6 +1007,13 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F +/* GL_IMG_texture_compression_pvrtc */ + +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 + /* GL_KHR_texture_compression_astc_hdr */ #define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 diff --git a/src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h b/src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h index 71242a115..db28e2484 100644 --- a/src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h +++ b/src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h @@ -520,6 +520,13 @@ typedef khronos_uint64_t GLuint64; #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F +/* GL_IMG_texture_compression_pvrtc */ + +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 + /* GL_KHR_texture_compression_astc_ldr */ #define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 diff --git a/src/MagnumExternal/OpenGL/GLES2/flextGLWindowsDesktop.h b/src/MagnumExternal/OpenGL/GLES2/flextGLWindowsDesktop.h index b0c4d4118..726a7890e 100644 --- a/src/MagnumExternal/OpenGL/GLES2/flextGLWindowsDesktop.h +++ b/src/MagnumExternal/OpenGL/GLES2/flextGLWindowsDesktop.h @@ -982,6 +982,15 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 #define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +/* GL_EXT_pvrtc_sRGB */ + +#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54 +#define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG 0x93F0 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG 0x93F1 + /* GL_EXT_polygon_offset_clamp */ #define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B @@ -993,6 +1002,13 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F +/* GL_IMG_texture_compression_pvrtc */ + +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 + /* GL_KHR_texture_compression_astc_hdr */ #define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 diff --git a/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt b/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt index 2eac73438..9e6126f00 100644 --- a/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt @@ -11,4 +11,5 @@ 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 +extension IMG_texture_compression_pvrtc optional extension KHR_texture_compression_astc_ldr optional diff --git a/src/MagnumExternal/OpenGL/GLES3/extensions.txt b/src/MagnumExternal/OpenGL/GLES3/extensions.txt index 37633991c..1ed2b994a 100644 --- a/src/MagnumExternal/OpenGL/GLES3/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES3/extensions.txt @@ -45,11 +45,13 @@ extension EXT_disjoint_timer_query optional extension EXT_texture_sRGB_decode optional extension EXT_sRGB_write_control optional extension EXT_texture_compression_s3tc optional +extension EXT_pvrtc_sRGB 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 IMG_texture_compression_pvrtc optional extension KHR_texture_compression_astc_hdr optional extension KHR_blend_equation_advanced_coherent optional extension KHR_context_flush_control optional diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGL.h b/src/MagnumExternal/OpenGL/GLES3/flextGL.h index 4063b5443..816f90f1f 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGL.h +++ b/src/MagnumExternal/OpenGL/GLES3/flextGL.h @@ -1526,6 +1526,15 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 #define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +/* GL_EXT_pvrtc_sRGB */ + +#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54 +#define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG 0x93F0 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG 0x93F1 + /* GL_EXT_polygon_offset_clamp */ #define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B @@ -1551,6 +1560,13 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F +/* GL_IMG_texture_compression_pvrtc */ + +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 + /* GL_KHR_texture_compression_astc_hdr */ #define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h b/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h index 793b0672a..66119f11c 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h @@ -759,6 +759,13 @@ typedef struct __GLsync *GLsync; #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F +/* GL_IMG_texture_compression_pvrtc */ + +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 + /* GL_KHR_texture_compression_astc_ldr */ #define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h b/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h index 4511db1b5..51f218eb0 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h @@ -1518,6 +1518,15 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 #define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +/* GL_EXT_pvrtc_sRGB */ + +#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54 +#define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG 0x93F0 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG 0x93F1 + /* GL_EXT_polygon_offset_clamp */ #define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B @@ -1543,6 +1552,13 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F +/* GL_IMG_texture_compression_pvrtc */ + +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 + /* GL_KHR_texture_compression_astc_hdr */ #define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 diff --git a/src/MagnumExternal/Vulkan/extensions.txt b/src/MagnumExternal/Vulkan/extensions.txt index de49e64f5..0e0af739b 100644 --- a/src/MagnumExternal/Vulkan/extensions.txt +++ b/src/MagnumExternal/Vulkan/extensions.txt @@ -23,3 +23,5 @@ extension KHR_sampler_ycbcr_conversion optional extension KHR_shader_draw_parameters optional extension KHR_storage_buffer_storage_class optional extension KHR_variable_pointers optional + +extension IMG_format_pvrtc optional diff --git a/src/MagnumExternal/Vulkan/flextVk.h b/src/MagnumExternal/Vulkan/flextVk.h index f16d9f64b..97258a63c 100644 --- a/src/MagnumExternal/Vulkan/flextVk.h +++ b/src/MagnumExternal/Vulkan/flextVk.h @@ -234,6 +234,11 @@ extern "C" { #define VK_KHR_VARIABLE_POINTERS_SPEC_VERSION 1 #define VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME "VK_KHR_variable_pointers" +/* VK_IMG_format_pvrtc */ + +#define VK_IMG_FORMAT_PVRTC_SPEC_VERSION 1 +#define VK_IMG_FORMAT_PVRTC_EXTENSION_NAME "VK_IMG_format_pvrtc" + /* Data types */ #define VK_MAKE_VERSION(major, minor, patch) \ @@ -802,7 +807,15 @@ typedef enum { VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR = VK_FORMAT_G16_B16R16_2PLANE_420_UNORM, VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR = VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM, VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR = VK_FORMAT_G16_B16R16_2PLANE_422_UNORM, - VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR = VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM + VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR = VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM, + VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG = 1000054000, + VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG = 1000054001, + VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG = 1000054002, + VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG = 1000054003, + VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG = 1000054004, + VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = 1000054005, + VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006, + VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007 } VkFormat; typedef enum {