Closed DoubleStyx closed 3 weeks ago
Please look over the code carefully and test it a few times. It looks pretty good in vr with minimal choppiness. In desktop it kinda looks ugly; too much frame stutter.
ok, so async does absolutely nothing over sync mode in desktop. In desktop, your camera is driven by FrooxEngine moving your player head. It's only OpenXR that handles the perspective shift. Async desktop throughput: max(game,renderer) Async VR throughput: renderer Sync desktop/VR throughput: max(game,renderer) Unity default: game + renderer So async VR is the only true defense against hitching
another issue with async is that it throws away vr/desktop input on each renderer loop, so maybe we'd want to queue that somehow. Might be less of an issue for VR, but I'd need to test more. At least in sync mode your input is buffered and not wasted So I think async should be considered experimental
Lastly, the player movement (except for noclip) seems to jitter somewhat in this mode. My hypothesis is that it's related to Unity's charactercontroller not being synced with Resonite, though I haven't checked
Adds async support. Basically it changes the regular task queue to a batch queue, which has an IsCompleted flag and its own queue internally. Also added conditionals to the locking logic; if you switch to sync, it will break out of the occasional thread wakeup, so no deadlocks. If you switch to async, then it never enters the waiting pattern.