Goshido / android-vulkan

This repository is a project for learning Vulkan API, constraint based 3D physics, Lua scripting, spatial sound rendering, HTML+CSS UI rendering.
30 stars 3 forks source link

Building the vulkan validation layers #62

Closed juan-lunarg closed 1 year ago

juan-lunarg commented 1 year ago

I noticed this document: https://github.com/Goshido/android-vulkan/blob/master/docs/vulkan-validation-layers.md

I've recently completely revamped the documentation / android build for the vulkan validation layers.

We use CMake entirely now, and I've removed the legacy ndk-build.

The official Khronos repo does not provide enough information about building libVkLayer_khronos_validation.so from scratch for Android OS. So in this document essential steps for building will be covered.

I believe our updated BUILD.md is up to par now. Although feedback would be appreciated.

Out of curiousity did you have issues with the pre-built binaries available on our release page?

https://github.com/KhronosGroup/Vulkan-ValidationLayers/releases

We follow the instructions provided by the NDK to deliver "middleware" so that developers don't have to build the validation layers manually.

https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/21ea4092207752244a94c391172d5768a60a8771/.github/workflows/sdk_android_build.yml#L33

Goshido commented 1 year ago

I believe our updated BUILD.md is up to par now. Although feedback would be appreciated.

Yes. You're absolutely right. I noticed that awesome new build process in [2023/08/04]. I was so happy to see such change! I immediately changed my documentation to reflect new VVL build process.

Before that the building process manual looked like this. Just compare. Pay attention on last step. It's literally porting old build-android/jni/Android.md to homemade CMakeLists.txt without autotest dependencies. After VVL commit eca34aae4cc04eb32035a7b1770a276933f37327 situation changed. Now we have official documentation and CMake way to build what you need. It's awesome!

I do know that VVL could be build using C++20. So my suggestion is to make it public via CMake flags. Something similar as CMAKE_ANDROID_ARCH_ABI for selecting chipset architecture.

Out of curiousity did you have issues with the pre-built binaries available on our release page?

Good question. Let me try to answer.

I would like to use the latest versions of VVL by demand. It's kindla rule for android-vulkan project to use latest available development tools. Long ago I noticed that VVL receives a huge amount of commits every week. Some useful features appear every day.

I would like to control the build toolchain which produces libVkLayer_khronos_validation.so. I mean NDK version which must be the same as android-vulkan project for consistency. Similar story for libfreetype.so, libLua.so, libogg.so, libvorbis.so and libvorbisfile.so.

I would like to build release binaries and strip them.

I believe that I also contribute to VVL project because I able to find issues before the official release by feeding the latest libVkLayer_khronos_validation.so to my project and inspect new problems. As you can see I was able to report several issues (look at the bottom of the page) which were fixed. Win-win situation.

So this documentation is kinda speedrun manual and reminder note how to quickly build what android-vulkan project needs.

@juan-lunarg did I answer to your questions? Maybe you have some suggestions about documentation? I would like to hear from you. Thank you!

juan-lunarg commented 1 year ago

Before that the building process manual looked like this. Just compare. Pay attention on last step. It's literally porting old build-android/jni/Android.md to homemade CMakeLists.txt without autotest dependencies. After VVL commit eca34aae4cc04eb32035a7b1770a276933f37327 situation changed. Now we have official documentation and CMake way to build what you need. It's awesome!

Yeah. For a while the Android build has been very neglected (No one wanted to deal with it).

But it kept causing more and more issues till I was tasked with fixing it up.

I do know that VVL could be build using C++20. So my suggestion is to make it public via CMake flags. Something similar as CMAKE_ANDROID_ARCH_ABI for selecting chipset architecture.

Technically you can do that right now via VVL_CPP_STANDARD. We mainly use it to check our code is C++20 compatible. Since some things were deprecated in C++20.

I would like to use the latest versions of VVL by demand. It's kindla rule for android-vulkan project to use latest available development tools. Long ago I noticed that VVL receives a huge amount of commits every week. Some useful features appear every day.

That's a fair point that has been raised. I've been giving some thoughts into producing daily binaries.

I would like to control the build toolchain which produces libVkLayer_khronos_validation.so. I mean NDK version which must be the same as android-vulkan project for consistency. Similar story for libfreetype.so, libLua.so, libogg.so, libvorbis.so and libvorbisfile.so.

That may be necessary for the other libraries. But the validation layer binary is designed to be a highly portable android binary.

I document some aspects of that here:

The only limitation of our binary is that the Android API minimum is 26

I would like to build release binaries and strip them.

Currently our linux/android binaries aren't stripped. I believe the rational was that for the validation layers in particular users wanted additional debug info. Providing a similar sort of parity with PDBs for Windows users.

I believe that I also contribute to VVL project because I able to find issues before the official release by feeding the latest libVkLayer_khronos_validation.so to my project and inspect new problems. As you can see I was able to report several issues (look at the bottom of the page) which were fixed. Win-win situation.

Agreed.

@juan-lunarg did I answer to your questions? Maybe you have some suggestions about documentation? I would like to hear from you. Thank you!

Yes this was valuable feedback. Thank you for your time 👍🏾

Goshido commented 1 year ago

Glad to help 👌