Installation¶
Prerequisites¶
All Platforms¶
- Vulkan SDK (1.2 or later) - Download from LunarG
- CMake (3.16 or later) - Download from cmake.org
- C11 compatible compiler
Linux¶
# Ubuntu/Debian
sudo apt update
sudo apt install vulkan-tools libvulkan-dev vulkan-validationlayers cmake build-essential
# Fedora
sudo dnf install vulkan-tools vulkan-loader-devel vulkan-validation-layers cmake gcc
# Arch
sudo pacman -S vulkan-tools vulkan-headers vulkan-validation-layers cmake base-devel
Verify installation:
Windows¶
- Install Visual Studio 2019+ with "Desktop development with C++" workload
- Install Vulkan SDK from LunarG
- Ensure
glslcis in your PATH (included with Vulkan SDK)
Verify installation:
macOS¶
-
Install Xcode Command Line Tools:
-
Install Vulkan SDK from LunarG (includes MoltenVK)
-
Set environment variables (add to
~/.zshrcor~/.bash_profile):
Verify installation:
Building VKCompute¶
Clone the Repository¶
Linux/macOS¶
# Using the build script
chmod +x build.sh
./build.sh
# Or manually
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --parallel
Windows¶
# Using the build script
build.bat
# Or with Visual Studio
mkdir build
cd build
cmake -G "Visual Studio 17 2022" ..
cmake --build . --config Release
Verify Installation¶
Run the first chapter:
You should see output like:
==============================================
VKCompute - Chapter 01: Hello Vulkan Compute
==============================================
Vulkan instance created
Found 1 GPU(s)
GPU 0: NVIDIA GeForce RTX 3080
Type: Discrete GPU
API Version: 1.3.277
...
Logical device created
Compute queue retrieved
=== SUCCESS ===
Vulkan is initialized and ready for compute work!
Troubleshooting¶
"No GPUs with Vulkan support found"¶
- Ensure your GPU drivers are up to date
- Check that Vulkan SDK is properly installed
- On macOS, verify MoltenVK environment variables are set
"Failed to create Vulkan instance" (Error -9 on macOS)¶
This is VK_ERROR_INCOMPATIBLE_DRIVER. The portability extension is needed for MoltenVK. Our code handles this automatically, but ensure you have the latest Vulkan SDK.
"Validation layer not found"¶
Install validation layers:
# Ubuntu/Debian
sudo apt install vulkan-validationlayers
# Fedora
sudo dnf install vulkan-validation-layers
Shader Compilation Errors¶
Ensure glslc (from the Vulkan SDK) is in your PATH:
Next Steps¶
With everything installed, head to Chapter 01 to write your first Vulkan program!