|
2 | 2 |
|
3 | 3 | = Base code |
4 | 4 |
|
| 5 | +== Vulkan-hpp and designated initializers |
| 6 | + |
| 7 | +NOTE: We are going to use designated initializers introduced with C++ 20. By default, |
| 8 | +Vulkan-hpp uses a different way of initializing and we need to explicitly enable this |
| 9 | +by using the `VULKAN_HPP_NO_STRUCT_CONSTRUCTORS` define. |
| 10 | + |
| 11 | +This provides a better meaning towards what each option relates to in the structures that we're depending upon. For this tutorial, said define is declared in the xref:../../02_Development_environment.adoc#cmake[CMake build setup]. |
| 12 | + |
| 13 | +If you use a different build setup or want to write code from scratch, you need to manually define this before including the Vulkan-hpp headers like this: |
| 14 | +[,c++] |
| 15 | +---- |
| 16 | +#define VULKAN_HPP_NO_STRUCT_CONSTRUCTORS |
| 17 | +#include <vulkan/vulkan.hpp> |
| 18 | +// or |
| 19 | +#include <vulkan/vulkan_raii.hpp> |
| 20 | +---- |
| 21 | + |
5 | 22 | == General structure |
6 | 23 |
|
7 | 24 | In the previous chapter, you've created a Vulkan project with all the proper |
@@ -156,14 +173,6 @@ vk::InstanceCreateInfo createInfo{ |
156 | 173 | instance = vk::raii::Instance(context, createInfo); |
157 | 174 | ---- |
158 | 175 |
|
159 | | -NOTE: We use Vulkan-hpp with designated initializers introduced with C++ 20. By default, |
160 | | -Vulkan-hpp uses a different way of initializing and we need to explicitly enable this |
161 | | -by using the `VULKAN_HPP_NO_STRUCT_CONSTRUCTORS` define. This provides a better meaning |
162 | | -towards what each option relates to in the structures that we're depending upon. |
163 | | -For this tutorial, said define is declared in the xref:../../02_Development_environment.adoc#cmake[CMake build setup]. |
164 | | -If you use a different build setup, you need to manually define this before including |
165 | | -Vulkan-hpp. |
166 | | - |
167 | 176 | == Integrating GLFW |
168 | 177 |
|
169 | 178 | Vulkan works perfectly fine without creating a window if you want to use it for |
|
0 commit comments