As I know Vulkan is implemented by GPU vendors. Why can’t just the GPU vendor implement it on Apple platform just like in Windows.
Because MacOS works differently from Windows.
See, back when 3D graphics cards started to emerge, Microsoft made the decision to build an Installable Client Driver model for OpenGL. This would allow GPU makers to install OpenGL implementations into Windows, and allow users to talk to them indirectly through the ICD model. But that means that there has to be a channel directly from the application to the driver, with minimal communication with Windows itself.
And while Microsoft later decided to make their own 3D API, that channel between the driver and the application still exists. Because that channel exists, it is possible for GPU driver vendors and so forth to build alternative models for communication between the application and the driver. Like, for example, Vulkan.
Microsoft could in theory remove that channel, but doing so would break lots of stuff. And Microsoft doesn’t like breaking backwards compatibility. But note that they don’t allow the use of that channel in UWP applications sold on their store.
On MacOS, such a channel never existed. The MacOS OpenGL implementation was MacOS. That is, your OpenGL function calls go to MacOS; it was MacOS who talked to the driver. This is why MacOS OpenGL extensions were rigidly controlled by Apple themselves; implementations couldn’t directly expose function pointers into their own driver. Everything had to go through MacOS.
Remember: the OS owns the GPU and the driver. The user can only communicate with the graphics driver to the extent that the OS allows them to. Windows had a channel to allow direct communication; MacOS never did. Without such direct communication mechanisms, it is not possible to build a Vulkan implementation.
At least, not directly in graphics drivers. You have to build it on top of MacOS’s graphics API: Metal.
What a fast reply, thank you sir now I can sleep in peace.
Hi, Haiiro no Jiren
you can use Vulkan API on MacOS via MoltenVK.
vulkan sdk for mac os also uses MoltenVK.
Has anyone here been following the Khronos_AppleICDs project?
I recently came across some posts about a project called Khronos_AppleICDs on r/opengl and was wondering whether anyone here has looked into it.
From what I understand, it is trying to build a replacement OpenGL system framework and driver stack for macOS, rather than another per-application wrapper or translation layer.
The idea seems to be that existing macOS applications would continue using the normal CGL, NSOpenGL, and OpenGL framework interfaces, while the replacement stack routes things through Mesa, Gallium, and a Metal backend.
Some of the recent updates mention:
-
Mesa and Gallium integration
-
ICD-style dispatch
-
NIR-to-MSL shader translation
-
Native Metal mipmap generation
-
Textured rendering now working in the runtime tests
-
Ongoing work around pbuffer import and synchronization
Apparently, because it replaces components in protected system locations, installation would require SIP and authenticated root to be disabled.
It sounds like a fairly ambitious approach, especially compared with the usual wrapper-based solutions for modern OpenGL on macOS.
Has anyone here looked at the code or followed the project closely? I would be interested to hear what people with experience in Mesa, Metal, CGL, or OpenGL driver development think about the overall approach.