Swapchain
This wording (emphasis added)
First step is getting the correct extent of the swapchain.
Is confusing.
docs.vulkan.org/VkSwapchainCreateInfoKHR says:
imageExtent [...] The behavior is platform-dependent if the image extent does not match the surface’s currentExtent as returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR.
However, later, in the if (updateSwapchain) block, imageExtent is changed to windowSize on a window resize.
Suggestion: do one of these things:
- delete the
if (surfaceCaps.currentExtent.width == 0xFFFFFFFF) block and set the value of swapchainExtent to the value of windowSize (both in the tutorial text and in the source code); remove the entire paragraph that starts with the sentence "First step is getting the correct extent of the swapchain."
- improve the explanation in "Swapchain" and/or "Recreate swapchain" with more detail on the reason for apparent inconsistency in (not) comparing
currentExtent as returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR with the window size as returned by SDL_GetWindowSize.
- if the current "Recreate swapchain" implementation is incorrect, and it should indeed use the extent values from
vkGetPhysicalDeviceSurfaceCapabilitiesKHR when possible, modify the "Recreate swapchain" implementation to do so (both in the tutorial text and in the source code).
Swapchain
This wording (emphasis added)
Is confusing.
docs.vulkan.org/VkSwapchainCreateInfoKHR says:
However, later, in the
if (updateSwapchain)block,imageExtentis changed to windowSize on a window resize.Suggestion: do one of these things:
if (surfaceCaps.currentExtent.width == 0xFFFFFFFF)block and set the value of swapchainExtent to the value of windowSize (both in the tutorial text and in the source code); remove the entire paragraph that starts with the sentence "First step is getting the correct extent of the swapchain."currentExtentas returned byvkGetPhysicalDeviceSurfaceCapabilitiesKHRwith the window size as returned bySDL_GetWindowSize.vkGetPhysicalDeviceSurfaceCapabilitiesKHRwhen possible, modify the "Recreate swapchain" implementation to do so (both in the tutorial text and in the source code).