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

Version 0.25 nor latest master allowing Surface to be acquired in android. #1986

Closed
tachyon-ops opened this issue Aug 5, 2021 · 7 comments
Closed
Labels
B - bug Dang, that shouldn't have happened C - needs investigation Issue must be confirmed and researched DS - android

Comments

@tachyon-ops
Copy link
Contributor

tachyon-ops commented Aug 5, 2021

Even though winit works fine in android, I cannot ever grab a valid surface. Try latest master with wgpu triangle example in android and it will crash on surface creation. If you downgrade to v0.24 it works fine.

Following this thread from wgpu, I have tried to fix the surface not found on startup by adapting my logic to use Resume/Suspended events. However, only with winit v0.24 that works. If I move to v0.25 or latest master the behaviour is changed, not triggering the Resume event nor the ability to grab the surface on app startup (hence never grabbing it).

This is what happens with winit from my forked repo and ios fix, forked from tag v0.23 with just a small ios fix already in PR in winit repo:

winit = { git="https://github.com/nmpribeiro/winit.git", branch="working_android_winit"}

output:

I/rust-app: rust_jsx_ui:     --- EVENT LOOP ---
D/ActivityThread: add activity client record, r= ActivityRecord{36f0754 token=android.os.BinderProxy@66c03de {io.github.nmpribeiro.rust_jsx_ui/android.app.NativeActivity}} token= android.os.BinderProxy@66c03de
D/HiTouch_PressGestureDetector: onAttached, package=io.github.nmpribeiro.rust_jsx_ui, windowType=1, mHiTouchRestricted=false
I/rust-app: rust_jsx_ui: App resumed
    rust_jsx_ui: ----------------------------------------- Activating!
    rust_jsx_ui: Activating now!
    rust_jsx_ui: Size: 1080 x 2312
    rust_jsx_ui: Instance

This is with winit v0.24:

I/rust-app: rust_jsx_ui:     --- EVENT LOOP ---
D/ActivityThread: add activity client record, r= ActivityRecord{36f0754 token=android.os.BinderProxy@66c03de {io.github.nmpribeiro.rust_jsx_ui/android.app.NativeActivity}} token= android.os.BinderProxy@66c03de
D/HiTouch_PressGestureDetector: onAttached, package=io.github.nmpribeiro.rust_jsx_ui, windowType=1, mHiTouchRestricted=false
I/HwViewRootImpl: removeInvalidNode jank list is null
D/AwareBitmapCacher: handleInit switch not opened pid=22664

While in my android simulator it doesn't work, it is expected that support for OpenGL for android is still lagging behind.

@tachyon-ops
Copy link
Contributor Author

tachyon-ops commented Aug 5, 2021

I was able to figure out some winit vs ndk_glue version combinations. It seems to make sense:

Android compatibility:

winit versions test with ndk_glue 0.2.1
[o] winit 0.24 + ndk_glue 0.2.1 -> works
[x] winit 0.25 + ndk_glue 0.2.1 -> fails

winit versions test with ndk_glue 0.3.0
[x] winit 0.24 + ndk_glue 0.3.0 -> fails
[o] winit 0.25 + ndk_glue 0.3.0 -> works

winit versions test with ndk_glue 0.4.0
[x] winit 0.25 + ndk_glue 0.4.0 -> fails
[x] winit master + ndk_glue 0.4.0 -> fails

That would suggest latest working pair combination is winit v0.25 with ndk_glue v0.3.0.

If this is expected, feel free to close.

@maroider maroider added DS - android C - needs investigation Issue must be confirmed and researched B - bug Dang, that shouldn't have happened labels Aug 5, 2021
@msiglreith
Copy link
Member

msiglreith commented Aug 5, 2021

Hi, right the ndk_glue version needs to match the version used by winit. Otherwise, the application will probably not even start correctly as they internal NativeActivity static is not the same due to version mismatch.

edit: probably worth adding a note in the README

@tachyon-ops
Copy link
Contributor Author

Hi @msiglreith I guess then ndk_glue usually releases first, then winit will follow and efforts are/will be made to keep up with ndk_glue::0.4.0 right?
That is super cool to know, but a bit annoying that this is not mentioned anywhere in the winit documentation. And we only see the error happening when we use something like wgpu. Kinda hard to figure this out.

Is there place to add such a versioning table anywhere?

@msiglreith
Copy link
Member

Is there place to add such a versioning table anywhere?

I agree, it's not immediately clear. README in the Android section seems best to me.

ndk_glue usually releases first, then winit will follow and efforts are/will be made to keep up with ndk_glue::0.4.0 right?

yep, next releases would support 0.4 then

@tachyon-ops
Copy link
Contributor Author

Hi, I've issued a PR to have some documentation relevant to this. Let me know if you guys are ok with it!

@MarijnS95
Copy link
Member

@nmpribeiro It looks like this is solved now, can we close this?

@tachyon-ops
Copy link
Contributor Author

Sure. Closed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B - bug Dang, that shouldn't have happened C - needs investigation Issue must be confirmed and researched DS - android
Development

No branches or pull requests

4 participants