attempt to deal with rounding issue when creating the swap chain#997
Merged
cart merged 4 commits intobevyengine:masterfrom Dec 7, 2020
Merged
attempt to deal with rounding issue when creating the swap chain#997cart merged 4 commits intobevyengine:masterfrom
cart merged 4 commits intobevyengine:masterfrom
Conversation
c00c9d5 to
5f622a4
Compare
Member
|
I think |
cart
reviewed
Dec 4, 2020
5f622a4 to
897387a
Compare
7f2d68d to
1b6d1c4
Compare
added 4 commits
December 7, 2020 12:04
* fix window size on creation * rename `logical_width` & `logical_height` back to `width` & `height` * update `Camera` trait to take width/height as `f32` * update `WindowResized` to report 'f32' sizes instead if `u32` * update `WindowCommand::SetResolution` to pass physical resolution instead of logical * put `set_resolution` back, now taking `f32` instead of `u32` * remove several unneeded `as f32`s now that `width` & `height` returns `f32`
* add back `logical_width` & `logical_height` so that code that wants full precision still has access, updated several places in engine that wanted `f32` to use these.
1b6d1c4 to
5ab7184
Compare
Member
|
Looks good to me! Thanks 😄 |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While resizing a window on a high DPI display, some window sizes cause an off by one error when recalculating the physical size of the window. This causes the swap chain to fail to resize until the window resized again to a "good" resolution. The issue is caused by the logical size being stored as an integer which looses precision when calculated from the physical size.
This patch attempts to solve the issue by storing the physical resolution of the window instead of the logical resolution. As part of the effort,
width&heightbecomelogical_width&logical_height,scaled_width&scaled_heightbecomephysical_width&physical_height. This requires touching a number of things and will probably break downstream users. It also changes the type of the components of the logical size tof32so it can better represent sizes that are a fraction of a pixel.