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

Commit ea32184c authored by Tom Murphy's avatar Tom Murphy
Browse files

Implement the VK_KHR_swapchain_mutable_format device extension in the vulkan loader

Add an implementation for the VK_KHR_swapchain_mutable_format extension.

Test: Stepped through changes in debugger
Test: Ran sample app with VVL which used the extension
Test: Ran dEQP-VK.image.swapchain_mutable.android.* dEQP tests
Flag: com.android.graphics.libvulkan.flags.swapchain_mutable_format_ext
Bug: 341978292
Change-Id: Ib0e5b9f750cd5a94ab65419542898db207716fcc
parent cb0f460a
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -32,6 +32,18 @@ ndk_library {
    ],
}

aconfig_declarations {
    name: "libvulkan_flags",
    package: "com.android.graphics.libvulkan.flags",
    container: "system",
    srcs: ["libvulkan_flags.aconfig"],
}

cc_aconfig_library {
    name: "libvulkanflags",
    aconfig_declarations: "libvulkan_flags",
}

cc_library_shared {
    name: "libvulkan",
    llndk: {
@@ -113,5 +125,8 @@ cc_library_shared {
        "android.hardware.graphics.common@1.0",
        "libSurfaceFlingerProp",
    ],
    static_libs: ["libgrallocusage"],
    static_libs: [
        "libgrallocusage",
        "libvulkanflags",
    ],
}
+3 −0
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@
#undef VK_NO_PROTOTYPES
#include "api.h"

/*
 * This file is autogenerated by api_generator.py. Do not edit directly.
 */
namespace vulkan {
namespace api {

+3 −0
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@

#include "driver_gen.h"

/*
 * This file is autogenerated by api_generator.py. Do not edit directly.
 */
namespace vulkan {
namespace api {

+13 −0
Original line number Diff line number Diff line
@@ -41,10 +41,12 @@
#include <new>
#include <vector>

#include <com_android_graphics_libvulkan_flags.h>
#include "stubhal.h"

using namespace android::hardware::configstore;
using namespace android::hardware::configstore::V1_0;
using namespace com::android::graphics::libvulkan;

extern "C" android_namespace_t* android_get_exported_namespace(const char*);

@@ -688,6 +690,7 @@ void CreateInfoWrapper::FilterExtension(const char* name) {
            case ProcHook::KHR_incremental_present:
            case ProcHook::KHR_shared_presentable_image:
            case ProcHook::KHR_swapchain:
            case ProcHook::KHR_swapchain_mutable_format:
            case ProcHook::EXT_hdr_metadata:
            case ProcHook::EXT_swapchain_maintenance1:
            case ProcHook::ANDROID_external_memory_android_hardware_buffer:
@@ -740,6 +743,7 @@ void CreateInfoWrapper::FilterExtension(const char* name) {
                break;
            case ProcHook::ANDROID_external_memory_android_hardware_buffer:
            case ProcHook::KHR_external_fence_fd:
            case ProcHook::KHR_swapchain_mutable_format:
            case ProcHook::EXTENSION_UNKNOWN:
                // Extensions we don't need to do anything about at this level
                break;
@@ -1251,6 +1255,15 @@ VkResult EnumerateDeviceExtensionProperties(
                VK_EXT_SWAPCHAIN_MAINTENANCE_1_SPEC_VERSION});
    }

    VkPhysicalDeviceProperties pDeviceProperties;
    data.driver.GetPhysicalDeviceProperties(physicalDevice, &pDeviceProperties);
    if (flags::swapchain_mutable_format_ext() &&
        pDeviceProperties.apiVersion >= VK_API_VERSION_1_2) {
        loader_extensions.push_back(
            {VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_EXTENSION_NAME,
             VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_SPEC_VERSION});
    }

    // enumerate our extensions first
    if (!pLayerName && pProperties) {
        uint32_t count = std::min(
+4 −0
Original line number Diff line number Diff line
@@ -26,6 +26,9 @@
namespace vulkan {
namespace driver {

/*
 * This file is autogenerated by driver_generator.py. Do not edit directly.
 */
namespace {

// clang-format off
@@ -613,6 +616,7 @@ ProcHook::Extension GetProcHookExtension(const char* name) {
    if (strcmp(name, "VK_KHR_external_semaphore_capabilities") == 0) return ProcHook::KHR_external_semaphore_capabilities;
    if (strcmp(name, "VK_KHR_external_fence_capabilities") == 0) return ProcHook::KHR_external_fence_capabilities;
    if (strcmp(name, "VK_KHR_external_fence_fd") == 0) return ProcHook::KHR_external_fence_fd;
    if (strcmp(name, "VK_KHR_swapchain_mutable_format") == 0) return ProcHook::KHR_swapchain_mutable_format;
    // clang-format on
    return ProcHook::EXTENSION_UNKNOWN;
}
Loading