I hope someone will make a tutorial for using SDL with Vulkan.
> You should not be trying to use multithreaded optimization. Play with fire and you will get burned.
That's some poor encouragement there. They should be teaching how to do multithreading properly instead, or referring to such resources. May be using languages like Rust where multithreading is more sane will encourage using it more.
As I discovered to my misfortune recently, SDL2 is a nightmare of undefined behaviour when you start involving multiple threads, even if you're doing things in what naively would appear to be the correct way with locks and the like. Depending on your OS and GL backend, a bunch of stuff is thread local and will bomb out or just fail to do anything. In the end I ended up having to do everything SDL related, not just rendering, but including things like polling the keyboard and mouse, inside one thread, with mailboxes back to everywhere else. The documentation was pretty weak on explaining this, too.
A nitpick I had with SDL2 is the inability to render while the window is being resized. There is a rather awkward hack around this on Stack Overflow[1], which involves a callback function that has to call right into your custom rendering routine and "may run in a different thread!"[2].
I find this hard to believe. I've implemented multi-threaded rendering engines with OpenGL without too any major issues. As long as you aren't adding multiple threads to the main render loop, you shouldn't have these issues. Could you elaborate?
This is with SDL overtop of OpenGL. I never had problems on Linux as long as I kept the rendering in its own thread, but on OSX I had more serious problems with SDL_PollEvent simply failing to do the right thing if not called from the main thread, if I recall.
> You should not be trying to use multithreaded optimization. Play with fire and you will get burned.
That's some poor encouragement there. They should be teaching how to do multithreading properly instead, or referring to such resources. May be using languages like Rust where multithreading is more sane will encourage using it more.