xref: /aosp_15_r20/frameworks/native/vulkan/vkprofiles/README.md (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
1*38e8c45fSAndroid Build Coastguard Worker
2*38e8c45fSAndroid Build Coastguard WorkerGet a local copy of the Vulkan-Profiles repository (https://github.com/KhronosGroup/Vulkan-Profiles/)
3*38e8c45fSAndroid Build Coastguard Worker
4*38e8c45fSAndroid Build Coastguard WorkerNOTE: If the Vulkan-Headers you need for generation is later than the one that exists in
5*38e8c45fSAndroid Build Coastguard Worker`external/vulkan-headers`, then `external/vulkan-headers` will need to be updated to match.
6*38e8c45fSAndroid Build Coastguard WorkerThese updates to `external/vulkan` need to be made in AOSP. Changes to `ndk_translation` may
7*38e8c45fSAndroid Build Coastguard Workerneed to be first made in internal-main.
8*38e8c45fSAndroid Build Coastguard Worker
9*38e8c45fSAndroid Build Coastguard WorkerRun Vulkan-Profiles/scripts/gen_profiles_solutions.py in debug mode.
10*38e8c45fSAndroid Build Coastguard Worker
11*38e8c45fSAndroid Build Coastguard WorkerDebug mode (at time of writing) requires a dedicated debug folder within the output-library location.
12*38e8c45fSAndroid Build Coastguard Worker~/Vulkan-Profiles$ mkdir debug
13*38e8c45fSAndroid Build Coastguard Worker~/Vulkan-Profiles$ python3 scripts/gen_profiles_solution.py --debug  --registry ~/<PATH_TO_YOUR_ANDROID_REPO>/external/vulkan-headers/registry/vk.xml --input ~/android/main/frameworks/native/vulkan/vkprofiles/profiles/ --output-library-inc . --output-library-src .
14*38e8c45fSAndroid Build Coastguard Worker
15*38e8c45fSAndroid Build Coastguard WorkerTake the generated vulkan_profiles.h and vulkan_profiles.cpp from the debug directory you just created.
16*38e8c45fSAndroid Build Coastguard Worker
17*38e8c45fSAndroid Build Coastguard Worker~/Vulkan-Profiles$ cp debug/vulkan_profiles.cpp <PATH_TO_YOUR_ANDROID_REPO>/frameworks/native/vulkan/vkprofile/generated/
18*38e8c45fSAndroid Build Coastguard Worker~/Vulkan-Profiles$ cp debug/vulkan_profiles.h <PATH_TO_YOUR_ANDROID_REPO>/frameworks/native/vulkan/vkprofile/generated/
19*38e8c45fSAndroid Build Coastguard Worker
20*38e8c45fSAndroid Build Coastguard Worker
21*38e8c45fSAndroid Build Coastguard WorkerThe files need to be modified to land.
22*38e8c45fSAndroid Build Coastguard Worker1. Replace the generated license with the correct Android license
23*38e8c45fSAndroid Build Coastguard Worker(https://cs.android.com/android/platform/superproject/main/+/main:development/docs/copyright-templates/c.txt).
24*38e8c45fSAndroid Build Coastguard WorkerMake sure to set the copyright to the current year. You should also remove the `This file is ***GENERATED***` part.
25*38e8c45fSAndroid Build Coastguard Worker2. Add VK_USE_PLATFORM_ANDROID_KHR between the license and the first includes for vulkan_profiles.cpp
26*38e8c45fSAndroid Build Coastguard Worker```
27*38e8c45fSAndroid Build Coastguard Worker */
28*38e8c45fSAndroid Build Coastguard Worker
29*38e8c45fSAndroid Build Coastguard Worker#ifndef VK_USE_PLATFORM_ANDROID_KHR
30*38e8c45fSAndroid Build Coastguard Worker#define VK_USE_PLATFORM_ANDROID_KHR
31*38e8c45fSAndroid Build Coastguard Worker#endif
32*38e8c45fSAndroid Build Coastguard Worker
33*38e8c45fSAndroid Build Coastguard Worker#include ...
34*38e8c45fSAndroid Build Coastguard Worker```
35*38e8c45fSAndroid Build Coastguard Worker3. Rewrite the includes so that `vulkan_profiles.h` is correctly included
36*38e8c45fSAndroid Build Coastguard Worker4. Modify the #define `VP_DEBUG_MESSAGE_CALLBACK(MSG) ...` from "Profiles ERROR/WARNING" to "vkprofiles ERROR/WARNING"
37*38e8c45fSAndroid Build Coastguard Worker5. You may need to modify the Android.bp to remove warnings as errors, e.g. `"-Wno-error=unused-parameter",`
38*38e8c45fSAndroid Build Coastguard Worker6. Add `clang-format off` to the beginning and `clang-format on` to the end of the files
39