# SaschaWillems/Vulkan: C++ example collection for the Vulkan API

> A repository of C++ samples covering Vulkan from a verbose first triangle to ray tracing and compute, with shaders in GLSL, HLSL and Slang. It is a reference library for engineers learning the API, not a framework you ship.

**SaschaWillems/Vulkan** — C++ examples for the Vulkan graphics API

- Repository: https://github.com/SaschaWillems/Vulkan
- Stars: 12,161 · Forks: 2,231
- Language: GLSL
- License: MIT
- Published: 2026-09-21 · Updated: 2026-09-21 · Language: en
- Canonical page: https://hysenlabs.com/projects/saschawillems-vulkan

## What SaschaWillems/Vulkan is for

This repository is a set of standalone C++ programs, each demonstrating one part of Vulkan. The README describes it as "a comprehensive collection of open source C++ examples" for the API. The examples are grouped by topic: Basics, glTF, Advanced, Performance, Physically Based Rendering, Deferred, Compute Shader, Geometry Shader, Tessellation Shader, Hardware accelerated ray tracing, Headless, User Interface, Effects, Extensions and Misc.

The intended reader is someone who wants to see one mechanism in isolation. The basic triangle example is deliberately verbose, and the README says a large part of that code is boilerplate that later examples abstract away. That is the whole design idea: start with the ceremony, then remove it. If you want a library that hides Vulkan behind an object model, this is the wrong repository, and the README points to the official Khronos Vulkan-Samples repository as the place where the author now contributes most of his work.

## How the samples are structured and how shaders are selected

Every example lives under examples/, with its own directory and CMake entry in examples/CMakeLists.txt. Shared code sits in base/, assets in assets, shader sources in shaders/, and third-party dependencies in external/ as submodules. The top level also carries android/, apple/ and openharmony/ directories, which matches the README's claim that the code builds on Windows, Android, iOS and macOS through MoltenVK.

Vulkan consumes SPIR-V, so the shader language is a build-time choice. GLSL under shaders/glsl is the primary language, and most samples also ship shaders/slang and shaders/hlsl versions so the three can be compared directly. At runtime the -s or --shaders option selects which compiled set to load, with the accepted values glsl, slang and hlsl. The README also notes that the Rust GPU project keeps Rust shader sources in a separate repository, so Rust shaders are not part of this tree.

One design decision worth flagging: the README carries a dedicated section titled "A note on synchronization". The presence of that section, rather than synchronization being handled silently in shared code, tells you the samples expect you to reason about barriers yourself. That is consistent with the teaching goal, but it means copying an example's synchronization into production code is copying a demonstration, not a validated pattern.

## Cloning, building and running a first example

The repository depends on submodules for external code and assets, so a plain clone leaves you without dependencies. The README gives the recursive form explicitly. Without --recursive the external/ directory and the asset submodule stay empty, and the build will fail in ways that look unrelated to cloning.

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

If you already have the repository, the README gives the manual submodule commands instead of a pull.

```bash
git submodule init
git submodule update
```

The build uses CMake and needs a C++20 compiler. The README states that everything required to compile on Windows, Android, iOS and macOS is included, and points to BUILD.md for the per-platform details. The top-level CMakeLists.txt is the entry point.

```bash
cmake -B build
cmake --build build
```

Built examples run from the bin directory. The README says the available options are listed with --help. The option list includes window sizing, validation layers, V-Sync, fullscreen, shader language selection, GPU selection, benchmark mode and a resource path override. The README warns that some examples need specific device features, and on a multi-GPU system you may need -gl to list devices and -g to pick one that supports them.

```bash
--help
-gl, --listgpus
-g, --gpu
-s, --shaders
```

## Where the samples stop being useful

The examples are self-contained programs, not a library you link against. There is no stable public API, no versioning scheme, and no release artifacts: the releases field is empty. Upgrading means pulling the repository and reconciling your own copy against whatever changed in base/ and examples/CMakeLists.txt.

The asset dependency is the other sharp edge. Assets arrive through a submodule, and the recursive clone is the only documented way to get them. The README does not document a fallback when the asset submodule fails to fetch, and it does not document rollback to an earlier state. If your environment blocks submodule fetches, the samples will build against missing data.

Finally, the samples target desktop and mobile GPUs with the features each example names. The README explicitly says some examples require specific device features. Running a ray tracing or descriptor indexing sample on hardware that lacks them is not a configuration problem you can work around; the sample is simply not applicable. For a server-side or headless-only deployment, the Headless category is the relevant slice, and the rest of the repository is noise.

## How it differs from the official Khronos samples

The README states that Khronos published an official Vulkan Samples repository and that the author was involved in getting it running and now contributes mostly there. The two repositories therefore share an author and a subject, but not a structure. The official repository is the one the README directs new work toward; this repository is where samples that do not fit there may still land, and the author states he will continue to maintain these samples.

For a reader choosing between them, the practical difference is scope and governance. This repository reads as a personal teaching collection organized by feature area, with the verbose triangle as its starting point and a note on synchronization as a first-class topic. The official repository is presented as the unified, Khronos-backed home. If you need a sample that is guaranteed to track the API's direction, the README's own pointer says to look there. If you want the long-form, one-feature-per-directory walkthrough, this is the one.

## Licence and maintenance cost

The repository is MIT licensed, with the licence text in LICENSE.md. MIT is permissive: it allows reuse and modification provided the copyright notice and permission notice are retained, and it comes with no warranty. Individual assets and third-party code under external/ and assets may carry their own terms, and the repository keeps a CREDITS.md file for attributions. That file is where to check before redistributing anything beyond the source. This is a description of the licence, not legal advice.

On maintenance: the last push to the default branch was on 2026-09-20, and the repository is not archived. There are no tagged releases, so there is no version to pin. The README does describe a forward path for newcomers through a separate HowToVulkan repository, which suggests the author expects readers to start there and use these samples as reference material afterward.

## Conclusion

Adopt it if you are learning Vulkan or need a minimal, readable reference for a specific feature. Do not adopt it as an application framework; there is no engine layer, no asset pipeline and no upgrade guarantee beyond the repository's own commits. Before relying on it, verify the submodule state after cloning and confirm which shader language and GPU your target machine supports, using -gl to list devices.

## FAQ

### How do I install SaschaWillems/Vulkan?

Clone it recursively with the command in the README, then build it with CMake using a C++20 compiler. The per-platform build steps are in BUILD.md.

### How do I use the SaschaWillems/Vulkan examples?

After a recursive clone, configure and build with CMake, then run the resulting binaries from the bin directory. The README says the full list of runtime options is shown with --help.

### Does SaschaWillems/Vulkan work on Windows 11?

The README states the repository contains everything required to compile and build the examples on Windows, Android, iOS and macOS using a C++20 compiler, with BUILD.md covering the per-platform details.

## Sources

- [Issues](https://github.com/SaschaWillems/Vulkan/issues)
- [License: MIT](https://github.com/SaschaWillems/Vulkan/blob/master/LICENSE)
- [README](https://github.com/SaschaWillems/Vulkan/blob/master/README.md)
- [SaschaWillems/Vulkan on GitHub](https://github.com/SaschaWillems/Vulkan)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/saschawillems-vulkan
