WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
234824
Writing gl_FragDepth without depth attachment disables color writes
https://bugs.webkit.org/show_bug.cgi?id=234824
Summary
Writing gl_FragDepth without depth attachment disables color writes
Ashley Gullen
Reported
2022-01-03 08:59:53 PST
In Safari 15, using the gl_FragDepth feature of WebGL 2 in a fragment shader rendering to a framebuffer without a depth attachment, causes all color writes to fail, resulting in a blank screen. In Chrome and Firefox on both Windows and Android it works correctly. Minimal repro:
https://downloads.scirra.com/labs/bugs/webglfragdepth/
This is a lightly modified version of the fbo_blit example from WebGL 2 samples (
http://webglsamples.org/WebGL2Samples/
). This example does not use any depth attachment on the FBO. The only meaningful change is the addition of this line to the fragment shader: gl_FragDepth = 1.0; This causes all the color writes to fail, producing a blank screen (tested on Safari 15.2 on macOS 12.1 and iPadOS 15.2). However it renders correctly in Chrome/Firefox on Windows/Android. Removing that line causes rendering to work again in Safari. With no depth attachment, it is expected that all writes to gl_FragDepth would simply have no effect. Instead the observed result is that the color writes stop working producing no rendering at all. We need this to work in our WebGL engine as we want to use some 2D shaders both with and without a depth buffer in use; however in Safari the presence of gl_FragDepth causes all rendering to fail.
Attachments
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2022-01-03 16:09:22 PST
> Minimal repro:
https://downloads.scirra.com/labs/bugs/webglfragdepth/
Is a red/grey checkerboard a pass or a failure on this test? If it’s a pass, this may be fixed on trunk already.
Ashley Gullen
Comment 2
2022-01-04 05:46:24 PST
The correct rendering should match this sample:
http://webglsamples.org/WebGL2Samples/#fbo_blit
i.e. if you see a red background with some images, it works. When it does not work, it's just a black screen with some text at the top.
Alexey Proskuryakov
Comment 3
2022-01-04 10:08:39 PST
Thank you. I'm getting black screen with some text at the top on STP 137; and a checkerboard without images on the iOS build that I have installed. So this doesn't appear to be fixed yet.
Radar WebKit Bug Importer
Comment 4
2022-01-04 10:08:55 PST
<
rdar://problem/87097485
>
Kenneth Russell
Comment 5
2022-01-04 10:48:49 PST
Thanks for reporting this; it's a bug in ANGLE's Metal backend. I've filed it upstream against ANGLE as: Metal: Writing gl_FragDepth without depth attachment disables color writes
https://bugs.chromium.org/p/angleproject/issues/detail?id=6865
We can perhaps prototype a fix in WebKit's copy of ANGLE, but ideally it'll be fixed upstream and just rolled into WebKit to avoid merge conflicts.
Ashley Gullen
Comment 6
2022-03-30 03:56:03 PDT
The corresponding ANGLE issue is marked fixed, but the issue still reproduces in Safari 15.4 and TP 142. When is it supposed to be fixed?
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug