Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viewport Position after Resize #2533

Open
matt328 opened this issue Apr 10, 2024 · 4 comments
Open

Viewport Position after Resize #2533

matt328 opened this issue Apr 10, 2024 · 4 comments
Labels
support Vulkan Windows Win32 specific (not Cygwin or WSL)

Comments

@matt328
Copy link

matt328 commented Apr 10, 2024

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.

@dougbinks dougbinks added Windows Win32 specific (not Cygwin or WSL) Vulkan support labels Apr 10, 2024
@dougbinks
Copy link
Contributor

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.

@matt328
Copy link
Author

matt328 commented Apr 10, 2024

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.

@dougbinks
Copy link
Contributor

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).

@dougbinks
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Vulkan Windows Win32 specific (not Cygwin or WSL)
Projects
None yet
Development

No branches or pull requests

2 participants