Skip to content

Add renderer backend and reversedDepthBuffer properties, pass multiview option to WebGPURenderer#5847

Open
vincentfretin wants to merge 3 commits into
aframevr:masterfrom
vincentfretin:webgpu-renderer-options
Open

Add renderer backend and reversedDepthBuffer properties, pass multiview option to WebGPURenderer#5847
vincentfretin wants to merge 3 commits into
aframevr:masterfrom
vincentfretin:webgpu-renderer-options

Conversation

@vincentfretin

Copy link
Copy Markdown
Contributor

Fixes #5749

New renderer properties

  • multiviewStereo is now also passed as the multiview option used by WebGPURenderer (WebGLRenderer keeps reading multiviewStereo, each renderer ignores the other's key).
  • New reversedDepthBuffer property, passed as-is to both WebGLRenderer and WebGPURenderer.
  • New backend property (webgpu or webgl): backend: webgl maps to the forceWebGL option of WebGPURenderer. When unset, nothing is passed so the WebGPU build keeps its current behavior (try WebGPU, fall back to WebGL2). Ignored by WebGLRenderer.

Wait for async renderer init before starting the render loop

WebGPURenderer initializes its backend asynchronously via init(). Previously renderStarted was set and renderstart emitted while the backend was still initializing (three.js setAnimationLoop recovers by awaiting init internally, but anything reacting to renderstart calling e.g. renderer.render() or compileAsync() would throw .render() called before the backend is initialized). The render loop kickoff now awaits renderer.init() when it exists; WebGLRenderer has no init method and keeps the fully synchronous path.

Tests

The renderer attribute parsing is extracted from setupRenderer() into getRendererConfig() so it is unit-testable without creating a WebGL context (setupRenderer is stubbed on CI). Added tests for multiviewStereo/multiview, reversedDepthBuffer, backend and the async init behavior. There were no existing tests covering multiviewStereo.

Also adds a code note that setPoseTarget (A-Frame specific super-three patch to WebXRManager) will need an equivalent in the XRManager used by WebGPURenderer when WebXR support is added.

Verified at runtime with both builds (npm run dev and npm run start:webgpu) driving headless Chrome: options reach the renderer (backend.isWebGLBackend, reversedDepthBuffer, xr._useMultiviewIfPossible) and renderer.initialized is now true when renderstart fires. Actual multiview rendering in VR still needs a headset test with examples/performance/multiview-extension.

🤖 Generated with Claude Code

vincentfretin and others added 3 commits July 4, 2026 16:03
…ew to WebGPURenderer

- multiviewStereo is now also passed as the multiview option used by
  WebGPURenderer (fixes aframevr#5749)
- new reversedDepthBuffer property passed to both WebGLRenderer and
  WebGPURenderer
- new backend property (webgpu or webgl) mapped to the forceWebGL option
  of WebGPURenderer; ignored by WebGLRenderer

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…derer config tests

WebGPURenderer initializes its backend asynchronously via init().
Previously renderStarted was set and renderstart emitted while the
backend was still initializing (three.js setAnimationLoop recovers by
awaiting init internally, but anything reacting to renderstart could
call renderer methods that throw before initialization). The render
loop kickoff now awaits renderer.init() when it exists; WebGLRenderer
has no init method and keeps the synchronous path.

Extract getRendererConfig() from setupRenderer() so the renderer
attribute parsing is unit-testable without creating a WebGL context,
and add tests for multiviewStereo/multiview, reversedDepthBuffer,
backend and the async init behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
setPoseTarget is an A-Frame specific patch in super-three to the
WebXRManager used by WebGLRenderer. An equivalent will need to be
implemented in super-three for the XRManager used by WebGPURenderer
when WebXR support for WebGPURenderer is added.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for multiview with WebGPURenderer

1 participant