Vulkan README

The project's README from github.com/SaschaWillems/Vulkan. As one markdown file: README.md.

Vulkan C++ examples and demos

A comprehensive collection of open source C++ examples for Vulkan®, the low-level graphics and compute API from Khronos.

Donate

Table of Contents

How to Vulkan in 2026

For an introduction on how to use Vulkan for graphics in 2026, see this repository. It's esp. helpful if you haven't done much with Vulkan (yet) and want to understand how Vulkan (and in turn these samples) work.

Official Khronos Vulkan Samples

Khronos has made an official Vulkan Samples repository available to the public (press release).

You can find this repository at https://github.com/KhronosGroup/Vulkan-Samples

As I've been involved with getting the official repository up and running, I'll be mostly contributing to that repository from now, but may still add samples that don't fit there in here and I'll of course continue to maintain these samples.

Cloning

This repository contains submodules for external dependencies and assets, so when doing a fresh clone you need to clone recursively:

git clone --recursive https://github.com/SaschaWillems/Vulkan.git

Existing repositories can be updated manually:

git submodule init
git submodule update

Building

The repository contains everything required to compile and build the examples on Windows, Android, iOS and macOS (using MoltenVK) using a C++ compiler that supports C++20.

See BUILD.md for details on how to build for the different platforms.

Running

Once built, examples can be run from the bin directory. The list of available command line options can be brought up with --help:

 --help: Show help
 -h, --height: Set window height
 -v, --validation: Enable validation layers
 -vs, --vsync: Enable V-Sync
 -f, --fullscreen: Start in fullscreen mode
 -w, --width: Set window width
 -s, --shaders: Select shader type to use (glsl, slang, hlsl)
 -g, --gpu: Select GPU to run on
 -gl, --listgpus: Display a list of available Vulkan devices
 -b, --benchmark: Run example in benchmark mode
 -bw, --benchwarmup: Set warmup time for benchmark mode in seconds
 -br, --benchruntime: Set duration time for benchmark mode in seconds
 -bf, --benchfilename: Set file name for benchmark results
 -bt, --benchframetimes: Save frame times to benchmark results file
 -bfs, --benchmarkframes: Only render the given number of frames
 -rp, --resourcepath: Set path for dir where assets and shaders folder is present

Note that some examples require specific device features, and if you are on a multi-gpu system you might need to use the -gl and -g to select a gpu that supports them.

Shaders

Vulkan consumes shaders in an intermediate representation called SPIR-V. This makes it possible to use different shader languages by compiling them to that bytecode format. The primary shader language used here is GLSL, most samples also come with slang and HLSL shader sources, making it easy to compare the differences between those shading languages. The Rust GPU project maintains Rust shader sources in a separate repo.

Examples

Basics

glTF

These samples show how implement different features of the glTF 2.0 3D format 3D transmission file format in detail.

Advanced

Performance

Physically Based Rendering

Physical based rendering as a lighting technique that achieves a more realistic and dynamic look by applying approximations of bidirectional reflectance distribution functions based on measured real-world material parameters and environment lighting.

Deferred

These examples use a deferred shading setup.

Compute Shader

All Vulkan implementations support compute shaders, a more generalized way of doing workloads on the GPU. These samples demonstrate how to use those compute shaders.

Geometry Shader

Tessellation Shader

Hardware accelerated ray tracing

Vulkan supports GPUs with dedicated hardware for ray tracing. These sampples show different parts of that functionality.

Headless

Examples that run one-time tasks and don't make use of visual output (no window system integration). These can be run in environments where no user interface is available (blog entry).

User Interface

Extensions

Vulkan is an extensible api with lots of functionality added by extensions. These samples demonstrate the usage of such extensions.

Note: Certain extensions may become core functionality for newer Vulkan versions. The samples will still work with these.

Effects

Assorted samples showing graphical effects not special to Vulkan.

Misc

Credits and Attributions

See CREDITS.md for additional credits and attributions.

Vulkan (SaschaWillems/Vulkan)

Searching Database…

12.2K ·GitHub
What is this?A comprehensive collection of open source C++ examples for Vulkan, the low-level graphics and compute API from Khronos, covering everything from a basic triangle to PBR, deferred rendering and hardware ray tracing.
Is this one app or many separate demos?It is not a single app - it's dozens of standalone C++ example programs, each demonstrating one specific Vulkan feature (textures, shadows, compute shaders, etc.), built and run independently from the bin directory.
How do I build and run the examples?Clone the repo recursively to pull in the submodules, then build with a C++20-capable compiler following the instructions in BUILD.md for your platform; once built, run any example binary from the bin directory (pass --help to see its options).
What do I need before building?A C++20-compatible compiler plus the Vulkan SDK/drivers for your platform; external dependencies and asset files come in automatically through git submodules.
Any gotchas when running the examples?Some examples require specific device features, and on multi-GPU machines you may need the -gl and -g flags to pick a GPU that actually supports them. Also, the author now adds most new samples to the official Khronos Vulkan Samples repo instead of here.
Which platforms can I build these on?Windows, Android, iOS and macOS (via MoltenVK) are all supported, with per-platform build steps documented in BUILD.md.
What shader languages can I use with these examples?Most samples are written in GLSL, the primary shading language used here, but they also ship with Slang and HLSL versions of the same shaders so you can compare the three.
Why keep this repo going alongside the official Khronos Samples?The author helped set up the official Khronos Vulkan Samples repository and now mostly contributes there, but keeps maintaining this older collection for samples that don't fit into the official one.
What kinds of techniques do the examples cover?They range from basics like descriptor sets and texture mapping to advanced topics such as shadow mapping, PBR with image-based lighting, deferred rendering, compute shaders, tessellation, hardware ray tracing and glTF 2.0 model loading.
How do I pick which GPU an example uses on a multi-GPU machine?Run the example with the -gl flag to list the available GPUs, then use -g to select the one that supports the required device features.
Size
223.4 MB
Stars
12.2K
Updated
CommitOct 10
Age
11y
Commits · 90 Days