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

Document possible side effects of making a context xrCompatible #1014

Closed
toji opened this issue May 1, 2020 · 9 comments · Fixed by #1025
Closed

Document possible side effects of making a context xrCompatible #1014

toji opened this issue May 1, 2020 · 9 comments · Fixed by #1025
Assignees
Labels
help wanted This is a good issue for anyone to pick up and work on filing a PR for.
Milestone

Comments

@toji
Copy link
Member

toji commented May 1, 2020

I've seen that many frameworks doing WebXR integrations are blindly setting xrCompatible on every WebGL context they create, regardless of whether or not the apps content will ever use WebXR. This is something that may have long-reaching negative side effects on some devices, as it may cause some devices (like VR-capable laptops) to forcibly switch the entire system to render on the high-powered discreet GPU rather than the low-powered integrated one. Worse, the page's developer may not have any indication this will happen for their users because their development devices may not have multiple GPUs (as is the case with most mobile/standalone/desktop devices).

This should be documented in a visible place in the spec, probably as a non-normative note, to discourage over-use of xrCompatible in contexts where it's not needed. We should also do some dev rel with the major frameworks to try and work out a better usage pattern.

@toji toji added this to the Pre-REC milestone May 1, 2020
@toji toji added the help wanted This is a good issue for anyone to pick up and work on filing a PR for. label May 1, 2020
@toji
Copy link
Member Author

toji commented May 1, 2020

Outreach to Three.js: mrdoob/three.js#19275

@asajeffrey
Copy link

Ouch. Related to #603

@asajeffrey
Copy link

I'll repeat #603 (comment) again and say that the worst case I can imagine for this is if we're sending GL commands over a WiFi TCP stream to a thin-client headset. If every canvas is marked as xr-compatible, then this will result in a lot of texture data being sent of the wire.

@Maksims
Copy link

Maksims commented May 2, 2020

In PlayCanvas, it is set true by default as well.
There are two workflows, we can modify it:

  1. Editor (online), where UI can be used to toggle it on/off. If developer uses XR without pre-flagging application, in Debug mode, we can give them console info "please use XR flag..".
  2. engline-only, developer instantiate Application himself, and can provide appropriate flags.

Also, is this flag basically a "cheat": to guarantee use of discrete GPU for WebGL application? ;)

@toji
Copy link
Member Author

toji commented May 3, 2020

There are two workflows, we can modify it:

Those both sound good. And with the right console messaging it should be a very minor thing for developers to fix when they first encounter the issue.

is this flag basically a "cheat": to guarantee use of discrete GPU for WebGL application? ;)

No, if that was all it was we'd have simply reused powerPreference: 'high-performance'. It specifically selects the best GPU for performing low-latency XR. It's true that in a majority of the cases this will simply be the discreet GPU, but in the case of something like an SLI system where you have multiple GPUs of similar or equal capabilities xrCompatible should cause the context to reside on the device the HMD is physically connected to, whereas powerPreference would have no to switch GPUs in that scenario.

@RafaelCintron
Copy link

@Maksims , @toji is correct with regard to not re-using powerPreference.

In addition, some runtimes require that the application use a specific adapter on the system. No other adapter is allowed. The specified adapter may or many not be the same as the adapter enumerated by power preference, though it generally is.

If you miss out on specifying the xrCompatible attribute at context creation time, you can use WebGLRenderingContextBase.makeXRCompatible. Be warned that you may receive webglcontextlost/webglcontextRestored events if you're not on the runtime's preferred adapter while the makeXRCompatible promise is outstanding.

@a2sheppy
Copy link

Note to whoever deals with the spec changes here; although the word "discreet" is being used throughout the comments here, what's really intended is "discrete."

@toji
Copy link
Member Author

toji commented May 11, 2020

although the word "discreet" is being used...

🤣 They're very careful GPUs, Eric. They'd never tell another process about your draw calls.

@a2sheppy
Copy link

@toji That's good to know, because I'm very much in the "if it looks right, who cares what's under the hood" kind of guy when it comes to this stuff... :)

(I see this particular homophone all the time).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted This is a good issue for anyone to pick up and work on filing a PR for.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants