Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Why is VRDisplay marked Send and Sync? #54

Open
asajeffrey opened this issue Feb 8, 2019 · 2 comments
Open

Why is VRDisplay marked Send and Sync? #54

asajeffrey opened this issue Feb 8, 2019 · 2 comments

Comments

@asajeffrey
Copy link
Member

I understand why the VRService has to be Send and Sync, because it may be created on a different thread than its used (e.g. created on the main thread, used on the WebVR thread). I don't understand why a VRDisplay has to be. Why not query the VRService for its displays on one thread and then just leave it on that thread?

@MortimerGoro
Copy link
Contributor

MortimerGoro commented Feb 11, 2019

It's just because at the time this was implemented we couldn't have all the VRDisplay internal code on the same thread as the VRService. The root of the problem is that Servo used shared OpenGL contexts to share WebGL textures instead of using texture primitives that could be shared among different threads/processes without requiring a shared GL context (e.g. SurfaceTextures on Andriod, IOSurface on Mac, etc)

I'm looking forward to having the VRDisplays fixed to the thread used for the VRService initialization or query. We can remove the Send and Sync once we get the new Servo WebGL texture sharing implemented. We can make the WebXR thread the owner of the VRDisplays and simplify some parts of the code.

@asajeffrey
Copy link
Member Author

OK, so this is just a temporary state of affairs. Yay.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants