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

Android interactions #54

Closed
msiglreith opened this issue Aug 13, 2020 · 2 comments · Fixed by #55
Closed

Android interactions #54

msiglreith opened this issue Aug 13, 2020 · 2 comments · Fixed by #55

Comments

@msiglreith
Copy link
Member

Recently, I played a bit with Android in combination with winit/Vulkan/wgpu and there are some topics which should be addressed imo:

  1. 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).

  1. 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.
@msiglreith
Copy link
Member Author

Followup on the 2nd point:

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

@Lokathor
Copy link
Contributor

I'm open to adjusting the docs of Android has a different concept of "a window".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants