Vulkan: correctly expose Vulkan entry points
This change fixes the advertisement of core Vulkan entry points as below:
1. GIPA returns a valid checked_proc for 1.1 core device APIs.
2. GDPA returns NULL for 1.1 core device APIs on a 1.0 physical device.
Bug: 134185757
Bug: 142266108
Test: dEQP-VK.memory.binding on 1.1 loader and 1.0 device ICD
Test: dEQP-VK.api.info.instance on 1.1 loader and 1.0 instance ICD
Change-Id: I0a3e06dc04bade4f36a7e68ee2f53979c656ee4e
diff --git a/vulkan/libvulkan/driver_gen.cpp b/vulkan/libvulkan/driver_gen.cpp
index f676573..52205e9 100644
--- a/vulkan/libvulkan/driver_gen.cpp
+++ b/vulkan/libvulkan/driver_gen.cpp
@@ -74,6 +74,15 @@
}
}
+VKAPI_ATTR VkResult checkedBindImageMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo* pBindInfos) {
+ if (GetData(device).hook_extensions[ProcHook::EXTENSION_CORE_1_1]) {
+ return BindImageMemory2(device, bindInfoCount, pBindInfos);
+ } else {
+ Logger(device).Err(device, "VK_VERSION_1_1 not enabled. vkBindImageMemory2 not executed.");
+ return VK_SUCCESS;
+ }
+}
+
VKAPI_ATTR VkResult checkedBindImageMemory2KHR(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo* pBindInfos) {
if (GetData(device).hook_extensions[ProcHook::KHR_bind_memory2]) {
return BindImageMemory2KHR(device, bindInfoCount, pBindInfos);
@@ -145,6 +154,14 @@
}
}
+VKAPI_ATTR void checkedGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2* pQueueInfo, VkQueue* pQueue) {
+ if (GetData(device).hook_extensions[ProcHook::EXTENSION_CORE_1_1]) {
+ GetDeviceQueue2(device, pQueueInfo, pQueue);
+ } else {
+ Logger(device).Err(device, "VK_VERSION_1_1 not enabled. vkGetDeviceQueue2 not executed.");
+ }
+}
+
// clang-format on
const ProcHook g_proc_hooks[] = {
@@ -173,16 +190,16 @@
{
"vkAllocateCommandBuffers",
ProcHook::DEVICE,
- ProcHook::EXTENSION_CORE,
+ ProcHook::EXTENSION_CORE_1_0,
reinterpret_cast<PFN_vkVoidFunction>(AllocateCommandBuffers),
nullptr,
},
{
"vkBindImageMemory2",
ProcHook::DEVICE,
- ProcHook::EXTENSION_CORE,
+ ProcHook::EXTENSION_CORE_1_1,
reinterpret_cast<PFN_vkVoidFunction>(BindImageMemory2),
- nullptr,
+ reinterpret_cast<PFN_vkVoidFunction>(checkedBindImageMemory2),
},
{
"vkBindImageMemory2KHR",
@@ -208,14 +225,14 @@
{
"vkCreateDevice",
ProcHook::INSTANCE,
- ProcHook::EXTENSION_CORE,
+ ProcHook::EXTENSION_CORE_1_0,
reinterpret_cast<PFN_vkVoidFunction>(CreateDevice),
nullptr,
},
{
"vkCreateInstance",
ProcHook::GLOBAL,
- ProcHook::EXTENSION_CORE,
+ ProcHook::EXTENSION_CORE_1_0,
reinterpret_cast<PFN_vkVoidFunction>(CreateInstance),
nullptr,
},
@@ -243,14 +260,14 @@
{
"vkDestroyDevice",
ProcHook::DEVICE,
- ProcHook::EXTENSION_CORE,
+ ProcHook::EXTENSION_CORE_1_0,
reinterpret_cast<PFN_vkVoidFunction>(DestroyDevice),
nullptr,
},
{
"vkDestroyInstance",
ProcHook::INSTANCE,
- ProcHook::EXTENSION_CORE,
+ ProcHook::EXTENSION_CORE_1_0,
reinterpret_cast<PFN_vkVoidFunction>(DestroyInstance),
nullptr,
},
@@ -271,28 +288,28 @@
{
"vkEnumerateDeviceExtensionProperties",
ProcHook::INSTANCE,
- ProcHook::EXTENSION_CORE,
+ ProcHook::EXTENSION_CORE_1_0,
reinterpret_cast<PFN_vkVoidFunction>(EnumerateDeviceExtensionProperties),
nullptr,
},
{
"vkEnumerateInstanceExtensionProperties",
ProcHook::GLOBAL,
- ProcHook::EXTENSION_CORE,
+ ProcHook::EXTENSION_CORE_1_0,
reinterpret_cast<PFN_vkVoidFunction>(EnumerateInstanceExtensionProperties),
nullptr,
},
{
"vkEnumeratePhysicalDeviceGroups",
ProcHook::INSTANCE,
- ProcHook::EXTENSION_CORE,
+ ProcHook::EXTENSION_CORE_1_1,
reinterpret_cast<PFN_vkVoidFunction>(EnumeratePhysicalDeviceGroups),
nullptr,
},
{
"vkEnumeratePhysicalDevices",
ProcHook::INSTANCE,
- ProcHook::EXTENSION_CORE,
+ ProcHook::EXTENSION_CORE_1_0,
reinterpret_cast<PFN_vkVoidFunction>(EnumeratePhysicalDevices),
nullptr,
},
@@ -313,28 +330,28 @@
{
"vkGetDeviceProcAddr",
ProcHook::DEVICE,
- ProcHook::EXTENSION_CORE,
+ ProcHook::EXTENSION_CORE_1_0,
reinterpret_cast<PFN_vkVoidFunction>(GetDeviceProcAddr),
nullptr,
},
{
"vkGetDeviceQueue",
ProcHook::DEVICE,
- ProcHook::EXTENSION_CORE,
+ ProcHook::EXTENSION_CORE_1_0,
reinterpret_cast<PFN_vkVoidFunction>(GetDeviceQueue),
nullptr,
},
{
"vkGetDeviceQueue2",
ProcHook::DEVICE,
- ProcHook::EXTENSION_CORE,
+ ProcHook::EXTENSION_CORE_1_1,
reinterpret_cast<PFN_vkVoidFunction>(GetDeviceQueue2),
- nullptr,
+ reinterpret_cast<PFN_vkVoidFunction>(checkedGetDeviceQueue2),
},
{
"vkGetInstanceProcAddr",
ProcHook::INSTANCE,
- ProcHook::EXTENSION_CORE,
+ ProcHook::EXTENSION_CORE_1_0,
reinterpret_cast<PFN_vkVoidFunction>(GetInstanceProcAddr),
nullptr,
},
@@ -446,7 +463,7 @@
{
"vkQueueSubmit",
ProcHook::DEVICE,
- ProcHook::EXTENSION_CORE,
+ ProcHook::EXTENSION_CORE_1_0,
reinterpret_cast<PFN_vkVoidFunction>(QueueSubmit),
nullptr,
},