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

Upgrade to raw-window-handle 0.6 #1385

Merged
merged 1 commit into from
Jun 13, 2024
Merged

Conversation

Noahnoah55
Copy link
Contributor

I implemented HasWindowHandle and HasDisplayHandle for Window, though its not send/sync due to it containing the underlying pointer to SDL_Window, preventing it from being used with wgpu without unsafe. Still, I updated the raw-window-handle/wgpu example to work with the most current version of both libraries.

Should fix #1376

I ran cargo check on the code for other platforms, but I don't have access to anything but my linux machine right now. I feel especially iffy about iOS code, as the required field changed from UI_Window to UI_View.

I'm hoping to find a better solution to implement send/sync for Window than just wrapping it in Arc<Mutex<>>, partially because it smells bad, and partially because it looks like it'll take a long time.

@Noahnoah55
Copy link
Contributor Author

Noahnoah55 commented Apr 11, 2024

Oh, also for some reason with the example, when I resize the screen I get one frame of SurfaceError::Outdated, but if you ignore it the problem goes away the next frame.

@Noahnoah55 Noahnoah55 changed the title Upgrade to raw-window-handle 0.6, partially Upgrade to raw-window-handle 0.6 Apr 12, 2024
@Cobrand
Copy link
Member

Cobrand commented Apr 12, 2024

I am really not familiar with all the raw-window-handle parts, so if someone else is knowledgeable and can tell me if this looks good, I'd appreciate it.

@thefiredman
Copy link

I am really not familiar with all the raw-window-handle parts, so if someone else is knowledgeable and can tell me if this looks good, I'd appreciate it.

I have tested it on MacOS and NixOS, it appears to work great.
I'm not knowledgeable enough to know though.

Hope this will be resolved soon.

@nickbp
Copy link

nickbp commented Apr 23, 2024

I was able to use this branch to upgrade wgpu to 0.19 which requires raw-window-handle 0.6.x. Not seeing any problems on Linux with X11.

Using it with this Cargo.toml for reference:

sdl2 = { git = "https://github.com/Noahnoah55/rust-sdl2/", branch = "master", features = ["raw-window-handle"] }
[...]
wgpu = "0.19"

Can see usage here: https://git.sr.ht/~nickbp/soundview/commit/d71d9f337ccfcb67ef2988b9f2d64c7106394c24#Cargo.toml

@Cobrand
Copy link
Member

Cobrand commented Apr 24, 2024

Alright then, it looks good, I just need to fix the CI beforehand (unrelated to your PR)

@jsgroth jsgroth mentioned this pull request May 6, 2024
4 tasks
tumdum pushed a commit to tumdum/rust-sdl2 that referenced this pull request May 19, 2024
@Cobrand Cobrand merged commit 726613e into Rust-SDL2:master Jun 13, 2024
13 of 17 checks passed
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.

Incompatible with wgpu 1.9.0+
4 participants