]> git.codecow.com Git - nano-pow.git/commitdiff
Tests WebGL availability by additionally checking for immediate context loss.
authorChris Duncan <chris@zoso.dev>
Thu, 2 Apr 2026 21:32:44 +0000 (14:32 -0700)
committerChris Duncan <chris@zoso.dev>
Thu, 2 Apr 2026 21:32:44 +0000 (14:32 -0700)
src/lib/index.ts

index e20fb545f7bd3bd4460e40fc7363299c793d0e2a..99f408fa3f697ab888c984d012e7b7f95f362485 100644 (file)
@@ -14,7 +14,7 @@ try {
 }
 try {
        const gl = new OffscreenCanvas(0, 0)?.getContext?.('webgl2')
-       isGlSupported = (gl instanceof WebGL2RenderingContext)
+       isGlSupported = (gl instanceof WebGL2RenderingContext && !gl.isContextLost())
 } catch (err) {
        console.warn('WebGL is not supported in this environment.\n', err)
        isGlSupported = false