Fix a crash in GLSurfaceEglReadback::SwapBuffers()
The crash is because GLSurfaceEglReadback::SwapBuffers() uses glReadPixels() to read back pixels from framebuffer to a buffer. It assumes the current GL_PIXEL_PACK_BUFFER_BINDING is 0, so glReadPixels() will store pixels in the buffer passed in instead of buffer binded at GL_PIXEL_PACK_BUFFER. However the GL_PIXEL_PACK_BUFFER_BINDING is not 0 sometimes. Fix the problem by binding 0 to GL_PIXEL_PACK_BUFFER before glReadPixels(), and restore it after glTreadPixels(). This change also sets 0 to GL_READ_FRAMEBUFFER_BINDING to make sure reading from the right surface. Bug: 1073882 Change-Id: Ic4bf35fb02baccb87664b7488af06d77d5197446 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2163080 Commit-Queue: Michael Spang <spang@chromium.org> Reviewed-by:Michael Spang <spang@chromium.org> Auto-Submit: Peng Huang <penghuang@chromium.org> Cr-Commit-Position: refs/heads/master@{#762161}
Showing
Please register or sign in to comment