High and Low Level Graphical APIs: Differences and How They Work

The graphics APIs are not a piece of hardware, but a piece of software, but it is essential for the rendering of the graphics that are presented on our screen and without them the communication between the applications and the GPU would not be possible. In this article we explain in an accessible way what graphical APIs are and we break some myths related to them.

It must be taken into account that GPUs do not execute programs, but they do execute a list of instructions. But, where does this list come from and how does it get to the GPU?

High and Low Level Graphical APIs: Differences

What is a Graphics API?

OpenGL Machine

The graphics APIs is what allows applications to communicate with the GPU to mark how it has to draw the next frame or part of it. The concept is based on the abstraction that is the creation in a programming language of what a GPU is, to understand the concept of abstraction we are going to suppose that instead of a GPU we have a soda machine connected.

The API of the refreshment machine would be a library with the following functions: toss coin, return change, select refreshment and deliver Refreshment, in such a way that the program can interact, this part of the API is called by the Front-End, and what we do with it is the list of instructions, well in a GPU this list is called DisplayList or screen list.

DisplayList Ring Buffer

Said screen list is read by software that is none other than the graphics card driver, this transforms the list into a microcode that the GPU can understand and copies it to a part of the RAM memory that the GPU always accesses. To read the screen list, copy the list into the internal memory of your command processors and start rendering the scene or that part of it with the instructions from the screen list.

This process is done continuously in each frame that the GPU renders and sends to the screen, regardless of whether you are using a gaming PC, a smartphone or a video game console.

What are the graphical APIs today?

APIs gráficas

The graphical APIs most used today are the following:

  • Vulkan: Replaces OpenGL, it is used in all types of operating systems, which is said to be platform agnostic, but it is Google’s main API.
  • Metal: Apple’s graphics API, used in macOS and specially optimized for its GPU architecture.
  • DirectX: Microsoft’s API for Windows and Xbox, was divided into several versions depending on the platform, but recently they have unified it in a single version.
  • GNM / GNMX / GNM ++: The graphical API for SONY’s PlayStation 4 and PlayStation 5 consoles, GNMX is a high-level API, GNM is the low-level version API on PS4 and GNM ++ on PS5.
  • NVN: The Nintendo Switch graphics API, which is used exclusively in this series of consoles.
  • OpenGL: The API that started it all, originally known as IrisGL and designed for Silicon Graphics workstations, evolved to become the API for PCs, consoles, and later smartphones. I reach version 4 being Vulkan a rebranding of OpenGL 5.

Computing vs Graphics

DX11 vs DX12

GPUs are highly complex processors that have long ceased to be mere toys to render video games, today they are used in fields such as artificial intelligence or high-performance computing, which has led to the evolution of graphics APIs and go beyond the graphics.

Currently the applications do not send a single list but several lists, one of them being graphics and the rest of computing, where the GPU is used to solve specific problems that have nothing to do with the rendering of the graphics, the latter working completely asynchronous and therefore not depending on the screen list.

For example, it may be that a graphic design application uses the power of the GPU to solve a special effect on a photograph, just because the GPU is better equipped to solve that problem than a CPU. Thanks to the computation lists you can do it using the free resources of the GPU to solve those little problems

High-level and low-level graphical APIs: how are they different?

APIs Gráficas Alto Bajo

When we talk about a low level API we refer to an API that runs close to the GPU, which is at the bottom of the stack while the driver is at the top, a high level API is therefore one that requires a driver generating the display list. As certain driver tasks are not executed in the high-level API, what is theoretically achieved is that the time when executing the screen list by the CPU is shorter, this means finishing the frame in fewer milliseconds or give more time to improve the graphics of that same frame.

In reality, it is false that the low-level APIs lack a driver as it can be read and listened to in some places, but this is much simpler and burdens the work when doing certain essential tasks to the application, this will allows developers to optimize the timing of each frame as much as possible by having control over the screen list creation process.

However, many times for developers it can be much more comfortable to use a high-level API, due to the fact that the additional development time is not financially worth it or simply because the benefit that can be gained through adapting the game to an API low level is imperceptible.

The myth of the console and the PC

There is a myth that because a console has a unique hardware, it means that the APIs are much more optimized than on the PC where there are many different configurations, but it is really the driver that we have installed that generates the screen list. The difference is that in consoles this driver is static and does not receive performance updates or changes in the entire commercial life of the console.