Skip to content

Integrating wgpu into existing iOS and Android apps

Jinlei Li edited this page Dec 28, 2022 · 3 revisions

wgpu does not depend on any window program, so it does not provide window creation and management functions. Only when creating a window-based Surface, an argument that implements the raw-window-handle abstract interface may be required. The winit used by the wgpu examples is a cross-platform window creation and management crate that implements the raw-window-handle abstract interface. It will take over the window management and events loop of the entire app.

There is no doubt that for game apps, the combination of wgpu + winit is very suitable. However, a large number of non-game apps also often need to use graphics APIs (such as charts, image filters, etc.). These apps need to use a lot of system UI components and interactions. Winit's way of taking over the entire app window is not suitable. So, it would be very useful to integrate wgpu into existing iOS and Android apps without using third-party window management libraries.

wgpu-in-app is a complete doc and example of how to do it.
The doc section also has two Chinese versions of: 与 iOS App 集成 and 与 Android App 集成