-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
attempt to deal with rounding issue when creating the swap chain #997
Conversation
c00c9d5
to
5f622a4
Compare
I think |
5f622a4
to
897387a
Compare
7f2d68d
to
1b6d1c4
Compare
* 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
Looks good to me! Thanks 😄 |
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
&height
becomelogical_width
&logical_height
,scaled_width
&scaled_height
becomephysical_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 tof32
so it can better represent sizes that are a fraction of a pixel.