See details on https://github.com/mrdoob/three.js/pull/13427
It's likely that preserveDrawingBuffer was broken as I changed compositing.
On top-of-tree WebKit, it looks like the only scenario which is definitively broken is preserveDrawingBuffer:true with antialias:false. Can confirm that a fix of this code path in the ANGLE backend eliminates this flicker on desktop macOS.
This is required to fix the conformance2webgl/2.0.0/conformance2/textures/webgl_canvas tests; blocking the umbrella bug for that.
Created attachment 398887 [details]
When I compile and run this patch on iOS hardware I don't get any rendering on https://rawgit.com/mrdoob/three.js/dev/examples/webgl_trails.html (just black).
I confirmed it still flickered without the patch.
Comment on attachment 398887 [details]
Rejecting review because this patch doesn't work on iOS hardware. Debugging.
The black screen reproduces on the iOS Simulator, too.
ANGLE takes the CopyTexSubImage2D path in BlitGL::copyTexSubImage for this case. Not immediately sure why that's not working.
Created attachment 398917 [details]
Zipped up webgl_trails for easier debugging
The problem on iOS is related to alpha:false. Setting it to alpha:true makes the content appear.
Debugging this earlier, for the alpha:false case, TextureGL::copySubTextureHelper was going down the BlitGL::copyTexSubImage path - didn't see exactly the source and destination internal formats.
For the alpha:true case, the sized internal format of the destination texture is GL_BGRA8_EXT, which in BuildInternalFormatInfoMap() in src/libANGLE/renderer/gl/formatutilsgl.cpp is declared not renderable on GLES - this is clearly wrong on iOS. It's falling back to CPU readback which seems to be why this case is working at all on iOS.
Created attachment 399286 [details]
From the ChangeLog:
With preserveDrawingBuffer:true and antialias:false, allocate an
intermediate texture and FBO, and blit from it to the destination
texture in prepareTexture(). Use wipeAlphaChannelFromPixels on iOS
as well as macOS.
In addition to fixing the test case from the bug, this also fixes
the webgl/2.0.0/conformance2/textures/webgl_canvas/ layout tests,
which will be re-enabled in a subsequent patch. It also passes the
more stringent webgl_canvas conformance tests in
Comment on attachment 399286 [details]
I tested this on a device and confirmed the flicker is gone.
Committed r261639: <https://trac.webkit.org/changeset/261639>
All reviewed patches have been landed. Closing bug and clearing flags on attachment 399286 [details].