Commit 2ed7b290 by Geoff Lang Committed by Commit Bot

GL: Unset the bound PBO when initiailizing texture data.

If a PBO is bound when uploading the initialization data, GL erorrs or crashes can happen. Covered by tests added in https://chromium-review.googlesource.com/c/angle/angle/+/1764476 BUG=angleproject:3858 Change-Id: I16963b1c09b5b173665a87f77296607f8639c975 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1769058Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 563f9f81
......@@ -182,6 +182,7 @@ class StateManagerGL final : angle::NonCopyable
{
return mFramebuffers[binding];
}
GLuint getBufferID(gl::BufferBinding binding) const { return mBuffers[binding]; }
private:
void setTextureCubemapSeamlessEnabled(bool enabled);
......
......@@ -1721,6 +1721,9 @@ angle::Result TextureGL::initializeContents(const gl::Context *context,
unpackState.alignment = 1;
stateManager->setPixelUnpackState(unpackState);
GLuint prevUnpackBuffer = stateManager->getBufferID(gl::BufferBinding::PixelUnpack);
stateManager->bindBuffer(gl::BufferBinding::PixelUnpack, 0);
stateManager->bindTexture(getType(), mTextureID);
if (internalFormatInfo.compressed)
{
......@@ -1786,6 +1789,7 @@ angle::Result TextureGL::initializeContents(const gl::Context *context,
// glTexImage call, we need to make sure that the texture data to be uploaded later has the
// expected unpack state.
stateManager->setPixelUnpackState(context->getState().getUnpackState());
stateManager->bindBuffer(gl::BufferBinding::PixelUnpack, prevUnpackBuffer);
return angle::Result::Continue;
}
......
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