Closed danielchasehooper closed 7 months ago
Yeah, all sokol-gfx functions are supposed to be called from the same thread.
Guarding the function calls with a mutex wouldn't be very useful because that would just serialize access. You're probably better off writing a small record/replay shim which records the sokol-gfx calls you want to call from another thread into a memory buffer and replays them on the "sokol-gfx" thread.
we have code that renders the window in the main thread, and some code that runs in a background thread that renders thumbnails for various user-generated content into a cache.
We just ported the background thumbnail renderer to sokol and we hit this all the time now:
SOKOL_ASSERT(!_sg.gl.in_pass);
How are you supposed to write multithreaded code with sokol? It doesn't look like there is a way to have a threadlocal _sg or anything like that.