diff --git a/src/Magnum/AbstractTexture.cpp b/src/Magnum/AbstractTexture.cpp index 4d2dd9d40..5594093c5 100644 --- a/src/Magnum/AbstractTexture.cpp +++ b/src/Magnum/AbstractTexture.cpp @@ -34,16 +34,22 @@ #include "Magnum/Context.h" #include "Magnum/Extensions.h" #include "Magnum/Image.h" -#include "Magnum/Shader.h" #include "Magnum/TextureFormat.h" +#ifdef MAGNUM_BUILD_DEPRECATED +#include "Magnum/Shader.h" +#endif + #include "Implementation/DebugState.h" #include "Implementation/State.h" #include "Implementation/TextureState.h" namespace Magnum { +#ifdef MAGNUM_BUILD_DEPRECATED Int AbstractTexture::maxLayers() { return Shader::maxCombinedTextureImageUnits(); } +Int AbstractTexture::maxSupportedLayerCount() { return Shader::maxCombinedTextureImageUnits(); } +#endif #ifndef MAGNUM_TARGET_GLES Int AbstractTexture::maxColorSamples() { @@ -183,7 +189,8 @@ void AbstractTexture::bindInternal() { return; /* Set internal layer as active if not already */ - const GLint internalLayer = maxLayers()-1; + CORRADE_INTERNAL_ASSERT(textureState->maxLayers > 1); + const GLint internalLayer = textureState->maxLayers-1; if(textureState->currentLayer != internalLayer) glActiveTexture(GL_TEXTURE0 + (textureState->currentLayer = internalLayer)); diff --git a/src/Magnum/AbstractTexture.h b/src/Magnum/AbstractTexture.h index a13211979..7062fbd64 100644 --- a/src/Magnum/AbstractTexture.h +++ b/src/Magnum/AbstractTexture.h @@ -102,23 +102,22 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { friend struct Implementation::TextureState; public: + #ifdef MAGNUM_BUILD_DEPRECATED /** - * @brief Max supported layer count - * - * The result is cached, repeated queries don't result in repeated - * OpenGL calls. This function is in fact alias to - * @ref Shader::maxCombinedTextureImageUnits(). - * @see @ref bind(Int) + * @copybrief Shader::maxCombinedTextureImageUnits() + * @deprecated Use @ref Magnum::Shader::maxCombinedTextureImageUnits() "Shader::maxCombinedTextureImageUnits()" + * instead. */ - static Int maxLayers(); + static CORRADE_DEPRECATED("use Shader::maxCombinedTextureImageUnits() instead") Int maxLayers(); + #endif #ifdef MAGNUM_BUILD_DEPRECATED /** - * @copybrief maxLayers() - * @deprecated Use @ref Magnum::AbstractTexture::maxLayers() "maxLayers()" + * @copybrief Shader::maxCombinedTextureImageUnits() + * @deprecated Use @ref Magnum::Shader::maxCombinedTextureImageUnits() "Shader::maxCombinedTextureImageUnits()" * instead. */ - static CORRADE_DEPRECATED("use maxLayers() instead") Int maxSupportedLayerCount() { return maxLayers(); } + static CORRADE_DEPRECATED("use Shader::maxCombinedTextureImageUnits() instead") Int maxSupportedLayerCount(); #endif #ifndef MAGNUM_TARGET_GLES