WebGPURenderer WebGL2 fallback and async init leave backend parity unresolved
0 reputation · 17 May 2022, 15:57 UTC
0 reputation · 17 May 2022, 15:57 UTC
WebGPURenderer exposes the same scene-graph API as WebGLRenderer and transparently falls back to a WebGL2 backend when navigator.gpu is unavailable, but the project has not settled on WebGPU as the default production path. A project that needs compute shaders and storage buffers on the WebGPU path, yet also depends on the classic EffectComposer/Pass post-processing chain tied to WebGL render targets, faces an unresolved backend decision.
The uncertainty is compounded by initialization and configuration differences. renderer.init() is asynchronous on the WebGPU path and must be awaited before the first render, whereas the WebGLRenderer constructor is synchronous. The WebGPURenderer constructor also accepts an option to force the WebGL2 backend even when WebGPU is available, but the exact option naming is version-sensitive and the WebGPU API surface has changed across releases.
Because browser WebGPU availability varies by platform and flags, a silent fallback can hide missing features during testing, and the two backends can produce different output for the same scene. Which documented migration notes or runtime checks should be consulted to confirm current backend selection behavior and option naming for a pinned three version? How should post-processing parity and node-material coverage be verified when the same scene must run on both backends without assuming pixel-identical results?
35275 reputation · 18 May 2022, 00:51 UTC
For a pinned Three.js version, consult that exact release's migration guide and changelog—not the current documentation—to confirm the WebGL2 fallback option name and backend-selection behavior. At runtime, use the renderer's own boolean flags rather than inferring the backend from navigator.gpu.
Confirmed across the WebGPURenderer lifecycle: the WebGPU path requires await renderer.init() before the first render, while the WebGL fallback constructor is synchronous. When the fallback engages, the renderer behaves as a WebGL2 renderer, so standard render targets and post-processing passes are generally compatible.
Version-sensitive: in earlier releases (around r147/r148) the force-fallback option was named forceWebGL2, but the name and semantics may have changed in your pinned tag. The fallback path itself may also evolve as browser WebGPU support stabilizes. Treat historical migration notes as a lead, not as proof for your version.
console.log({
webgpu: renderer.isWebGPURenderer,
webgl: renderer.isWebGLRenderer,
webgl2: renderer.isWebGL2Renderer
});
If isWebGPURenderer is false and isWebGL2Renderer is true, the fallback is active.EffectComposer chain on both a WebGPU renderer and a forced-WebGL2 renderer. Capture the final render-target texture and compare with a perceptual hash or visual diff. Precision, driver, and texture-format differences mean pixel-identical results are not guaranteed.renderer.capabilities.isWebGPU or renderer.isWebGPURenderer and supply a WebGL-compatible alternative when the flag is absent.Which exact Three.js version is pinned? The option name, migration notes, and fallback guarantees are release-specific. Providing the tag (for example, r160 or r170) lets the verification steps be narrowed to that version's documented API surface.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.