Commit a2257dac by Corentin Wallez Committed by Commit Bot

Set the bound XFB to 0 when it is deleted

BUG=605775 Change-Id: Ie7af2c0dc4536b26473510a80955f4628ea496bb Reviewed-on: https://chromium-review.googlesource.com/340113Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
parent e71ea19a
......@@ -1862,7 +1862,17 @@ void Context::detachVertexArray(GLuint vertexArray)
void Context::detachTransformFeedback(GLuint transformFeedback)
{
mState.detachTransformFeedback(transformFeedback);
// Transform feedback detachment is handled by Context, because 0 is a valid
// transform feedback, and a pointer to it must be passed from Context to State at
// binding time.
// The OpenGL specification doesn't mention what should happen when the currently bound
// transform feedback object is deleted. Since it is a container object, we treat it like
// VAOs and FBOs and set the current bound transform feedback back to 0.
if (mState.removeTransformFeedbackBinding(transformFeedback))
{
bindTransformFeedback(0);
}
}
void Context::detachSampler(GLuint sampler)
......
......@@ -685,10 +685,10 @@ void State::detachTexture(const TextureMap &zeroTextures, GLuint texture)
// If a texture object is deleted, it is as if all texture units which are bound to that texture object are
// rebound to texture object zero
for (TextureBindingMap::iterator bindingVec = mSamplerTextures.begin(); bindingVec != mSamplerTextures.end(); bindingVec++)
for (auto &bindingVec : mSamplerTextures)
{
GLenum textureType = bindingVec->first;
TextureBindingVector &textureVector = bindingVec->second;
GLenum textureType = bindingVec.first;
TextureBindingVector &textureVector = bindingVec.second;
for (size_t textureIdx = 0; textureIdx < textureVector.size(); textureIdx++)
{
BindingPointer<Texture> &binding = textureVector[textureIdx];
......@@ -971,12 +971,15 @@ bool State::isTransformFeedbackActiveUnpaused() const
return curTransformFeedback && curTransformFeedback->isActive() && !curTransformFeedback->isPaused();
}
void State::detachTransformFeedback(GLuint transformFeedback)
bool State::removeTransformFeedbackBinding(GLuint transformFeedback)
{
if (mTransformFeedback.id() == transformFeedback)
{
mTransformFeedback.set(NULL);
mTransformFeedback.set(nullptr);
return true;
}
return false;
}
bool State::isQueryActive(GLenum type) const
......
......@@ -191,7 +191,7 @@ class State : angle::NonCopyable
void setTransformFeedbackBinding(TransformFeedback *transformFeedback);
TransformFeedback *getCurrentTransformFeedback() const;
bool isTransformFeedbackActiveUnpaused() const;
void detachTransformFeedback(GLuint transformFeedback);
bool removeTransformFeedbackBinding(GLuint transformFeedback);
// Query binding manipulation
bool isQueryActive(GLenum type) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment