How to create and run an example Vulkan app on the

2019-05-28 02:01发布

问题:

I want to play around with mobile Vulkan without having to buy a device.

If it is not supported, please provide evidence (e.g. source code, official Google statements). Are there any plans to support it?

If supported, please give detailed and tested instructions of how to get a minimal hello world triangle app running, including the app you have tested with.

I have tried https://github.com/googlesamples/android-vulkan-tutorials/tree/7ba478ac2e0d9006c9e2e261446003a4449b8aa3/tutorial05_triangle with a Pixel API 25 image (API 25 is supposed to support Vulkan), but keep getting build or runtime errors.

I have opened an issue at: https://github.com/googlesamples/android-vulkan-tutorials/issues/13 but it was closed without solution.

Related:

  • OpenGL ES 2: Does the Android Emulator support OpenGL ES 2.0?
  • OpenGL ES 3: Does the Android emulator support OpenGL ES 3.0?

回答1:

I suspect this Android Vulkan setup document is as definitive an answer as you're going to find from Google:

Before beginning, make sure you have the right hardware and platform version prepared. You should use a device that supports Vulkan, running Android API level 24 or higher.

Note that it does not suggest an emulator as an alternative approach - it talks only about correct hardware and device.

The good news if you have a cross-platform codebase, is that getting Vulkan running correctly on PC will get you about 99% of the way to having Vulkan running on Android. That is, assuming you're going with a Vulkan-only NativeActivity, it gets a bit more fiddly if you want a mixed Java/Native app with Vulkan support and OpenGLES fallback, in that case, there's a chunk of Android-specific work to do, but you're still over 90% there focusing on PC.



回答2:

@Ciro, the emulator is a device, sure. But not necessarily a Vulkan capable. Also, if your underlaying platform doesn't support Vulkan, possible your emulator will not provide it also. AFAIK, there is no software emulation for Vulkan yet. I say that based on what happens on OpenGL ES. The Android emulator uses your video card capabilities to provide 3D hardware acceleration. Otherwise, it falls back in terrible slow software emulation. See OpenGL ES emulation:

Graphics acceleration for the emulator takes advantage of the graphics hardware on your development computer, specifically the graphics processing unit (GPU), to make screen rendering faster. Android devices use OpenGL for Embedded Systems (OpenGL ES or GLES) for rendering both 2D and 3D graphics on the screen.

(more...)

I use a Nexus 5X with Android 7 (Beta Program), to my Vulkan experiments.