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

Update to wgpu 0.19, cross-platform #16

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

fr-an-k
Copy link

@fr-an-k fr-an-k commented Jan 21, 2024

It has been very difficult to get wgpu to work (especially on older devices), so I'm sharing my result.
Now that Android and WASM support has improved in all crates, I managed to support all platforms with the latest crate versions.

I know the intention of this repository is Android, but I believe having a ready-to-go example with cross-platform instructions is critical to support both developers and libraries on this new platform.

Unfortunately I don't have time to update all examples, but I think it's best to at least update this one for now.

I'm not sure about the web-sys features but it seems to support webgl and webgpu like this.

I set present_mode to fifo and alpha_mode to opaque, because that's what worked on my Android 8.1 device and is probably more widely supported. I left the other options commented out.

I also moved the rendering to App. Perhaps App should also get an input(event) and tick/update() function.

I also introduced WGPU_BACKEND as a compile time variable.

I also commented out the unnecessary request_redraw, with a comment that one could use it for animation.

Comment on lines 38 to 39
export ANDROID_NDK_HOME="path/to/ndk"
export ANDROID_SDK_HOME="path/to/sdk"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied it from the cargo APK instructions; doesn't xbuild have a dependency on Android SDK/NDK?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't copy that, the tools are quite different.

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 this pull request may close these issues.

2 participants