WebGPU XR view-instanced rendering#8732
Conversation
|
Amazing, I'll look into details next week, thanks so much! |
|
I think we should move the built-ins / clustered lighting changes to a separate PRs, as those are pretty much read to be merged. I'll do it next week, unless you do before then. Great changes overall. Any idea where we might get those other multi-view / multi-sampled arrays extensions? |
|
I can move those to their own separate PR. |
|
They will land as experimental features in the next 2 releases of Quest Browser. As soon as the proposals are merged, I will ship them by default. |
Add native WebGPU XR view-instanced rendering when projection-layer sub-images share a texture array. The WebGPU XR bridge now detects compatible layered sub-images, records the view-count state on the device, and drives FramePassMultiView through a single native pass when supported. Request and expose the WebGPU view-instancing and multisampled-array-textures capabilities, including maxViewInstanceCount handling. Backbuffer render-target setup now allocates array-layered color/depth attachments for native view-instanced XR, including multisampled texture-array attachments when needed. Teach WGSL processing and bind group layout generation about multisampled 2D array textures, native view-index handling, and view-uniform arrays. Materials and mesh shader caching now include the view-instancing shader variant so XR array uniforms select the correct per-view matrices and camera data.
00cb5b4 to
9fe3f8c
Compare
|
@mvaligursky done. I moved the optimization to a different patch. I'll keep this one as "draft" |
There was a problem hiding this comment.
Pull request overview
This PR adds a WebGPU-native XR view-instancing path so compatible XR stereo projection-layer texture arrays can render through a single native multi-view pass instead of replaying passes per eye.
Changes:
- Adds WebGPU XR capability/state detection for view instancing, multisampled array textures, and layered XR sub-image descriptors.
- Extends renderer/view uniform setup, shader processing, and material shader cache keys to support view-indexed uniform arrays.
- Updates WebGPU render-target/backbuffer setup to allocate and bind array-layered color/depth attachments for native XR passes.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/scene/renderer/renderer.js |
Adds view-instancing uniform formats, array upload, and bind-group switching. |
src/scene/renderer/frame-pass-multi-view.js |
Adds native single-pass XR path and preserves/restores XR render state. |
src/scene/renderer/forward-renderer.js |
Propagates view-instancing shader variants and draws native XR views once. |
src/scene/particle-system/particle-material.js |
Passes view-instancing shader processing option. |
src/scene/mesh-instance.js |
Includes view-instancing in shader instance cache/input params. |
src/scene/materials/standard-material.js |
Passes view-instancing shader processing option. |
src/scene/materials/shader-material.js |
Passes view-instancing shader processing option. |
src/scene/materials/material.js |
Documents the material shader parameter. |
src/scene/materials/lit-material.js |
Passes view-instancing shader processing option. |
src/platform/graphics/webgpu/webgpu-xr-bridge.js |
Detects compatible XR texture-array sub-images and exposes native view descriptor state. |
src/platform/graphics/webgpu/webgpu-shader-processor-wgsl.js |
Adds multisampled 2D-array texture handling and native view-index uniform array rewriting. |
src/platform/graphics/webgpu/webgpu-render-target.js |
Configures view-count render passes and array-layered attachments. |
src/platform/graphics/webgpu/webgpu-graphics-device.js |
Requests/exposes WebGPU features and reallocates backbuffer on view-count changes. |
src/platform/graphics/webgpu/webgpu-bind-group-format.js |
Propagates multisampled texture binding metadata. |
src/platform/graphics/shader-processor-options.js |
Tracks view-instancing in processing options and generated shader keys. |
src/platform/graphics/shader-definition-utils.js |
Emits multisampled array texture WGSL enable when supported. |
src/platform/graphics/bind-group-format.js |
Adds multisampled metadata to texture bind formats. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.