Resizing the display window
When a display window resizes, the Vulkan application is given the new window dimensions to re-paint the drawing images. On the Windows platform, the WM_SIZE
message of the associated window's procedure can be used to indicate the change in the dimension size as shown in the following highlighted code. The new changes added to the WndProc()
function are highlighted with bold; the new dimension size is updated to the VulkanSwapChain
class using the setSwapChainExtent()
function, which will be later used to recreate the new swapchain images with the indicated dimensions:
LRESULT CALLBACK VulkanRenderer::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { VulkanApplication* appObj = VulkanApplication::GetInstance(); switch (uMsg) { case WM_CLOSE: PostQuitMessage(0); break; case WM_PAINT: // Many lines skipped please, refer to the source code case WM_SIZE: if (wParam != SIZE_MINIMIZED) { appObj->rendererObj...