Skip to content

Commit 4309320

Browse files
committed
Merge branch 'main' into clang_format
# Conflicts: # attachments/07_image_views.cpp # attachments/08_graphics_pipeline.cpp # attachments/09_shader_modules.cpp # attachments/10_fixed_functions.cpp # attachments/12_graphics_pipeline_complete.cpp # attachments/14_command_buffers.cpp # attachments/15_hello_triangle.cpp # attachments/16_frames_in_flight.cpp # attachments/17_swap_chain_recreation.cpp # attachments/18_vertex_input.cpp # attachments/19_vertex_buffer.cpp # attachments/20_staging_buffer.cpp # attachments/21_index_buffer.cpp # attachments/22_descriptor_layout.cpp # attachments/23_descriptor_sets.cpp # attachments/24_texture_image.cpp # attachments/25_sampler.cpp # attachments/26_texture_mapping.cpp # attachments/27_depth_buffering.cpp # attachments/28_model_loading.cpp # attachments/29_mipmapping.cpp # attachments/30_multisampling.cpp # attachments/31_compute_shader.cpp # attachments/32_ecosystem_utilities.cpp # attachments/33_vulkan_profiles.cpp # attachments/34_android.cpp # attachments/35_gltf_ktx.cpp # attachments/36_multiple_objects.cpp # attachments/37_multithreading.cpp
2 parents 3ea68a8 + 769e70c commit 4309320

File tree

86 files changed

+178393
-130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+178393
-130
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ temp_ebook.md
99
ebook/*.pdf
1010
ebook/*.epub
1111

12-
convert.py
12+
convert.py
13+
14+
attachments/build/

antora/modules/ROOT/nav.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,13 @@
5252
* xref:15_GLTF_KTX2_Migration.adoc[Migrating to Modern Asset Formats: glTF and KTX2]
5353
* xref:16_Multiple_Objects.adoc[Rendering Multiple Objects]
5454
* xref:17_Multithreading.adoc[Multithreading]
55+
* xref:courses/18_Ray_tracing/00_Overview.adoc[Ray Tracing]
56+
** xref:courses/18_Ray_tracing/00_Overview.adoc[Overview]
57+
** xref:courses/18_Ray_tracing/01_Dynamic_rendering.adoc[Dynamic rendering]
58+
** xref:courses/18_Ray_tracing/02_Acceleration_structures.adoc[Acceleration structures]
59+
** xref:courses/18_Ray_tracing/03_Ray_query_shadows.adoc[Ray query shadows]
60+
** xref:courses/18_Ray_tracing/04_TLAS_animation.adoc[TLAS animation]
61+
** xref:courses/18_Ray_tracing/05_Shadow_transparency.adoc[Shadow transparency]
62+
** xref:courses/18_Ray_tracing/06_Reflections.adoc[Reflections]
63+
** xref:courses/18_Ray_tracing/07_Conclusion.adoc[Conclusion]
5564
* xref:90_FAQ.adoc[FAQ]

attachments/07_image_views.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ class HelloTriangleApplication
276276

277277
void createImageViews()
278278
{
279-
swapChainImageViews.clear();
279+
assert(swapChainImageViews.empty());
280280

281281
vk::ImageViewCreateInfo imageViewCreateInfo{.viewType = vk::ImageViewType::e2D, .format = swapChainSurfaceFormat.format, .subresourceRange = {vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1}};
282282
for (auto image : swapChainImages)

attachments/08_graphics_pipeline.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ class HelloTriangleApplication
277277

278278
void createImageViews()
279279
{
280-
swapChainImageViews.clear();
280+
assert(swapChainImageViews.empty());
281281

282282
vk::ImageViewCreateInfo imageViewCreateInfo{.viewType = vk::ImageViewType::e2D, .format = swapChainSurfaceFormat.format, .subresourceRange = {vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1}};
283283
for (auto image : swapChainImages)

attachments/09_shader_modules.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,12 @@ class HelloTriangleApplication
197197
[requiredDeviceExtension](auto const &availableDeviceExtension) { return strcmp(availableDeviceExtension.extensionName, requiredDeviceExtension) == 0; });
198198
});
199199

200-
auto features = device.template getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
201-
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
200+
auto features = device.template getFeatures2<vk::PhysicalDeviceFeatures2,
201+
vk::PhysicalDeviceVulkan11Features,
202+
vk::PhysicalDeviceVulkan13Features,
203+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
204+
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan11Features>().shaderDrawParameters &&
205+
features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
202206
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;
203207

204208
return supportsVulkan1_3 && supportsGraphics && supportsAllRequiredExtensions && supportsRequiredFeatures;
@@ -235,11 +239,16 @@ class HelloTriangleApplication
235239
}
236240

237241
// query for Vulkan 1.3 features
238-
vk::StructureChain<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT> featureChain = {
239-
{}, // vk::PhysicalDeviceFeatures2
240-
{.dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
241-
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
242-
};
242+
vk::StructureChain<vk::PhysicalDeviceFeatures2,
243+
vk::PhysicalDeviceVulkan11Features,
244+
vk::PhysicalDeviceVulkan13Features,
245+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>
246+
featureChain = {
247+
{}, // vk::PhysicalDeviceFeatures2
248+
{.shaderDrawParameters = true}, // vk::PhysicalDeviceVulkan11Features
249+
{.dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
250+
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
251+
};
243252

244253
// create a Device
245254
float queuePriority = 0.0f;
@@ -278,7 +287,7 @@ class HelloTriangleApplication
278287

279288
void createImageViews()
280289
{
281-
swapChainImageViews.clear();
290+
assert(swapChainImageViews.empty());
282291

283292
vk::ImageViewCreateInfo imageViewCreateInfo{.viewType = vk::ImageViewType::e2D, .format = swapChainSurfaceFormat.format, .subresourceRange = {vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1}};
284293
for (auto image : swapChainImages)

attachments/10_fixed_functions.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,12 @@ class HelloTriangleApplication
199199
[requiredDeviceExtension](auto const &availableDeviceExtension) { return strcmp(availableDeviceExtension.extensionName, requiredDeviceExtension) == 0; });
200200
});
201201

202-
auto features = device.template getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
203-
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
202+
auto features = device.template getFeatures2<vk::PhysicalDeviceFeatures2,
203+
vk::PhysicalDeviceVulkan11Features,
204+
vk::PhysicalDeviceVulkan13Features,
205+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
206+
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan11Features>().shaderDrawParameters &&
207+
features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
204208
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;
205209

206210
return supportsVulkan1_3 && supportsGraphics && supportsAllRequiredExtensions && supportsRequiredFeatures;
@@ -237,11 +241,16 @@ class HelloTriangleApplication
237241
}
238242

239243
// query for Vulkan 1.3 features
240-
vk::StructureChain<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT> featureChain = {
241-
{}, // vk::PhysicalDeviceFeatures2
242-
{.dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
243-
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
244-
};
244+
vk::StructureChain<vk::PhysicalDeviceFeatures2,
245+
vk::PhysicalDeviceVulkan11Features,
246+
vk::PhysicalDeviceVulkan13Features,
247+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>
248+
featureChain = {
249+
{}, // vk::PhysicalDeviceFeatures2
250+
{.shaderDrawParameters = true}, // vk::PhysicalDeviceVulkan11Features
251+
{.dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
252+
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
253+
};
245254

246255
// create a Device
247256
float queuePriority = 0.0f;
@@ -280,7 +289,7 @@ class HelloTriangleApplication
280289

281290
void createImageViews()
282291
{
283-
swapChainImageViews.clear();
292+
assert(swapChainImageViews.empty());
284293

285294
vk::ImageViewCreateInfo imageViewCreateInfo{.viewType = vk::ImageViewType::e2D, .format = swapChainSurfaceFormat.format, .subresourceRange = {vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1}};
286295
for (auto image : swapChainImages)

attachments/12_graphics_pipeline_complete.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,12 @@ class HelloTriangleApplication
200200
[requiredDeviceExtension](auto const &availableDeviceExtension) { return strcmp(availableDeviceExtension.extensionName, requiredDeviceExtension) == 0; });
201201
});
202202

203-
auto features = device.template getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
204-
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
203+
auto features = device.template getFeatures2<vk::PhysicalDeviceFeatures2,
204+
vk::PhysicalDeviceVulkan11Features,
205+
vk::PhysicalDeviceVulkan13Features,
206+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
207+
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan11Features>().shaderDrawParameters &&
208+
features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
205209
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;
206210

207211
return supportsVulkan1_3 && supportsGraphics && supportsAllRequiredExtensions && supportsRequiredFeatures;
@@ -238,11 +242,16 @@ class HelloTriangleApplication
238242
}
239243

240244
// query for Vulkan 1.3 features
241-
vk::StructureChain<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT> featureChain = {
242-
{}, // vk::PhysicalDeviceFeatures2
243-
{.dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
244-
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
245-
};
245+
vk::StructureChain<vk::PhysicalDeviceFeatures2,
246+
vk::PhysicalDeviceVulkan11Features,
247+
vk::PhysicalDeviceVulkan13Features,
248+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>
249+
featureChain = {
250+
{}, // vk::PhysicalDeviceFeatures2
251+
{.shaderDrawParameters = true}, // vk::PhysicalDeviceVulkan11Features
252+
{.dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
253+
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
254+
};
246255

247256
// create a Device
248257
float queuePriority = 0.0f;
@@ -281,7 +290,7 @@ class HelloTriangleApplication
281290

282291
void createImageViews()
283292
{
284-
swapChainImageViews.clear();
293+
assert(swapChainImageViews.empty());
285294

286295
vk::ImageViewCreateInfo imageViewCreateInfo{.viewType = vk::ImageViewType::e2D, .format = swapChainSurfaceFormat.format, .subresourceRange = {vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1}};
287296
for (auto image : swapChainImages)

attachments/14_command_buffers.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,12 @@ class HelloTriangleApplication
205205
[requiredDeviceExtension](auto const &availableDeviceExtension) { return strcmp(availableDeviceExtension.extensionName, requiredDeviceExtension) == 0; });
206206
});
207207

208-
auto features = device.template getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
209-
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
208+
auto features = device.template getFeatures2<vk::PhysicalDeviceFeatures2,
209+
vk::PhysicalDeviceVulkan11Features,
210+
vk::PhysicalDeviceVulkan13Features,
211+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
212+
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan11Features>().shaderDrawParameters &&
213+
features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
210214
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;
211215

212216
return supportsVulkan1_3 && supportsGraphics && supportsAllRequiredExtensions && supportsRequiredFeatures;
@@ -242,11 +246,16 @@ class HelloTriangleApplication
242246
}
243247

244248
// query for Vulkan 1.3 features
245-
vk::StructureChain<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT> featureChain = {
246-
{}, // vk::PhysicalDeviceFeatures2
247-
{.dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
248-
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
249-
};
249+
vk::StructureChain<vk::PhysicalDeviceFeatures2,
250+
vk::PhysicalDeviceVulkan11Features,
251+
vk::PhysicalDeviceVulkan13Features,
252+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>
253+
featureChain = {
254+
{}, // vk::PhysicalDeviceFeatures2
255+
{.shaderDrawParameters = true}, // vk::PhysicalDeviceVulkan11Features
256+
{.dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
257+
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
258+
};
250259

251260
// create a Device
252261
float queuePriority = 0.0f;
@@ -285,7 +294,7 @@ class HelloTriangleApplication
285294

286295
void createImageViews()
287296
{
288-
swapChainImageViews.clear();
297+
assert(swapChainImageViews.empty());
289298

290299
vk::ImageViewCreateInfo imageViewCreateInfo{.viewType = vk::ImageViewType::e2D, .format = swapChainSurfaceFormat.format, .subresourceRange = {vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1}};
291300
for (auto image : swapChainImages)

attachments/15_hello_triangle.cpp

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,13 @@ class HelloTriangleApplication
214214
[requiredDeviceExtension](auto const &availableDeviceExtension) { return strcmp(availableDeviceExtension.extensionName, requiredDeviceExtension) == 0; });
215215
});
216216

217-
auto features = device.template getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
218-
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
217+
auto features = device.template getFeatures2<vk::PhysicalDeviceFeatures2,
218+
vk::PhysicalDeviceVulkan11Features,
219+
vk::PhysicalDeviceVulkan13Features,
220+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
221+
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan11Features>().shaderDrawParameters &&
222+
features.template get<vk::PhysicalDeviceVulkan13Features>().synchronization2 &&
223+
features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
219224
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;
220225

221226
return supportsVulkan1_3 && supportsGraphics && supportsAllRequiredExtensions && supportsRequiredFeatures;
@@ -251,11 +256,16 @@ class HelloTriangleApplication
251256
}
252257

253258
// query for Vulkan 1.3 features
254-
vk::StructureChain<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT> featureChain = {
255-
{}, // vk::PhysicalDeviceFeatures2
256-
{.synchronization2 = true, .dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
257-
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
258-
};
259+
vk::StructureChain<vk::PhysicalDeviceFeatures2,
260+
vk::PhysicalDeviceVulkan11Features,
261+
vk::PhysicalDeviceVulkan13Features,
262+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>
263+
featureChain = {
264+
{}, // vk::PhysicalDeviceFeatures2
265+
{.shaderDrawParameters = true}, // vk::PhysicalDeviceVulkan11Features
266+
{.synchronization2 = true, .dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
267+
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
268+
};
259269

260270
// create a Device
261271
float queuePriority = 0.0f;
@@ -294,10 +304,10 @@ class HelloTriangleApplication
294304

295305
void createImageViews()
296306
{
297-
swapChainImageViews.clear();
307+
assert(swapChainImageViews.empty());
298308

299309
vk::ImageViewCreateInfo imageViewCreateInfo{.viewType = vk::ImageViewType::e2D, .format = swapChainSurfaceFormat.format, .subresourceRange = {vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1}};
300-
for (auto image : swapChainImages)
310+
for (auto &image : swapChainImages)
301311
{
302312
imageViewCreateInfo.image = image;
303313
swapChainImageViews.emplace_back(device, imageViewCreateInfo);

0 commit comments

Comments
 (0)