diff --git a/src/Magnum/GL/AbstractTexture.cpp b/src/Magnum/GL/AbstractTexture.cpp index e2991cfdc..56a90ab5c 100644 --- a/src/Magnum/GL/AbstractTexture.cpp +++ b/src/Magnum/GL/AbstractTexture.cpp @@ -119,13 +119,11 @@ void AbstractTexture::unbind(const Int textureUnit) { Implementation::TextureState& textureState = Context::current().state().texture; /* If given texture unit is already unbound, nothing to do */ - if(textureState.bindings[textureUnit].second == 0) return; + if(textureState.bindings[textureUnit].second() == 0) return; /* Unbind the texture, reset state tracker */ Context::current().state().texture.unbindImplementation(textureUnit); - /* libstdc++ since GCC 6.3 can't handle just = {} (ambiguous overload of - operator=) */ - textureState.bindings[textureUnit] = std::pair{}; + textureState.bindings[textureUnit] = {}; } void AbstractTexture::unbindImplementationDefault(const GLint textureUnit) { @@ -135,8 +133,8 @@ void AbstractTexture::unbindImplementationDefault(const GLint textureUnit) { if(textureState.currentTextureUnit != textureUnit) glActiveTexture(GL_TEXTURE0 + (textureState.currentTextureUnit = textureUnit)); - CORRADE_INTERNAL_ASSERT(textureState.bindings[textureUnit].first != 0); - glBindTexture(textureState.bindings[textureUnit].first, 0); + CORRADE_INTERNAL_ASSERT(textureState.bindings[textureUnit].first() != 0); + glBindTexture(textureState.bindings[textureUnit].first(), 0); } #ifndef MAGNUM_TARGET_GLES @@ -146,7 +144,7 @@ void AbstractTexture::unbindImplementationMulti(const GLint textureUnit) { } void AbstractTexture::unbindImplementationDSA(const GLint textureUnit) { - CORRADE_INTERNAL_ASSERT(Context::current().state().texture.bindings[textureUnit].first != 0); + CORRADE_INTERNAL_ASSERT(Context::current().state().texture.bindings[textureUnit].first() != 0); glBindTextureUnit(textureUnit, 0); } #endif @@ -184,9 +182,9 @@ void AbstractTexture::bindImplementationMulti(const GLint firstTextureUnit, Cont ids[i] = id; } - if(textureState.bindings[firstTextureUnit + i].second != id) { + if(textureState.bindings[firstTextureUnit + i].second() != id) { different = true; - textureState.bindings[firstTextureUnit + i].second = id; + textureState.bindings[firstTextureUnit + i].second() = id; } } @@ -235,9 +233,7 @@ AbstractTexture::~AbstractTexture() { /* Remove all bindings */ for(auto& binding: Context::current().state().texture.bindings) { /* MSVC 2015 needs the parentheses around */ - /* libstdc++ since GCC 6.3 can't handle just = {} (ambiguous overload - of operator=) */ - if(binding.second == _id) binding = std::pair{}; + if(binding.second() == _id) binding = {}; } #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) @@ -335,7 +331,7 @@ void AbstractTexture::bind(Int textureUnit) { Implementation::TextureState& textureState = Context::current().state().texture; /* If already bound in given texture unit, nothing to do */ - if(textureState.bindings[textureUnit].second == _id) return; + if(textureState.bindings[textureUnit].second() == _id) return; /* Update state tracker, bind the texture to the unit */ textureState.bindings[textureUnit] = {_target, _id}; @@ -525,7 +521,7 @@ void AbstractTexture::bindInternal() { Implementation::TextureState& textureState = Context::current().state().texture; /* If the texture is already bound in current unit, nothing to do */ - if(textureState.bindings[textureState.currentTextureUnit].second == _id) + if(textureState.bindings[textureState.currentTextureUnit].second() == _id) return; /* Set internal unit as active if not already, update state tracker */ @@ -535,7 +531,7 @@ void AbstractTexture::bindInternal() { glActiveTexture(GL_TEXTURE0 + (textureState.currentTextureUnit = internalTextureUnit)); /* If already bound in given texture unit, nothing to do */ - if(textureState.bindings[internalTextureUnit].second == _id) return; + if(textureState.bindings[internalTextureUnit].second() == _id) return; /* Update state tracker, bind the texture to the unit. Not directly calling glBindTexture() here because we may need to include various diff --git a/src/Magnum/GL/Buffer.cpp b/src/Magnum/GL/Buffer.cpp index eb9eb9c4a..91fc38daf 100644 --- a/src/Magnum/GL/Buffer.cpp +++ b/src/Magnum/GL/Buffer.cpp @@ -603,9 +603,7 @@ void Buffer::textureWorkaroundAppleBefore() { /* Unbind the texture, reset state tracker */ glBindTexture(GL_TEXTURE_BUFFER, 0); - /* libstdc++ since GCC 6.3 can't handle just = {} (ambiguous overload - of operator=) */ - textureState.bindings[textureUnit] = std::pair{}; + textureState.bindings[textureUnit] = {}; textureState.bufferTextureBound.set(textureUnit, false); } } diff --git a/src/Magnum/GL/Implementation/State.cpp b/src/Magnum/GL/Implementation/State.cpp index e3eb1149b..3e6b12d39 100644 --- a/src/Magnum/GL/Implementation/State.cpp +++ b/src/Magnum/GL/Implementation/State.cpp @@ -26,6 +26,7 @@ #include "State.h" #include +#include #include #include "Magnum/GL/Context.h" @@ -83,7 +84,7 @@ std::pair State::allocate(Context& context, std: Containers::ArrayView shaderStateView; Containers::ArrayView shaderProgramStateView; Containers::ArrayView textureStateView; - Containers::ArrayView> textureBindings; + Containers::ArrayView> textureBindings; #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) Containers::ArrayView imageBindings; #endif diff --git a/src/Magnum/GL/Implementation/TextureState.cpp b/src/Magnum/GL/Implementation/TextureState.cpp index 8d51cea6e..c6a0b97c4 100644 --- a/src/Magnum/GL/Implementation/TextureState.cpp +++ b/src/Magnum/GL/Implementation/TextureState.cpp @@ -43,7 +43,7 @@ namespace Magnum { namespace GL { namespace Implementation { using namespace Containers::Literals; TextureState::TextureState(Context& context, - Containers::ArrayView> bindings, + Containers::ArrayView> bindings, #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) Containers::ArrayView imageBindings, #endif @@ -547,7 +547,7 @@ TextureState::TextureState(Context& context, } void TextureState::reset() { - for(std::pair& i: bindings) + for(Containers::Pair& i: bindings) i = {{}, State::DisengagedBinding}; #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) for(ImageBinding& i: imageBindings) diff --git a/src/Magnum/GL/Implementation/TextureState.h b/src/Magnum/GL/Implementation/TextureState.h index 7a360110a..5b31d1909 100644 --- a/src/Magnum/GL/Implementation/TextureState.h +++ b/src/Magnum/GL/Implementation/TextureState.h @@ -25,7 +25,7 @@ DEALINGS IN THE SOFTWARE. */ -#include /* std::pair */ +#include #include #include "Magnum/Magnum.h" @@ -74,7 +74,7 @@ struct TextureState { #endif explicit TextureState(Context& context, - Containers::ArrayView> bindings, + Containers::ArrayView> bindings, #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) Containers::ArrayView imageBindings, #endif @@ -187,7 +187,7 @@ struct TextureState { /* Texture type, texture object ID. While not true, for simplicity this assumes that each slot can have just one ID bound, not one ID per texture type. */ - Containers::ArrayView> bindings; + Containers::ArrayView> bindings; #if defined(CORRADE_TARGET_APPLE) && !defined(MAGNUM_TARGET_GLES) Math::BitVector<80> bufferTextureBound; #endif