Skip to content
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

Handle changes in XRWebGLLayer framebuffer size #9853

Merged
merged 1 commit into from
Jan 27, 2021

Conversation

kainino0x
Copy link

@kainino0x kainino0x commented Jan 27, 2021

XRWebGLLayer's framebuffer size (and framebuffer object) are allowed to
change between frames. WebXRSessionManager's IRenderTargetProvider would
create a RenderTargetTexture just once, so it would miss changes coming
from WebXR.

Obviously I have no idea if this is the right fix, but it works :)
Guidance would be appreciated.

I found this bug while working on a personal project:
https://github.com/kainino0x/holoplay-webxr
It is possible to verify this fix by loading the Babylon playground with this browser extension installed, entering XR, then changing the "number of views to render".

XRWebGLLayer's framebuffer size (and framebuffer object) are allowed to
change between frames. WebXRSessionManager's IRenderTargetProvider would
create a RenderTargetTexture just once, so it would miss changes coming
from WebXR.
Copy link
Member

@RaananW RaananW left a comment

Choose a reason for hiding this comment

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

LGTM!

Thanks for submitting the fix.

Wanted to ask about the extension you mentioned - I know the WebXR emulator and have been using it for some time now, but I don't remember seeing a way to change the number of views there.

@RaananW RaananW merged commit fc26753 into BabylonJS:master Jan 27, 2021
@kainino0x kainino0x deleted the xr-framebuffer-resize branch January 27, 2021 21:51
@kainino0x
Copy link
Author

kainino0x commented Jan 27, 2021

Wanted to ask about the extension you mentioned - I know the WebXR emulator and have been using it for some time now, but I don't remember seeing a way to change the number of views there.

Indeed the WebXR emulator doesn't have a way to change the number of views (beyond 1-2) or the framebuffer size. That control is specific to my project which outputs to a Looking Glass display, which can display an arbitrary number of different angles in a 30 degree "cone" around the display.

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.

2 participants