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

Fix 2583. #2584

Merged
merged 5 commits into from
Oct 20, 2024
Merged

Fix 2583. #2584

merged 5 commits into from
Oct 20, 2024

Conversation

coolcatcoder
Copy link
Contributor

Fixes 2583. It seems that triangle-util is the only example that fell into this trap, but there are a lot of examples, so I can't say for certain.

@marc0246
Copy link
Contributor

marc0246 commented Oct 20, 2024

I noticed this as well and yes this is the only example that suffers from this I think. But I would have preferred it if you did it the same way every other example does it, that is, update the viewport when recreating the swapchain.

The docs of Viewport are talking about the viewport(s) you pass when creating ViewportState. The idea is that you use ViewportState::default() when creating the pipeline with dynamic viewport state. The fact that this default exists at all is IMO a footgun, but unrelated to this issue. You can forget to update the viewport using static or dynamic viewport state; it's entirely unrelated to this.

All in all I think the only change should be this:

                         // Whenever the window resizes we need to recreate everything dependent
                         // on the window size. In this example that
                         // includes the swapchain, the framebuffers
                         // and the dynamic state viewport.
                         rcx.framebuffers =
                             window_size_dependent_setup(swapchain_images, &rcx.render_pass);
+                        rcx.viewport = window_size.into();

@coolcatcoder
Copy link
Contributor Author

Cool, thanks!

@marc0246
Copy link
Contributor

Awesome, thank you!

@marc0246 marc0246 merged commit 0815e76 into vulkano-rs:master Oct 20, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Viewport extent documentation and examples are wrong.
2 participants