Vulkan and MoltenVK

I’m curious about the current state of things with SDL.
If I make and a window and renderer with SDL does it now by default use Metal on Mac and iOS? Previously, if I wanted more 3D control, I could create a GL context with SDL, but now that Apple has deprecated OpenGL, Im curious about Vulkan. If I create a Vulkan instance with SDL, will it use Vulkan on viable machines and use MoltenVK on both Mac and iOS?

Yes! But it has to be able to find MoltenVK, so plan to ship it with your app. Naturally, this will only work on OS versions and hardware that support Apple’s Metal API (SDL will presumably report an error trying to use Vulkan on an unsupported configuration).

Oh, I forgot to answer this: SDL has a Metal backend for its 2D rendering API now, but I think it (currently) defaults to OpenGL still. That will likely change in 2.0.10 to default to Metal.

If you ask for an OpenGL window and call SDL_GL_CreateContext(), it’s still OpenGL. If it ever get completely removed from macOS or iOS, SDL will report failure in this case, but it won’t try to emulate OpenGL on Metal.

Although if something that implements OpenGL on Metal (Mesa or MoltenGL, etc) comes along, I presume we can do the same thing we do with MoltenVK now.

Awesome! Thanks for the info!

1 Like