You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently, I played a bit with Android in combination with winit/Vulkan/wgpu and there are some topics which should be addressed imo:
raw-window-handle docs:
The exact handles returned by raw_window_handle must remain consistent between multiple calls to raw_window_handle, and must be valid for at least the lifetime of the HasRawWindowHandle implementer.
This constraint is in particular hard to uphold for winit as the window handle is only available between certain events in the event loop. As far as I know the ANativeWindow may change ov ertime (Suspend-Resumed cycles).
Change the type of a_native_window from *mut _ to Option<NonNull<_>> or it should be explictly annotated that it may be null. Right now this is not clear, some graphic libraries assume it's always a valid handle. On the other hand, winit currently panicks when requesting the RawWindowHandle as it shouldn't return a nullptr, which basically shifts the issue to the client to uphold the requirement of only requesting the handle if it safe to do so. This makes it actually quite hard to write portable implementations for anything Vulkan based (extensions query and surface support via RawWindowHandle). Using the Option<NonNull<_>> would make it safe for libraries consuming the handle as well as window libraries to say that a handle might not be available right now.
The text was updated successfully, but these errors were encountered:
This would probably lead to switch all pointers to either Option<NonNull<_>> or NonNull<_> to enforce that providers set the corresponding values and make it more clear for clients what to expect - e.g gfx-rs/gfx#3329
Recently, I played a bit with Android in combination with winit/Vulkan/wgpu and there are some topics which should be addressed imo:
raw-window-handle
docs:This constraint is in particular hard to uphold for winit as the window handle is only available between certain events in the event loop. As far as I know the ANativeWindow may change ov ertime (Suspend-Resumed cycles).
a_native_window
from*mut _
toOption<NonNull<_>>
or it should be explictly annotated that it may benull
. Right now this is not clear, some graphic libraries assume it's always a valid handle. On the other hand, winit currently panicks when requesting the RawWindowHandle as it shouldn't return a nullptr, which basically shifts the issue to the client to uphold the requirement of only requesting the handle if it safe to do so. This makes it actually quite hard to write portable implementations for anything Vulkan based (extensions query and surface support via RawWindowHandle). Using theOption<NonNull<_>>
would make it safe for libraries consuming the handle as well as window libraries to say that a handle might not be available right now.The text was updated successfully, but these errors were encountered: