I've enabled WebGL 2 in Safari Technology Preview Release 121 (Safari 14.2, WebKit 15612.1.4.3) on macOS 10.15.7. Please open https://threejs.org/examples/#webgl_framebuffer_texture The demo renders a scene and then copies a portion of the framebuffer into a texture (via copyTexImage2D()). This texture is then used for a sprite which is rendered at the top-left corner of the screen with an additional render pass. When you now hover with the mouse over the links in the left menu bar, the sprite starts to flicker red. This does not happen when using WebGL1 and not with latest Firefox and Chrome. When using stable Safari (Version 14.0 15610.1.28.1.9, 15610) and WebGL 2, there is only a signle red flicker right when loading the page (but not when hovering links). My system: iMac (Retina 5K, 27'', ultimo 2014) 4 GHz Quad-Core Intel Core i7 16 GB 1600 MHz DDR3 AMD Radeon R9 M295X 4 GB
On my machine (2017 15" MacBook Pro, Intel HD 630 / AMD Radeon 560), the sprite flickers to black while hovering over the links on the left. The texture copying code looks correct - it's doing the copy inside the requestAnimationFrame callback. Otherwise I might have guessed it was relying on undefined behavior, if preserveDrawingBuffer is set to the default false (haven't checked). The behavior is quite strange. I don't know how other rendering work the browser is doing could interfere with the WebGL rendering in this way. Could this have something to do with how the WebGLLayer publishes its textures to the compositor? Kimmo, can you reproduce?
Created attachment 422557 [details] Patch
Red is the uninitialized IOSurface contents visible due to multisample resolve blit erroring out.
Comment on attachment 422557 [details] Patch Looks good. Would you please consider putting up a pull request enhancing the associated tests in the WebGL conformance suite? Please see https://github.com/KhronosGroup/WebGL/issues/3255 . Thanks. r+
Committed r274141: <https://commits.webkit.org/r274141> All reviewed patches have been landed. Closing bug and clearing flags on attachment 422557 [details].
<rdar://problem/75207365>