You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems trying to load a font (FC_LoadFont(...)) on a thread that isn't the main rendering one will cause an exception.
If i try to use a thread: std::thread(&SWindow::doFrame, this, onFrame).detach(); i get an access violation exception in nvd3dumx.dll, which is caused by the FC_LoadFont function.
The strange thing is if i debug through my function step by step no exception is thrown, however the debugger doesn't jump to the next line of code, it just does nothing.
The text was updated successfully, but these errors were encountered:
Doing multithreaded graphics is currently perilous. D3D and OpenGL require some careful attention to the rendering context or else you'll get crashes like this. SDL does not implement that level of care needed for it to support multithreaded access to GPU resources. I don't think you can unbind an SDL_Renderer. Vulkan is much better designed in this regard, but I don't know if SDL's access pattern using that renderer supports multithreading anyway. https://www.khronos.org/opengl/wiki/OpenGL_and_multithreading
When using SDL_Renderer, it is best to keep all of your calls to the GPU on the main thread. Things like loading an SDL_Surface or game logic can be done in a separate thread and communicated back to the main thread. You can do multithreaded work if you control the rendering context, using D3D, OpenGL, or Vulkan directly, but then using SDL_FontCache might not be ideal.
It seems trying to load a font (FC_LoadFont(...)) on a thread that isn't the main rendering one will cause an exception.
If i try to use a thread:
std::thread(&SWindow::doFrame, this, onFrame).detach();
i get an access violation exception in nvd3dumx.dll, which is caused by the FC_LoadFont function.The strange thing is if i debug through my function step by step no exception is thrown, however the debugger doesn't jump to the next line of code, it just does nothing.
The text was updated successfully, but these errors were encountered: