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

Commit 8f9e4e1e authored by Chris Forbes's avatar Chris Forbes
Browse files

Add support for vulkan api level 1.4 in loader

Bug: b/370568136
Flag: com.android.graphics.libvulkan.flags.vulkan_1_4_instance_api
Change-Id: Ibf168e24f5be16cdf87b683322d291336b11244f
parent a5296cdb
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -45,6 +45,9 @@
#include "driver.h"
#include "layers_extensions.h"

#include <com_android_graphics_libvulkan_flags.h>

using namespace com::android::graphics::libvulkan;

namespace vulkan {
namespace api {
@@ -1473,7 +1476,7 @@ VkResult EnumerateInstanceVersion(uint32_t* pApiVersion) {
    if (!EnsureInitialized())
        return VK_ERROR_OUT_OF_HOST_MEMORY;

    *pApiVersion = VK_API_VERSION_1_3;
    *pApiVersion = flags::vulkan_1_4_instance_api() ? VK_API_VERSION_1_4 : VK_API_VERSION_1_3;
    return VK_SUCCESS;
}

+8 −2
Original line number Diff line number Diff line
@@ -398,7 +398,7 @@ CreateInfoWrapper::CreateInfoWrapper(const VkInstanceCreateInfo& create_info,
                                     const VkAllocationCallbacks& allocator)
    : is_instance_(true),
      allocator_(allocator),
      loader_api_version_(VK_API_VERSION_1_3),
      loader_api_version_(flags::vulkan_1_4_instance_api() ? VK_API_VERSION_1_4 : VK_API_VERSION_1_3),
      icd_api_version_(icd_api_version),
      physical_dev_(VK_NULL_HANDLE),
      instance_info_(create_info),
@@ -410,7 +410,7 @@ CreateInfoWrapper::CreateInfoWrapper(VkPhysicalDevice physical_dev,
                                     const VkAllocationCallbacks& allocator)
    : is_instance_(false),
      allocator_(allocator),
      loader_api_version_(VK_API_VERSION_1_3),
      loader_api_version_(flags::vulkan_1_4_instance_api() ? VK_API_VERSION_1_4 : VK_API_VERSION_1_3),
      icd_api_version_(icd_api_version),
      physical_dev_(physical_dev),
      dev_info_(create_info),
@@ -552,6 +552,10 @@ VkResult CreateInfoWrapper::SanitizeExtensions() {
        is_instance_ ? loader_api_version_
                     : std::min(icd_api_version_, loader_api_version_);
    switch (api_version) {
        case VK_API_VERSION_1_4:
            hook_extensions_.set(ProcHook::EXTENSION_CORE_1_4);
            hal_extensions_.set(ProcHook::EXTENSION_CORE_1_4);
            [[clang::fallthrough]];
        case VK_API_VERSION_1_3:
            hook_extensions_.set(ProcHook::EXTENSION_CORE_1_3);
            hal_extensions_.set(ProcHook::EXTENSION_CORE_1_3);
@@ -701,6 +705,7 @@ void CreateInfoWrapper::FilterExtension(const char* name) {
            case ProcHook::EXTENSION_CORE_1_1:
            case ProcHook::EXTENSION_CORE_1_2:
            case ProcHook::EXTENSION_CORE_1_3:
            case ProcHook::EXTENSION_CORE_1_4:
            case ProcHook::EXTENSION_COUNT:
                // Device and meta extensions. If we ever get here it's a bug in
                // our code. But enumerating them lets us avoid having a default
@@ -766,6 +771,7 @@ void CreateInfoWrapper::FilterExtension(const char* name) {
            case ProcHook::EXTENSION_CORE_1_1:
            case ProcHook::EXTENSION_CORE_1_2:
            case ProcHook::EXTENSION_CORE_1_3:
            case ProcHook::EXTENSION_CORE_1_4:
            case ProcHook::EXTENSION_COUNT:
                // Instance and meta extensions. If we ever get here it's a bug
                // in our code. But enumerating them lets us avoid having a