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 Surface::frome_uiview can not guarantee set correct contentScaleFactor #2470

Merged
merged 1 commit into from
Feb 10, 2022
Merged

Fix Surface::frome_uiview can not guarantee set correct contentScaleFactor #2470

merged 1 commit into from
Feb 10, 2022

Conversation

jinleili
Copy link
Contributor

Description
On iOS, Surface::from_uiview may be called before the application initialization is complete (when using winit to manage windows and events), msg_send![view, window] or msg_send![window, screen] will get null, then, view's contentScaleFactor remain default 1. The correct value should be between [2.0, 3.0], depending on physical device.

from_uiview is the same as from_nsview more than half of code, so, merged together.

Testing
Tested wgpu + winit on iOS, follow the implementation of bevy's iOS demo.
Tested winit-free mode on iOS, use wgpu-on-app.
Tested all Wgpu's examples on M1 Mac(macOS 12.2)

Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

wgpu-hal/src/metal/surface.rs Show resolved Hide resolved
@kvark kvark merged commit 48f8811 into gfx-rs:master Feb 10, 2022
@kvark kvark added the PR: needs back-porting PR with a fix that needs to land on crates label Feb 10, 2022
@cwfitzgerald cwfitzgerald removed the PR: needs back-porting PR with a fix that needs to land on crates label Feb 9, 2023
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.

3 participants