glfw/glfw

Viewport Position after Resize

matt328 opened this issue · 4 comments

I'm using glfw 3.4 with Vulkan 1.3.261 on Windows 10. I've just switched from 'static' viewport and scissor specified in the Vulkan pipeline object to dynamic viewport and scissor specified when recording the command buffer, and now when I resize my window, this happens:

image

It looks like the position of the rendered area isn't taking into account the window decorations. The strange part is when I move the window, even a single pixel, it corrects itself. Also strange is the ImGui controls' hitboxes are in the correct areas despite the rendered image being shifted.

One thing I suspect might be an issue is I'm only recreating my swapchain based on if acquireNextImage or present returns an error rather than by using the glfw framebuffersize callback. This worked before with static viewport and scissor, and it also works on Windows 11, so I'm not sure changing all that is worthwhile or not.

This project is a little beyond a small self contained example, so if there's any sections of code that would be helpful I can post or link to them.

I've labelled this as a support issue (question) as I think you're looking for help with Vulkan in achieving what you want.

If this is instead an issue report let me know, however GLFW itself doesn't interact with Vulkan other than to provide some assistance functions for cross platform device and surface creation.

You mention using ImGui: if you are using Dear ImGui perhaps try their GLFW + Vulkan example to check if it has the same issue, and also make sure to run with the debug validation layer.

Yeah, I wasn't really sure where to start with this. Was kinda hoping someone might have some insight into what dragging the window does in glfw that might cause this to correct itself. So yeah it's definitely a support question for now.

when I resize my window, this happens

Was kinda hoping someone might have some insight into what dragging the window does in glfw

When you resize a GLFW window the operating system / windowing system handles the resizing and GLFW simply receives event information. Everything else with Vulkan is up to the client code. I'm not sure what would cause the symptoms you see but would start with debug validation layers and comparing the difference between your application and a known working example (such as the Dear ImGui GLFW + Vulkan demo).

I was able to get time to test my own projects and also Dear ImGui GLFW + Vulkan demo (which my Vulkan code is somewhat based off), and both work as expected under Windows 11 with GLFW 3.4 and Vulkan SDK 1.3.275.