-
Notifications
You must be signed in to change notification settings - Fork 938
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
[metal] Use raw-window-metal
to do layer creation
#6210
base: trunk
Are you sure you want to change the base?
Conversation
9d04bcc
to
dad5c3c
Compare
This uses observers internally, which fixes resizing when using Wgpu together with an auto-layout NSView. Though it probably won't matter much, it's also more reliable to update the scale factor this way, rather than haphazardly in `configure`.
dad5c3c
to
ffabb52
Compare
This is no longer necessary, since Winit can now properly issue redraw events on resize.
3714887
to
9565109
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very appreciated, having that code as part of raw-window-metal
sounds great to me :)
As pointed out this will have to wait for the objc2 pr to be approved. cc: @jimblandy
(therefore not putting ✔️ just yet so this doesn't get merged ahead of time)
I've tested this and it still adds some noticeable (especially in comparison) with the way it was before previous PR (#6107) had been merged. I've gone into a bit further details here #6107 (comment). |
You know, all that code and documentation I just wrote in #6107? Let's throw it
awayinto a library, so thatwgpu
,ash
,vulkano
,i-slint-renderer-skia
and so on can all benefit from it.raw-window-metal
is that library (existed previously, I've updated it in rust-windowing/raw-window-metal#19).This makes Wgpu depend transitively on
objc2
, so the concerns about doing that apply here as well, see also #5641.Description
Use the
raw-window-metal
crate to do layer creation. This uses much the same approach as we do currently, except that it also uses observers internally, which fixes resizing on high DPI screens when using Wgpu together with anNSView
using auto-layout.Though it probably won't matter much, it's also more reliable to update the scale factor this way, rather than haphazardly in
configure
.The logic in
raw-window-metal
could be re-implemented in Wgpu to avoid the dependency, however I deemed it complex enough that I thought it wiser to centralize the implementation in one place.Testing
See #6107 (comment).
Checklist
cargo fmt
.cargo clippy
.cargo xtask test
to run tests.CHANGELOG.md
. See simple instructions inside file.