From 27aea0ccd5c4272ccc0c1b9efb3747b32832fde4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 1 Jan 2016 23:27:34 +0100 Subject: [PATCH] Don't spread cubemap texture level parameter query workarounds elsewhere. Pre-DSA code paths need to specify for which face we are querying the level parameters, which meant that all other calls had to specify the (implicit) target too. I'm also preparing to put a cubemap-specific workaround in the level parameter query and that really shouldn't be present in the generic implementation for all texture types. The other place where a specific target is needed is in setImage() implementations, but these are rather big chunks of code and I don't feel like copying these verbatim to cubemap implementation just to isolate the workaround in one place. --- src/Magnum/AbstractTexture.cpp | 44 ++++++++--------- src/Magnum/AbstractTexture.h | 12 ++--- src/Magnum/CubeMapTexture.cpp | 57 ++++++++++++++++------ src/Magnum/CubeMapTexture.h | 12 +++-- src/Magnum/CubeMapTextureArray.h | 2 +- src/Magnum/Implementation/TextureState.cpp | 5 ++ src/Magnum/Implementation/TextureState.h | 5 +- src/Magnum/MultisampleTexture.h | 2 +- src/Magnum/RectangleTexture.h | 2 +- src/Magnum/Texture.h | 2 +- src/Magnum/TextureArray.h | 2 +- 11 files changed, 92 insertions(+), 53 deletions(-) diff --git a/src/Magnum/AbstractTexture.cpp b/src/Magnum/AbstractTexture.cpp index 3a1de6229..8f0bad58a 100644 --- a/src/Magnum/AbstractTexture.cpp +++ b/src/Magnum/AbstractTexture.cpp @@ -1094,19 +1094,19 @@ void AbstractTexture::setMaxAnisotropyImplementationExt(GLfloat anisotropy) { } #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) -void AbstractTexture::getLevelParameterImplementationDefault(const GLenum target, const GLint level, const GLenum parameter, GLint* const values) { +void AbstractTexture::getLevelParameterImplementationDefault(const GLint level, const GLenum parameter, GLint* const values) { bindInternal(); - glGetTexLevelParameteriv(target, level, parameter, values); + glGetTexLevelParameteriv(_target, level, parameter, values); } #ifndef MAGNUM_TARGET_GLES -void AbstractTexture::getLevelParameterImplementationDSA(GLenum, const GLint level, const GLenum parameter, GLint* const values) { +void AbstractTexture::getLevelParameterImplementationDSA(const GLint level, const GLenum parameter, GLint* const values) { glGetTextureLevelParameteriv(_id, level, parameter, values); } -void AbstractTexture::getLevelParameterImplementationDSAEXT(const GLenum target, const GLint level, const GLenum parameter, GLint* const values) { +void AbstractTexture::getLevelParameterImplementationDSAEXT(const GLint level, const GLenum parameter, GLint* const values) { _flags |= ObjectFlag::Created; - glGetTextureLevelParameterivEXT(_id, target, level, parameter, values); + glGetTextureLevelParameterivEXT(_id, _target, level, parameter, values); } #endif #endif @@ -1493,7 +1493,7 @@ void AbstractTexture::invalidateSubImageImplementationARB(GLint level, const Vec #ifndef DOXYGEN_GENERATING_OUTPUT #ifndef MAGNUM_TARGET_GLES template void AbstractTexture::image(GLint level, Image& image) { - const Math::Vector size = DataHelper::imageSize(*this, _target, level); + const Math::Vector size = DataHelper::imageSize(*this, level); const std::size_t dataSize = Implementation::imageDataSizeFor(image, size); /* Reallocate only if needed */ @@ -1512,7 +1512,7 @@ template void MAGNUM_EXPORT AbstractTexture::image<2>(GLint, Image<2>&); template void MAGNUM_EXPORT AbstractTexture::image<3>(GLint, Image<3>&); template void AbstractTexture::image(GLint level, BufferImage& image, BufferUsage usage) { - const Math::Vector size = DataHelper::imageSize(*this, _target, level); + const Math::Vector size = DataHelper::imageSize(*this, level); const std::size_t dataSize = Implementation::imageDataSizeFor(image, size); /* Reallocate only if needed */ @@ -1531,12 +1531,12 @@ template void MAGNUM_EXPORT AbstractTexture::image<2>(GLint, BufferImage<2>&, Bu template void MAGNUM_EXPORT AbstractTexture::image<3>(GLint, BufferImage<3>&, BufferUsage); template void AbstractTexture::compressedImage(const GLint level, CompressedImage& image) { - const Math::Vector size = DataHelper::imageSize(*this, _target, level); + const Math::Vector size = DataHelper::imageSize(*this, level); GLint textureDataSize; - (this->*Context::current()->state().texture->getLevelParameterivImplementation)(_target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &textureDataSize); + (this->*Context::current()->state().texture->getLevelParameterivImplementation)(level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &textureDataSize); const std::size_t dataSize = Implementation::compressedImageDataSizeFor(image, size, textureDataSize); GLint format; - (this->*Context::current()->state().texture->getLevelParameterivImplementation)(_target, level, GL_TEXTURE_INTERNAL_FORMAT, &format); + (this->*Context::current()->state().texture->getLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format); /* Reallocate only if needed */ Containers::Array data{image.release()}; @@ -1554,12 +1554,12 @@ template void MAGNUM_EXPORT AbstractTexture::compressedImage<2>(GLint, Compresse template void MAGNUM_EXPORT AbstractTexture::compressedImage<3>(GLint, CompressedImage<3>&); template void AbstractTexture::compressedImage(const GLint level, CompressedBufferImage& image, BufferUsage usage) { - const Math::Vector size = DataHelper::imageSize(*this, _target, level); + const Math::Vector size = DataHelper::imageSize(*this, level); GLint textureDataSize; - (this->*Context::current()->state().texture->getLevelParameterivImplementation)(_target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &textureDataSize); + (this->*Context::current()->state().texture->getLevelParameterivImplementation)(level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &textureDataSize); const std::size_t dataSize = Implementation::compressedImageDataSizeFor(image, size, textureDataSize); GLint format; - (this->*Context::current()->state().texture->getLevelParameterivImplementation)(_target, level, GL_TEXTURE_INTERNAL_FORMAT, &format); + (this->*Context::current()->state().texture->getLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format); /* Reallocate only if needed */ if(image.dataSize() < dataSize) @@ -1626,30 +1626,30 @@ template void MAGNUM_EXPORT AbstractTexture::subImage<3>(GLint, const Range3Di&, #ifndef DOXYGEN_GENERATING_OUTPUT #ifndef MAGNUM_TARGET_GLES -Math::Vector<1, GLint> AbstractTexture::DataHelper<1>::imageSize(AbstractTexture& texture, GLenum, const GLint level) { +Math::Vector<1, GLint> AbstractTexture::DataHelper<1>::imageSize(AbstractTexture& texture, const GLint level) { Math::Vector<1, GLint> value; - (texture.*Context::current()->state().texture->getLevelParameterivImplementation)(texture._target, level, GL_TEXTURE_WIDTH, &value[0]); + (texture.*Context::current()->state().texture->getLevelParameterivImplementation)(level, GL_TEXTURE_WIDTH, &value[0]); return value; } #endif #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) -Vector2i AbstractTexture::DataHelper<2>::imageSize(AbstractTexture& texture, const GLenum target, const GLint level) { +Vector2i AbstractTexture::DataHelper<2>::imageSize(AbstractTexture& texture, const GLint level) { const Implementation::TextureState& state = *Context::current()->state().texture; Vector2i value; - (texture.*state.getLevelParameterivImplementation)(target, level, GL_TEXTURE_WIDTH, &value[0]); - (texture.*state.getLevelParameterivImplementation)(target, level, GL_TEXTURE_HEIGHT, &value[1]); + (texture.*state.getLevelParameterivImplementation)(level, GL_TEXTURE_WIDTH, &value[0]); + (texture.*state.getLevelParameterivImplementation)(level, GL_TEXTURE_HEIGHT, &value[1]); return value; } -Vector3i AbstractTexture::DataHelper<3>::imageSize(AbstractTexture& texture, GLenum, const GLint level) { +Vector3i AbstractTexture::DataHelper<3>::imageSize(AbstractTexture& texture, const GLint level) { const Implementation::TextureState& state = *Context::current()->state().texture; Vector3i value; - (texture.*state.getLevelParameterivImplementation)(texture._target, level, GL_TEXTURE_WIDTH, &value[0]); - (texture.*state.getLevelParameterivImplementation)(texture._target, level, GL_TEXTURE_HEIGHT, &value[1]); - (texture.*state.getLevelParameterivImplementation)(texture._target, level, GL_TEXTURE_DEPTH, &value[2]); + (texture.*state.getLevelParameterivImplementation)(level, GL_TEXTURE_WIDTH, &value[0]); + (texture.*state.getLevelParameterivImplementation)(level, GL_TEXTURE_HEIGHT, &value[1]); + (texture.*state.getLevelParameterivImplementation)(level, GL_TEXTURE_DEPTH, &value[2]); return value; } #endif diff --git a/src/Magnum/AbstractTexture.h b/src/Magnum/AbstractTexture.h index 5784f1067..defd3bc1a 100644 --- a/src/Magnum/AbstractTexture.h +++ b/src/Magnum/AbstractTexture.h @@ -463,10 +463,10 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { void MAGNUM_LOCAL setMaxAnisotropyImplementationExt(GLfloat anisotropy); #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) - void MAGNUM_LOCAL getLevelParameterImplementationDefault(GLenum target, GLint level, GLenum parameter, GLint* values); + void MAGNUM_LOCAL getLevelParameterImplementationDefault(GLint level, GLenum parameter, GLint* values); #ifndef MAGNUM_TARGET_GLES - void MAGNUM_LOCAL getLevelParameterImplementationDSA(GLenum, GLint level, GLenum parameter, GLint* values); - void MAGNUM_LOCAL getLevelParameterImplementationDSAEXT(GLenum target, GLint level, GLenum parameter, GLint* values); + void MAGNUM_LOCAL getLevelParameterImplementationDSA(GLint level, GLenum parameter, GLint* values); + void MAGNUM_LOCAL getLevelParameterImplementationDSAEXT(GLint level, GLenum parameter, GLint* values); #endif #endif @@ -584,7 +584,7 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { #ifndef DOXYGEN_GENERATING_OUTPUT #ifndef MAGNUM_TARGET_GLES template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<1> { - static Math::Vector<1, GLint> imageSize(AbstractTexture& texture, GLenum, GLint level); + static Math::Vector<1, GLint> imageSize(AbstractTexture& texture, GLint level); static void setWrapping(AbstractTexture& texture, const Array1D& wrapping); @@ -605,7 +605,7 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<1> { #endif template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<2> { #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) - static Vector2i imageSize(AbstractTexture& texture, GLenum target, GLint level); + static Vector2i imageSize(AbstractTexture& texture, GLint level); #endif static void setWrapping(AbstractTexture& texture, const Array2D& wrapping); @@ -647,7 +647,7 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<2> { template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<3> { #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) #ifndef MAGNUM_TARGET_GLES2 - static Vector3i imageSize(AbstractTexture& texture, GLenum, GLint level); + static Vector3i imageSize(AbstractTexture& texture, GLint level); #endif static void setWrapping(AbstractTexture& texture, const Array3D& wrapping); diff --git a/src/Magnum/CubeMapTexture.cpp b/src/Magnum/CubeMapTexture.cpp index 2e2c15666..2e5e917c9 100644 --- a/src/Magnum/CubeMapTexture.cpp +++ b/src/Magnum/CubeMapTexture.cpp @@ -49,6 +49,17 @@ Vector2i CubeMapTexture::maxSize() { return Vector2i{Implementation::maxCubeMapTextureSideSize()}; } +#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) +Vector2i CubeMapTexture::imageSize(const Int level) { + const Implementation::TextureState& state = *Context::current()->state().texture; + + Vector2i value; + (this->*state.getCubeLevelParameterivImplementation)(level, GL_TEXTURE_WIDTH, &value[0]); + (this->*state.getCubeLevelParameterivImplementation)(level, GL_TEXTURE_HEIGHT, &value[1]); + return value; +} +#endif + #ifndef MAGNUM_TARGET_GLES void CubeMapTexture::image(const Int level, Image3D& image) { createIfNotAlready(); @@ -99,12 +110,10 @@ void CubeMapTexture::compressedImage(const Int level, CompressedImage3D& image) const Vector3i size{imageSize(level), 6}; GLint textureDataSize; - /* Similarly to imageSize(), use only parameters of +X in pre-DSA code path - and assume that all other slices are the same */ - (this->*Context::current()->state().texture->getLevelParameterivImplementation)(GL_TEXTURE_CUBE_MAP_POSITIVE_X, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &textureDataSize); + (this->*Context::current()->state().texture->getCubeLevelParameterivImplementation)(level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &textureDataSize); const std::size_t dataSize = Implementation::compressedImageDataSizeFor(image, size, textureDataSize); GLint format; - (this->*Context::current()->state().texture->getLevelParameterivImplementation)(GL_TEXTURE_CUBE_MAP_POSITIVE_X, level, GL_TEXTURE_INTERNAL_FORMAT, &format); + (this->*Context::current()->state().texture->getCubeLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format); /* Reallocate only if needed */ Containers::Array data{image.release()}; @@ -127,12 +136,10 @@ void CubeMapTexture::compressedImage(const Int level, CompressedBufferImage3D& i const Vector3i size{imageSize(level), 6}; GLint textureDataSize; - /* Similarly to imageSize(), use only parameters of +X in pre-DSA code path - and assume that all other slices are the same */ - (this->*Context::current()->state().texture->getLevelParameterivImplementation)(GL_TEXTURE_CUBE_MAP_POSITIVE_X, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &textureDataSize); + (this->*Context::current()->state().texture->getCubeLevelParameterivImplementation)(level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &textureDataSize); const std::size_t dataSize = Implementation::compressedImageDataSizeFor(image, size, textureDataSize); GLint format; - (this->*Context::current()->state().texture->getLevelParameterivImplementation)(GL_TEXTURE_CUBE_MAP_POSITIVE_X, level, GL_TEXTURE_INTERNAL_FORMAT, &format); + (this->*Context::current()->state().texture->getCubeLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format); /* Reallocate only if needed */ if(image.dataSize() < dataSize) @@ -193,12 +200,10 @@ BufferImage2D CubeMapTexture::image(const Coordinate coordinate, const Int level void CubeMapTexture::compressedImage(const Coordinate coordinate, const Int level, CompressedImage2D& image) { const Vector2i size = imageSize(level); GLint textureDataSize; - /* Similarly to imageSize(), use only parameters of +X in pre-DSA code path - and assume that all other slices are the same */ - (this->*Context::current()->state().texture->getLevelParameterivImplementation)(GL_TEXTURE_CUBE_MAP_POSITIVE_X, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &textureDataSize); + (this->*Context::current()->state().texture->getCubeLevelParameterivImplementation)(level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &textureDataSize); const std::size_t dataSize = Implementation::compressedImageDataSizeFor(image, size, textureDataSize); GLint format; - (this->*Context::current()->state().texture->getLevelParameterivImplementation)(GL_TEXTURE_CUBE_MAP_POSITIVE_X, level, GL_TEXTURE_INTERNAL_FORMAT, &format); + (this->*Context::current()->state().texture->getCubeLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format); /* Reallocate only if needed */ Containers::Array data{image.release()}; @@ -219,12 +224,10 @@ CompressedImage2D CubeMapTexture::compressedImage(const Coordinate coordinate, c void CubeMapTexture::compressedImage(const Coordinate coordinate, const Int level, CompressedBufferImage2D& image, const BufferUsage usage) { const Vector2i size = imageSize(level); GLint textureDataSize; - /* Similarly to imageSize(), use only parameters of +X in pre-DSA code path - and assume that all other slices are the same */ - (this->*Context::current()->state().texture->getLevelParameterivImplementation)(GL_TEXTURE_CUBE_MAP_POSITIVE_X, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &textureDataSize); + (this->*Context::current()->state().texture->getCubeLevelParameterivImplementation)(level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &textureDataSize); const std::size_t dataSize = Implementation::compressedImageDataSizeFor(image, size, textureDataSize); GLint format; - (this->*Context::current()->state().texture->getLevelParameterivImplementation)(GL_TEXTURE_CUBE_MAP_POSITIVE_X, level, GL_TEXTURE_INTERNAL_FORMAT, &format); + (this->*Context::current()->state().texture->getCubeLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format); /* Reallocate only if needed */ if(image.dataSize() < dataSize) @@ -337,6 +340,28 @@ CubeMapTexture& CubeMapTexture::setCompressedSubImage(const Coordinate coordinat } #endif +#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) +void CubeMapTexture::getLevelParameterImplementationDefault(const GLint level, const GLenum parameter, GLint* const values) { + bindInternal(); + /* Using only parameters of +X in pre-DSA code path and assuming that all + other faces are the same */ + glGetTexLevelParameteriv(GL_TEXTURE_CUBE_MAP_POSITIVE_X, level, parameter, values); +} + +#ifndef MAGNUM_TARGET_GLES +void CubeMapTexture::getLevelParameterImplementationDSA(const GLint level, const GLenum parameter, GLint* const values) { + glGetTextureLevelParameteriv(_id, level, parameter, values); +} + +void CubeMapTexture::getLevelParameterImplementationDSAEXT(const GLint level, const GLenum parameter, GLint* const values) { + _flags |= ObjectFlag::Created; + /* Using only parameters of +X in pre-DSA code path and assuming that all + other faces are the same */ + glGetTextureLevelParameterivEXT(_id, GL_TEXTURE_CUBE_MAP_POSITIVE_X, level, parameter, values); +} +#endif +#endif + #ifndef MAGNUM_TARGET_GLES void CubeMapTexture::getImageImplementationDefault(const Coordinate coordinate, const GLint level, const Vector2i&, const PixelFormat format, const PixelType type, std::size_t, GLvoid* const data) { bindInternal(); diff --git a/src/Magnum/CubeMapTexture.h b/src/Magnum/CubeMapTexture.h index 11331a67e..9f0a4ffc8 100644 --- a/src/Magnum/CubeMapTexture.h +++ b/src/Magnum/CubeMapTexture.h @@ -421,9 +421,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture { * @requires_gles Texture image size queries are not available in * WebGL. */ - Vector2i imageSize(Int level) { - return DataHelper<2>::imageSize(*this, GL_TEXTURE_CUBE_MAP_POSITIVE_X, level); - } + Vector2i imageSize(Int level); #ifdef MAGNUM_BUILD_DEPRECATED /** @@ -946,6 +944,14 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture { private: explicit CubeMapTexture(GLuint id, ObjectFlags flags) noexcept: AbstractTexture{id, GL_TEXTURE_CUBE_MAP, flags} {} + #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) + void MAGNUM_LOCAL getLevelParameterImplementationDefault(GLint level, GLenum parameter, GLint* values); + #ifndef MAGNUM_TARGET_GLES + void MAGNUM_LOCAL getLevelParameterImplementationDSA(GLint level, GLenum parameter, GLint* values); + void MAGNUM_LOCAL getLevelParameterImplementationDSAEXT(GLint level, GLenum parameter, GLint* values); + #endif + #endif + #ifndef MAGNUM_TARGET_GLES void MAGNUM_LOCAL getImageImplementationDefault(Coordinate coordinate, GLint level, const Vector2i& size, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data); void MAGNUM_LOCAL getImageImplementationDSA(Coordinate coordinate, GLint level, const Vector2i& size, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data); diff --git a/src/Magnum/CubeMapTextureArray.h b/src/Magnum/CubeMapTextureArray.h index 880a31128..059c05add 100644 --- a/src/Magnum/CubeMapTextureArray.h +++ b/src/Magnum/CubeMapTextureArray.h @@ -368,7 +368,7 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { * See @ref Texture::imageSize() for more information. */ Vector3i imageSize(Int level) { - return DataHelper<3>::imageSize(*this, _target, level); + return DataHelper<3>::imageSize(*this, level); } #ifndef MAGNUM_TARGET_GLES diff --git a/src/Magnum/Implementation/TextureState.cpp b/src/Magnum/Implementation/TextureState.cpp index 31f5f582f..0ece7be34 100644 --- a/src/Magnum/Implementation/TextureState.cpp +++ b/src/Magnum/Implementation/TextureState.cpp @@ -135,6 +135,7 @@ TextureState::TextureState(Context& context, std::vector& extension setBufferImplementation = &BufferTexture::setBufferImplementationDSA; setBufferRangeImplementation = &BufferTexture::setBufferRangeImplementationDSA; + getCubeLevelParameterivImplementation = &CubeMapTexture::getLevelParameterImplementationDSA; cubeSubImageImplementation = &CubeMapTexture::subImageImplementationDSA; cubeCompressedSubImageImplementation = &CubeMapTexture::compressedSubImageImplementationDSA; @@ -159,6 +160,7 @@ TextureState::TextureState(Context& context, std::vector& extension setBufferImplementation = &BufferTexture::setBufferImplementationDSAEXT; setBufferRangeImplementation = &BufferTexture::setBufferRangeImplementationDSAEXT; + getCubeLevelParameterivImplementation = &CubeMapTexture::getLevelParameterImplementationDSAEXT; cubeSubImageImplementation = &CubeMapTexture::subImageImplementationDSAEXT; cubeCompressedSubImageImplementation = &CubeMapTexture::compressedSubImageImplementationDSAEXT; @@ -195,6 +197,9 @@ TextureState::TextureState(Context& context, std::vector& extension setBufferRangeImplementation = &BufferTexture::setBufferRangeImplementationDefault; #endif + #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) + getCubeLevelParameterivImplementation = &CubeMapTexture::getLevelParameterImplementationDefault; + #endif cubeSubImageImplementation = &CubeMapTexture::subImageImplementationDefault; cubeCompressedSubImageImplementation = &CubeMapTexture::compressedSubImageImplementationDefault; } diff --git a/src/Magnum/Implementation/TextureState.h b/src/Magnum/Implementation/TextureState.h index 43035a9e2..81ab20a42 100644 --- a/src/Magnum/Implementation/TextureState.h +++ b/src/Magnum/Implementation/TextureState.h @@ -61,7 +61,7 @@ struct TextureState { #endif void(AbstractTexture::*setMaxAnisotropyImplementation)(GLfloat); #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) - void(AbstractTexture::*getLevelParameterivImplementation)(GLenum, GLint, GLenum, GLint*); + void(AbstractTexture::*getLevelParameterivImplementation)(GLint, GLenum, GLint*); #endif void(AbstractTexture::*mipmapImplementation)(); #ifndef MAGNUM_TARGET_GLES @@ -97,6 +97,9 @@ struct TextureState { void(BufferTexture::*setBufferRangeImplementation)(BufferTextureFormat, Buffer&, GLintptr, GLsizeiptr); #endif + #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) + void(CubeMapTexture::*getCubeLevelParameterivImplementation)(GLint, GLenum, GLint*); + #endif #ifndef MAGNUM_TARGET_GLES void(CubeMapTexture::*getCubeImageImplementation)(CubeMapTexture::Coordinate, GLint, const Vector2i&, PixelFormat, PixelType, std::size_t, GLvoid*); void(CubeMapTexture::*getCompressedCubeImageImplementation)(CubeMapTexture::Coordinate, GLint, const Vector2i&, std::size_t, GLvoid*); diff --git a/src/Magnum/MultisampleTexture.h b/src/Magnum/MultisampleTexture.h index d806d4a0c..d9d42e3d8 100644 --- a/src/Magnum/MultisampleTexture.h +++ b/src/Magnum/MultisampleTexture.h @@ -210,7 +210,7 @@ template class MultisampleTexture: public AbstractTextur * OpenGL ES 3.0 and older. */ VectorTypeFor imageSize() { - return DataHelper::imageSize(*this, _target, 0); + return DataHelper::imageSize(*this, 0); } /** diff --git a/src/Magnum/RectangleTexture.h b/src/Magnum/RectangleTexture.h index dabe8f4c2..0962c9e7a 100644 --- a/src/Magnum/RectangleTexture.h +++ b/src/Magnum/RectangleTexture.h @@ -275,7 +275,7 @@ class MAGNUM_EXPORT RectangleTexture: public AbstractTexture { * * See @ref Texture::imageSize() for more information. */ - Vector2i imageSize() { return DataHelper<2>::imageSize(*this, _target, 0); } + Vector2i imageSize() { return DataHelper<2>::imageSize(*this, 0); } /** * @brief Read texture to image diff --git a/src/Magnum/Texture.h b/src/Magnum/Texture.h index 3d274b4be..8bfa7e9bc 100644 --- a/src/Magnum/Texture.h +++ b/src/Magnum/Texture.h @@ -625,7 +625,7 @@ template class Texture: public AbstractTexture { * WebGL. */ VectorTypeFor imageSize(Int level) { - return DataHelper::imageSize(*this, _target, level); + return DataHelper::imageSize(*this, level); } #endif diff --git a/src/Magnum/TextureArray.h b/src/Magnum/TextureArray.h index 00867ac36..e87cba8ec 100644 --- a/src/Magnum/TextureArray.h +++ b/src/Magnum/TextureArray.h @@ -388,7 +388,7 @@ template class TextureArray: public AbstractTexture { * WebGL. */ VectorTypeFor imageSize(Int level) { - return DataHelper::imageSize(*this, _target, level); + return DataHelper::imageSize(*this, level); } #endif