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

Update wgpu to 0.19, glyphon to 0.5, softbuffer to 0.4, window-clipboard to 0.4, and raw-window-handle to 0.6 #2191

Merged
merged 16 commits into from
Jan 19, 2024

Conversation

ids1024
Copy link
Contributor

@ids1024 ids1024 commented Jan 10, 2024

Based on #2169 and #2190. This updates wgpu to the latest trunk (the last release doesn't use raw-window-handle 0.6).

This can't be merged until those two PRs are, and when a wgpu release is made. I just wanted to test Iced with newer Wgpu changes. And to see how the API changes here.

This should make the API here safe, while RawWindowHandle/RawDisplayHandle can be unsafe to use, since they can contain pointers and don't constrain the lifetime.

Problems:

  • To create a softbuffer Context and Surface from W, we need W: Clone. So this adds an Arc around winit::window::Window.
  • wgpu::WasmNotSendSync bounds are a bit awkward.
  • It should be possible for a Compositor to handle non-'static W. Need to try getting that to work.
  • window_clipboard will need to be updated for raw-window-handle 0.6

If the way softbuffer and wgpu use WindowHandle/DisplayHandle is problematic for iced, perhaps changes could be made there.

Closes #2190.

@ids1024 ids1024 force-pushed the raw-window-handle-0.6 branch 3 times, most recently from dcc26e7 to 181ecb6 Compare January 17, 2024 21:48
@ids1024
Copy link
Contributor Author

ids1024 commented Jan 17, 2024

Wgpu 0.19 has just been released.

But this depends on grovesNL/glyphon#80, and an update to window_clipboard.

@ids1024
Copy link
Contributor Author

ids1024 commented Jan 17, 2024

I think this should basically be ready pending glyphon and hecrj/window_clipboard#24. If everything is working properly.

@hecrj hecrj changed the title WIP raw-window-handle 0.6, softbuffer 0.4, wgpu trunk Update wgpu to 0.19, glyphon to 0.4, softbuffer to 0.4, and raw-window-handle to 0.6 Jan 18, 2024
@hecrj hecrj marked this pull request as ready for review January 18, 2024 09:37
@hecrj hecrj added this to the 0.12 milestone Jan 18, 2024
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks! 🥳

I have simplified some stuff here and there. Let me know what you think and we can merge.

@hecrj hecrj changed the title Update wgpu to 0.19, glyphon to 0.4, softbuffer to 0.4, and raw-window-handle to 0.6 Update wgpu to 0.19, glyphon to 0.5, softbuffer to 0.4, and raw-window-handle to 0.6 Jan 18, 2024
@hecrj hecrj changed the title Update wgpu to 0.19, glyphon to 0.5, softbuffer to 0.4, and raw-window-handle to 0.6 Update wgpu to 0.19, glyphon to 0.5, softbuffer to 0.4, window-clipboard to 0.4, and raw-window-handle to 0.6 Jan 18, 2024
@ids1024
Copy link
Contributor Author

ids1024 commented Jan 18, 2024

Those changes seem reasonable. Out-of-order ages won't currently happen with softbuffer, but might in the future if it makes sense for any backend, so that seems reasonable. Using the max age that's been seen seems like a better idea than what I had. It means not having damage tracking for the first couple frames (which perhaps is why I didn't think of it), but that's reasonable.

@hecrj
Copy link
Member

hecrj commented Jan 19, 2024

@ids1024 Awesome!

Currently blocked by gfx-rs/wgpu#5088.

@ids1024
Copy link
Contributor Author

ids1024 commented Jan 19, 2024

We could probably detect if the dx12 backend is being used an then set desired_maximum_frame_latency to 3 (which perhaps is what a fix in wgpu is going to do?). Though if they release a fix fairly soon that isn't really necessary.

@dtzxporter
Copy link
Contributor

We could probably detect if the dx12 backend is being used an then set desired_maximum_frame_latency to 3 (which perhaps is what a fix in wgpu is going to do?). Though if they release a fix fairly soon that isn't really necessary.

This seems a bit hacky, I've spoken with the wgpu team and they intend to release a patch release for this fix. I already have an approved PR waiting to be merged that fixes the issue.

@thunderstorm010
Copy link
Contributor

gfx-rs/wgpu#5088 is fixed by gfx-rs/wgpu#5091!

@hecrj
Copy link
Member

hecrj commented Jan 19, 2024

Let's merge then!

@hecrj hecrj merged commit 7ae7fcb into iced-rs:master Jan 19, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants