Replies: 3 comments
-
In the end I was able to run the android-activity winit + wgpu example with wgpu bumped from 0.14 to 0.18 (!= 0.19), adding "rwh_05" to winit features (instead of the default rwh_06) and fixing the compiler errors. So at least I can move on, but the issue above remains. |
Beta Was this translation helpful? Give feedback.
-
Do you have an minimal example we could help with? A To easily get a // Wrap the window in an `Arc`
let window = Arc::new(WindowBuilder::new().build(&event_loop).unwrap());
// ... then at some point later when you're creating your surface ...
// Clone the `Arc` and pass it to the surface
let surface = instance.create_surface(window.clone()).unwrap(); The |
Beta Was this translation helpful? Give feedback.
-
I managed to solve it; in an earlier attempt I moved the window variable to the run function (stack) behind an Option. It kind of makes sense now, the compiler abstracts the lifetime of the parameters, losing the connection to the lifetime of the App struct. Indeed the window also needs to be wrapped in an Arc. https://github.com/rust-mobile/rust-android-examples |
Beta Was this translation helpful? Give feedback.
-
In Android you can only create a surface after WindowEvent::Resumed and before WindowEvent::Suspended.
It has always been impossible to get wgpu to run on Android (8.1), but I did manage to get a surface with android-activity winit + wgpu, but that's using old versions.
In wgpu 0.19 Surface gets a lifetime annotation; I cannot seem to get this to work.
There does not seem to be an example using wgpu 0.19 and WindowEvent::Resumed.
I tried to understand life times but the documentation is too vague regarding this situation.
It looks like atomics are needed like Arc to manipulate the lifetime, and the android example uses a static lifetime, which doesn't seem appropriate.
How do I achieve this?
It's very frustrating that there is no documentation or cross-platform gpu example for beginning Rust developers.
Beta Was this translation helpful? Give feedback.
All reactions