Skip to content

Commit c5729e9

Browse files
committed
Merge branch 'upstream-main' into Vulkan-Compute-advanced-tutorial
# Conflicts: # antora/modules/ROOT/nav.adoc
2 parents 92bf2b5 + f1be81e commit c5729e9

67 files changed

Lines changed: 28417 additions & 5 deletions

File tree

Some content is hidden

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

antora/modules/ROOT/nav.adoc

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
** xref:courses/18_Ray_tracing/05_Shadow_transparency.adoc[Shadow transparency]
6262
** xref:courses/18_Ray_tracing/06_Reflections.adoc[Reflections]
6363
** xref:courses/18_Ray_tracing/07_Conclusion.adoc[Conclusion]
64+
* xref:courses/siggraph2026_vk_tutorial/00_Overview.adoc[How to write a Vulkan application in 2026]
6465
* xref:90_FAQ.adoc[FAQ]
6566
* link:https://github.com/KhronosGroup/Vulkan-Tutorial[GitHub Repository, window=_blank]
6667
@@ -202,3 +203,51 @@
202203
*** xref:Advanced_Vulkan_Compute/11_Diagnostics_and_Refinement/02_compute_validation.adoc[Compute Validation]
203204
*** xref:Advanced_Vulkan_Compute/11_Diagnostics_and_Refinement/03_assistant_led_optimization.adoc[Assistant-Led Optimization]
204205
** xref:Advanced_Vulkan_Compute/conclusion.adoc[Conclusion]
206+
207+
* Synchronization 2
208+
** xref:Synchronization/introduction.adoc[Introduction]
209+
** Anatomy of a Dependency
210+
*** xref:Synchronization/Anatomy_of_a_Dependency/01_introduction.adoc[Introduction]
211+
*** xref:Synchronization/Anatomy_of_a_Dependency/02_execution_vs_memory.adoc[Execution vs. Memory]
212+
*** xref:Synchronization/Anatomy_of_a_Dependency/03_sync2_advantage.adoc[Sync 2 Advantage]
213+
*** xref:Synchronization/Anatomy_of_a_Dependency/04_refined_pipeline_stages.adoc[Refined Pipeline Stages]
214+
*** xref:Synchronization/Anatomy_of_a_Dependency/05_conclusion.adoc[Conclusion]
215+
** Pipeline Barriers and Transitions
216+
*** xref:Synchronization/Pipeline_Barriers_Transitions/01_introduction.adoc[Introduction]
217+
*** xref:Synchronization/Pipeline_Barriers_Transitions/02_image_barrier.adoc[The Image Barrier]
218+
*** xref:Synchronization/Pipeline_Barriers_Transitions/03_queue_family_ownership.adoc[Queue Family Ownership]
219+
*** xref:Synchronization/Pipeline_Barriers_Transitions/04_global_vs_local_barriers.adoc[Global vs. Local Barriers]
220+
** Timeline Semaphores
221+
*** xref:Synchronization/Timeline_Semaphores/01_introduction.adoc[Introduction]
222+
*** xref:Synchronization/Timeline_Semaphores/02_unifying_sync.adoc[Unifying Sync]
223+
*** xref:Synchronization/Timeline_Semaphores/03_monotonic_counter.adoc[Monotonic Counter]
224+
*** xref:Synchronization/Timeline_Semaphores/04_wait_before_signal.adoc[Wait Before Signal]
225+
** Frame-in-Flight Architecture
226+
*** xref:Synchronization/Frame_in_Flight/01_introduction.adoc[Introduction]
227+
*** xref:Synchronization/Frame_in_Flight/02_managing_concurrent_frames.adoc[Managing Concurrent Frames]
228+
*** xref:Synchronization/Frame_in_Flight/03_resource_lifetimes.adoc[Resource Lifetimes]
229+
** Asynchronous Compute & Overlap
230+
*** xref:Synchronization/Async_Compute_Overlap/01_introduction.adoc[Introduction]
231+
*** xref:Synchronization/Async_Compute_Overlap/02_maximizing_throughput.adoc[Maximizing Throughput]
232+
*** xref:Synchronization/Async_Compute_Overlap/03_async_post_processing.adoc[Async Post-processing]
233+
*** xref:Synchronization/Async_Compute_Overlap/04_bubble_problem.adoc[The Bubble Problem]
234+
** Transfer Queues & Asset Streaming Sync
235+
*** xref:Synchronization/Transfer_Queues_Streaming/01_introduction.adoc[Introduction]
236+
*** xref:Synchronization/Transfer_Queues_Streaming/02_non_blocking_uploads.adoc[Non-blocking Uploads]
237+
*** xref:Synchronization/Transfer_Queues_Streaming/03_staging_sync.adoc[Staging Sync]
238+
** Synchronization in Dynamic Rendering
239+
*** xref:Synchronization/Dynamic_Rendering_Sync/01_introduction.adoc[Introduction]
240+
*** xref:Synchronization/Dynamic_Rendering_Sync/02_subpass_replacement.adoc[Subpass Replacement]
241+
*** xref:Synchronization/Dynamic_Rendering_Sync/03_local_read_sync.adoc[Local Read Sync]
242+
** Host Image Copies & Memory Mapped Sync
243+
*** xref:Synchronization/Host_Image_Copies_Memory_Sync/01_introduction.adoc[Introduction]
244+
*** xref:Synchronization/Host_Image_Copies_Memory_Sync/02_cpu_to_image_access.adoc[CPU-to-Image Access]
245+
*** xref:Synchronization/Host_Image_Copies_Memory_Sync/03_visibility_flushes.adoc[Visibility Flushes]
246+
** Debugging with Synchronization Validation
247+
*** xref:Synchronization/Synchronization_Validation/01_introduction.adoc[Introduction]
248+
*** xref:Synchronization/Synchronization_Validation/02_validation_layer.adoc[Validation Layer]
249+
*** xref:Synchronization/Synchronization_Validation/03_interpreting_vuids.adoc[Interpreting VUIDs]
250+
** Profiling, Batching, and Optimization
251+
*** xref:Synchronization/Profiling_Optimization/01_introduction.adoc[Introduction]
252+
*** xref:Synchronization/Profiling_Optimization/02_barrier_batching.adoc[Barrier Batching]
253+
*** xref:Synchronization/Profiling_Optimization/03_visualizing_stalls.adoc[Visualizing Stalls]

attachments/38_ray_tracing.cpp

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,7 @@ struct UniformBufferObject
106106
struct PushConstant
107107
{
108108
uint32_t materialIndex;
109-
#if LAB_TASK_LEVEL >= LAB_TASK_REFLECTIONS
110-
// TASK11
111109
uint32_t reflective;
112-
#endif // LAB_TASK_LEVEL >= LAB_TASK_REFLECTIONS
113110
};
114111

115112
class VulkanRaytracingApplication
@@ -123,6 +120,14 @@ class VulkanRaytracingApplication
123120
cleanup();
124121
}
125122

123+
~VulkanRaytracingApplication()
124+
{
125+
if (*device)
126+
{
127+
device.waitIdle();
128+
}
129+
}
130+
126131
private:
127132
GLFWwindow *window = nullptr;
128133

@@ -1645,6 +1650,8 @@ class VulkanRaytracingApplication
16451650
.materialIndex = sub.materialID < 0 ? 0u : static_cast<uint32_t>(sub.materialID),
16461651
#if LAB_TASK_LEVEL >= LAB_TASK_REFLECTIONS
16471652
.reflective = sub.reflective
1653+
#else
1654+
.reflective = 0u
16481655
#endif // LAB_TASK_LEVEL >= LAB_TASK_REFLECTIONS
16491656
};
16501657
commandBuffer.pushConstants<PushConstant>(pipelineLayout, vk::ShaderStageFlagBits::eFragment, 0, pushConstant);
@@ -1845,7 +1852,19 @@ class VulkanRaytracingApplication
18451852
throw std::runtime_error("failed to wait for fence!");
18461853
}
18471854

1848-
auto [result, imageIndex] = swapChain.acquireNextImage(UINT64_MAX, *presentCompleteSemaphores[frameIndex], nullptr);
1855+
vk::Result result;
1856+
uint32_t imageIndex;
1857+
try
1858+
{
1859+
auto res = swapChain.acquireNextImage(UINT64_MAX, *presentCompleteSemaphores[frameIndex], nullptr);
1860+
result = res.result;
1861+
imageIndex = res.value;
1862+
}
1863+
catch (const vk::OutOfDateKHRError &e)
1864+
{
1865+
recreateSwapChain();
1866+
return;
1867+
}
18491868

18501869
// Due to VULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS being defined, eErrorOutOfDateKHR can be checked as a result
18511870
// here and does not need to be caught by an exception.
@@ -1888,7 +1907,14 @@ class VulkanRaytracingApplication
18881907
.swapchainCount = 1,
18891908
.pSwapchains = &*swapChain,
18901909
.pImageIndices = &imageIndex};
1891-
result = presentQueue.presentKHR(presentInfoKHR);
1910+
try
1911+
{
1912+
result = presentQueue.presentKHR(presentInfoKHR);
1913+
}
1914+
catch (const vk::OutOfDateKHRError &e)
1915+
{
1916+
result = vk::Result::eErrorOutOfDateKHR;
1917+
}
18921918
// Due to VULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS being defined, eErrorOutOfDateKHR can be checked as a result
18931919
// here and does not need to be caught by an exception.
18941920
if ((result == vk::Result::eSuboptimalKHR) || (result == vk::Result::eErrorOutOfDateKHR) || framebufferResized)

0 commit comments

Comments
 (0)