Browse Source

GL: ensure the texture is actually created when using ARB_multi_bind.

With ARB_DSA disabled, the test added in previous commit would assert
already during bind(), and not later in label(). This was due to the
state tracker being updated too early here.
pull/680/head
Vladimír Vondruš 10 months ago
parent
commit
744b38dada
  1. 8
      src/Magnum/GL/AbstractTexture.cpp

8
src/Magnum/GL/AbstractTexture.cpp

@ -347,9 +347,13 @@ void AbstractTexture::bind(Int textureUnit) {
/* If already bound in given texture unit, nothing to do */ /* 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 */ /* Bind the texture to the unit, *then* update the state tracker. The order
textureState.bindings[textureUnit] = {_target, _id}; is important, as if bindImplementationMulti() is used, it calls into
createIfNotAlready() which then, if the state tracker would be already
updated, would see that the texture is bound already, and thus wouldn't
bind it at all, never actually creating it. */
textureState.bindImplementation(*this, textureUnit); textureState.bindImplementation(*this, textureUnit);
textureState.bindings[textureUnit] = {_target, _id};
} }
void AbstractTexture::bindImplementationDefault(AbstractTexture& self, GLint textureUnit) { void AbstractTexture::bindImplementationDefault(AbstractTexture& self, GLint textureUnit) {

Loading…
Cancel
Save