Advice on interactive window resizing and vulkan swapchain recreation


With interactive resizing I mean click-dragging the window borders. So I registered a window size callback, which receives lot of messages in one resizing manipulation. Recreating vulkans swapchain, its image views, framebuffers, additional images (depth) and all related command buffers per resize message does not seem to be a smart method (it crashed my driver several times. I confirmed that one, even few, recreations work).
What I would like is to get the final message at the end of the resizing manipulation releasing the left mouse button. Unfortunately mouse button events are not registered at the window borders (decorations?), so I don’t see any way how this final event could be detected. Any advise how I could achieve the described functionality? I would prefer not to “wait for some time” and check if further resize messages are received.

Cheers, PP


Quick question for more information: are you doing more than one resize of your resources per frame, or ensuring you only do it once per frame?


Thanks Doug, you opened my eyes. In fact all the resize events are coming in one frame and the my render loop is paused. I assumed that the loop keeps running while resizing.
With the loop being paused its trivial to get the final event and resize once. Works like a charm now :slight_smile:


Glad you’ve solved it!

An alternative approach to using the event callbacks is to query window size with glfwGetWindowSize at the start of every frame on your main render thread, then do any device resource resizing if needed.