VulkanCppExamples
Comprehensive Vulkan examples written in C++20.
Install / Use
/learn @myemural/VulkanCppExamplesREADME
Vulkan C++ Examples
This repository contains Vulkan examples written in modern C++20, structured in a granular, step-by-step progression from basic to advanced concepts. Each example builds incrementally on the previous ones, making it easier to understand Vulkan's low-level API in a practical way. These examples will first cover the basic features of Vulkan, and then include examples of implementing techniques such as real-time lighting, real-time shadowing, PBR, post-processing, ray tracing etc. using Vulkan.

Getting Started
Prerequisites
Before start, you should download and install the latest LunarG Vulkan SDK from here (1.4.328.1 version has been tested): https://vulkan.lunarg.com/sdk/home
To compile and test the examples, CMake 3.31+ is recommended. All third party libraries are added with using Git Submodule. Therefore, you do not need to worry about installing them separately. Here is a list of 3rd party libraries (repos):
NOTE: Normally, the stb_image library is also used for texture loading. However, this library is already integrated with the tinygltf library.
Clone
To clone this repository, you should run this command on your local terminal:
git clone --recursive https://github.com/myemural/VulkanCppExamples.git
Since this project contains various submodule dependencies, you will then need to run the following commands:
git submodule init
git submodule update
Build and Run
Every example has its own directory and CMake target. You can build what you want with CMake command line tools or IDE tools. Additionally, the built examples create executable files in the bin/<CONFIG> directory. You can run any example from this directory.
General Info
Common Parameters
Window Parameters
| Parameter / Key | Type | Usage in Code | Description | Default Value | |--------------------|---------------|---------------------------|-----------------------------------------|---------------| | Window.Width | std::uint32_t | WindowParams::Width | Initial width of the window (in pixel) | 800 | | Window.Height | std::uint32_t | WindowParams::Height | Initial height of the window (in pixel) | 600 | | Window.Title | std::string | WindowParams::Title | Title of the window | | | Window.Resizable | bool | WindowParams::Resizable | Specifies window is resizable or not | false |
Vulkan Parameters
| Parameter / Key | Type | Usage in Code | Description | Default Value | |---------------------------|--------------------------------|----------------------------------|-----------------------------------|--------------------------| | Vulkan.ApplicationName | std::string | VulkanParams::ApplicationName | Name of the Vulkan application | | | Vulkan.VulkanApiVersion | std::uint32_t | VulkanParams::VulkanApiVersion | Version of the Vulkan API | VK_API_VERSION_1_0 | | Vulkan.ApplicationVersion | std::uint32_t | VulkanParams::ApplicationVersion | Version of the Vulkan application | VK_MAKE_VERSION(1, 0, 0) | | Vulkan.EngineName | std::string | VulkanParams::EngineName | Name of the engine | "DefaultEngine" | | Vulkan.EngineVersion | std::uint32_t | VulkanParams::EngineVersion | Version of the engine | VK_MAKE_VERSION(1, 0, 0) | | Vulkan.InstanceLayers | std::vector<std::string> | VulkanParams::InstanceLayers | List of the instance layers | | | Vulkan.InstanceExtensions | std::vector<std::string> | VulkanParams::InstanceExtensions | List of the instance extensions | |
All Examples
Fundamentals
- Basics
- Descriptor Sets
- Images and Samplers
- Drawing 3D
- Pipelines And Passes
- Swap Chains and Viewports
- Model Loading
- Multisampling
- Compute Shaders
- Queries and Performance
- Visibility Check with Occlusion Queries
- [Measuring The GPU Time with Timestamp Queries](/Examples/Fundamentals/Quer
