Closed pseregiet closed 1 month ago
Basically the opposite of the NOAPI stuff 😄
I don't know yet what to think of that idea TBH. Too many configuration options may create too many paths to test, it would also require to add new platform-specific functions to the public API, and complicate the internal code structure.
Things like SDL_INIT_AUDIO
, SDL_INIT_TIMER
is already taken care of by having separate sokol headers which you can simply decide to use or not.
But window system, input, 3D API setup and swapchain creation are quite closely related (that's why they all ended up in sokol_app.h in the first place instead of being implemented in independent libraries), and splitting those things up (even internally) may be too messy (since it would require to pass platform-specific data, like window handles/pointers into sokol_app.h).
FWIW, there are examples of how to setup D3D11 and Metal without sokol_app.h, it's not all that much code, the tricky part is usually the window system stuff (which in your case would be handled by SDL).
...and here's a simple example which uses GLFW in "NOAPI" mode together with a Metal (no depth buffer or MSAA support though): https://github.com/floooh/sokol-samples/blob/master/glfw/metal-glfw.m
PS: I do still roll the around the idea in my head to have a "SDL backend" in sokol_app.h, this would be a more robust solution on Linux, where SDL is essentially a system library.
SDL2 backed would be awesome, for sure. Thanks for the example code I think I'll figure it out from that.
Hi. This is an idea from SDL2. In SDL2 init function you can specify which subsystems you want to enable. For example you can enable only input if you don't care about video or audio. This would be useful for sokol_app. In my case I'd like to use sokol_app to setup the 3d context (I thought SDL2 does that already, but it only does for OpenGL and Vulkan, not Dx11/Metal). But have the window and events still be handled by SDL2.