RESOLVED FIXED 183151
Bad flicker on three.js example
https://bugs.webkit.org/show_bug.cgi?id=183151
Summary Bad flicker on three.js example
Attachments
Patch (26.13 KB, patch)
2020-05-08 14:28 PDT, Kenneth Russell
no flags
Zipped up webgl_trails for easier debugging (235.29 KB, application/zip)
2020-05-08 22:22 PDT, Kenneth Russell
no flags
Patch (12.78 KB, patch)
2020-05-13 11:47 PDT, Kenneth Russell
no flags
Radar WebKit Bug Importer
Comment 1 2018-02-26 15:05:18 PST
Dean Jackson
Comment 2 2018-02-26 15:06:11 PST
It's likely that preserveDrawingBuffer was broken as I changed compositing.
Kenneth Russell
Comment 3 2020-05-08 13:29:21 PDT
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.
Kenneth Russell
Comment 4 2020-05-08 14:28:29 PDT
Dean Jackson
Comment 5 2020-05-08 16:25:09 PDT
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.
Kenneth Russell
Comment 6 2020-05-08 16:31:27 PDT
Comment on attachment 398887 [details] Patch Rejecting review because this patch doesn't work on iOS hardware. Debugging.
Kenneth Russell
Comment 7 2020-05-08 18:35:53 PDT
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.
Kenneth Russell
Comment 8 2020-05-08 22:22:35 PDT
Created attachment 398917 [details] Zipped up webgl_trails for easier debugging
Kenneth Russell
Comment 9 2020-05-08 22:28:11 PDT
The problem on iOS is related to alpha:false. Setting it to alpha:true makes the content appear.
Kenneth Russell
Comment 10 2020-05-08 22:48:37 PDT
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.
Kenneth Russell
Comment 11 2020-05-13 11:47:10 PDT
Kenneth Russell
Comment 12 2020-05-13 11:47:53 PDT
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 https://github.com/KhronosGroup/WebGL/pull/3071 .
Dean Jackson
Comment 13 2020-05-13 12:43:55 PDT
Comment on attachment 399286 [details] Patch I tested this on a device and confirmed the flicker is gone.
EWS
Comment 14 2020-05-13 12:57:10 PDT
Committed r261639: <https://trac.webkit.org/changeset/261639> All reviewed patches have been landed. Closing bug and clearing flags on attachment 399286 [details].
Note You need to log in before you can comment on or make changes to this bug.