explaingit

saschawillems/vulkan

11,951GLSLAudience · developerComplexity · 4/5Setup · hard

TLDR

A large collection of self-contained C++ example programs for learning Vulkan GPU programming, covering topics from a basic triangle to ray tracing and physically-based rendering, with shaders in GLSL, HLSL, and Slang.

Mindmap

mindmap
  root((Vulkan Examples))
    Basics
      Triangle textures
      Buffers pipelines
      Render passes
    Advanced Rendering
      Physically-based rendering
      Deferred shading
      Ray tracing
    Compute
      Compute shaders
      Non-graphics GPU work
    Shading Languages
      GLSL HLSL Slang
    Platforms
      Windows macOS
      Android iOS
    Tools
      Benchmark recording
      Submodule assets
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Study a specific Vulkan topic, textures, deferred shading, ray tracing, by running the corresponding self-contained C++ example.

USE CASE 2

Compare GLSL, HLSL, and Slang shader implementations side by side for the same visual effect.

USE CASE 3

Build and run Vulkan examples on Windows, macOS, Android, or iOS to test cross-platform rendering code.

USE CASE 4

Use the benchmark recording feature to measure GPU performance of specific rendering techniques.

Tech stack

C++GLSLHLSLSlangVulkanCMake

Getting it running

Difficulty · hard Time to first run · 1h+

Must clone with --recurse-submodules for assets and dependencies, requires a Vulkan-capable GPU and up-to-date drivers.

In plain English

This repository is a large collection of working code examples for Vulkan, a low-level graphics and compute API developed by Khronos. Vulkan is used to write software that talks directly to a GPU, typically for games, simulations, or any application where high-performance rendering matters. Unlike higher-level graphics tools, Vulkan requires the programmer to handle many details manually, which gives more control over performance but makes it harder to learn. The collection is organized into categories covering a wide range of topics. Basics examples start with a plain colored triangle and work up through textures, buffers, and rendering pipelines. More advanced sections cover physically-based rendering, deferred shading, compute shaders for non-graphics GPU work, geometry and tessellation shaders, hardware-accelerated ray tracing, and various visual effects. There are also examples focused on performance measurement and on using Vulkan extensions that add optional capabilities. Each example is a self-contained C++ program. The shaders, which are the small programs that run on the GPU to control how things are drawn, are provided in three languages: GLSL, HLSL, and Slang. This makes the repository useful for comparing how the same effect is written in different shading languages. A Rust shader variant is maintained separately by the Rust GPU project. Building the examples requires cloning the repository with its submodules included, because some dependencies and asset files are tracked as submodules. The code compiles on Windows, Android, iOS, and macOS. Once built, each example runs as a standalone program with command-line flags for resolution, fullscreen mode, GPU selection, and benchmark recording. The author notes that Khronos, the organization behind Vulkan, now maintains its own official samples repository, and that most new samples from the author go there rather than here. This repository continues to receive maintenance and occasional additions that do not fit the official collection. The full README is longer than what was shown.

Copy-paste prompts

Prompt 1
I just got a Vulkan triangle running and want to add a texture. Using the Vulkan examples collection as reference, show me what changes are needed to the descriptor set, pipeline layout, and render pass.
Prompt 2
Using the physically-based rendering example from saschawillems/vulkan as a reference, explain the key Vulkan objects involved: render passes, framebuffers, and descriptor sets.
Prompt 3
I want to implement deferred shading in Vulkan. Walk me through the geometry pass and lighting pass structure based on the deferred shading example in this collection.
Prompt 4
How do I add hardware ray tracing to a Vulkan application? Explain the acceleration structure setup and ray generation shader based on the ray tracing examples in this repo.
Prompt 5
Show me how to run the Vulkan examples in benchmark mode and explain what the recorded metrics mean for identifying GPU performance bottlenecks.
Open on GitHub → Explain another repo

← saschawillems on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.