diff --git a/src/Magnum/GL/AbstractTexture.cpp b/src/Magnum/GL/AbstractTexture.cpp index 052a9de00..f5f87a6e9 100644 --- a/src/Magnum/GL/AbstractTexture.cpp +++ b/src/Magnum/GL/AbstractTexture.cpp @@ -539,9 +539,12 @@ void AbstractTexture::bindInternal() { /* Update state tracker, bind the texture to the unit. Not directly calling glBindTexture() here because we may need to include various - platform-specific workarounds (Apple, Intel Windpws) */ + platform-specific workarounds (Apple, Intel Windpws), also can't just + reuse textureState.bindImplementation as we *need* to call + glBindTexture() in order to create it and have ObjectFlag::Created set + (which is then asserted in createIfNotAlready()) */ textureState.bindings[internalTextureUnit] = {_target, _id}; - (this->*textureState.bindImplementation)(internalTextureUnit); + (this->*textureState.bindInternalImplementation)(internalTextureUnit); } #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2) diff --git a/src/Magnum/GL/Implementation/TextureState.cpp b/src/Magnum/GL/Implementation/TextureState.cpp index 11a4d4952..71ebe630e 100644 --- a/src/Magnum/GL/Implementation/TextureState.cpp +++ b/src/Magnum/GL/Implementation/TextureState.cpp @@ -103,6 +103,8 @@ TextureState::TextureState(Context& context, std::vector& extension #endif { unbindImplementation = &AbstractTexture::unbindImplementationDefault; + /* This is additionally modified below for the + apple-buffer-texture-unbind-on-buffer-modify workaround */ bindImplementation = &AbstractTexture::bindImplementationDefault; } @@ -495,8 +497,13 @@ TextureState::TextureState(Context& context, std::vector& extension implement the workaround also for bindMultiImplementation */ CORRADE_INTERNAL_ASSERT(!context.isExtensionSupported()); bindImplementation = &AbstractTexture::bindImplementationAppleBufferTextureWorkaround; - } + bindInternalImplementation = &AbstractTexture::bindImplementationAppleBufferTextureWorkaround; + } else #endif + { + /* bindImplementation already set above */ + bindInternalImplementation = &AbstractTexture::bindImplementationDefault; + } #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) /* Allocate image bindings array to hold all possible image units */ diff --git a/src/Magnum/GL/Implementation/TextureState.h b/src/Magnum/GL/Implementation/TextureState.h index 07f473efc..55c38bb92 100644 --- a/src/Magnum/GL/Implementation/TextureState.h +++ b/src/Magnum/GL/Implementation/TextureState.h @@ -63,6 +63,7 @@ struct TextureState { void(*bindMultiImplementation)(GLint, Containers::ArrayView); void(AbstractTexture::*createImplementation)(); void(AbstractTexture::*bindImplementation)(GLint); + void(AbstractTexture::*bindInternalImplementation)(GLint); void(AbstractTexture::*parameteriImplementation)(GLenum, GLint); void(AbstractTexture::*parameterfImplementation)(GLenum, GLfloat); #ifndef MAGNUM_TARGET_GLES2