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 port #78

Closed
raphlinus opened this issue Apr 1, 2021 · 6 comments · Fixed by #273
Closed

Android port #78

raphlinus opened this issue Apr 1, 2021 · 6 comments · Fixed by #273

Comments

@raphlinus
Copy link
Contributor

I have a local branch which displays tiger on a Pixel 4, but it needs a fair amount of cleanup before it can be merged. This issue is to track that happening and also document some of the things I ran into.

I was not able to get winit to work on my device - for reasons I still do not understand, it never seems to get a WindowCreated event which is properly plumbed through to the user. I used ndk-glue instead and was able to get it to work. I have some concerns about that code as well, which I should raise as issues on that repo, but none of it is blocking the work at hand, which is to get it running well enough to do performance measurement. One concern is that at least one callback is intended to be synchronous, but the ndk-glue code just asynchronously sends an event (over a Unix fd pipe, for a reason I do not understand) to the user thread.

The Pixel 4 does not debug validation layers, and the current code depends on those existing in debug builds. It should sense it at runtime.

The Pixel 4 also does not have descriptor indexing. Again, this should be queried at runtime. This issue is considerably more complex, as it requires multiple compilations of k4, and also CPU-side code to deal with the non descriptor indexing case. The local branch just disables images.

For some reason, I'm getting ERROR_SURFACE_LOST_KHR when acquiring the swapchain after two presentations. This is probably something simple, I just haven't figured it out yet.

As part of the cleanup, I want to reduce code duplication between the existing two binaries (cli and winit) which are now three.

If anyone is really eager to try this at home, I can upload my local branch as a draft PR. But I plan on getting the real PR uploaded before long also.

@eliasnaur
Copy link
Collaborator

The Pixel 4 also does not have descriptor indexing. Again, this should be queried at runtime. This issue is considerably more complex, as it requires multiple compilations of k4, and also CPU-side code to deal with the non descriptor indexing case. The local branch just disables images.

In case you haven't seen the option, there's a header define to disable use of descriptor indexing. I use that for Gio.

@raphlinus
Copy link
Contributor Author

Yes, I've definitely seen the option, and basically what I'm proposing is to compile k4.comp to produce two different .spv's, one with it on and one with it off. The reason I just disabled it in my local branch is simply don't yet have Rust code yet to supply the image in the non descriptor indexing case. The existence of that define is a large step towards making it more compatible, thanks for it!

raphlinus added a commit that referenced this issue Apr 3, 2021
Don't run extensions unless they're available. This includes querying
for descriptor indexing, and running one of two versions of kernel4
depending on whether it's enabled.

Part of the support needed for #78
raphlinus added a commit that referenced this issue Apr 8, 2021
Don't run extensions unless they're available. This includes querying
for descriptor indexing, and running one of two versions of kernel4
depending on whether it's enabled.

Part of the support needed for #78
@dvc94ch
Copy link

dvc94ch commented Jan 7, 2022

any progress on this? the ndk-glue pipe was inspired by the android_native_app_glue distributed with android. the android looper has a blocking api and the pipe can be registered with it. if a channel or atomics where used we'd still have to wake the looper. however it's been a while since I wrote it and my memory is a bit fuzzy.

@m-hugo
Copy link
Contributor

m-hugo commented Oct 18, 2022

piet-gpu currently has working android support without winit (see android.rs in piet-gpu/piet-gpu) and can be made to work with winit

but since winit's android backend will change soon, I think I'll wait for the next version before adding support

@DJMcNab
Copy link
Member

DJMcNab commented Jan 4, 2023

For reference on the android backend changing, see rust-windowing/winit#2444

And the big pile of discussion in rust-windowing/winit#2293

It looks like 0.28 isn't coming anytime soon, so this is still blocked.

@m-hugo
Copy link
Contributor

m-hugo commented Jan 4, 2023

note that it's just a change to the example, I haven't tried the rewrite but both 0.27 and git were working just fine with piet-gpu, I can give you a 0.27 example if anybody cares, you can also just pin a git version with the new backend if you don't want to change the boilerplate after a month

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

Successfully merging a pull request may close this issue.

5 participants