diff --git a/src/Magnum/AbstractTexture.cpp b/src/Magnum/AbstractTexture.cpp index f5518f4d7..b4eba3edc 100644 --- a/src/Magnum/AbstractTexture.cpp +++ b/src/Magnum/AbstractTexture.cpp @@ -817,16 +817,18 @@ void AbstractTexture::setMaxAnisotropyImplementationExt(GLfloat anisotropy) { (this->*Context::current()->state().texture->parameterfImplementation)(GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy); } -#ifndef MAGNUM_TARGET_GLES +#ifndef MAGNUM_TARGET_GLES2 void AbstractTexture::getLevelParameterImplementationDefault(GLenum target, GLint level, GLenum parameter, GLint* values) { bindInternal(); glGetTexLevelParameteriv(target, level, parameter, values); } +#ifndef MAGNUM_TARGET_GLES void AbstractTexture::getLevelParameterImplementationDSA(GLenum target, GLint level, GLenum parameter, GLint* values) { glGetTextureLevelParameterivEXT(_id, target, level, parameter, values); } #endif +#endif #ifndef MAGNUM_TARGET_GLES void AbstractTexture::storageImplementationFallback(const GLenum target, const GLsizei levels, const TextureFormat internalFormat, const Math::Vector<1, GLsizei>& size) { @@ -1155,7 +1157,9 @@ Math::Vector<1, GLint> AbstractTexture::DataHelper<1>::imageSize(AbstractTexture (texture.*Context::current()->state().texture->getLevelParameterivImplementation)(target, level, GL_TEXTURE_WIDTH, &value[0]); return value; } +#endif +#ifndef MAGNUM_TARGET_GLES2 Vector2i AbstractTexture::DataHelper<2>::imageSize(AbstractTexture& texture, const GLenum target, const GLint level) { const Implementation::TextureState& state = *Context::current()->state().texture; diff --git a/src/Magnum/AbstractTexture.h b/src/Magnum/AbstractTexture.h index f7f478423..11de23750 100644 --- a/src/Magnum/AbstractTexture.h +++ b/src/Magnum/AbstractTexture.h @@ -388,10 +388,12 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { void MAGNUM_LOCAL setMaxAnisotropyImplementationNoOp(GLfloat); void MAGNUM_LOCAL setMaxAnisotropyImplementationExt(GLfloat anisotropy); - #ifndef MAGNUM_TARGET_GLES + #ifndef MAGNUM_TARGET_GLES2 void MAGNUM_LOCAL getLevelParameterImplementationDefault(GLenum target, GLint level, GLenum parameter, GLint* values); + #ifndef MAGNUM_TARGET_GLES void MAGNUM_LOCAL getLevelParameterImplementationDSA(GLenum target, GLint level, GLenum parameter, GLint* values); #endif + #endif void MAGNUM_LOCAL mipmapImplementationDefault(); #ifndef MAGNUM_TARGET_GLES @@ -514,7 +516,7 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<2> { }; #endif - #ifndef MAGNUM_TARGET_GLES + #ifndef MAGNUM_TARGET_GLES2 static Vector2i imageSize(AbstractTexture& texture, GLenum target, GLint level); #endif @@ -551,7 +553,7 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<3> { }; #endif - #ifndef MAGNUM_TARGET_GLES + #ifndef MAGNUM_TARGET_GLES2 static Vector3i imageSize(AbstractTexture& texture, GLenum target, GLint level); #endif diff --git a/src/Magnum/CubeMapTexture.h b/src/Magnum/CubeMapTexture.h index 8209be45c..61a34cff8 100644 --- a/src/Magnum/CubeMapTexture.h +++ b/src/Magnum/CubeMapTexture.h @@ -236,14 +236,15 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture { } #endif - #ifndef MAGNUM_TARGET_GLES + #ifndef MAGNUM_TARGET_GLES2 /** * @brief %Image size in given mip level * @param coordinate Coordinate * @param level Mip level * * See @ref Texture::imageSize() for more information. - * @requires_gl %Texture image queries are not available in OpenGL ES. + * @requires_gles31 %Texture image size queries are not available in + * OpenGL ES 3.0 and older. */ Vector2i imageSize(Coordinate coordinate, Int level) { return DataHelper<2>::imageSize(*this, GLenum(coordinate), level); diff --git a/src/Magnum/Implementation/TextureState.cpp b/src/Magnum/Implementation/TextureState.cpp index 60c031784..cf2df73eb 100644 --- a/src/Magnum/Implementation/TextureState.cpp +++ b/src/Magnum/Implementation/TextureState.cpp @@ -113,6 +113,8 @@ TextureState::TextureState(Context& context, std::vector& extension #ifndef MAGNUM_TARGET_GLES parameterIuivImplementation = &AbstractTexture::parameterIImplementationDefault; parameterIivImplementation = &AbstractTexture::parameterIImplementationDefault; + #endif + #ifndef MAGNUM_TARGET_GLES2 getLevelParameterivImplementation = &AbstractTexture::getLevelParameterImplementationDefault; #endif mipmapImplementation = &AbstractTexture::mipmapImplementationDefault; diff --git a/src/Magnum/Implementation/TextureState.h b/src/Magnum/Implementation/TextureState.h index c4acf3e5d..6fb7d3087 100644 --- a/src/Magnum/Implementation/TextureState.h +++ b/src/Magnum/Implementation/TextureState.h @@ -53,7 +53,7 @@ struct TextureState { void(AbstractTexture::*parameterIivImplementation)(GLenum, const GLint*); #endif void(AbstractTexture::*setMaxAnisotropyImplementation)(GLfloat); - #ifndef MAGNUM_TARGET_GLES + #ifndef MAGNUM_TARGET_GLES2 void(AbstractTexture::*getLevelParameterivImplementation)(GLenum, GLint, GLenum, GLint*); #endif void(AbstractTexture::*mipmapImplementation)(); diff --git a/src/Magnum/Test/CubeMapTextureGLTest.cpp b/src/Magnum/Test/CubeMapTextureGLTest.cpp index 8cd00eba4..5a7a23805 100644 --- a/src/Magnum/Test/CubeMapTextureGLTest.cpp +++ b/src/Magnum/Test/CubeMapTextureGLTest.cpp @@ -264,8 +264,12 @@ void CubeMapTextureGLTest::storage() { MAGNUM_VERIFY_NO_ERROR(); - /** @todo How to test this on ES? */ - #ifndef MAGNUM_TARGET_GLES + #ifndef MAGNUM_TARGET_GLES2 + #ifdef MAGNUM_TARGET_GLES + if(!Context::current()->isVersionSupported(Version::GLES310)) + CORRADE_SKIP("OpenGL ES 3.1 not supported, skipping image size testing"); + #endif + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveX, 0), Vector2i(32)); CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::NegativeX, 0), Vector2i(32)); CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveY, 0), Vector2i(32)); diff --git a/src/Magnum/Test/TextureArrayGLTest.cpp b/src/Magnum/Test/TextureArrayGLTest.cpp index a93011b9c..3c0dec591 100644 --- a/src/Magnum/Test/TextureArrayGLTest.cpp +++ b/src/Magnum/Test/TextureArrayGLTest.cpp @@ -526,8 +526,12 @@ void TextureArrayGLTest::storage2D() { MAGNUM_VERIFY_NO_ERROR(); - /** @todo How to test this on ES? */ - #ifndef MAGNUM_TARGET_GLES + #ifndef MAGNUM_TARGET_GLES2 + #ifdef MAGNUM_TARGET_GLES + if(!Context::current()->isVersionSupported(Version::GLES310)) + CORRADE_SKIP("OpenGL ES 3.1 not supported, skipping image size testing"); + #endif + CORRADE_COMPARE(texture.imageSize(0), Vector3i(32, 32, 32)); CORRADE_COMPARE(texture.imageSize(1), Vector3i(16, 16, 32)); CORRADE_COMPARE(texture.imageSize(2), Vector3i( 8, 8, 32)); diff --git a/src/Magnum/Test/TextureGLTest.cpp b/src/Magnum/Test/TextureGLTest.cpp index 4f699cb4e..04a786e11 100644 --- a/src/Magnum/Test/TextureGLTest.cpp +++ b/src/Magnum/Test/TextureGLTest.cpp @@ -683,8 +683,12 @@ void TextureGLTest::storage2D() { MAGNUM_VERIFY_NO_ERROR(); - /** @todo How to test this on ES? */ - #ifndef MAGNUM_TARGET_GLES + #ifndef MAGNUM_TARGET_GLES2 + #ifdef MAGNUM_TARGET_GLES + if(!Context::current()->isVersionSupported(Version::GLES310)) + CORRADE_SKIP("OpenGL ES 3.1 not supported, skipping image size testing."); + #endif + CORRADE_COMPARE(texture.imageSize(0), Vector2i(32)); CORRADE_COMPARE(texture.imageSize(1), Vector2i(16)); CORRADE_COMPARE(texture.imageSize(2), Vector2i( 8)); @@ -707,8 +711,12 @@ void TextureGLTest::storage3D() { MAGNUM_VERIFY_NO_ERROR(); - /** @todo How to test this on ES? */ - #ifndef MAGNUM_TARGET_GLES + #ifndef MAGNUM_TARGET_GLES2 + #ifdef MAGNUM_TARGET_GLES + if(!Context::current()->isVersionSupported(Version::GLES310)) + CORRADE_SKIP("OpenGL ES 3.1 not supported, skipping image size testing."); + #endif + CORRADE_COMPARE(texture.imageSize(0), Vector3i(32)); CORRADE_COMPARE(texture.imageSize(1), Vector3i(16)); CORRADE_COMPARE(texture.imageSize(2), Vector3i( 8)); diff --git a/src/Magnum/Texture.h b/src/Magnum/Texture.h index cbda5f7e9..5df42e37c 100644 --- a/src/Magnum/Texture.h +++ b/src/Magnum/Texture.h @@ -185,7 +185,7 @@ template class Texture: public AbstractTexture { constexpr CORRADE_DEPRECATED("use dedicated Texture, TextureArray, MultisampleTexture, RectangleTexture classes instead") Target target() const { return static_cast(_target); } #endif - #ifndef MAGNUM_TARGET_GLES + #ifndef MAGNUM_TARGET_GLES2 /** * @brief %Image size in given mip level * @@ -196,7 +196,8 @@ template class Texture: public AbstractTexture { * @fn_gl{GetTexLevelParameter} or @fn_gl_extension{GetTextureLevelParameter,EXT,direct_state_access} * with @def_gl{TEXTURE_WIDTH}, @def_gl{TEXTURE_HEIGHT} or * @def_gl{TEXTURE_DEPTH} - * @requires_gl %Texture image queries are not available in OpenGL ES. + * @requires_gles31 %Texture image size queries are not available in + * OpenGL ES 3.0 and older. */ VectorTypeFor imageSize(Int level) { return DataHelper::imageSize(*this, _target, level); diff --git a/src/Magnum/TextureArray.h b/src/Magnum/TextureArray.h index 3ca9fdcf2..b4f6b1582 100644 --- a/src/Magnum/TextureArray.h +++ b/src/Magnum/TextureArray.h @@ -249,7 +249,7 @@ template class TextureArray: public AbstractTexture { } #endif - #ifndef MAGNUM_TARGET_GLES + #ifndef MAGNUM_TARGET_GLES2 /** @copydoc Texture::imageSize() */ VectorTypeFor imageSize(Int level) { return DataHelper::imageSize(*this, _target, level);