I have followed the tutorial at https://vulkan-tutorial.com... I created it without using the GLFW etension. So far I'm up to "Swap chain Recreation", and all is setup and rendering correctly.
However, I can't seem to get resizing working correctly!
I've hooked into the XCB_RESIZE_REQUEST
and am setting my info struct w/h like so:
if (resize->width > 0) { info.width = resize->width; }
if (resize->height > 0) { info.height = resize->height; }
info.framebufferResized = true;
Which causes (in the next drawFrame()
call) recreateSwapchain()
to be called:
if (res == VK_ERROR_OUT_OF_DATE_KHR || res == VK_SUBOPTIMAL_KHR || info.framebufferResized) {
info.framebufferResized = false;
recreateSwapchain();
} else if (res != VK_SUCCESS) {
throw runtime_error("failed to present swap chain image!");
}
recreateSwapchain() {
vkDeviceWaitIdle(info.device);
cleanupSwapchain();
querySwapchainSupport(info.physicalDevice);
createSwapchain();
createImageViews();
createRenderPass();
createGraphicsPipeline();
createFramebuffers();
createCommandBuffers();
}
I've done some debugging, and have found that the swapchainSupport.capabilities.minImageExtent.width
(and height) do not change from the initial values!.. That is, this call
querySwapchainSupport(VkPhysicalDevice physicalDevice) {
VkResult res = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
physicalDevice, info.surface, &info.swapchainSupport.capabilities);
assert(res == VK_SUCCESS);
Does not update the info.swapchainSupport.capabilities
with new window size.
Any help, or comments would be greatly appreciated.
Example Screenshot:
minImageExtent
instead ofcurrentExtent
? – Monterrey