Skip to content

Commit 18233af

Browse files
committed
Update documentation on swap chain recreation.
1 parent c57e29c commit 18233af

21 files changed

Lines changed: 99 additions & 56 deletions

attachments/17_swap_chain_recreation.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,13 +522,15 @@ class HelloTriangleApplication
522522
}
523523
// On other success codes than eSuccess and eSuboptimalKHR we just throw an exception.
524524
// On any error code, aquireNextImage already threw an exception.
525-
if (result != vk::Result::eSuccess && result != vk::Result::eSuboptimalKHR)
525+
else if (result != vk::Result::eSuccess && result != vk::Result::eSuboptimalKHR)
526526
{
527527
assert(result == vk::Result::eTimeout || result == vk::Result::eNotReady);
528528
throw std::runtime_error("failed to acquire swap chain image!");
529529
}
530530

531+
// Only reset the fence if we are submitting work
531532
device.resetFences(*inFlightFences[frameIndex]);
533+
532534
commandBuffers[frameIndex].reset();
533535
recordCommandBuffer(imageIndex);
534536

attachments/18_vertex_input.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,9 @@ class HelloTriangleApplication
547547
throw std::runtime_error("failed to acquire swap chain image!");
548548
}
549549

550+
// Only reset the fence if we are submitting work
550551
device.resetFences(*inFlightFences[frameIndex]);
552+
551553
commandBuffers[frameIndex].reset();
552554
recordCommandBuffer(imageIndex);
553555

attachments/19_vertex_buffer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,9 @@ class HelloTriangleApplication
583583
throw std::runtime_error("failed to acquire swap chain image!");
584584
}
585585

586+
// Only reset the fence if we are submitting work
586587
device.resetFences(*inFlightFences[frameIndex]);
588+
587589
commandBuffers[frameIndex].reset();
588590
recordCommandBuffer(imageIndex);
589591

attachments/20_staging_buffer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,9 @@ class HelloTriangleApplication
603603
throw std::runtime_error("failed to acquire swap chain image!");
604604
}
605605

606+
// Only reset the fence if we are submitting work
606607
device.resetFences(*inFlightFences[frameIndex]);
608+
607609
commandBuffers[frameIndex].reset();
608610
recordCommandBuffer(imageIndex);
609611

attachments/21_index_buffer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,9 @@ class HelloTriangleApplication
629629
throw std::runtime_error("failed to acquire swap chain image!");
630630
}
631631

632+
// Only reset the fence if we are submitting work
632633
device.resetFences(*inFlightFences[frameIndex]);
634+
633635
commandBuffers[frameIndex].reset();
634636
recordCommandBuffer(imageIndex);
635637

attachments/22_descriptor_layout.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,9 @@ class HelloTriangleApplication
689689
}
690690
updateUniformBuffer(frameIndex);
691691

692+
// Only reset the fence if we are submitting work
692693
device.resetFences(*inFlightFences[frameIndex]);
694+
693695
commandBuffers[frameIndex].reset();
694696
recordCommandBuffer(imageIndex);
695697

attachments/23_descriptor_sets.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,9 @@ class HelloTriangleApplication
717717
}
718718
updateUniformBuffer(frameIndex);
719719

720+
// Only reset the fence if we are submitting work
720721
device.resetFences(*inFlightFences[frameIndex]);
722+
721723
commandBuffers[frameIndex].reset();
722724
recordCommandBuffer(imageIndex);
723725

attachments/24_texture_image.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,9 @@ class HelloTriangleApplication
826826
}
827827
updateUniformBuffer(frameIndex);
828828

829+
// Only reset the fence if we are submitting work
829830
device.resetFences(*inFlightFences[frameIndex]);
831+
830832
commandBuffers[frameIndex].reset();
831833
recordCommandBuffer(imageIndex);
832834

attachments/25_sampler.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,9 @@ class HelloTriangleApplication
862862
}
863863
updateUniformBuffer(frameIndex);
864864

865+
// Only reset the fence if we are submitting work
865866
device.resetFences(*inFlightFences[frameIndex]);
867+
866868
commandBuffers[frameIndex].reset();
867869
recordCommandBuffer(imageIndex);
868870

attachments/26_texture_mapping.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,9 @@ class HelloTriangleApplication
927927
}
928928
updateUniformBuffer(frameIndex);
929929

930+
// Only reset the fence if we are submitting work
930931
device.resetFences(*inFlightFences[frameIndex]);
932+
931933
commandBuffers[frameIndex].reset();
932934
recordCommandBuffer(imageIndex);
933935

0 commit comments

Comments
 (0)