webgl: Fix incorrect redraw due to read pixels with software compositing
The issue is that we don't reset the contents_changed_ flag to false at the end of DrawingBuffer::FinishPrepareTransferableResourceSoftware. Here's the problem: 1) We draw something into webgl canvas (DrawingBuffer) and export it as a software resource (FinishPrepareTransferableResourceSoftware). 2) Later we do a readPixels on the canvas (which is preserveDrawingBuffer: false). The readPixels will clear the canvas to match spec behavior (WebGLRenderingContextBase::ClearIfComposited). 3) The next time blink document lifecycle happens (rAF, resize, etc.) DrawingBuffer thinks it needs to export the back buffer to compositor again because contents_changed_ is still true. 4) DrawingBuffer exports the cleared back buffer to compositor. This CL includes a pixel test that simulates the above case by switching tabs (and calling readPixels) to force a document lifecycle update. The included test fails before this fix and passes afterwards. Bug: 1047829 Change-Id: I1496919b974d84e975db28eafd9b8e6ffc71d91e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2040732Reviewed-by:Kenneth Russell <kbr@chromium.org> Reviewed-by:
Zhenyao Mo <zmo@chromium.org> Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org> Cr-Commit-Position: refs/heads/master@{#739141}
Showing
Please register or sign in to comment