diff --git a/gpu/command_buffer/service/shared_image/gl_texture_holder.cc b/gpu/command_buffer/service/shared_image/gl_texture_holder.cc index 8c35e9e706544..8bb21efdf6062 100644 --- a/gpu/command_buffer/service/shared_image/gl_texture_holder.cc +++ b/gpu/command_buffer/service/shared_image/gl_texture_holder.cc @@ -480,6 +480,16 @@ bool GLTextureHolder::ReadbackToMemory(const SkPixmap& pixmap) { pixels); } + // Bind away from the temporary FBO before deleting it. Some + // Imagination/PowerVR drivers retain an internal reference to the + // previously-bound FBO across bind transitions; deleting it while bound and + // then issuing a subsequent glBindFramebuffer can dereference freed driver + // state. See the ensure_previous_framebuffer_not_deleted workaround and the + // sibling fix in GLES2DecoderImpl::ClearLevelUsingGL. The + // ScopedFramebufferBinder dtor either issues another raw bind (safe, since + // "previous" is now FBO 0) or, on virtualized contexts, only marks state + // dirty without issuing a bind. + api->glBindFramebufferEXTFn(GL_FRAMEBUFFER, 0); api->glDeleteFramebuffersEXTFn(1, &framebuffer); if (!unpack_buffer.empty()) {