diff --git a/doc/opengl-support.dox b/doc/opengl-support.dox index 7a2b1347b..cad12726b 100644 --- a/doc/opengl-support.dox +++ b/doc/opengl-support.dox @@ -454,7 +454,7 @@ Extension | Status @m_class{m-doc-external} [ANGLE_base_vertex_base_instance](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_base_vertex_base_instance.txt) (unlisted) | done @m_class{m-doc-external} [ANGLE_provoking_vertex](https://chromium.googlesource.com/angle/angle/+/main/extensions/ANGLE_provoking_vertex.txt) (unlisted) | done @m_class{m-doc-external} [ANGLE_polygon_mode](https://chromium.googlesource.com/angle/angle/+/HEAD/extensions/ANGLE_polygon_mode.txt) (unlisted) | done -@m_class{m-doc-external} [ANGLE_stencil_texturing](https://chromium.googlesource.com/angle/angle/+/HEAD/extensions/ANGLE_stencil_texturing.txt) (unlisted) | | +@m_class{m-doc-external} [ANGLE_stencil_texturing](https://chromium.googlesource.com/angle/angle/+/HEAD/extensions/ANGLE_stencil_texturing.txt) (unlisted) | done @gl_extension{APPLE,texture_format_BGRA8888} | done @gl_extension{APPLE,clip_distance} | done @gl_extension{ARM,shader_framebuffer_fetch} | missing renderer setup and limit query @@ -597,7 +597,7 @@ Extension | Status @webgl_extension{WEBGL,provoking_vertex} | missing support in Emscripten @webgl_extension{WEBGL,polygon_mode} | missing support in Emscripten @webgl_extension{WEBGL,blend_func_extended} | | -@webgl_extension{WEBGL,stencil_texturing} | | +@webgl_extension{WEBGL,stencil_texturing} | done @section opengl-unsupported Unsupported OpenGL features diff --git a/src/Magnum/GL/AbstractTexture.cpp b/src/Magnum/GL/AbstractTexture.cpp index 90d0ef6ff..bdd0b0390 100644 --- a/src/Magnum/GL/AbstractTexture.cpp +++ b/src/Magnum/GL/AbstractTexture.cpp @@ -498,9 +498,15 @@ void AbstractTexture::setCompareFunction(const SamplerCompareFunction function) } #endif -#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) +#ifndef MAGNUM_TARGET_GLES2 void AbstractTexture::setDepthStencilMode(const SamplerDepthStencilMode mode) { - Context::current().state().texture.parameteriImplementation(*this, GL_DEPTH_STENCIL_TEXTURE_MODE, GLenum(mode)); + Context::current().state().texture.parameteriImplementation(*this, + #ifndef MAGNUM_TARGET_WEBGL + GL_DEPTH_STENCIL_TEXTURE_MODE + #else + GL_DEPTH_STENCIL_TEXTURE_MODE_ANGLE + #endif + , GLenum(mode)); } #endif diff --git a/src/Magnum/GL/AbstractTexture.h b/src/Magnum/GL/AbstractTexture.h index 3b30a4076..2c160fe32 100644 --- a/src/Magnum/GL/AbstractTexture.h +++ b/src/Magnum/GL/AbstractTexture.h @@ -488,7 +488,7 @@ class MAGNUM_GL_EXPORT AbstractTexture: public AbstractObject { void setCompareMode(SamplerCompareMode mode); void setCompareFunction(SamplerCompareFunction function); #endif - #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) + #ifndef MAGNUM_TARGET_GLES2 void setDepthStencilMode(SamplerDepthStencilMode mode); #endif #if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL)) diff --git a/src/Magnum/GL/CubeMapTexture.h b/src/Magnum/GL/CubeMapTexture.h index 3f270ca10..a8e980908 100644 --- a/src/Magnum/GL/CubeMapTexture.h +++ b/src/Magnum/GL/CubeMapTexture.h @@ -541,16 +541,17 @@ class MAGNUM_GL_EXPORT CubeMapTexture: public AbstractTexture { } #endif - #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) + #ifndef MAGNUM_TARGET_GLES2 /** * @brief @copybrief Texture::setDepthStencilMode() * @return Reference to self (for method chaining) * * See @ref Texture::setDepthStencilMode() for more information. * @requires_gl43 Extension @gl_extension{ARB,stencil_texturing} - * @requires_gles31 Stencil texturing is not available in OpenGL ES 3.0 - * and older. - * @requires_gles Stencil texturing is not available in WebGL. + * @requires_gles31 Extension @m_class{m-doc-external} [ANGLE_stencil_texturing](https://chromium.googlesource.com/angle/angle/+/HEAD/extensions/ANGLE_stencil_texturing.txt) + * in OpenGL ES 3.0. + * @requires_webgl_extension WebGL 2.0 and extension + * @webgl_extension{WEBGL,stencil_texturing} */ CubeMapTexture& setDepthStencilMode(SamplerDepthStencilMode mode) { AbstractTexture::setDepthStencilMode(mode); diff --git a/src/Magnum/GL/GL.h b/src/Magnum/GL/GL.h index f2900fd9a..6f3014edf 100644 --- a/src/Magnum/GL/GL.h +++ b/src/Magnum/GL/GL.h @@ -150,7 +150,7 @@ enum class SamplerCompareMode: GLenum; #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) enum class SamplerCompareFunction: GLenum; #endif -#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) +#ifndef MAGNUM_TARGET_GLES2 enum class SamplerDepthStencilMode: GLenum; #endif diff --git a/src/Magnum/GL/Sampler.cpp b/src/Magnum/GL/Sampler.cpp index e20fcaa29..e1da4e3e0 100644 --- a/src/Magnum/GL/Sampler.cpp +++ b/src/Magnum/GL/Sampler.cpp @@ -219,7 +219,7 @@ Debug& operator<<(Debug& debug, const SamplerCompareFunction value) { } #endif -#ifndef MAGNUM_TARGET_GLES +#ifndef MAGNUM_TARGET_GLES2 Debug& operator<<(Debug& debug, const SamplerDepthStencilMode value) { debug << "GL::SamplerDepthStencilMode" << Debug::nospace; diff --git a/src/Magnum/GL/Sampler.h b/src/Magnum/GL/Sampler.h index 0d0bbf332..59d6797fc 100644 --- a/src/Magnum/GL/Sampler.h +++ b/src/Magnum/GL/Sampler.h @@ -303,23 +303,28 @@ enum class SamplerCompareFunction: GLenum { MAGNUM_GL_EXPORT Debug& operator<<(Debug& debug, SamplerCompareFunction value); #endif -#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) +#ifndef MAGNUM_TARGET_GLES2 /** @brief Texture sampler depth/stencil mode @see @ref Texture::setDepthStencilMode() "*Texture::setDepthStencilMode()" @m_enum_values_as_keywords @requires_gl43 Extension @gl_extension{ARB,stencil_texturing} -@requires_gles31 Stencil texturing is not available in OpenGL ES 3.0 - and older. -@requires_gles Stencil texturing is not available in WebGL. +@requires_gles31 Extension @m_class{m-doc-external} [ANGLE_stencil_texturing](https://chromium.googlesource.com/angle/angle/+/HEAD/extensions/ANGLE_stencil_texturing.txt) + in OpenGL ES 3.0. +@requires_webgl_extension WebGL 2.0 and extension + @webgl_extension{WEBGL,stencil_texturing} */ enum class SamplerDepthStencilMode: GLenum { /** Sample depth component */ DepthComponent = GL_DEPTH_COMPONENT, /** Sample stencil index (as unsigned integer texture) */ + #ifndef MAGNUM_TARGET_WEBGL StencilIndex = GL_STENCIL_INDEX + #else + StencilIndex = GL_STENCIL_INDEX_ANGLE + #endif }; /** @debugoperatorenum{SamplerDepthStencilMode} */ diff --git a/src/Magnum/GL/Test/CubeMapTextureGLTest.cpp b/src/Magnum/GL/Test/CubeMapTextureGLTest.cpp index cb8e35bf5..96f49ce12 100644 --- a/src/Magnum/GL/Test/CubeMapTextureGLTest.cpp +++ b/src/Magnum/GL/Test/CubeMapTextureGLTest.cpp @@ -82,6 +82,8 @@ struct CubeMapTextureGLTest: OpenGLTester { #endif #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) void samplingBorderInteger(); + #endif + #ifndef MAGNUM_TARGET_GLES2 void samplingDepthStencilMode(); #endif #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) @@ -351,6 +353,8 @@ CubeMapTextureGLTest::CubeMapTextureGLTest() { #endif #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) &CubeMapTextureGLTest::samplingBorderInteger, + #endif + #ifndef MAGNUM_TARGET_GLES2 &CubeMapTextureGLTest::samplingDepthStencilMode, #endif #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) @@ -688,14 +692,19 @@ void CubeMapTextureGLTest::samplingBorderInteger() { MAGNUM_VERIFY_NO_GL_ERROR(); } +#endif +#ifndef MAGNUM_TARGET_GLES2 void CubeMapTextureGLTest::samplingDepthStencilMode() { #ifndef MAGNUM_TARGET_GLES if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::ARB::stencil_texturing::string() << "is not supported."); + #elif !defined(MAGNUM_TARGET_WEBGL) + if(!Context::current().isVersionSupported(Version::GLES310) && !Context::current().isExtensionSupported()) + CORRADE_SKIP("Neither OpenGL ES 3.1 nor" << Extensions::ANGLE::stencil_texturing::string() << "is supported."); #else - if(!Context::current().isVersionSupported(Version::GLES310)) - CORRADE_SKIP("OpenGL ES 3.1 not supported."); + if(!Context::current().isExtensionSupported()) + CORRADE_SKIP(Extensions::WEBGL::stencil_texturing::string() << "is not supported."); #endif CubeMapTexture texture; diff --git a/src/Magnum/GL/Test/TextureArrayGLTest.cpp b/src/Magnum/GL/Test/TextureArrayGLTest.cpp index ae0b60bfd..46808de88 100644 --- a/src/Magnum/GL/Test/TextureArrayGLTest.cpp +++ b/src/Magnum/GL/Test/TextureArrayGLTest.cpp @@ -112,9 +112,7 @@ struct TextureArrayGLTest: OpenGLTester { #ifndef MAGNUM_TARGET_GLES void samplingDepthStencilMode1D(); #endif - #ifndef MAGNUM_TARGET_WEBGL void samplingDepthStencilMode2D(); - #endif #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) void samplingBorder2D(); #endif @@ -356,9 +354,7 @@ TextureArrayGLTest::TextureArrayGLTest() { #ifndef MAGNUM_TARGET_GLES &TextureArrayGLTest::samplingDepthStencilMode1D, #endif - #ifndef MAGNUM_TARGET_WEBGL &TextureArrayGLTest::samplingDepthStencilMode2D, - #endif #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) &TextureArrayGLTest::samplingBorder2D, #endif @@ -879,16 +875,18 @@ void TextureArrayGLTest::samplingBorderInteger2D() { } #endif -#ifndef MAGNUM_TARGET_WEBGL void TextureArrayGLTest::samplingDepthStencilMode2D() { #ifndef MAGNUM_TARGET_GLES if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::EXT::texture_array::string() << "is not supported."); if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::ARB::stencil_texturing::string() << "is not supported."); + #elif !defined(MAGNUM_TARGET_WEBGL) + if(!Context::current().isVersionSupported(Version::GLES310) && !Context::current().isExtensionSupported()) + CORRADE_SKIP("Neither OpenGL ES 3.1 nor" << Extensions::ANGLE::stencil_texturing::string() << "is supported."); #else - if(!Context::current().isVersionSupported(Version::GLES310)) - CORRADE_SKIP("OpenGL ES 3.1 is not supported."); + if(!Context::current().isExtensionSupported()) + CORRADE_SKIP(Extensions::WEBGL::stencil_texturing::string() << "is not supported."); #endif Texture2DArray texture; @@ -896,7 +894,6 @@ void TextureArrayGLTest::samplingDepthStencilMode2D() { MAGNUM_VERIFY_NO_GL_ERROR(); } -#endif #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) void TextureArrayGLTest::samplingBorder2D() { diff --git a/src/Magnum/GL/Test/TextureGLTest.cpp b/src/Magnum/GL/Test/TextureGLTest.cpp index 881e5e950..bf6368975 100644 --- a/src/Magnum/GL/Test/TextureGLTest.cpp +++ b/src/Magnum/GL/Test/TextureGLTest.cpp @@ -140,7 +140,7 @@ struct TextureGLTest: OpenGLTester { #ifndef MAGNUM_TARGET_GLES void samplingDepthStencilMode1D(); #endif - #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) + #ifndef MAGNUM_TARGET_GLES2 void samplingDepthStencilMode2D(); void samplingDepthStencilMode3D(); #endif @@ -542,7 +542,7 @@ TextureGLTest::TextureGLTest() { #ifndef MAGNUM_TARGET_GLES &TextureGLTest::samplingDepthStencilMode1D, #endif - #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) + #ifndef MAGNUM_TARGET_GLES2 &TextureGLTest::samplingDepthStencilMode2D, &TextureGLTest::samplingDepthStencilMode3D, #endif @@ -1197,14 +1197,19 @@ void TextureGLTest::samplingBorderInteger2D() { MAGNUM_VERIFY_NO_GL_ERROR(); } +#endif +#ifndef MAGNUM_TARGET_GLES2 void TextureGLTest::samplingDepthStencilMode2D() { #ifndef MAGNUM_TARGET_GLES if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::ARB::stencil_texturing::string() << "is not supported."); + #elif !defined(MAGNUM_TARGET_WEBGL) + if(!Context::current().isVersionSupported(Version::GLES310) && !Context::current().isExtensionSupported()) + CORRADE_SKIP("Neither OpenGL ES 3.1 nor" << Extensions::ANGLE::stencil_texturing::string() << "is supported."); #else - if(!Context::current().isVersionSupported(Version::GLES310)) - CORRADE_SKIP("OpenGL ES 3.1 is not supported."); + if(!Context::current().isExtensionSupported()) + CORRADE_SKIP(Extensions::WEBGL::stencil_texturing::string() << "is not supported."); #endif Texture2D texture; @@ -1326,14 +1331,19 @@ void TextureGLTest::samplingBorderInteger3D() { MAGNUM_VERIFY_NO_GL_ERROR(); } +#endif +#ifndef MAGNUM_TARGET_GLES2 void TextureGLTest::samplingDepthStencilMode3D() { #ifndef MAGNUM_TARGET_GLES if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::ARB::stencil_texturing::string() << "is not supported."); + #elif !defined(MAGNUM_TARGET_WEBGL) + if(!Context::current().isVersionSupported(Version::GLES310) && !Context::current().isExtensionSupported()) + CORRADE_SKIP("Neither OpenGL ES 3.1 nor" << Extensions::ANGLE::stencil_texturing::string() << "is supported."); #else - if(!Context::current().isVersionSupported(Version::GLES310)) - CORRADE_SKIP("OpenGL ES 3.1 is not supported."); + if(!Context::current().isExtensionSupported()) + CORRADE_SKIP(Extensions::WEBGL::stencil_texturing::string() << "is not supported."); #endif Texture3D texture; diff --git a/src/Magnum/GL/Texture.h b/src/Magnum/GL/Texture.h index 01c5bba5e..66efdc30d 100644 --- a/src/Magnum/GL/Texture.h +++ b/src/Magnum/GL/Texture.h @@ -771,7 +771,7 @@ Texture: public AbstractTexture { } #endif - #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) + #ifndef MAGNUM_TARGET_GLES2 /** * @brief Set depth/stencil texture mode * @return Reference to self (for method chaining) @@ -786,9 +786,10 @@ Texture: public AbstractTexture { * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * @fn_gl_keyword{TexParameter} with @def_gl_keyword{DEPTH_STENCIL_TEXTURE_MODE} * @requires_gl43 Extension @gl_extension{ARB,stencil_texturing} - * @requires_gles31 Stencil texturing is not available in OpenGL ES 3.0 - * and older. - * @requires_gles Stencil texturing is not available in WebGL. + * @requires_gles31 Extension @m_class{m-doc-external} [ANGLE_stencil_texturing](https://chromium.googlesource.com/angle/angle/+/HEAD/extensions/ANGLE_stencil_texturing.txt) + * in OpenGL ES 3.0. + * @requires_webgl_extension WebGL 2.0 and extension + * @webgl_extension{WEBGL,stencil_texturing} */ Texture& setDepthStencilMode(SamplerDepthStencilMode mode) { AbstractTexture::setDepthStencilMode(mode); diff --git a/src/Magnum/GL/TextureArray.h b/src/Magnum/GL/TextureArray.h index b095dc92d..944fc76c4 100644 --- a/src/Magnum/GL/TextureArray.h +++ b/src/Magnum/GL/TextureArray.h @@ -558,22 +558,21 @@ TextureArray: public AbstractTexture { return *this; } - #ifndef MAGNUM_TARGET_WEBGL /** * @brief @copybrief Texture::setDepthStencilMode() * @return Reference to self (for method chaining) * * See @ref Texture::setDepthStencilMode() for more information. * @requires_gl43 Extension @gl_extension{ARB,stencil_texturing} - * @requires_gles31 Stencil texturing is not available in OpenGL ES 3.0 - * and older. - * @requires_gles Stencil texturing is not available in WebGL. + * @requires_gles31 Extension @m_class{m-doc-external} [ANGLE_stencil_texturing](https://chromium.googlesource.com/angle/angle/+/HEAD/extensions/ANGLE_stencil_texturing.txt) + * in OpenGL ES 3.0. + * @requires_webgl_extension WebGL 2.0 and extension + * @webgl_extension{WEBGL,stencil_texturing} */ TextureArray& setDepthStencilMode(SamplerDepthStencilMode mode) { AbstractTexture::setDepthStencilMode(mode); return *this; } - #endif /** * @brief @copybrief Texture::setStorage()