Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 04c80fca authored by Trevor Black's avatar Trevor Black Committed by Android (Google) Code Review
Browse files

Merge "Refactor Vulkan-Profiles interaction into vkprofiles" into main

parents 5ecb69f5 1b7d4202
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -42,4 +42,5 @@ subdirs = [
    "nulldrv",
    "libvulkan",
    "vkjson",
    "vkprofiles",
]
+68 −0
Original line number Diff line number Diff line
package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "frameworks_native_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["frameworks_native_license"],
}

cc_defaults {
    name: "libvkprofiles_deps",
    shared_libs: [
        "libvulkan",
    ],
}

cc_library_static {
    name: "libvkprofiles",
    defaults: [
        "libvkprofiles_deps",
    ],
    srcs: [
        "vkprofiles.cpp",
        "generated/vulkan_profiles.cpp",
    ],
    cflags: [
        "-Wall",
        "-Werror",
        "-Wimplicit-fallthrough",
    ],
    cppflags: [
        "-Wno-error=unused-parameter",
        "-Wno-error=missing-braces",
        "-Wno-sign-compare",
    ],
    export_include_dirs: [
        ".",
    ],
    export_shared_lib_headers: [
        "libvulkan",
    ],
}

cc_library_static {
    name: "libvkprofiles_ndk",
    srcs: [
        "vkprofiles.cpp",
        "generated/vulkan_profiles.cpp",
    ],
    cflags: [
        "-Wall",
        "-Werror",
        "-Wimplicit-fallthrough",
    ],
    cppflags: [
        "-Wno-error=unused-parameter",
        "-Wno-error=missing-braces",
        "-Wno-sign-compare",
    ],
    export_include_dirs: [
        ".",
    ],
    header_libs: [
        "vulkan_headers",
    ],
    sdk_version: "24",
    stl: "libc++_static",
}
+38 −0
Original line number Diff line number Diff line

Get a local copy of the Vulkan-Profiles repository (https://github.com/KhronosGroup/Vulkan-Profiles/)

NOTE: If the Vulkan-Headers you need for generation is later than the one that exists in
`external/vulkan-headers`, then `external/vulkan-headers` will need to be updated to match.
These updates to `external/vulkan` need to be made in AOSP. Changes to `ndk_translation` may
need to be first made in internal-main.

Run Vulkan-Profiles/scripts/gen_profiles_solutions.py in debug mode.

Debug mode (at time of writing) requires a dedicated debug folder within the output-library location.
~/Vulkan-Profiles$ mkdir debug
~/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 .

Take the generated vulkan_profiles.h and vulkan_profiles.cpp from the debug directory you just created.

~/Vulkan-Profiles$ cp debug/vulkan_profiles.cpp <PATH_TO_YOUR_ANDROID_REPO>/frameworks/native/vulkan/vkprofile/generated/
~/Vulkan-Profiles$ cp debug/vulkan_profiles.h <PATH_TO_YOUR_ANDROID_REPO>/frameworks/native/vulkan/vkprofile/generated/


The files need to be modified to land.
1. Replace the generated license with the correct Android license
(https://cs.android.com/android/platform/superproject/main/+/main:development/docs/copyright-templates/c.txt).
Make sure to set the copyright to the current year. You should also remove the `This file is ***GENERATED***` part.
2. Add VK_USE_PLATFORM_ANDROID_KHR between the license and the first includes for vulkan_profiles.cpp
```
 */

#ifndef VK_USE_PLATFORM_ANDROID_KHR
#define VK_USE_PLATFORM_ANDROID_KHR
#endif

#include ...
```
3. Rewrite the includes so that `vulkan_profiles.h` is correctly included
4. Modify the #define `VP_DEBUG_MESSAGE_CALLBACK(MSG) ...` from "Profiles ERROR/WARNING" to "vkprofiles ERROR/WARNING"
5. You may need to modify the Android.bp to remove warnings as errors, e.g. `"-Wno-error=unused-parameter",`
6. Add `clang-format off` to the beginning and `clang-format on` to the end of the files
+3 −0
Original line number Diff line number Diff line
# Take the outputted source files from gen_profiles_solution.py and don't format
DisableFormat: true
SortIncludes: Never
+11257 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading