-
-
Notifications
You must be signed in to change notification settings - Fork 477
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
Use non-static StructGenerator
on Android
#1398
Use non-static StructGenerator
on Android
#1398
Conversation
I don't know anything about using glutin on android, but the patch looks good to me given that it just switches to what other unix platforms do here, and I think libloading should work on android fine. Have you tried running something with glutin on android with your patch applied? Though, if you're in doubt, I'd suggest asking other folks using glutin on android, since I think there're some in gamedev engines communities. Could also add a note in CHANGELOG entry that the build for android got fixed. |
Rather than StaticStructGenerator. This avoids a compilation error due to calling SwapBuffersWithDamageKHR.is_loaded(), which isn't defined when using the static generator.
Note this doesn't fix all of the compilation errors on Android. But yes, I am successfully using Glutin with this patch and another to fix the rest, and our app runs perfectly. Added a changelog entry. |
a52e2ee
to
9952703
Compare
CHANGELOG.md
Outdated
@@ -1,3 +1,7 @@ | |||
# Unreleased | |||
|
|||
- On Android, switched from StaticStructGenerator to StructGenerator, fixing some compilation errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- On Android, switched from StaticStructGenerator to StructGenerator, fixing some compilation errors. | |
- On Android, switched from `StaticStructGenerator` to `StructGenerator`, fixing some compilation errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In hindsight, should we elaborate on what the compiler error is/means? I don't think the StructGenerator
means a ton to end-users reading the glutin
changelog either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but I thought if I try to just tackle part of the problem, and do so properly rather than just commenting out the broken code, it might be easier to push things forward.
Massive, massive thanks for this. It just makes PRs so much easier to review, have shorter life/churn-time, and is overal a lot friendlier for maintainers. If we go ahead with this and a followup we can finally start closing all the other noise 🎉
Regarding the contents, this seems like a sensible solution. It removes Android-specific bloat (libloading
definitely works on Android, it's "just Unix") and statically linking against an optional extension function is wrong (looking at you, recent PRs that just comment out is_loaded()
). Then again I don't know if Android devices are required to ship with EGL_KHR_swap_buffers_with_damage
, seems like they provide some fallback that diverts into eglSwapBuffers
: https://android.googlesource.com/platform/frameworks/native/+/a894d08%5E%21/ (so perhaps it's possible to just always static-link into this one).
The only alternative solution I can think of is statically and dynamically link, and make a clear decision in every place which one to use. Perhaps the EGL bindings generator should be able to make this distinction by generating the core statically and the extensions dyanamically.
Do you want to open a PR with that as soon as we merge this one? (If you fix the changelog conflict I'll click the button 😄). Then we can finally close a whole bunch of noise on lots of repositories that all tried to address the compiler errors in mysterious ways. I've cooked up a little Android example within the Finally we'll have to think up what to do about the |
StructGenerator
on Android
@kchibisov I tested this too, if you don't mind I'll click the squash+merge button :) |
I'm not familiar with android at all, so I was kind of more style/don't break anything without testing by third parties. Given that you know what android is and can likely test stuff on it, you can go ahead without my approvals on pure android backend stuff. |
Lovely, thanks! |
Thanks for merging this @MarijnS95!
Would be delighted to! I started with just this one as I thought it was the more production ready of the two, given the remaining issues you mentioned with Suspend/Resume. But a PR is a good starting point to discuss those further, and even landing as is would be an improvement on the current situation of it not compiling. |
Trunk-based development is perfect here, makes for a much more pleasant experience getting things in, one isolated feature/fix at a time.
Perhaps it's fine to get your removal in so that it compiles and people manually use Does that sound sensible to you or should we tackle the migration from |
That sounds very sensible to me. This will allow a lot of people to finally use glutin on android again. Let's not let perfect be the enemy of good. |
Opened #1411 |
For reference I brought this up not to be perfect on the first try, but because I don't feel like removing "valid" (yet ancient) functionality in hopes of adding it back some time in the future. But alas, it's coming anyway so no need to make a fuss about this one. |
This is an attempt to fix the current compilation errors on Android. I know there is already #1313 and #1385, but I thought if I try to just tackle part of the problem, and do so properly rather than just commenting out the broken code, it might be easier to push things forward.
On of the compilation errors we get on android is:
This is due to using the
StaticStructGenerator
rather thanStructGenerator
. From my testing usingStructGenerator
appears to work correctly, so this patch switches us to use that on Android. Are there any issues with using StructGenerator on Android that I'm not aware about?cargo fmt
has been run on this branchcargo doc
builds successfullyCHANGELOG.md
if knowledge of this change could be valuable to usersCloses #1407