MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / resize

Method resize

samples/api/hello_triangle/hello_triangle.cpp:1146–1173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1144}
1145
1146bool HelloTriangle::resize(const uint32_t, const uint32_t)
1147{
1148 if (context.device == VK_NULL_HANDLE)
1149 {
1150 return false;
1151 }
1152
1153 VkSurfaceCapabilitiesKHR surface_properties;
1154 VK_CHECK(vkGetPhysicalDeviceSurfaceCapabilitiesKHR(context.gpu, context.surface, &surface_properties));
1155
1156 // Only rebuild the swapchain if the dimensions have changed
1157 if (surface_properties.currentExtent.width == context.swapchain_dimensions.width &&
1158 surface_properties.currentExtent.height == context.swapchain_dimensions.height)
1159 {
1160 return false;
1161 }
1162
1163 vkDeviceWaitIdle(context.device);
1164
1165 for (auto &framebuffer : context.swapchain_framebuffers)
1166 {
1167 vkDestroyFramebuffer(context.device, framebuffer, nullptr);
1168 }
1169
1170 init_swapchain();
1171 init_framebuffers();
1172 return true;
1173}
1174
1175std::unique_ptr<vkb::Application> create_hello_triangle()
1176{

Callers 1

init_swapchainMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected