Skip to content

Commit

Permalink
Remove unnecessary access to the old swapchain just for getting image…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
SaschaWillems authored Dec 2, 2024
1 parent 42cc427 commit bee3fcf
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions samples/api/hello_triangle/hello_triangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,12 +539,9 @@ void HelloTriangle::init_swapchain()
vkDestroyImageView(context.device, image_view, nullptr);
}

uint32_t image_count;
VK_CHECK(vkGetSwapchainImagesKHR(context.device, old_swapchain, &image_count, nullptr));

for (size_t i = 0; i < image_count; i++)
for (auto &per_frame : context.per_frame)
{
teardown_per_frame(context.per_frame[i]);
teardown_per_frame(per_frame);
}

context.swapchain_image_views.clear();
Expand Down

0 comments on commit bee3fcf

Please sign in to comment.