Currently:
- load/update/run/etc. take place on the boot.lua coroutine.
- draw happens "asynchronously" on the main thread.
When C needs to throw an error, it doesn't know which thread to
throw the error on. If it throws it on the wrong thread, you get
a crash instead of an error screen.
One way to fix this is to change the error context based on the
thread that's currently running, so that errors in C are thrown
on the correct thread. This is the approach that's taken here.
A potentially better approach would be to run all the code on the
same thread, but I ran into issues when I tried to do this.
It may also be possible to (ab)use the Lua panic handler to catch
errors on one of the threads and somehow forward them to the other.
- lovr.graphics.tock returns the latest value of the timer, or 0.
- Timers are not in the stats table anymore.
This is to prepare for an upcoming internal change that affects timers.
This means Lua print() statements can be uniquely filtered out vs anything else (because internal Lovr logging uses loglevel DEBUG and lovr errors use loglevel WARN).
The "mask" example was failing on Oculus Mobile on the line of glsl:
if (lovrViewID == 1) {
because lovrViewID was unsigned and 1 was signed. One way to fix this would be to replace 1 with 1u as that is unsigned, but this would be the wrong fix because lovrViewID is in fact signed on all platforms other than Oculus Mobile. lovrViewID was depending on platform defined to either gl_ViewportIndex (signed), a signed uniform, or gl_ViewID_OVR (unsigned). The solution is to place an explicit cast in the multiview definition of lovrViewID so that it is signed on all platforms.