Vulkan

On this page 7

Vulkan is an open, cross-platform low-level graphics and compute API that lets applications control a GPU directly through command buffers, explicit memory management and explicit synchronization. In graphics and computer hardware, it serves as the vendor-neutral interface between software such as games, engines and professional tools and the GPU driver, and it is maintained by the Khronos Group as the successor to OpenGL.

Vulkan shifts responsibility from the driver to the application. The driver does far less guessing and validation at run time, which lowers CPU overhead and enables multithreaded command recording, but the developer must manage resources, memory and timing that older APIs handled automatically.

How Vulkan drives the GPU

Vulkan drives the GPU by having the application record commands into command buffers and submit them to queues, which the hardware then executes asynchronously. Nothing is drawn immediately when an application calls a drawing function; the call is only recorded, and execution begins when the buffer is submitted.

Before rendering, an application creates a set of explicit objects. It selects a physical device, creates a logical device with the queues it needs, allocates memory, and compiles pipeline state objects that bundle shaders, blending, depth testing and vertex layout into one immutable object. Shaders are delivered in SPIR-V, a binary intermediate representation, rather than as source text.

The table below lists the core objects that appear in almost every Vulkan application.

ObjectRoleTypical lifetime
InstanceConnects the application to the Vulkan loaderWhole application
Logical deviceRepresents an opened GPU with chosen featuresWhole application
QueueAccepts submitted command buffersSame as the device
Command bufferHolds recorded draw, dispatch and copy commandsOne frame or reused
PipelineFixes shader and state configurationCreated at load time
Descriptor setBinds buffers, images and samplers to shadersPer material or per frame
SwapchainPresents rendered images to a windowUntil resize or mode change
Core Vulkan objects and their roles

Explicit memory and synchronization

Vulkan requires the application to allocate GPU memory itself and bind buffers and images to it. The device reports several memory heaps and memory types, such as device-local memory in VRAM, host-visible memory for uploads and, on integrated GPUs, unified memory shared with the CPU. Choosing the right type for each resource has a direct impact on bandwidth and latency.

Synchronization is equally explicit. The GPU executes work out of order and in parallel, so the application must declare dependencies with pipeline barriers, semaphores and fences. A missing barrier produces race conditions that may only appear on certain hardware, while excessive barriers stall the GPU and waste performance.

The following table explains which synchronization primitive fits which purpose.

PrimitiveSynchronizesCommon use
Pipeline barrierCommands within one queueTransition an image from render target to texture
Binary semaphoreQueue submissions on the GPUWait for swapchain image before rendering
Timeline semaphoreGPU work and CPU with countersTrack frame progress across queues
FenceGPU completion to the CPUKnow when a frame’s resources can be reused
EventFine-grained points inside a queueSplit producer and consumer work
Vulkan synchronization primitives

Most production engines use a memory allocator library and a render graph that derive barriers automatically from declared resource usage, because manual tracking does not scale to large renderers.

Vulkan compared with other graphics APIs

Vulkan belongs to the generation of explicit graphics APIs together with Direct3D 12 and Metal, and it differs most sharply from older implicit APIs such as OpenGL and Direct3D 11. Its distinguishing feature among the explicit APIs is portability across operating systems and vendors.

APIPlatformsAbstraction levelDriver overhead
VulkanWindows, Linux, Android, othersExplicitLow
Direct3D 12Windows, XboxExplicitLow
MetalApple platformsExplicit with conveniencesLow
OpenGLMost desktop systemsImplicit state machineHigh
Direct3D 11WindowsImplicitModerate to high
Vulkan and related graphics APIs

On Apple systems, Vulkan runs through a translation layer that maps calls to Metal, under the Vulkan portability subset. Conversely, translation layers that map Direct3D calls onto Vulkan let many Windows games run on Linux, which has made Vulkan an important compatibility target as well as a native API.

Extensions, versions and feature support

Vulkan evolves through core versions and extensions. New features usually appear first as vendor or multi-vendor extensions, and the most successful ones are promoted into a later core version, such as dynamic rendering and synchronization2 in Vulkan 1.3. Applications must query which extensions and features a device supports before using them.

To reduce fragmentation, Khronos publishes profiles that define a guaranteed baseline for a class of devices. The table below shows notable feature areas and what they enable.

Feature areaWhat it enablesHardware requirement
Ray tracing extensionsAcceleration structures and ray queriesGPUs with RT cores or equivalent
Mesh shadersGPU-driven geometry processingRecent desktop GPUs
Descriptor indexingBindless access to large resource arraysMost modern GPUs
Video extensionsHardware video decode and encodeGPUs with media engines
Compute shadersGeneral-purpose GPU computationAll Vulkan devices
Notable Vulkan feature areas

Benefits, costs and common mistakes

Vulkan delivers its benefits mainly in CPU-bound scenes, where thousands of draw calls and frequent state changes overwhelm an implicit driver. In GPU-bound scenes, a well-written OpenGL or Direct3D 11 renderer can perform similarly, because the shaders and memory bandwidth, not the API, set the limit.

The cost is development effort. A minimal triangle in Vulkan requires several hundred lines of setup code, and correctness depends on discipline that the driver no longer enforces. Teams that adopt Vulkan typically face the following problems.

  • Shipping without validation layers during development hides incorrect usage that works on one GPU and fails on another.
  • Creating pipelines during gameplay causes visible stutter; pipelines should be compiled at load time and stored in a pipeline cache.
  • Overly broad barriers serialize GPU work and remove the performance gains that motivated the move to Vulkan.
  • Many small memory allocations exhaust allocation limits; resources should be sub-allocated from larger blocks.
  • Assuming identical behavior across vendors ignores differences in tiling, memory types and queue families, especially between desktop and mobile GPUs.

Understanding it simply

Vulkan is a common language for graphics cards that programs use to give them instructions. Older languages of this kind worked like a helpful assistant who guessed what you meant and fixed small mistakes, which was convenient but slow.

Vulkan removes the assistant. The program must state exactly what it wants, in what order and with which memory. This takes more work from developers but lets the computer waste far less time, so games and creative applications can draw more detail with smoother frame rates on many kinds of devices.

Applied in practice

A small studio builds an open-world game that must run on Windows PCs, Linux handhelds and Android tablets. Its original OpenGL renderer struggled in dense city scenes with about 8,000 draw calls per frame, where one CPU core spent most of its time inside the driver.

The team moves to Vulkan and records command buffers on six worker threads in parallel, compiles all pipelines during loading and uses timeline semaphores to overlap rendering with asset streaming. Validation layers catch dozens of synchronization errors before release.

The result is a frame time cut from about 22 ms to 14 ms on a mid-range laptop in the busiest areas, with one renderer serving all three platforms instead of separate code paths.