Browse Source

GL: hook up EXT_texture_sRGB_RG8 for desktop GL as well.

Was browsing the extension registry looking for something else and found
this instead. It used to be ES catching up with desktop, now it's the
other way around.
pull/549/head
Vladimír Vondruš 4 years ago
parent
commit
042f28a90e
  1. 3
      doc/changelog.dox
  2. 1
      doc/opengl-support.dox
  3. 8
      src/Magnum/GL/AbstractTexture.cpp
  4. 1
      src/Magnum/GL/Context.cpp
  5. 3
      src/Magnum/GL/Extensions.h
  6. 4
      src/Magnum/GL/Implementation/pixelFormatMapping.hpp
  7. 4
      src/Magnum/GL/Test/PixelFormatTest.cpp
  8. 6
      src/Magnum/GL/TextureFormat.cpp
  9. 11
      src/Magnum/GL/TextureFormat.h
  10. 1
      src/MagnumExternal/OpenGL/GL/extensions.txt
  11. 4
      src/MagnumExternal/OpenGL/GL/flextGL.h

3
doc/changelog.dox

@ -88,6 +88,9 @@ See also:
@webgl_extension{EXT,texture_norm16} ES and WebGL extensions, making @webgl_extension{EXT,texture_norm16} ES and WebGL extensions, making
normalized 16-bit texture and renderbuffer formats available on all normalized 16-bit texture and renderbuffer formats available on all
platforms platforms
- The @gl_extension{EXT,texture_sRGB_RG8} extension is now available on
desktop OpenGL as well, exposing a two-component sRGB format in addition to
the already present one-, three- and four-component formats
- Implemented @webgl_extension{WEBGL,blend_equation_advanced_coherent} - Implemented @webgl_extension{WEBGL,blend_equation_advanced_coherent}
extension, making advanced @ref GL::Renderer::BlendEquation values extension, making advanced @ref GL::Renderer::BlendEquation values
available on all platforms available on all platforms

1
doc/opengl-support.dox

@ -323,6 +323,7 @@ Extension | Status
@gl_extension{EXT,debug_label} | missing pipeline and sampler label @gl_extension{EXT,debug_label} | missing pipeline and sampler label
@gl_extension{EXT,debug_marker} | done @gl_extension{EXT,debug_marker} | done
@gl_extension{EXT,texture_sRGB_R8} | done @gl_extension{EXT,texture_sRGB_R8} | done
@gl_extension{EXT,texture_sRGB_RG8} | done
@gl_extension{GREMEDY,string_marker} | done @gl_extension{GREMEDY,string_marker} | done
@gl_extension{NV,sample_locations} | | @gl_extension{NV,sample_locations} | |
@gl_extension{NV,fragment_shader_barycentric} | done (shading language only) @gl_extension{NV,fragment_shader_barycentric} | done (shading language only)

8
src/Magnum/GL/AbstractTexture.cpp

@ -610,7 +610,7 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) {
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
case TextureFormat::RG8Snorm: case TextureFormat::RG8Snorm:
#endif #endif
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_GLES2) #ifndef MAGNUM_TARGET_GLES2
case TextureFormat::SRG8: case TextureFormat::SRG8:
#endif #endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -917,14 +917,10 @@ PixelType pixelTypeForInternalFormat(const TextureFormat internalFormat) {
case TextureFormat::Luminance: case TextureFormat::Luminance:
case TextureFormat::LuminanceAlpha: case TextureFormat::LuminanceAlpha:
#endif #endif
#ifndef MAGNUM_TARGET_WEBGL #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
#ifndef MAGNUM_TARGET_GLES2
case TextureFormat::SR8: case TextureFormat::SR8:
#endif
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_GLES2)
case TextureFormat::SRG8: case TextureFormat::SRG8:
#endif #endif
#endif
#if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2) #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2)
case TextureFormat::SRGB: case TextureFormat::SRGB:
case TextureFormat::SRGBAlpha: case TextureFormat::SRGBAlpha:

1
src/Magnum/GL/Context.cpp

@ -98,6 +98,7 @@ constexpr Extension ExtensionList[]{
Extensions::EXT::texture_filter_anisotropic{}, Extensions::EXT::texture_filter_anisotropic{},
Extensions::EXT::texture_mirror_clamp{}, Extensions::EXT::texture_mirror_clamp{},
Extensions::EXT::texture_sRGB_R8{}, Extensions::EXT::texture_sRGB_R8{},
Extensions::EXT::texture_sRGB_RG8{},
Extensions::EXT::texture_sRGB_decode{}, Extensions::EXT::texture_sRGB_decode{},
Extensions::GREMEDY::string_marker{}, Extensions::GREMEDY::string_marker{},
Extensions::KHR::blend_equation_advanced{}, Extensions::KHR::blend_equation_advanced{},

3
src/Magnum/GL/Extensions.h

@ -242,8 +242,9 @@ namespace AMD {
_extension(154,EXT,debug_label, GL210, None) // #439 _extension(154,EXT,debug_label, GL210, None) // #439
_extension(155,EXT,debug_marker, GL210, None) // #440 _extension(155,EXT,debug_marker, GL210, None) // #440
_extension(156,EXT,texture_sRGB_R8, GL210, None) // #534 _extension(156,EXT,texture_sRGB_R8, GL210, None) // #534
_extension(157,EXT,texture_sRGB_RG8, GL210, None) // #555
} namespace GREMEDY { } namespace GREMEDY {
_extension(157,GREMEDY,string_marker, GL210, None) // #311 _extension(158,GREMEDY,string_marker, GL210, None) // #311
} namespace KHR { } namespace KHR {
_extension(160,KHR,texture_compression_astc_ldr, GL210, None) // #118 _extension(160,KHR,texture_compression_astc_ldr, GL210, None) // #118
_extension(161,KHR,texture_compression_astc_hdr, GL210, None) // #118 _extension(161,KHR,texture_compression_astc_hdr, GL210, None) // #118

4
src/Magnum/GL/Implementation/pixelFormatMapping.hpp

@ -59,12 +59,8 @@ _s(RGBA8Snorm)
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
_c(R8Srgb, Red, UnsignedByte, SR8) _c(R8Srgb, Red, UnsignedByte, SR8)
#ifdef MAGNUM_TARGET_GLES
_c(RG8Srgb, RG, UnsignedByte, SRG8) _c(RG8Srgb, RG, UnsignedByte, SRG8)
#else #else
_n(RG8Srgb, RG, UnsignedByte)
#endif
#else
_n(R8Srgb, Red, UnsignedByte) _n(R8Srgb, Red, UnsignedByte)
_n(RG8Srgb, RG, UnsignedByte) _n(RG8Srgb, RG, UnsignedByte)
#endif #endif

4
src/Magnum/GL/Test/PixelFormatTest.cpp

@ -311,8 +311,8 @@ void PixelFormatTest::mapTextureFormatUnsupported() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
textureFormat(Magnum::PixelFormat::RG8Srgb); textureFormat(Magnum::PixelFormat::Depth16UnormStencil8UI);
CORRADE_COMPARE(out.str(), "GL::textureFormat(): format PixelFormat::RG8Srgb is not supported on this target\n"); CORRADE_COMPARE(out.str(), "GL::textureFormat(): format PixelFormat::Depth16UnormStencil8UI is not supported on this target\n");
#endif #endif
} }

6
src/Magnum/GL/TextureFormat.cpp

@ -63,14 +63,10 @@ Debug& operator<<(Debug& debug, const TextureFormat value) {
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
_c(RGBA8) _c(RGBA8)
#endif #endif
#ifndef MAGNUM_TARGET_WEBGL #if !defined(MAGNUM_TARGET_WEBGL) && !defined(MAGNUM_TARGET_GLES2)
#ifndef MAGNUM_TARGET_GLES2
_c(SR8) _c(SR8)
#endif
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_GLES2)
_c(SRG8) _c(SRG8)
#endif #endif
#endif
#if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2) #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2)
_c(SRGB) _c(SRGB)
#endif #endif

11
src/Magnum/GL/TextureFormat.h

@ -195,8 +195,7 @@ enum class TextureFormat: GLenum {
#endif #endif
#endif #endif
#ifndef MAGNUM_TARGET_WEBGL #if !defined(MAGNUM_TARGET_WEBGL) && !defined(MAGNUM_TARGET_GLES2)
#ifndef MAGNUM_TARGET_GLES2
/** /**
* sRGB-encoded red component, normalized unsigned byte. * sRGB-encoded red component, normalized unsigned byte.
* @requires_extension Extension @gl_extension{EXT,texture_sRGB_R8} * @requires_extension Extension @gl_extension{EXT,texture_sRGB_R8}
@ -208,23 +207,19 @@ enum class TextureFormat: GLenum {
* @m_since{2019,10} * @m_since{2019,10}
*/ */
SR8 = GL_SR8_EXT, SR8 = GL_SR8_EXT,
#endif
#if (defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_GLES2)) || defined(DOXYGEN_GENERATING_OUTPUT)
/** /**
* sRGB-encoded red and green component, normalized unsigned byte. * sRGB-encoded red and green component, normalized unsigned byte.
* @requires_extension Extension @gl_extension{EXT,texture_sRGB_RG8}
* @requires_es_extension OpenGL ES 3.0 and extension * @requires_es_extension OpenGL ES 3.0 and extension
* @gl_extension{EXT,texture_sRGB_RG8} * @gl_extension{EXT,texture_sRGB_RG8}
* @requires_gles One- and two-component sRGB texture formats are not * @requires_gles One- and two-component sRGB texture formats are not
* available in WebGL, use @ref TextureFormat::SRGB8 or * available in WebGL, use @ref TextureFormat::SRGB8 or
* @ref TextureFormat::SRGB8Alpha8 instead. Only * @ref TextureFormat::SRGB8Alpha8 instead.
* @ref TextureFormat::SR8, @ref TextureFormat::SRGB8 or
* @ref TextureFormat::SRGB8Alpha8 is available in desktop OpenGL.
* @m_since{2019,10} * @m_since{2019,10}
*/ */
SRG8 = GL_SRG8_EXT, SRG8 = GL_SRG8_EXT,
#endif #endif
#endif
#if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2) #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2)
/** /**

1
src/MagnumExternal/OpenGL/GL/extensions.txt vendored

@ -34,6 +34,7 @@ extension EXT_shader_integer_mix optional
extension EXT_debug_label optional extension EXT_debug_label optional
extension EXT_debug_marker optional extension EXT_debug_marker optional
extension EXT_texture_sRGB_R8 optional extension EXT_texture_sRGB_R8 optional
extension EXT_texture_sRGB_RG8 optional
extension GREMEDY_string_marker optional extension GREMEDY_string_marker optional
extension KHR_texture_compression_astc_ldr optional extension KHR_texture_compression_astc_ldr optional
# extension KHR_texture_compression_astc_hdr optional # extension KHR_texture_compression_astc_hdr optional

4
src/MagnumExternal/OpenGL/GL/flextGL.h vendored

@ -1716,6 +1716,10 @@ typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum
#define GL_SR8_EXT 0x8FBD #define GL_SR8_EXT 0x8FBD
/* GL_EXT_texture_sRGB_RG8 */
#define GL_SRG8_EXT 0x8FBE
/* GL_KHR_texture_compression_astc_ldr */ /* GL_KHR_texture_compression_astc_ldr */
#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 #define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0

Loading…
Cancel
Save