fix(render): release the atmosphere probe's WebGL context

Lose the throwaway WebGL2 probe context right after the link probe instead
of leaving it for GC; browsers (Safari especially) cap live contexts. Note
that affected devices also lose globe-basemap fog, credit the changelog
entry and move it to the top.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Sameh KhamisandClaude Opus 5.5 committed 2026-09-24 21:53:06 -07:00
1 parent 351b5fcaa4
commit 20a03aad87
4 files changed
+42 -16

No files matched your search

+13 -1
View File
@@ -154,7 +154,19 @@ export function shouldDisableModelAtmosphere({
} = {}) {
const gl = createProbeContext();
if (gl) {
if (probeOutParamVaryingLinkFailure(gl)) return true;
let linkFails;
try {
linkFails = probeOutParamVaryingLinkFailure(gl);
} finally {
// Browsers cap live WebGL contexts (Safari especially); release the
// throwaway probe context now rather than waiting for GC.
try {
gl.getExtension?.('WEBGL_lose_context')?.loseContext();
} catch {
// A context that cannot be released is left to GC.
}
}
if (linkFails) return true;
// Probe ran and the driver accepted the pattern. Apple mobile is still
// quarantined: the probe program is far simpler than Cesium's, and a
// false negative there costs the entire scene.