Browse Source

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.
pull/51/head
Vladimír Vondruš 12 years ago
parent
commit
e55ee11b6a
  1. 11
      src/Magnum/AbstractTexture.cpp
  2. 19
      src/Magnum/AbstractTexture.h

11
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));

19
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

Loading…
Cancel
Save