immersive-web / webxr-polyfill

Use the WebXR Device API today, providing fallbacks to native WebVR 1.1 and Cardboard
Apache License 2.0
378 stars 84 forks source link

Polyfilled XRWebGLLayer is not spec compliant #167

Closed AAwouters closed 5 months ago

AAwouters commented 1 year ago

The XRWebGLLayer spec mentions:

If session is an immersive session and context’s XR compatible boolean is false, throw an InvalidStateError and abort these steps.

In the current implementation, an InvalidStateError is thrown when the XR compatible boolean is set to false regardless of whether or not the session is an immersive session.

This makes a progressive enhancement experience as mentioned in the WebXR explainer not possible. When creating a context without the XR compatible boolean set, it should still be usable in an inline session.

AAwouters commented 1 year ago

It should be trivial to add a check but as the immersive flag is made private, it is somewhat less clear how this should be done.