From e55ee11b6af3322b28307971ea0b05d5c74a7494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 4 Feb 2014 16:14:08 +0100 Subject: [PATCH] Deprecate AbstractTexture::maxLayers() altogether. *Texture::bind() is now meant to be used only internally from shaders, thus this function is not needed at all, as we should query directly the particular shader type for the limits. The name also somehow clashes with layered textures, which should be avoided. --- src/Magnum/AbstractTexture.cpp | 11 +++++++++-- src/Magnum/AbstractTexture.h | 19 +++++++++---------- 2 files changed, 18 insertions(+), 12 deletions(-) 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