Turns out 33ms aren't "more than enough", during shader compilation
the timeout was often reached. Increasing it to 100ms seems to solve
the issue, and it's still short enough to avoid blocking the application for
too long in case something goes wrong.
Since the Linux version seems much more unstable than the Windows one,
having more information where the crash occured will help with figuring
out where the problems are.
This commit adds a simple crash handler that dumps out the stacktrace,
it's only supported on Linux.
This changes `vulkan_check` and other macros to directly take the call
to be executed. It will execute it and check the result, if it's not
successful, it will log an error with the function name.
It also returns the result code, allowing further processing.
The current implementation works insofar as that there is no deadlock,
but unfortunately the `entries` data can become corrupted enough for
the program to crash in the C++ stdlib.
For the new solution we use a shared_timed_mutex, allowing shared read
access to `entries`, and only acquire a unique lock for writing. Since
this can run into a deadlock if an error happens during rendering of
the backlog itself, we only wait 33ms to acquire it (1 frame @ 30 fps).
If we can't get it by that time, we still write to debug output, but not
into `entries`.
The shared_timed_mutex also allows us to wait for a read lock at the
end of the program, so we now wait for 1s instead of giving up immediately.
This commit also fixes a missing synchronization when accessing `history`
that was accidentially removed.
* When rendering the backlog, a GPU call might fail, causing
wilog_assert to write to the backlog. This would then try
to acquire the `entriesLock` (formerly `logLock`) but deadlock since
the thread already holds it. Fix it by replacing SpinLock with
std::recursive_lock.
Reduce the time for how long the lock is held to only apply
to when `entries` is accessed.
Ensure we will not hang on destruction of LogWriter, even if
the program aborts while another thread holds the entriesLock.
* wi_assert: Add parenthesis around if condition to ensure it works
correctly in edge cases, like `i >= 0`
* add deprecation attribute to `input`, `acceptInput`, `deleteFromInput`
so people who still reference them can remove the now pointless calls.
IMGUI leaves the scissor in a random state. This messes up the color normalization in HDR10, where the scissor needs to include the whole viewport. Restore the scissor after IMGUI is done drawing stuff.