Bug 268071
Summary: | The usage of flat qualifier breaks the WebGL context in Safari | ||
---|---|---|---|
Product: | WebKit | Reporter: | Daniel Eke <endanke> |
Component: | WebGL | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | Normal | CC: | ahmad.saleem792, dino, kbr, kkinnunen, webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | Other | ||
Hardware: | iPhone / iPad | ||
OS: | Unspecified |
Daniel Eke
We have run into a regression regarding the usage of the "flat" storage qualifier in GLSL shaders, which causes the browser to lose the WebGL context across several tabs.
This breaks rendering of any further WebGL content and to recover, the browser needs to be force-closed and opened again.
The issue was reproducible in Safari on multiple iPad models (MK2K3KN/A and MQDW2TY/A) on one iPhone model (MT9G2ZD/A) and across different iOS versions (16.3.1 and 17.3).
On desktop environment we were unable to reproduce it.
The exact conditions are not clear, as the browser can render some frames before it loses the context, but usually it happens within a couple of seconds.
As a minimal example, we've set the following property in a vertex shader:
flat out float v_test;
...
v_test = 1.0;
And accessed it in the fragment shader similar to:
flat in float v_test;
...
float alpha = v_test;
glFragColor = vec4(1.0, 1.0, 1.0, alpha);
The repeated usage of these shaders breaks the context in a couple of seconds.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Kimmo Kinnunen
To confirm:
- What does "these shaders breaks the context in a couple of seconds"? Is it WebGL context lost or crash? If I'm reading correctly, it's context lost.
If you can share a minimal example, that would be good.
In case your flat shading algorithm does not care which vertex provokes the values, please see https://registry.khronos.org/webgl/extensions/WEBGL_provoking_vertex/ to fix your issue.
Kimmo Kinnunen
possibly fix.
Daniel Eke
It means GL context lost, which we saw in the logs in some cases. In other cases it just manifests by stopping the rendering and turning the target surface to blank, without any additional logs.
I'm working on a self-contained example. It turns out just the usage of "flat" is not enough, but it's definitely required to produce the problem.
Thanks for the linked example, I'll take a look.
Ahmad Saleem
*** This bug has been marked as a duplicate of bug 268070 ***
Ahmad Saleem
Apologise! Wanted to mark other way around.
Ahmad Saleem
*** Bug 268070 has been marked as a duplicate of this bug. ***
Daniel Eke
Oh excuse me, apparently I sent the form twice accidentally. Thanks for noticing the duplication.
Radar WebKit Bug Importer
<rdar://problem/122083140>
Kimmo Kinnunen
Marking this fixed in bug 272023
e38cf95a58 Metal: Release prov. vertex buffers on event set
If this persists, please reopen.
*** This bug has been marked as a duplicate of bug 272023 ***
Kimmo Kinnunen
iOS 18 beta
macOS 15 Beta Sequoia
Safari Technology Preview (macOS)