Skip to content

feat(xr): WebGPU multiview frame pass, XR bridge, and clustered lights#8723

Merged
mvaligursky merged 2 commits into
mainfrom
mv-webgpu-xr-multiview-clustered
May 13, 2026
Merged

feat(xr): WebGPU multiview frame pass, XR bridge, and clustered lights#8723
mvaligursky merged 2 commits into
mainfrom
mv-webgpu-xr-multiview-clustered

Conversation

@mvaligursky
Copy link
Copy Markdown
Contributor

Overview

Implements per-eye WebGPU XR rendering via a FramePassMultiView wrapper integrated with the frame graph and forward renderer, extends WebGPU XR bridge/device state for sub-images and cleanup, and ensures clustered lighting assignment runs for passes inside the multiview wrapper. Updates the xr-views test example and related WebGPU debug labeling.

Changes:

  • Add FramePassMultiView to run child frame passes once per XR view with device/backbuffer XR state.
  • Extend FrameGraph with multiview begin/end helpers and pass-merge rules that treat the wrapper as atomic.
  • Forward renderer: schedule stereo passes into multiview when appropriate; fix multiview detection to read XR from CameraComponent; guard unsupported depth/post paths.
  • WebGPU: XR bridge sub-image population, xrSubImages / xrColorTextureViewDescriptor / _clearXrState behavior; framebuffer color view creation and debug labels for XR vs context paths.
  • WorldClustersAllocator: unwrap FramePassMultiView when assigning clusters so inner render actions get lightClusters before forward passes run.
  • xr-views.example.mjs: expanded harness for multiview / composite testing.

Public API: None intended; new types and device fields are @ignore engine internals.

Examples: examples/src/examples/test/xr-views.example.mjs updated.

Add FramePassMultiView and frame graph integration for per-eye WebGPU XR
rendering; extend WebGPU XR bridge and device state; fix multiview
detection and cluster assignment for wrapped passes; refresh xr-views
example and debug labels.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a WebGPU-focused XR stereo rendering path by introducing a FramePassMultiView wrapper that replays captured frame passes once per XR view, integrating that wrapper into the frame graph and forward renderer scheduling. It also extends the WebGPU XR bridge/device state to expose per-view sub-image data (including view descriptors for layered textures) and updates clustered-light assignment to work correctly for passes captured inside the multiview wrapper.

Changes:

  • Added FramePassMultiView and FrameGraph.beginMultiView/endMultiView to capture and replay passes per XR view while keeping frame-graph pass merging safe.
  • Updated ForwardRenderer scheduling to wrap eligible stereo XR blocks, and updated the per-view draw loop to render only the active view when a wrapper is iterating.
  • Extended WebGPU XR state (xrSubImages, xrColorTextureViewDescriptor, _clearXrState) and updated the XR views example to visualize multiview output on WebGPU.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/scene/renderer/world-clusters-allocator.js Unwraps FramePassMultiView so clustered lighting gets assigned to child passes’ render actions.
src/scene/renderer/frame-pass-multi-view.js New wrapper pass that iterates XR sub-images per view and replays child passes.
src/scene/renderer/forward-renderer.js Wraps eligible camera/layer blocks in multiview scopes and restricts per-view rendering to the active eye when iterating.
src/scene/frame-graph.js Adds multiview capture scope plumbing and compiles wrapper children with existing optimizations.
src/platform/graphics/webgpu/webgpu-xr-bridge.js Populates per-view XR sub-image info (including optional view descriptors) and centralizes XR state clearing.
src/platform/graphics/webgpu/webgpu-render-target.js Creates framebuffer color views using the XR per-eye view descriptor when applicable and improves labels.
src/platform/graphics/webgpu/webgpu-graphics-device.js Adds XR multiview state fields and implements _clearXrState().
examples/src/examples/test/xr-views.example.mjs Expands the XR views harness for WebGPU array-layer rendering + composite visualization.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/scene/renderer/frame-pass-multi-view.js Outdated
Comment thread examples/src/examples/test/xr-views.example.mjs
@mvaligursky mvaligursky merged commit 4a29d18 into main May 13, 2026
8 checks passed
@mvaligursky mvaligursky deleted the mv-webgpu-xr-multiview-clustered branch May 13, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue area: xr XR related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants