Closed
Conversation
Member
Author
|
398cbb6 to
1acd002
Compare
4c6c5fd to
c96391f
Compare
added 22 commits
December 5, 2018 21:55
added 27 commits
December 6, 2018 22:59
This reverts commit 9948600.
Member
Author
|
The work in this branch is outdated. All of this functionality has moved forward with #760. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #382.
Fixes #130.
This PR implements multithreaded rendering in Exokit. The goal is to break out every
windowcontext into its own thread of execution, which runs in parallel with all others.Reasoning
Bugs: The first reason to do this is that the existing
windowandWorkerimplementations,vm-oneandwindow-worker, are custom hacks that reimplement the node tick loop. In addition to a history of platform-specific Worker bugs in implementingimportScripts, this interacts badly with some native node code in e.g. the TLS implementation, necessitating more out-of-thread routing hacks. All of these problems go away if we just use first-classworker_threads, with native node support that does not need to be tracked or debugged.Starvation: The way the current tick loop works, the
windowtick execution is the only place thatwindowcontexts can make forward progress inlibuv. That means that receiving request data is actually tied to the frame rate of the system -- this manifests as an inexplicable network slowness during loading. This is just howuv_runworks by default, and trying to schedule work on thewindowinstances is a problem that's 100% solved for us if we useworker_threads.Performance: The way the current tick loop works, we run each
windowserially in the main loop (no other way to do it, since allwindows are bound to the same thread). By removing this restriction, we can run allwindowraf ticks, and therefore rendering, in parallel. This especially helps in the case of reality tabs, where we potentially have many render layers in the same renderloop, all of which can logically run independently. Even if you don't care about reality tabs, this is nonetheless a performance improvement for the single-window case, since Exokit's main loop itself can now run in parallel with yourwindow.Future features: This paves the way for more futuristic features such as desynching misbehaving reality tab layers and correcting the blend with a userspace reprojection.
Implementation
This requires Node 11 for
worker_threadsstability. Most notably, this required a port oflibnode.aforarm64/Magic Leap.Additionally, this completely rewrites
vm-oneandwindow-workerin terms ofworker_threads.Finally, this PR requires some light synchronization where the Exokit renderloop needs to access/call into the rafs and events of the
windowinstances.Dependent PRs
Ingests avaer/window-worker@ed59b8d, avaer/vm-one#4.