← Back to context

Comment by dlivingston

9 days ago

To correct some misconceptions for readers:

Operating systems do not implement graphics APIs for GPUs. These are created by the GPU manufacturer themselves (AMD, Nvidia, etc.). This includes DirectX drivers, both user-space and kernel-space drivers.

Graphics APIs like DirectX and Vulkan are better thought of as (1) a formal specification for GPU behavior, combined with (2) a small runtime. The actual DX/VK drivers are thin shims around a GPU manufacturer's own driver API.

For AMD, the DirectX / Vulkan / OpenGL graphics drivers share a common layer called "PAL" which AMD has open sourced: <https://github.com/GPUOpen-Drivers/pal>

Apple really isn't that different here: they leave the graphics manufacturers to implement their own drivers. Unfortunately, Apple is the sole graphics manufacturer for their OS, and they've chosen to only implement Metal drivers for their GPUs (and a legacy OpenGL driver too).

It's not that big of a deal though, because Vulkan is supported on macOS through the MetalVK project, which wrap the Vulkan API around the Metal API. And projects like vkd3d wrap the DirectX 12 API around the Vulkan API, which is then wrapped around the Metal API. This is how you're able to run Windows games on Mac via the Game Porting Toolkit or CrossOver, btw.

Except that the APIs that are first party, have great experiences on the vendor SDK, whereas the OEM ones are an hit and miss in regards to IDE integration and graphical debugging, and have zero high level frameworks to improve the dev experience.

And you don't install Khronos stuff on console devkits.

Although as usual, NVidia tends to be the exception.

> and a legacy OpenGL driver too

FWIW, the OpenGL 'driver' on macOS and iOS is just an layer on top of Metal for many years now - e.g. same thing as ANGLE, DXVK or MoltenVk, just maintained directly by Apple.

The important difference both of D3D and Metal compared to Vulkan is that Vulkan lacks steering and vision (e.g. it's not a technical problem at all but a cultural/organizational).

Vulkan development looks like GPU vendors just come up with random Vulkan extensions which then from time to time are blessed by Khronos and elevated into the core API.

This "throwing shit at the wall and see what sticks" approach was already the biggest problem in GL (and my naive younger self thought that this obvious problem would be fixed with Vulkan - alas it turned out that this was the one thing that Khronos didn't change). This is really not how a 3D API should be designed.

> Operating systems do not implement graphics APIs for GPUs.

Mesa has entered the chat. Granted that with the amount of functionality that's stuffed into opaque firmware blobs these days you can make a reasonable argument that a nontrivial portion of any API is ultimately implemented by the firmware authors.