<blockquote>
<p>Wouldn't it be better if each GPU vendor provided their own graphics API?</p>
</blockquote>
<p>... no.</p>
<p>First, the GPU doesn't belong to you. It belongs to the platform, the OS. In order for different programs to effectively share hardware resources, those programs have to talk to some intermediary that exists to ensure that no programs are completely starved of resources. Furthermore, there needs to be code to ensure that pathological use of the hardware resources resources can be dealt with.</p>
<p>We know what platforms that don't have these kinds of things look like. One program that does something wrong can force a reboot of the system. The only way to prevent this is for someone to stand between programs and the hardware to make sure everybody plays by the rules.</p>
<p>So regardless, there is going to be some platform-specific aspect of any of this. The platform is going to have to approve at least that there is a direct connection between a program and the driver.</p>
<p>Second, developers benefit from having cross-hardware APIs, even platform-specific ones.</p>
<p>Here's the thing. While Metal, D3D12, and Vulkan are different APIs, they're not all <em>that</em> different, structurally speaking. They all have command buffers, some object that represents the shader pipeline, similar ways of attaching resources, similar mechanisms for allocating memory and using it with objects, etc.</p>
<p>By contrast, hardware-specific APIs will expose their particular hardware in substantially different ways. They will also expose specific details of their hardware that other APIs don't, which will make building hardware-neutral graphics programs incredibly difficult.</p>
<p>To take an example, consider image layouts. This is a concept that Vulkan introduced almost entirely as an affordance to AMD's graphics hardware. Their hardware has a lot of layouts that restrict the use of images.</p>
<p>Their OpenGL/D3D11 drivers would do the behind-the-scenes work to transition layouts as you changed how you used images. But the nature of a command-buffer API makes doing that highly impractical. Therefore, any command-buffer API built to handle AMD hardware must expose the basic concept of layouts to the user.</p>
<p>But NVIDIA hardware has no such concept. Well, it does have similar concepts, but the GPU <em>itself</em> handles transitions automatically in most cases.</p>
<p>So an AMD API would require you to use image layouts, and the NVIDIA version wouldn't. Any platform-neutral engine would have to figure out how to square this circle.</p>
<p>Consider Mantle. It had no concept of UBOs (just read-only SSBOs) or a vertex fetching stage. This is because AMD's hardware of the day had no concept of those things either. But other hardware of the day <em>did</em> have those things. So that's another thing you would have to deal with.</p>
<p>And that doesn't even <em>begin</em> to get into some of the more fundamental differences between a standard rendering GPU and a tile-based GPU.</p>
<p>Eventually, developers would just build some kind of cross-hardware abstraction API. You know, like Vulkan.</p>
<blockquote>
<p>Additionally, if you are writing a high-end rendering engine and you want to get the most out of your GPU, you'll need to do architecture-specific optimizations to shaders, which means having multiple variations of each shader, FOR EACH graphics API.</p>
</blockquote>
<p>But you're going to have to do that work <em>regardless</em> of the API you're using. Optimizations based on architecture are based on the GPU architecture, not the graphics API.</p>
<p>Windows boxes don't use the same GPUs as consoles. They may be similar to certain specific PC GPUs, but they're not the same. You're going to have to use specific optimizations for those specific GPUs anyway.</p>
<p>Not to mention, there are so many PC GPUs anyway that if you're doing significant hardware-specific optimizations to your shader logic, you won't notice 2 more versions. And since you're doing development on consoles too, you're already going to have to build some mechanism to compile your shaders for different targets.</p>
<p>This would be true if you were coding to the GPU; you'd just have <em>way more targets</em>, since each GPU core has changes to its internal machine code relative to previous generations of GPUs.</p>
<blockquote>
<p>For example, look at how long it took for raytracing to land in Vulkan. The first raytracing cards came out near the end of 2018 and while raytracing was supported in Vulkan soon after, it was only through an NVIDIA-exclusive extension. The official, cross-vendor extension didn't come until 2020.</p>
</blockquote>
<p>What's your point?</p>
<p>If you were in 2019 and wanted to implement raytracing in a program, you were going to be limited to NVIDIA hardware anyway because... no <em>other GPUs</em> supported it. It took quite a long time for other GPUs to provide the feature. So relying on an NVIDIA extension is just normal.</p>
<p>Furthermore, when that feature did land in Vulkan, it did so in a way that non-NVIDIA GPUs could also implement. And it did so at a time when non-NVIDIA GPUs actually existed that could use it.</p>

CC BY-SA 4.0
2022-08-30T14:20:22.537Z
There are niche use cases where one does want a single program to monopolize an entire GPU or most of one. Several server and workstation workloads come to mind. It used to be *normal* for 3D games in fullscreen mode to have exclusive use of the GPU.
Criticize SE actions means ban
CC BY-SA 4.0
2022-09-01T06:44:00.897Z
@user253751 you can still do this offcourse you just need to modify your os appropriately. There are devices like this in military, aviation and other high value industries where the end user is ready to spend 10-100k on this alone.
joojaa
CC BY-SA 4.0
2022-08-29T14:21:34.503Z
2022-08-29T14:21:34.503Z
Nicol Bolas
<p>In the early years of the PC, it was common for every game (and other piece of software that needed them) to ship with its own set of sound and graphics drivers. This had a number of drawbacks:</p>
<ul>
<li>Every game developer had to write and maintain a large set of drivers, even though most games needed exactly the same facilities.</li>
<li>New hardware would have to list in its user manual which drivers from old software it was most likely to work with.</li>
<li>Smaller hardware vendors were forced to reverse-engineer their rivals interfaces from documentation, to make these existing drivers work.</li>
<li>The operating system could not take any control of these drivers to guarantee the security and stability of the system. MS-DOS essentially gave full control of the hardware to the game, and hoped for the best.</li>
</ul>
<p>This led to the development of what Windows 95 called &quot;virtual device drivers&quot; - rather than a driver interfacing each game to each piece of hardware, a single driver interfaces the OS to the hardware, and the game ships with a single adapter for the OS. In theory, this solves all the above problems:</p>
<ul>
<li>The game developer only needs to write and maintain a single driver</li>
<li>New hardware can ship with a driver that installs into the OS, and immediately be available for all games</li>
<li>The OS interface is designed and documented for new drivers to be written implementing it</li>
<li>The OS can limit the access of games to keep the system secure and stable, and allow multiple pieces of software to share the hardware effectively</li>
</ul>
<p>Abstraction layers like DirectX, OpenGL, etc, work on the same principle: they act as an intermediary between the hardware-specific driver and the game-specific code.</p>
<p>Note that is doesn't really matter whether Nvidia writes a GeForce driver for DirectX, or Microsoft writes a DirectX driver for GeForce; games written for DirectX can use it either way.</p>
<p>As you've pointed out, it's not <em>quite</em> as simple as that:</p>
<ul>
<li>Games may wish to target more than one OS (or abstraction layer), so still need multiple drivers.</li>
<li>Games may wish to use cutting edge or unusual features of a particular piece of hardware, which the abstraction layer doesn't support.</li>
</ul>
<p>These two problems point in exactly opposite directions: the first suggests that there should be &quot;one abstraction to rule them all&quot;; the second suggests that abstractions should be fragmented into a huge range of device-specific functionality.</p>
<p>Highly vendor-specific APIs might appeal to console developers with exclusive agreements to develop for a particular hardware and software platform; highly portable APIs will be more useful to indie developers who want to make their game available on multiple platforms as cheaply as possible.</p>
<p>The result is that people will keep coming up with new abstractions, and extensions to those abstractions, to suit different situations. But ultimately, <em>somebody</em> has to write the code that makes the different combinations of game+OS+hardware possible.</p>

CC BY-SA 4.0
2022-08-30T20:51:31.577Z
This was not just the case with games (who tended to use relatively "low spec" modes anyway, often compatible in hardware at least across VGA-like cards) but even more with DOS based productivity applications (CAD programs and bitmap editors usually required you to manually choose the graphics hardware installed) that actually needed the often hardware-specific higher resolution/color depth modes ...
rackandboneman
CC BY-SA 4.0
2022-08-30T21:35:39.450Z
@rackandboneman Yes, I concentrated on games simply because the question did. However, the situation with *sound* drivers in games was very noticeable in the 1990s, with settings menus listing dozens of specific cards, along with options like "Ultrasound-compatible" and "SoundBlaster-compatible" which you would select and hope if you had a budget system with no-name components.
IMSoP
CC BY-SA 4.0
2022-08-30T12:31:36.223Z
2022-08-30T21:48:44.843Z
2022-08-30T21:48:44.843Z
IMSoP
<p><strong>Featureful Versus Widely Available</strong><br>
You're talking about the economics proposition of high functionality for limited subsets versus having a program (game, image processing, video processing) be widely available, independent of hardware.</p>
<p>This can work but only if the features are compelling. This was the case very early on when there were a large number of graphics card providers and even a modest number of computer platform providers. Amiga with Video Toaster was one. So was Silicon Graphics with their advanced workstations.</p>
<p>The problem is that, as technology advances, the common feature set accumulates enough weight to typically outweigh any comparatively small advantages offered by a specific competitor. Their only option is to provide a common driver with extra features that expose their specific advances to be taken advantage of. That allows program developers who want to the option to take advantage of those. The previous answer talks about ray tracing in NVIDIA hardware as a specific example.</p>
<p>As a developer, I'm rarely going to choose a novel software package that requires significant work beyond a standard approach for several reasons. They all boil down to economics. I will have a hard time justifying paying the premium for the license and the extra work to my management. On top of that, the single vendor is likely to have serious bugs in their implementation that we have to cope with over the long haul. The benefits have to be very, very compelling to take on the risk and extra cost.</p>
<p>The economy of scale pretty much demands that maturing technologies evolve towards a common API so that developers can easily switch between products. It's so well pronounced a phenomenon that it typically starts happening in less than ten years. Expect quantum computing to be the same way.</p>

CC BY-SA 4.0
2022-08-30T12:37:49.840Z
2022-08-30T12:37:49.840Z
C Teegarden
<p>I think the best example of a hardware-specific graphics API was <a href="https://en.wikipedia.org/wiki/Glide_(API)" rel="nofollow noreferrer">Glide</a>, by 3dfx.  It was fairly common in the late 1990's.  If you owned one of their Voodoo Graphics cards, it was consistently the most performant way to play a game.</p>
<p>There were a couple of issues with this:</p>
<ul>
<li>It caused vendor lock-in (the best performance required specific hardware), which was good for 3dfx but not so much for the consumer.</li>
<li>It required more development effort from the game developers, as the rendering pipeline would have to target yet another API (and DirectX, OpenGL, and Software renderers were common options at the time, so this would add yet another code path and set of testing)</li>
</ul>
<p>Glide faded away when 3dfx did, as a result of questionable business choices by 3dfx coupled with Nvidia releasing superior hardware in their TNT2 and GeForce GPUs.</p>

CC BY-SA 4.0
2022-08-31T14:11:07.277Z
Another good example was RRedline/Speedy3D that allowed use of Vérité 3D accelerators with popular games such as Quake. https://fabiensanglard.net/vquake/
Bert
CC BY-SA 4.0
2022-09-05T09:30:33.150Z
FWIW, Glide could have been emulated on other hardware (the company I work for considered it) but 3dfx were very protective and legal battles are best avoided - even if the only thing that was in common was the interface.
Simon F
CC BY-SA 4.0
2022-08-30T21:58:54.583Z
2022-08-30T21:58:54.583Z
Neil F
<p>A good deal of software is only available for a single platform (e.g., Android, iOS, Windows or Mac). The current situation means that authors of single-platform software only need to program for a single graphics API.</p>
<p>If you're producing software for multiple platforms, you're already having to deal with differences between them. Adding multiple graphics APIs makes that situation worse, but not radically so.</p>

CC BY-SA 4.0
2022-08-31T22:23:58.667Z
2022-08-31T22:23:58.667Z
John Dallman
<p>I think a summary of other answers is: you would end up with current situation. On top of vendor-specific API you would implement some abstraction layer, which in the long run, with typical forces, would end up similar to current &quot;general&quot; APIs.</p>
<p>Anyway, the world is complicated.</p>
<p>I think current (rendering/compute) GPU architecture is close to Vulkan/Direct3D12 APIs, so perhaps internal APIs are not that different (I'm guessing). Also, much of what is hardware-specific is in extensions. And there are lots of them.</p>
<p>But there are vendor-specific APIs: video encoding APIs. Current GPUs have video encoding and decoding chips. Each vendor has their own encoding API. For example, NVIDIA's <a href="https://developer.nvidia.com/nvidia-video-codec-sdk" rel="nofollow noreferrer">NVENC</a>, AMD's <a href="https://gpuopen.com/advanced-media-framework/" rel="nofollow noreferrer">AMF</a>, Intel's Quick Sync Video, and probably mobile GPUs too. And there are platform-specific video encoding APIs too! Such as VAAPI <del>and VDPAU</del> on linux, and recently Direct3D 12 Video.</p>
<p>There is some information on low level access to GPU hardware. See for example <a href="https://computergraphics.stackexchange.com/questions/7809/what-does-gpu-assembly-look-like">this question</a>. AMD has <a href="https://developer.amd.com/resources/developer-guides-manuals/" rel="nofollow noreferrer">published details on their GPUs</a>; <a href="https://rocmdocs.amd.com/en/latest/Programming_Guides/gcn-assembler.html" rel="nofollow noreferrer">more info</a>. NVIDIA has their (compute) <a href="https://developer.nvidia.com/cuda-zone" rel="nofollow noreferrer">CUDA API</a>.</p>

CC BY-SA 4.0
2022-09-01T13:56:43.697Z
VAAPI and VDPAU are *decoding* (and scaling/display, including for software decoding) APIs, not encoding.  (Or not *just* encoding).  I think you meant to write "decoding" in that sentence.
Peter Cordes
CC BY-SA 4.0
2022-09-02T13:38:11.147Z
@PeterCordes  I meant encoding. It's just that I'm ignorant of VAAPI and VDPAU. I just know they exist and very roughly what they are for. It seems that VAAPI supports encoding, though. But VDPAU is decode (+processing) only. Corrected answer. Thanks for the heads-up.
Pablo H
CC BY-SA 4.0
2022-08-30T18:19:52.930Z
2022-09-02T13:38:03.560Z
2022-09-02T13:38:03.560Z
Pablo H
<p>Right now, if you want to use a GPU, you have to do it through graphics APIs like DirectX or Vulkan. These APIs are meant to be hardware-independent, but more often than not, they are tied to a specific platform (like DirectX for Windows, or Metal for iOS and macOS). The only modern graphics API which was designed to be cross-platform is Vulkan and even it is not supported by every platform. Both iOS and macOS don't support it (you have to use MoltenVK, but that's an API wrapper, not a driver implementation) and I'm assuming that neither PlayStation nor Xbox have support for it.</p>
<p>It seems like we have solved the problem of hardware independence, but we've imposed the (artificial) problem of platform dependence. The hardware is doing the same thing no matter if it's in a Windows system or an Apple system. Wouldn't it be better if each GPU vendor provided their own graphics API?</p>
<p>So, <strong>my question is</strong>: Why don't we have hardware-specific graphics APIs instead of platform-specific ones?</p>
<p>Here's my reasoning for it...</p>
<p><strong>More work for engine programmers</strong></p>
<p>Let's say you are a game company and you want to make a game using your own game engine. And let's say you want to ship your game on PC and consoles. This means you want to support Windows, Xbox, and PlayStation. macOS and Linux aren't really a concern because not that many people game on them. The graphics APIs for Windows are DirectX and Vulkan (not counting OpenGL), for Xbox its DirectX (DX12 Ultimate <em>technically</em> is the same for Windows and Xbox), and for PlayStation, it's GNM (Sony's own proprietary graphics API). This means that if you wanted to write a rendering engine with as little effort as possible, you would, at the very least, have to support DirectX 12 and GNM.</p>
<p>This doesn't seem that bad until you consider the fact that this is only the bare minimum. Many game engines also support Vulkan on Windows, not to mention that if you want to port your game to Mac or the Nintendo Switch you'll have to support even more APIs.</p>
<p>Additionally, if you are writing a high-end rendering engine and you want to get the most out of your GPU, you'll need to do architecture-specific optimizations to shaders, which means having multiple variations of each shader, FOR EACH graphics API. You could write a shader translator so that you only need to write your shaders once, but then you get into other problems.</p>
<p><strong>More work for driver implementers</strong></p>
<p>On the other side, we have drivers. You have to support OpenGL, DirectX 11, DirectX 12, and Vulkan (all of these are just for Windows). If you provide hardware to Apple you also have to support Metal (although, Apple seem to be making their own hardware now so maybe they're not a concern anymore) and if you provide hardware for consoles, you also have to support their proprietary API. This becomes even worse when you consider the fact that drivers for mobile GPUs (e.g. for laptops and phones) and discrete GPUs are different.</p>
<p>I don't think hardware vendors write a completely different driver for each API+platform+GPU combination, that would be insane! I'm guessing that drivers have their own internal API, or something similar, and each graphics API implementation is just wrapping around that internal API. However, this still leads to a massive amount of software, which ultimately means more bugs and more money spent on more developers.</p>
<p><strong>The (possibly) ideal solution</strong></p>
<p>I think it makes much more sense for hardware vendors to provide their own APIs. These APIs are tailor-made for their own GPUs. If your new GPUs behave differently than the older ones, you can just change the API to better fit the new GPUs instead of giving programmers hacky workarounds for existing APIs. I also think that these APIs should let programmers write in GPU assembly. Of course, I don't think programmers will write in GPU assembly most of the time, however, it gives them more freedom to do architecture-specific optimizations.</p>
<p>One big problem with current graphics APIs is that they are hardware-independent. Why is that a problem? Because it means that everybody has to conform to the same interface. This isn't always bad. A well-designed API can be general enough that it suits everyone's needs, while also not being too restrictive. However, doing this means collaborating with multiple hardware manufacturers, which can take a lot of time. For example, look at how long it took for raytracing to land in Vulkan. The first raytracing cards came out near the end of 2018 and while raytracing was supported in Vulkan soon after, it was only through an NVIDIA-exclusive extension. The official, cross-vendor extension didn't come until 2020.</p>
<p>Granted, I don't think current graphics APIs should be removed entirely. I think that the responsibility of implementing them should fall in the hands of the people who design/provide them, like Microsoft, Apple, or the Khronos Group, and not in the hands of hardware vendors. Instead of having custom implementations for each API in the driver, APIs like DirectX will be implemented at the application level using the publicly-available hardware-specific APIs provided by GPU vendors. This way, programmers who don't care a lot about performance or cutting-edge features, will still be able to use the current APIs.</p>
<p><strong>The end (Finally!)</strong></p>
<p>This seems like something someone working on graphics APIs would have thought of and since it seems like this approach is much better than the current one, I can't think of a reason why it hasn't happened yet. I expect that there must be a pretty good reason why this isn't the way we do things other than just &quot;we've always done things this way so why change it now&quot;, I just can't think of it!</p>
<p>Edit: After reading the responses, I think I may have explained some things a bit poorly. In particular, I'm not suggesting that we remove all abstractions and have APIs that are extremely low level. They should still live in user-land and take advantage of things like sharing resources, scheduling, and TDR. What I'm suggesting is APIs similar to Vulkan or DirectX in terms of abstraction, but that are tied to specific hardware, not a specific platform.
Anyway, thank you for the responses!</p>

CC BY-SA 4.0
2022-08-29T13:49:39.793Z
I doubt developers will be very pleased having to study an API per GPU. APIs per platform and vendor are already enough of a pain. Cuda vs opencl is already bad enough.
lightxbulb
CC BY-SA 4.0
2022-08-29T18:55:28.910Z
Do you have the same argument for any other computer peripherals?  hard disks?  keyboards? speakers?  (I expect not.)
Wyck
CC BY-SA 4.0
2022-08-29T21:39:54.133Z
The 90's just phoned, they want their graphics programming methodologies back.
lfgtm
CC BY-SA 4.0
2022-08-29T23:27:53.963Z
GPU's have an ABI, you can write code that uses it directly, you could even write code that takes complete control of the computer like games used to. Insert USB drive, reboot and wow that power at your hands...but good luck writing and maintaining all that code. We stopped doing that years ago for good reason. If you want big beautiful worlds to play in, then these API's are the current best way to do it. And they are improving, hence the reason for multiple interfaces.
pmw1234
CC BY-SA 4.0
2022-08-30T02:58:36.837Z
@pmw1234 it's also 100% undocumented
Criticize SE actions means ban
CC BY-SA 4.0
2022-08-30T05:50:00.297Z
This question seems to repeat every 6-12 months in different forms. Usually its caused by a person wanting to do something simple but not wanting to learn the current api. I wouldnt want to be a client of software that did this.
joojaa
CC BY-SA 4.0
2022-08-30T12:38:38.330Z
This post reads as an end-user rant rather than something insightful from a developer.
MonkeyZeus
CC BY-SA 4.0
2022-08-31T13:09:50.617Z
"I can't think of a reason why it hasn't happened yet." It already happened, and we have the current level of abstraction to solve problems with this approach.
StuperUser
CC BY-SA 4.0
2022-09-01T06:35:56.010Z
If GPU vendor only provide a GPU-specific API, then many software vendors would emerge and implement the public API and make big money (anyone remember ELSA?). The reason why we have today's situation is precisely because the GPU want this big money themselves.
user3528438
<gpu><api>
Why can't we have hardware-specific graphics APIs?
J22o
# Why can't we have hardware-specific graphics APIs?

(Asked by: username_0 on 2022-08-29)

Right now, if you want to use a GPU, you have to do it through graphics APIs like DirectX or Vulkan. These APIs are meant to be hardware-independent, but more often than not, they are tied to a specific platform (like DirectX for Windows, or Metal for iOS and macOS). The only modern graphics API which was designed to be cross-platform is Vulkan and even it is not supported by every platform. Both iOS and macOS don't support it (you have to use MoltenVK, but that's an API wrapper, not a driver implementation) and I'm assuming that neither PlayStation nor Xbox have support for it.

It seems like we have solved the problem of hardware independence, but we've imposed the (artificial) problem of platform dependence. The hardware is doing the same thing no matter if it's in a Windows system or an Apple system. Wouldn't it be better if each GPU vendor provided their own graphics API?

So, **my question is**: Why don't we have hardware-specific graphics APIs instead of platform-specific ones?

Here's my reasoning for it...

**More work for engine programmers**

Let's say you are a game company and you want to make a game using your own game engine. And let's say you want to ship your game on PC and consoles. This means you want to support Windows, Xbox, and PlayStation. macOS and Linux aren't really a concern because not that many people game on them. The graphics APIs for Windows are DirectX and Vulkan (not counting OpenGL), for Xbox its DirectX (DX12 Ultimate *technically* is the same for Windows and Xbox), and for PlayStation, it's GNM (Sony's own proprietary graphics API). This means that if you wanted to write a rendering engine with as little effort as possible, you would, at the very least, have to support DirectX 12 and GNM.

This doesn't seem that bad until you consider the fact that this is only the bare minimum. Many game engines also support Vulkan on Windows, not to mention that if you want to port your game to Mac or the Nintendo Switch you'll have to support even more APIs.

Additionally, if you are writing a high-end rendering engine and you want to get the most out of your GPU, you'll need to do architecture-specific optimizations to shaders, which means having multiple variations of each shader, FOR EACH graphics API. You could write a shader translator so that you only need to write your shaders once, but then you get into other problems.

**More work for driver implementers**

On the other side, we have drivers. You have to support OpenGL, DirectX 11, DirectX 12, and Vulkan (all of these are just for Windows). If you provide hardware to Apple you also have to support Metal (although, Apple seem to be making their own hardware now so maybe they're not a concern anymore) and if you provide hardware for consoles, you also have to support their proprietary API. This becomes even worse when you consider the fact that drivers for mobile GPUs (e.g. for laptops and phones) and discrete GPUs are different.

I don't think hardware vendors write a completely different driver for each API+platform+GPU combination, that would be insane! I'm guessing that drivers have their own internal API, or something similar, and each graphics API implementation is just wrapping around that internal API. However, this still leads to a massive amount of software, which ultimately means more bugs and more money spent on more developers.

**The (possibly) ideal solution**

I think it makes much more sense for hardware vendors to provide their own APIs. These APIs are tailor-made for their own GPUs. If your new GPUs behave differently than the older ones, you can just change the API to better fit the new GPUs instead of giving programmers hacky workarounds for existing APIs. I also think that these APIs should let programmers write in GPU assembly. Of course, I don't think programmers will write in GPU assembly most of the time, however, it gives them more freedom to do architecture-specific optimizations.

One big problem with current graphics APIs is that they are hardware-independent. Why is that a problem? Because it means that everybody has to conform to the same interface. This isn't always bad. A well-designed API can be general enough that it suits everyone's needs, while also not being too restrictive. However, doing this means collaborating with multiple hardware manufacturers, which can take a lot of time. For example, look at how long it took for raytracing to land in Vulkan. The first raytracing cards came out near the end of 2018 and while raytracing was supported in Vulkan soon after, it was only through an NVIDIA-exclusive extension. The official, cross-vendor extension didn't come until 2020.

Granted, I don't think current graphics APIs should be removed entirely. I think that the responsibility of implementing them should fall in the hands of the people who design/provide them, like Microsoft, Apple, or the Khronos Group, and not in the hands of hardware vendors. Instead of having custom implementations for each API in the driver, APIs like DirectX will be implemented at the application level using the publicly-available hardware-specific APIs provided by GPU vendors. This way, programmers who don't care a lot about performance or cutting-edge features, will still be able to use the current APIs.

**The end (Finally!)**

This seems like something someone working on graphics APIs would have thought of and since it seems like this approach is much better than the current one, I can't think of a reason why it hasn't happened yet. I expect that there must be a pretty good reason why this isn't the way we do things other than just "we've always done things this way so why change it now", I just can't think of it!

Edit: After reading the responses, I think I may have explained some things a bit poorly. In particular, I'm not suggesting that we remove all abstractions and have APIs that are extremely low level. They should still live in user-land and take advantage of things like sharing resources, scheduling, and TDR. What I'm suggesting is APIs similar to Vulkan or DirectX in terms of abstraction, but that are tied to specific hardware, not a specific platform.
Anyway, thank you for the responses!

**Tags:** gpu, api

> **Comments:**
> **username_1**: I doubt developers will be very pleased having to study an API per GPU. APIs per platform and vendor are already enough of a pain. Cuda vs opencl is already bad enough.  
> **username_2**: Do you have the same argument for any other computer peripherals?  hard disks?  keyboards? speakers?  (I expect not.)  
> **username_3**: The 90's just phoned, they want their graphics programming methodologies back.  
> **username_4**: GPU's have an ABI, you can write code that uses it directly, you could even write code that takes complete control of the computer like games used to. Insert USB drive, reboot and wow that power at your hands...but good luck writing and maintaining all that code. We stopped doing that years ago for good reason. If you want big beautiful worlds to play in, then these API's are the current best way to do it. And they are improving, hence the reason for multiple interfaces.  
> **username_5**: @username_4 it's also 100% undocumented  
> **username_6**: This question seems to repeat every 6-12 months in different forms. Usually its caused by a person wanting to do something simple but not wanting to learn the current api. I wouldnt want to be a client of software that did this.  
> **username_7**: This post reads as an end-user rant rather than something insightful from a developer.  
> **username_8**: "I can't think of a reason why it hasn't happened yet." It already happened, and we have the current level of abstraction to solve problems with this approach.  
> **username_9**: If GPU vendor only provide a GPU-specific API, then many software vendors would emerge and implement the public API and make big money (anyone remember ELSA?). The reason why we have today's situation is precisely because the GPU want this big money themselves.  

---

## 6 answers

### Answer by username_10 on 2022-08-29. Score: 25

> Wouldn't it be better if each GPU vendor provided their own graphics API?

... no.

First, the GPU doesn't belong to you. It belongs to the platform, the OS. In order for different programs to effectively share hardware resources, those programs have to talk to some intermediary that exists to ensure that no programs are completely starved of resources. Furthermore, there needs to be code to ensure that pathological use of the hardware resources resources can be dealt with.

We know what platforms that don't have these kinds of things look like. One program that does something wrong can force a reboot of the system. The only way to prevent this is for someone to stand between programs and the hardware to make sure everybody plays by the rules.

So regardless, there is going to be some platform-specific aspect of any of this. The platform is going to have to approve at least that there is a direct connection between a program and the driver.

Second, developers benefit from having cross-hardware APIs, even platform-specific ones.

Here's the thing. While Metal, D3D12, and Vulkan are different APIs, they're not all *that* different, structurally speaking. They all have command buffers, some object that represents the shader pipeline, similar ways of attaching resources, similar mechanisms for allocating memory and using it with objects, etc.

By contrast, hardware-specific APIs will expose their particular hardware in substantially different ways. They will also expose specific details of their hardware that other APIs don't, which will make building hardware-neutral graphics programs incredibly difficult.

To take an example, consider image layouts. This is a concept that Vulkan introduced almost entirely as an affordance to AMD's graphics hardware. Their hardware has a lot of layouts that restrict the use of images.

Their OpenGL/D3D11 drivers would do the behind-the-scenes work to transition layouts as you changed how you used images. But the nature of a command-buffer API makes doing that highly impractical. Therefore, any command-buffer API built to handle AMD hardware must expose the basic concept of layouts to the user.

But NVIDIA hardware has no such concept. Well, it does have similar concepts, but the GPU *itself* handles transitions automatically in most cases.

So an AMD API would require you to use image layouts, and the NVIDIA version wouldn't. Any platform-neutral engine would have to figure out how to square this circle.

Consider Mantle. It had no concept of UBOs (just read-only SSBOs) or a vertex fetching stage. This is because AMD's hardware of the day had no concept of those things either. But other hardware of the day *did* have those things. So that's another thing you would have to deal with.

And that doesn't even *begin* to get into some of the more fundamental differences between a standard rendering GPU and a tile-based GPU.

Eventually, developers would just build some kind of cross-hardware abstraction API. You know, like Vulkan.

> Additionally, if you are writing a high-end rendering engine and you want to get the most out of your GPU, you'll need to do architecture-specific optimizations to shaders, which means having multiple variations of each shader, FOR EACH graphics API.

But you're going to have to do that work *regardless* of the API you're using. Optimizations based on architecture are based on the GPU architecture, not the graphics API.

Windows boxes don't use the same GPUs as consoles. They may be similar to certain specific PC GPUs, but they're not the same. You're going to have to use specific optimizations for those specific GPUs anyway.

Not to mention, there are so many PC GPUs anyway that if you're doing significant hardware-specific optimizations to your shader logic, you won't notice 2 more versions. And since you're doing development on consoles too, you're already going to have to build some mechanism to compile your shaders for different targets.

This would be true if you were coding to the GPU; you'd just have *way more targets*, since each GPU core has changes to its internal machine code relative to previous generations of GPUs.

> For example, look at how long it took for raytracing to land in Vulkan. The first raytracing cards came out near the end of 2018 and while raytracing was supported in Vulkan soon after, it was only through an NVIDIA-exclusive extension. The official, cross-vendor extension didn't come until 2020.

What's your point?

If you were in 2019 and wanted to implement raytracing in a program, you were going to be limited to NVIDIA hardware anyway because... no *other GPUs* supported it. It took quite a long time for other GPUs to provide the feature. So relying on an NVIDIA extension is just normal.

Furthermore, when that feature did land in Vulkan, it did so in a way that non-NVIDIA GPUs could also implement. And it did so at a time when non-NVIDIA GPUs actually existed that could use it.

> **Comments:**
> **username_5**: There are niche use cases where one does want a single program to monopolize an entire GPU or most of one. Several server and workstation workloads come to mind. It used to be *normal* for 3D games in fullscreen mode to have exclusive use of the GPU.  
> **username_6**: @user253751 you can still do this offcourse you just need to modify your os appropriately. There are devices like this in military, aviation and other high value industries where the end user is ready to spend 10-100k on this alone.  

---

### Answer by username_11 on 2022-08-30. Score: 14

In the early years of the PC, it was common for every game (and other piece of software that needed them) to ship with its own set of sound and graphics drivers. This had a number of drawbacks:

* Every game developer had to write and maintain a large set of drivers, even though most games needed exactly the same facilities.
* New hardware would have to list in its user manual which drivers from old software it was most likely to work with.
* Smaller hardware vendors were forced to reverse-engineer their rivals interfaces from documentation, to make these existing drivers work.
* The operating system could not take any control of these drivers to guarantee the security and stability of the system. MS-DOS essentially gave full control of the hardware to the game, and hoped for the best.

This led to the development of what Windows 95 called "virtual device drivers" - rather than a driver interfacing each game to each piece of hardware, a single driver interfaces the OS to the hardware, and the game ships with a single adapter for the OS. In theory, this solves all the above problems:

* The game developer only needs to write and maintain a single driver
* New hardware can ship with a driver that installs into the OS, and immediately be available for all games
* The OS interface is designed and documented for new drivers to be written implementing it
* The OS can limit the access of games to keep the system secure and stable, and allow multiple pieces of software to share the hardware effectively

Abstraction layers like DirectX, OpenGL, etc, work on the same principle: they act as an intermediary between the hardware-specific driver and the game-specific code.

Note that is doesn't really matter whether Nvidia writes a GeForce driver for DirectX, or Microsoft writes a DirectX driver for GeForce; games written for DirectX can use it either way.

As you've pointed out, it's not *quite* as simple as that:

* Games may wish to target more than one OS (or abstraction layer), so still need multiple drivers.
* Games may wish to use cutting edge or unusual features of a particular piece of hardware, which the abstraction layer doesn't support.

These two problems point in exactly opposite directions: the first suggests that there should be "one abstraction to rule them all"; the second suggests that abstractions should be fragmented into a huge range of device-specific functionality.

Highly vendor-specific APIs might appeal to console developers with exclusive agreements to develop for a particular hardware and software platform; highly portable APIs will be more useful to indie developers who want to make their game available on multiple platforms as cheaply as possible.

The result is that people will keep coming up with new abstractions, and extensions to those abstractions, to suit different situations. But ultimately, *somebody* has to write the code that makes the different combinations of game+OS+hardware possible.

> **Comments:**
> **username_12**: This was not just the case with games (who tended to use relatively "low spec" modes anyway, often compatible in hardware at least across VGA-like cards) but even more with DOS based productivity applications (CAD programs and bitmap editors usually required you to manually choose the graphics hardware installed) that actually needed the often hardware-specific higher resolution/color depth modes ...  
> **username_11**: @username_12 Yes, I concentrated on games simply because the question did. However, the situation with *sound* drivers in games was very noticeable in the 1990s, with settings menus listing dozens of specific cards, along with options like "Ultrasound-compatible" and "SoundBlaster-compatible" which you would select and hope if you had a budget system with no-name components.  

---

### Answer by username_13 on 2022-08-30. Score: 4

**Featureful Versus Widely Available**  
You're talking about the economics proposition of high functionality for limited subsets versus having a program (game, image processing, video processing) be widely available, independent of hardware.

This can work but only if the features are compelling. This was the case very early on when there were a large number of graphics card providers and even a modest number of computer platform providers. Amiga with Video Toaster was one. So was Silicon Graphics with their advanced workstations.

The problem is that, as technology advances, the common feature set accumulates enough weight to typically outweigh any comparatively small advantages offered by a specific competitor. Their only option is to provide a common driver with extra features that expose their specific advances to be taken advantage of. That allows program developers who want to the option to take advantage of those. The previous answer talks about ray tracing in NVIDIA hardware as a specific example.

As a developer, I'm rarely going to choose a novel software package that requires significant work beyond a standard approach for several reasons. They all boil down to economics. I will have a hard time justifying paying the premium for the license and the extra work to my management. On top of that, the single vendor is likely to have serious bugs in their implementation that we have to cope with over the long haul. The benefits have to be very, very compelling to take on the risk and extra cost.

The economy of scale pretty much demands that maturing technologies evolve towards a common API so that developers can easily switch between products. It's so well pronounced a phenomenon that it typically starts happening in less than ten years. Expect quantum computing to be the same way.


---

### Answer by username_14 on 2022-08-30. Score: 4

I think the best example of a hardware-specific graphics API was [Glide](https://en.wikipedia.org/wiki/Glide_(API)), by 3dfx. It was fairly common in the late 1990's. If you owned one of their Voodoo Graphics cards, it was consistently the most performant way to play a game.

There were a couple of issues with this:

* It caused vendor lock-in (the best performance required specific hardware), which was good for 3dfx but not so much for the consumer.
* It required more development effort from the game developers, as the rendering pipeline would have to target yet another API (and DirectX, OpenGL, and Software renderers were common options at the time, so this would add yet another code path and set of testing)

Glide faded away when 3dfx did, as a result of questionable business choices by 3dfx coupled with Nvidia releasing superior hardware in their TNT2 and GeForce GPUs.

> **Comments:**
> **username_15**: Another good example was RRedline/Speedy3D that allowed use of Vérité 3D accelerators with popular games such as Quake. https://fabiensanglard.net/vquake/  
> **username_16**: FWIW, Glide could have been emulated on other hardware (the company I work for considered it) but 3dfx were very protective and legal battles are best avoided - even if the only thing that was in common was the interface.  

---

### Answer by username_17 on 2022-08-31. Score: 2

A good deal of software is only available for a single platform (e.g., Android, iOS, Windows or Mac). The current situation means that authors of single-platform software only need to program for a single graphics API.

If you're producing software for multiple platforms, you're already having to deal with differences between them. Adding multiple graphics APIs makes that situation worse, but not radically so.


---

### Answer by username_18 on 2022-08-30. Score: 2

I think a summary of other answers is: you would end up with current situation. On top of vendor-specific API you would implement some abstraction layer, which in the long run, with typical forces, would end up similar to current "general" APIs.

Anyway, the world is complicated.

I think current (rendering/compute) GPU architecture is close to Vulkan/Direct3D12 APIs, so perhaps internal APIs are not that different (I'm guessing). Also, much of what is hardware-specific is in extensions. And there are lots of them.

But there are vendor-specific APIs: video encoding APIs. Current GPUs have video encoding and decoding chips. Each vendor has their own encoding API. For example, NVIDIA's [NVENC](https://developer.nvidia.com/nvidia-video-codec-sdk), AMD's [AMF](https://gpuopen.com/advanced-media-framework/), Intel's Quick Sync Video, and probably mobile GPUs too. And there are platform-specific video encoding APIs too! Such as VAAPI ~~and VDPAU~~ on linux, and recently Direct3D 12 Video.

There is some information on low level access to GPU hardware. See for example [this question](https://computergraphics.stackexchange.com/questions/7809/what-does-gpu-assembly-look-like). AMD has [published details on their GPUs](https://developer.amd.com/resources/developer-guides-manuals/); [more info](https://rocmdocs.amd.com/en/latest/Programming_Guides/gcn-assembler.html). NVIDIA has their (compute) [CUDA API](https://developer.nvidia.com/cuda-zone).

> **Comments:**
> **username_19**: VAAPI and VDPAU are *decoding* (and scaling/display, including for software decoding) APIs, not encoding.  (Or not *just* encoding).  I think you meant to write "decoding" in that sentence.  
> **username_18**: @username_19  I meant encoding. It's just that I'm ignorant of VAAPI and VDPAU. I just know they exist and very roughly what they are for. It seems that VAAPI supports encoding, though. But VDPAU is decode (+processing) only. Corrected answer. Thanks for the heads-up.  

---

