From 8d1fb84b021abb89d5de39cbdb86da0399688bd6 Mon Sep 17 00:00:00 2001 From: swinston Date: Thu, 20 Aug 2026 17:46:47 -0700 Subject: [PATCH 1/2] Explain the __INTELLISENSE__/USE_CPP20_MODULES preprocessor block --- en/03_Drawing_a_triangle/00_Setup/00_Base_code.adoc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/en/03_Drawing_a_triangle/00_Setup/00_Base_code.adoc b/en/03_Drawing_a_triangle/00_Setup/00_Base_code.adoc index eeaf0702..a5ad4232 100644 --- a/en/03_Drawing_a_triangle/00_Setup/00_Base_code.adoc +++ b/en/03_Drawing_a_triangle/00_Setup/00_Base_code.adoc @@ -38,6 +38,19 @@ import vulkan_hpp; #include class HelloTriangleApplication { +---- + +The `#if defined(__INTELLISENSE__) || !defined(USE_CPP20_MODULES)` block picks +between two ways of pulling in the Vulkan-Hpp API. When `USE_CPP20_MODULES` is +defined, we `import vulkan_hpp;` as a C++20 module. Visual Studio and VS Code's +IntelliSense engine doesn't yet understand `import` for modules and will flag +it as an error even though the code compiles fine, so we fall back to +including the traditional `` header whenever +`__INTELLISENSE__` is defined (which IntelliSense itself defines while +analyzing the code) or when modules are turned off entirely. + +[,c++] +---- public: void run() { initVulkan(); From 0997f83f610fae9098cd6af2b8634285195202dd Mon Sep 17 00:00:00 2001 From: swinston Date: Tue, 1 Sep 2026 12:01:45 -0700 Subject: [PATCH 2/2] Consolidate the duplicated IntelliSense/module explanation into one block --- .../00_Setup/00_Base_code.adoc | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/en/03_Drawing_a_triangle/00_Setup/00_Base_code.adoc b/en/03_Drawing_a_triangle/00_Setup/00_Base_code.adoc index a5ad4232..d1d52f72 100644 --- a/en/03_Drawing_a_triangle/00_Setup/00_Base_code.adoc +++ b/en/03_Drawing_a_triangle/00_Setup/00_Base_code.adoc @@ -41,13 +41,16 @@ class HelloTriangleApplication { ---- The `#if defined(__INTELLISENSE__) || !defined(USE_CPP20_MODULES)` block picks -between two ways of pulling in the Vulkan-Hpp API. When `USE_CPP20_MODULES` is -defined, we `import vulkan_hpp;` as a C++20 module. Visual Studio and VS Code's -IntelliSense engine doesn't yet understand `import` for modules and will flag -it as an error even though the code compiles fine, so we fall back to -including the traditional `` header whenever -`__INTELLISENSE__` is defined (which IntelliSense itself defines while -analyzing the code) or when modules are turned off entirely. +between two ways of pulling in the Vulkan-Hpp API, both of which provide the +same functions, structures, and enumerations. By default we include the +traditional `` header. If you enable C{pp}20 modules +(`-DENABLE_CPP20_MODULE=ON`), the `USE_CPP20_MODULES` define set by CMake +makes the code `import vulkan_hpp;` instead. Either way, Visual Studio and VS +Code's IntelliSense engine doesn't yet understand `import` for modules and +will flag it as an error even though the code compiles fine, so we fall back +to the header whenever `__INTELLISENSE__` is defined (which IntelliSense +itself defines while analyzing the code) or when modules are turned off +entirely. [,c++] ---- @@ -89,12 +92,9 @@ int main() } ---- -We first include the Vulkan-Hpp RAII header by default, which provides the -functions, structures and enumerations. If you enable C{pp}20 modules -(`-DENABLE_CPP20_MODULE=ON`), the code will `import vulkan_hpp;` instead via the -`USE_CPP20_MODULES` define set by CMake. The `stdexcept` and `iostream` headers -are included for reporting and propagating errors. The `cstdlib` header -provides the `EXIT_SUCCESS` and `EXIT_FAILURE` macros. +The `stdexcept` and `iostream` headers are included for reporting and +propagating errors. The `cstdlib` header provides the `EXIT_SUCCESS` and +`EXIT_FAILURE` macros. The program itself is wrapped into a class where we'll store the Vulkan objects as private class members and add functions to initiate each of them, which will