Whether this environment could run WebGL 2 at all (§62) — the cheap
pre-filter "auto" uses before it builds anything.
The check is the presence of the WebGL2RenderingContext global, read off
globalThis because this package compiles without lib.dom (the canvas is
described structurally by WebglCanvas, and so is this). Node, a worker
without OffscreenCanvas, and a browser too old for WebGL 2 all answer
false; every browser that can draw answers true.
It deliberately does not touch the canvas. A canvas hands out one
context per type, and a probe calling getContext("webgl2") with its own
attributes would fix the attributes of the context
WebglRenderer.initialize later acquires — silently turning
antialias: true off. The real gate is that initialize, which already
fails with RENDERER_INITIALIZATION_FAILED (§89) for a blocked GPU or a
canvas that already holds another context, and whose failure "auto"
recovers from by moving to §62's next backend. This probe only has to be
right about "there is no point trying".
Whether this environment could run WebGL 2 at all (§62) — the cheap pre-filter
"auto"uses before it builds anything.The check is the presence of the
WebGL2RenderingContextglobal, read offglobalThisbecause this package compiles withoutlib.dom(the canvas is described structurally byWebglCanvas, and so is this). Node, a worker without OffscreenCanvas, and a browser too old for WebGL 2 all answerfalse; every browser that can draw answerstrue.It deliberately does not touch the canvas. A canvas hands out one context per type, and a probe calling
getContext("webgl2")with its own attributes would fix the attributes of the context WebglRenderer.initialize later acquires — silently turningantialias: trueoff. The real gate is thatinitialize, which already fails withRENDERER_INITIALIZATION_FAILED(§89) for a blocked GPU or a canvas that already holds another context, and whose failure"auto"recovers from by moving to §62's next backend. This probe only has to be right about "there is no point trying".