It is currently the end of the Big 26, and it is still impossible to render a basic shape using a modern GPU without several thousand lines of over abstraction.
TL;DR of Sebastian Aaltonen’s No Graphics API post, the current Graphics APIs (DirectX, OpenGL, Vulkan, Metal) were all originally designed for very old GPUs and as GPUs modernised, they have all converged to a similar, much simpler architecuture.
Current graphics APIs have maintained backwards compatability and have been slowly adding extensions to try to reduce the amount of driver overhead. The effort is good, but the implementation has some pretty extreme verbosity. Writing simple GPU code is virtually impossible with any modern graphics API. In order to simplify things, we need to write something over the existing APIs.
Unfortunately GPU manufacturers are able to abuse their monopolies to keep their instruction set architectures and drivers proprietary. This makes it impossible to write a compiler that targets different GPUs like we do for CPUs. In order to maximise profits, GPU manufacturers vendor lock GPU code so that is unportable as possible, even if a competitor has a superior product, the difficulty of porting code removes any benifit.
The best approach is to duct tape Vulkan extensions and modern Metal 4 features together into something that gets the job done well enough.
The goal of this post is outline a Rust implementation that allows for GPU shader code to be written like normal code, without incrediblely slow build times because of proc macro dependencies.
Unfortunately the cutoff for GPUs that have for resizable bar (direct gpu memory access) is NVIDIA 3000s series. So older GPUs have to go through an overcomplicated ring buffer fallback.
I would like to note that this library is basically the complete opposite of WebGPU. WebGPU supports no modern features and trys to cover the widest possible range of devices. It is genuinely an awful choice for any modern application. It is also not a graphics API and neither is this. These are both abstractions over existing APIs.
Shaders are written as Rust code and compiled to either Metal Shading Language or Standard Portable Intermediate Representation (SPIR-V). Despite SPIR-V having “Standard” and “Portable” in the name, it’s not supported on Apple silicon (thank you Apple).