Add WebGPU backend interop for WebXR integration - #9350
Closed
RenzoraEngine wants to merge 5 commits into
Closed
Conversation
Add Device::as_webgpu() and Device::create_texture_from_webgpu() as the WebGPU backend equivalents of as_hal()/create_texture_from_hal(). Add RequestAdapterOptions::xr_compatible to pass through the xrCompatible flag per the WebXR WebGPU Binding spec. Relates to #4067
|
After just a cursory glance, this PR does introduce breaking changes. For example the addition of a new field in |
Author
|
@TheButlah I have updated the description to include the disclaimer. |
Member
|
This PR doesn't appear to follow our guidelines of change ownership and LLM policy, see https://github.com/gfx-rs/wgpu/blob/trunk/CONTRIBUTING.md#change-ownership. We'd welcome a change of this nature, but as it stands, we cannot accept this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
the code in the PR is generated with AI assistance using Claude Opus 4.6 (1M context)
Relates to #4067
Add
Device::as_webgpu()andDevice::create_texture_from_webgpu()as the WebGPU backend equivalents ofas_hal()/create_texture_from_hal(). AddRequestAdapterOptions::xr_compatibleto pass through thexrCompatibleflag per the WebXR WebGPU Binding spec.There is currently no way to use wgpu for WebXR rendering on the WebGPU backend. The XR compositor provides
GPUTextureobjects that wgpu needs to render into, and requires the underlyingGPUDeviceto create anXRGPUBinding. These three additions solve that.No internal types are exposed. Both methods use
JsValueat the public API boundary. 62 lines across 3 files, no breaking changes, no new dependencies.Working demo: renzora/wgpu-webxr-webgpu — renders a scene in stereo VR directly into XR projection layer textures. Tested on Chrome + Meta Quest via Horizon Link.
Tested manually with a working WebXR demo on Chrome with Meta Quest headset via Horizon Link. WebXR cannot be tested in CI as it requires VR hardware and browser flags (
chrome://flags/#webxr-incubations).Single commit, ready to rebase.