Skip to content

Commit bee3fcf

Browse files
Remove unnecessary access to the old swapchain just for getting image count (#1227)
The image count is only used to teardown per-frame resources That's already a vector, so we can simply iterate over that
1 parent 42cc427 commit bee3fcf

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

samples/api/hello_triangle/hello_triangle.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -539,12 +539,9 @@ void HelloTriangle::init_swapchain()
539539
vkDestroyImageView(context.device, image_view, nullptr);
540540
}
541541

542-
uint32_t image_count;
543-
VK_CHECK(vkGetSwapchainImagesKHR(context.device, old_swapchain, &image_count, nullptr));
544-
545-
for (size_t i = 0; i < image_count; i++)
542+
for (auto &per_frame : context.per_frame)
546543
{
547-
teardown_per_frame(context.per_frame[i]);
544+
teardown_per_frame(per_frame);
548545
}
549546

550547
context.swapchain_image_views.clear();

0 commit comments

Comments
 (0)