Browse Source

GL: one more iteration on the Apple buffer texture workaround.

This broke DSA-less contexts with ARB_multi_bind present.
pull/454/head
Vladimír Vondruš 6 years ago
parent
commit
c4e41d28f1
  1. 7
      src/Magnum/GL/AbstractTexture.cpp
  2. 9
      src/Magnum/GL/Implementation/TextureState.cpp
  3. 1
      src/Magnum/GL/Implementation/TextureState.h

7
src/Magnum/GL/AbstractTexture.cpp

@ -539,9 +539,12 @@ void AbstractTexture::bindInternal() {
/* Update state tracker, bind the texture to the unit. Not directly calling /* Update state tracker, bind the texture to the unit. Not directly calling
glBindTexture() here because we may need to include various 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}; textureState.bindings[internalTextureUnit] = {_target, _id};
(this->*textureState.bindImplementation)(internalTextureUnit); (this->*textureState.bindInternalImplementation)(internalTextureUnit);
} }
#if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2) #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2)

9
src/Magnum/GL/Implementation/TextureState.cpp

@ -103,6 +103,8 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
#endif #endif
{ {
unbindImplementation = &AbstractTexture::unbindImplementationDefault; unbindImplementation = &AbstractTexture::unbindImplementationDefault;
/* This is additionally modified below for the
apple-buffer-texture-unbind-on-buffer-modify workaround */
bindImplementation = &AbstractTexture::bindImplementationDefault; bindImplementation = &AbstractTexture::bindImplementationDefault;
} }
@ -495,8 +497,13 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
implement the workaround also for bindMultiImplementation */ implement the workaround also for bindMultiImplementation */
CORRADE_INTERNAL_ASSERT(!context.isExtensionSupported<Extensions::ARB::multi_bind>()); CORRADE_INTERNAL_ASSERT(!context.isExtensionSupported<Extensions::ARB::multi_bind>());
bindImplementation = &AbstractTexture::bindImplementationAppleBufferTextureWorkaround; bindImplementation = &AbstractTexture::bindImplementationAppleBufferTextureWorkaround;
} bindInternalImplementation = &AbstractTexture::bindImplementationAppleBufferTextureWorkaround;
} else
#endif #endif
{
/* bindImplementation already set above */
bindInternalImplementation = &AbstractTexture::bindImplementationDefault;
}
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/* Allocate image bindings array to hold all possible image units */ /* Allocate image bindings array to hold all possible image units */

1
src/Magnum/GL/Implementation/TextureState.h

@ -63,6 +63,7 @@ struct TextureState {
void(*bindMultiImplementation)(GLint, Containers::ArrayView<AbstractTexture* const>); void(*bindMultiImplementation)(GLint, Containers::ArrayView<AbstractTexture* const>);
void(AbstractTexture::*createImplementation)(); void(AbstractTexture::*createImplementation)();
void(AbstractTexture::*bindImplementation)(GLint); void(AbstractTexture::*bindImplementation)(GLint);
void(AbstractTexture::*bindInternalImplementation)(GLint);
void(AbstractTexture::*parameteriImplementation)(GLenum, GLint); void(AbstractTexture::*parameteriImplementation)(GLenum, GLint);
void(AbstractTexture::*parameterfImplementation)(GLenum, GLfloat); void(AbstractTexture::*parameterfImplementation)(GLenum, GLfloat);
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2

Loading…
Cancel
Save