This issue probably affects all tutorials that use shaders. When running 09_shader_modules—the first tutorial target that uses shaders—from Visual Studio, the application exits with:
The target loads its shader using a relative path:
readFile("shaders/slang.spv")
With a Visual Studio multi-config generator, CMake places the executable and shader under the active configuration directory. For example, a Debug build produces:
build/09_shader_modules/Debug/09_shader_modules.exe
build/09_shader_modules/Debug/shaders/slang.spv
However, the generated debugger working directory is:
Consequently, the application looks for:
build/09_shader_modules/shaders/slang.spv
which does not exist.
All Visual Studio build configurations are affected, including Debug, Release, MinSizeRel, and RelWithDebInfo, because their executables and shaders are placed in separate configuration-specific directories while the debugger working directory remains their common parent directory.
Environment
- Windows
- Visual Studio Community 2026
- CMake generator:
Visual Studio 18 2026
- Vulkan SDK 1.4.357
- Repository revision:
a762d8a
This likely affects all Visual Studio multi-config generators, not only Visual Studio 2026.
Steps to reproduce
- Configure the attachment projects:
cmake -S attachments -B build -G "Visual Studio 18 2026" -A x64 `
-DCMAKE_TOOLCHAIN_FILE="C:\path\to\vcpkg\scripts\buildsystems\vcpkg.cmake"
- Open
build/VulkanTutorial.slnx.
- Set
09_shader_modules as the startup project.
- Build and run any configuration.
Suspected regression
This appears to have been introduced by commit 7e49123. It changed SHADERS_DIR at lines 88–90 and 112–114 to include $<CONFIG>,
if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*" OR
${CMAKE_GENERATOR} MATCHES "Ninja Multi-Config")
set (SHADERS_DIR ${CMAKE_BINARY_DIR}/${SHADER_CHAPTER_NAME}/$<CONFIG>/shaders)
while VS_DEBUGGER_WORKING_DIRECTORY at line 157 continued to use the parent chapter directory.
if(WIN32)
if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
set_target_properties(${CHAPTER_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/${CHAPTER_NAME}")
endif()
endif()
Proposed fix
Use the target’s executable directory as the debugger working directory:
set_target_properties(${CHAPTER_NAME} PROPERTIES
VS_DEBUGGER_WORKING_DIRECTORY "$<TARGET_FILE_DIR:${CHAPTER_NAME}>"
)
I tested this change locally. CMake generates the correct configuration-specific working directory, and 09_shader_modules runs successfully from Visual Studio.
This issue probably affects all tutorials that use shaders. When running
09_shader_modules—the first tutorial target that uses shaders—from Visual Studio, the application exits with:The target loads its shader using a relative path:
With a Visual Studio multi-config generator, CMake places the executable and shader under the active configuration directory. For example, a Debug build produces:
However, the generated debugger working directory is:
Consequently, the application looks for:
which does not exist.
All Visual Studio build configurations are affected, including
Debug,Release,MinSizeRel, andRelWithDebInfo, because their executables and shaders are placed in separate configuration-specific directories while the debugger working directory remains their common parent directory.Environment
Visual Studio 18 2026a762d8aThis likely affects all Visual Studio multi-config generators, not only Visual Studio 2026.
Steps to reproduce
build/VulkanTutorial.slnx.09_shader_modulesas the startup project.Suspected regression
This appears to have been introduced by commit 7e49123. It changed SHADERS_DIR at lines 88–90 and 112–114 to include
$<CONFIG>,while
VS_DEBUGGER_WORKING_DIRECTORYat line 157 continued to use the parent chapter directory.Proposed fix
Use the target’s executable directory as the debugger working directory:
I tested this change locally. CMake generates the correct configuration-specific working directory, and 09_shader_modules runs successfully from Visual Studio.