]> git.codecow.com Git - nano-pow.git/commitdiff
Check for immediate WebGL context loss for API availability. fix/ios-gl-regression
authorChris Duncan <chris@zoso.dev>
Thu, 2 Apr 2026 21:30:33 +0000 (14:30 -0700)
committerChris Duncan <chris@zoso.dev>
Thu, 2 Apr 2026 21:30:33 +0000 (14:30 -0700)
src/utils/api-support/webgl.ts

index c31c4efe65ba4643d0407e2e405779804feedaad..7d87b71046f373ed797b28575154a3809949e41d 100644 (file)
@@ -7,7 +7,7 @@ Object.defineProperty(webgl, 'isSupported', {
                let isWebglSupported = false
                try {
                        const gl = new OffscreenCanvas(0, 0)?.getContext?.('webgl2')
-                       isWebglSupported = (gl instanceof WebGL2RenderingContext)
+                       isWebglSupported = (gl instanceof WebGL2RenderingContext && !gl.isContextLost())
                } catch (err) {
                        console.warn('WebGL is not supported in this environment.\n', err)
                        isWebglSupported = false