-
Notifications
You must be signed in to change notification settings - Fork 187
MacOS wgpu-rs with sdl2 raw-window-handle Crashes #187
Comments
This test runs without difficulty on windows. I do not have any data if it runs on linux |
I suppose it is very possible that this issue should be raised in the upstream repo. If so I am happy to do so |
Could you print out the |
I cannot since I don't have a mac. However I looked up the sdl2 source and the ns_view is set to 0 https://github.com/Rust-SDL2/rust-sdl2/blob/master/src/sdl2/raw_window_handle.rs#L65 |
And to prove it should be handled by gfx-hal or w/e the raw_window_handle folks say that windowing systems are not required to set it to an actual value: rust-windowing/raw-window-handle#14 (comment) |
I looked up where it is consumed and looks like wgpu's dependency requires the ns_view to have a value: https://github.com/gfx-rs/gfx/blob/77c3e28331f8ab593e57425b47db344f0e9e8112/src/backend/metal/src/lib.rs#L266 |
Looks like this was fixed by gfx-rs/wgpu#462. Could you try depending on the git version of latest |
Oh very cool. Yes I will try this |
Edit: nvm I was confused |
This will require updated wgpu glyph in a branch. I will do this tonight and ask the person who encountered the error to test it. This looks very likely to fix the issue though so I will close it. Thanks for the help! |
One more reason for us to make a release... https://github.com/gfx-rs/wgpu-rs/milestone/1 |
I'm considering wgpu-rs as a renderer platform for an editor gui I am working on, but in some basic tests I got reports of a crash on MacOS. I don't myself have a mac to test it on locally, but it seems like something about the raw-window-handle isn't working properly.
The test repo is here: https://github.com/Kethku/sdl2-wgpu-test
This is the description of the error I got:
"I gave sdl2-wgpu-test on macOS a brief run. It seems what happens is that the SDL2 window that is created (which is a NSWindow) does either not have an actual NSView for wgpu to use, or it is the wrong type. The panic happens here: https://github.com/gfx-rs/gfx/blob/77c3e28331f8ab593e57425b47db344f0e9e8112/src/backend/metal/src/lib.rs#L366 and it is transmuting to cocoa::base::id. Interestingly, it should have a view, which is a SDLView, which in turn is a subclass of NSView (https://github.com/LuaDist/sdl/blob/e3fb85ea57742a3358ae8e20ecba83f8ef006d28/src/video/cocoa/SDL_cocoawindow.m#L574). So it might be that the transmute fails because it is a different class. "
The text was updated successfully, but these errors were encountered: