Skip to content

XRManager: More fixes. #31198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2025
Merged

XRManager: More fixes. #31198

merged 1 commit into from
May 29, 2025

Conversation

cabanier
Copy link
Contributor

@cabanier cabanier commented May 29, 2025

Fixed #31193.

This fixes a couple of issues in the XR rendering:

  • non-multiview rendering will now use multisampling
  • webxr will render correctly in browsers that don't support layers (ie apple vision pro)
  • resolve js error at end of the render pass for browsers that don't support layers

Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 337.26
78.64
337.26
78.64
+0 B
+0 B
WebGPU 553.48
153.41
553.64
153.44
+163 B
+25 B
WebGPU Nodes 552.83
153.26
552.99
153.28
+163 B
+25 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 468.44
113.28
468.44
113.28
+0 B
+0 B
WebGPU 628.43
170.1
628.59
170.12
+163 B
+25 B
WebGPU Nodes 583.28
159.44
583.44
159.47
+163 B
+24 B

@Mugen87 Mugen87 merged commit 54e3591 into mrdoob:dev May 29, 2025
12 checks passed
@cabanier cabanier deleted the non-xr-layers-fix branch May 29, 2025 21:09
@Mugen87 Mugen87 changed the title fix issues with xr rendering XRManager: More fixes. May 29, 2025
@@ -1260,6 +1260,7 @@ class Renderer {
frameBufferTarget.scissorTest = this._scissorTest;
frameBufferTarget.multiview = outputRenderTarget !== null ? outputRenderTarget.multiview : false;
frameBufferTarget.resolveDepthBuffer = outputRenderTarget !== null ? outputRenderTarget.resolveDepthBuffer : true;
frameBufferTarget.autoAllocateDepthBuffer = outputRenderTarget !== null ? outputRenderTarget.autoAllocateDepthBuffer : false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should rename setOutputRenderTarget() to _setXROutputRenderTarget(). autoAllocateDepthBuffer only exists for XRRenderTarget and setOutputRenderTarget() is only relevant for XR. We should not allow to use this method as a part of the public API.

Copy link
Owner

Choose a reason for hiding this comment

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

Agreed 👍

Copy link
Collaborator

Choose a reason for hiding this comment

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

setOutputRenderTarget() is only relevant for XR..

I thought we could use it for something like this too. #27628

Copy link
Collaborator

Choose a reason for hiding this comment

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

In this case let's wait before make more decisions.

The bit that might need refactoring is how autoAllocateDepthBuffer is implemented here. It's not a property of RenderTarget but frameBufferTarget gets it assigned.

Ideally, we can mark the XR code path more clearly so it's easier to maintain it in the future. Having XRRenderTarget and dedicated XR methods (like _setXRLayerSize()) and properties helped to detect XR exclusive logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should rename setOutputRenderTarget() to _setXROutputRenderTarget().

do you want me to make that change? I agree that the xr code is a bit mixed. Some of it could also apply to regular rendering (ie auto-allocating depth and discarding it before tone mapping)

@Mugen87 Mugen87 added this to the r177 milestone May 29, 2025
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.

WebXR error in WebGPURenderer / WebGLBackend in non layer devices
4 participants