vk_raytracing_tutorial_KHR

Setup Guide

This guide will help you set up a working copy of the foundation sample for the Vulkan Ray Tracing Tutorial.

Important: Create a Working Copy

Before starting this tutorial, create a copy of the 01_foundation directory to work with:

# Navigate to the raytrace_tutorial directory
cd raytrace_tutorial

Create a working copy of the foundation sample

# Linux
cp -r 01_foundation 01_foundation_copy
# Windows
xcopy 01_foundation 01_foundation_copy /S /E

Why Create a Copy?

CMakeLists.txt Modification

You need to add the new project to the main CMakeLists.txt. Insert this line after the original foundation project:

add_subdirectory(raytrace_tutorial/01_foundation)
add_subdirectory(raytrace_tutorial/01_foundation_copy)
add_subdirectory(raytrace_tutorial/02_basic)

Working Directory Structure

After creating the copy, your directory should look like this:

raytrace_tutorial/
├── 01_foundation/                    # Original (don't modify)
│   ├── 01_foundation.cpp
│   ├── shaders/
│   │   ├── foundation.slang
│   │   └── shaderio.h
│   ├── CMakeLists.txt
│   └── README.md
├── 01_foundation_copy/               # Your working copy
│   ├── 01_foundation.cpp             # Main file to modify
│   ├── shaders/                      # Will add rtbasic.slang
│   │   ├── foundation.slang         
│   │   └── shaderio.h
│   ├── CMakeLists.txt
│   └── README.md
├── 02_basic/                         # Reference implementation
│   ├── 02_basic.cpp
│   ├── shaders/
│   │   ├── rtbasic.slang
│   │   └── shaderio.h
│   └── CMakeLists.txt
└── docs/
    └── index.md   # Main tutorial (includes setup instructions)

Build Verification

Since this is a unified build system, you only need to rebuild from the root directory:

# From the project root directory
cmake -B build -S .
cmake --build build -j 8

This will build all projects including both:

Both should produce identical results initially.