Skip to content

Commit 8f9e4e1

Browse files
committed
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
1 parent a5296cd commit 8f9e4e1

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

vulkan/libvulkan/api.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
#include "driver.h"
4646
#include "layers_extensions.h"
4747

48+
#include <com_android_graphics_libvulkan_flags.h>
49+
50+
using namespace com::android::graphics::libvulkan;
4851

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

1476-
*pApiVersion = VK_API_VERSION_1_3;
1479+
*pApiVersion = flags::vulkan_1_4_instance_api() ? VK_API_VERSION_1_4 : VK_API_VERSION_1_3;
14771480
return VK_SUCCESS;
14781481
}
14791482

vulkan/libvulkan/driver.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ CreateInfoWrapper::CreateInfoWrapper(const VkInstanceCreateInfo& create_info,
398398
const VkAllocationCallbacks& allocator)
399399
: is_instance_(true),
400400
allocator_(allocator),
401-
loader_api_version_(VK_API_VERSION_1_3),
401+
loader_api_version_(flags::vulkan_1_4_instance_api() ? VK_API_VERSION_1_4 : VK_API_VERSION_1_3),
402402
icd_api_version_(icd_api_version),
403403
physical_dev_(VK_NULL_HANDLE),
404404
instance_info_(create_info),
@@ -410,7 +410,7 @@ CreateInfoWrapper::CreateInfoWrapper(VkPhysicalDevice physical_dev,
410410
const VkAllocationCallbacks& allocator)
411411
: is_instance_(false),
412412
allocator_(allocator),
413-
loader_api_version_(VK_API_VERSION_1_3),
413+
loader_api_version_(flags::vulkan_1_4_instance_api() ? VK_API_VERSION_1_4 : VK_API_VERSION_1_3),
414414
icd_api_version_(icd_api_version),
415415
physical_dev_(physical_dev),
416416
dev_info_(create_info),
@@ -552,6 +552,10 @@ VkResult CreateInfoWrapper::SanitizeExtensions() {
552552
is_instance_ ? loader_api_version_
553553
: std::min(icd_api_version_, loader_api_version_);
554554
switch (api_version) {
555+
case VK_API_VERSION_1_4:
556+
hook_extensions_.set(ProcHook::EXTENSION_CORE_1_4);
557+
hal_extensions_.set(ProcHook::EXTENSION_CORE_1_4);
558+
[[clang::fallthrough]];
555559
case VK_API_VERSION_1_3:
556560
hook_extensions_.set(ProcHook::EXTENSION_CORE_1_3);
557561
hal_extensions_.set(ProcHook::EXTENSION_CORE_1_3);
@@ -701,6 +705,7 @@ void CreateInfoWrapper::FilterExtension(const char* name) {
701705
case ProcHook::EXTENSION_CORE_1_1:
702706
case ProcHook::EXTENSION_CORE_1_2:
703707
case ProcHook::EXTENSION_CORE_1_3:
708+
case ProcHook::EXTENSION_CORE_1_4:
704709
case ProcHook::EXTENSION_COUNT:
705710
// Device and meta extensions. If we ever get here it's a bug in
706711
// our code. But enumerating them lets us avoid having a default
@@ -766,6 +771,7 @@ void CreateInfoWrapper::FilterExtension(const char* name) {
766771
case ProcHook::EXTENSION_CORE_1_1:
767772
case ProcHook::EXTENSION_CORE_1_2:
768773
case ProcHook::EXTENSION_CORE_1_3:
774+
case ProcHook::EXTENSION_CORE_1_4:
769775
case ProcHook::EXTENSION_COUNT:
770776
// Instance and meta extensions. If we ever get here it's a bug
771777
// in our code. But enumerating them lets us avoid having a

0 commit comments

Comments
 (0)