blob: 819f6b211ccfebaec24f7365ad35645c6167033a [file] [log] [blame]
Chia-I Wueb7db122016-03-24 09:11:06 +08001/*
2 * Copyright 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17// WARNING: This file is generated. See ../README.md for instructions.
18
19#ifndef LIBVULKAN_DRIVER_GEN_H
20#define LIBVULKAN_DRIVER_GEN_H
21
Chia-I Wueb7db122016-03-24 09:11:06 +080022#include <vulkan/vk_android_native_buffer.h>
Chris Forbese2d3ee12017-03-16 16:10:15 +130023#include <vulkan/vulkan.h>
Yiwei Zhang6d78a572019-04-10 15:35:38 -070024
Chris Forbese2d3ee12017-03-16 16:10:15 +130025#include <bitset>
Yiwei Zhang7c0c07c2020-07-04 23:49:47 -070026#include <optional>
27#include <vector>
Chia-I Wueb7db122016-03-24 09:11:06 +080028
29namespace vulkan {
30namespace driver {
31
32struct ProcHook {
33 enum Type {
34 GLOBAL,
35 INSTANCE,
36 DEVICE,
37 };
38 enum Extension {
39 ANDROID_native_buffer,
40 EXT_debug_report,
Courtney Goeltzenleuchterd634c482017-01-05 15:55:31 -070041 EXT_hdr_metadata,
Courtney Goeltzenleuchtere278daf2017-02-02 16:54:57 -070042 EXT_swapchain_colorspace,
Courtney Goeltzenleuchterd634c482017-01-05 15:55:31 -070043 GOOGLE_display_timing,
Chia-I Wueb7db122016-03-24 09:11:06 +080044 KHR_android_surface,
Yiwei Zhangdc792f52019-10-10 16:29:42 -070045 KHR_get_surface_capabilities2,
Chris Forbes48853712017-01-12 14:09:33 +130046 KHR_incremental_present,
Courtney Goeltzenleuchtere278daf2017-02-02 16:54:57 -070047 KHR_shared_presentable_image,
Chia-I Wueb7db122016-03-24 09:11:06 +080048 KHR_surface,
49 KHR_swapchain,
Jesse Halla8d367a2018-01-18 15:40:46 -080050 ANDROID_external_memory_android_hardware_buffer,
Yiwei Zhang23143102019-04-10 18:24:05 -070051 KHR_bind_memory2,
Yiwei Zhangdc792f52019-10-10 16:29:42 -070052 KHR_get_physical_device_properties2,
Yiwei Zhange4f64172020-07-05 15:17:32 -070053 KHR_device_group_creation,
Yiwei Zhange1f35012020-07-05 22:52:04 -070054 KHR_external_memory_capabilities,
55 KHR_external_semaphore_capabilities,
56 KHR_external_fence_capabilities,
Chia-I Wueb7db122016-03-24 09:11:06 +080057
Yiwei Zhang7cc36a52019-10-11 19:02:09 -070058 EXTENSION_CORE_1_0,
59 EXTENSION_CORE_1_1,
Yiwei Zhang6be097b2020-10-19 20:22:05 -070060 EXTENSION_CORE_1_2,
Trevor David Blackb700ae82021-09-27 04:50:04 +000061 EXTENSION_CORE_1_3,
Chia-I Wueb7db122016-03-24 09:11:06 +080062 EXTENSION_COUNT,
63 EXTENSION_UNKNOWN,
64 };
65
66 const char* name;
67 Type type;
68 Extension extension;
69
70 PFN_vkVoidFunction proc;
Chia-I Wu36cc00a2016-04-13 16:52:06 +080071 PFN_vkVoidFunction checked_proc; // always nullptr for non-device hooks
Chia-I Wueb7db122016-03-24 09:11:06 +080072};
73
Chia-I Wucc5e2762016-03-24 13:01:16 +080074struct InstanceDriverTable {
75 // clang-format off
76 PFN_vkDestroyInstance DestroyInstance;
77 PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
78 PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
Jesse Hall85bb0c52017-02-09 22:13:02 -080079 PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
Chia-I Wucc5e2762016-03-24 13:01:16 +080080 PFN_vkCreateDevice CreateDevice;
81 PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
82 PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
83 PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
84 PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
Yiwei Zhanga55624b2020-07-05 16:05:26 -070085 PFN_vkGetPhysicalDeviceFeatures2 GetPhysicalDeviceFeatures2;
86 PFN_vkGetPhysicalDeviceFeatures2KHR GetPhysicalDeviceFeatures2KHR;
Adithya Srinivasan8dce9d72019-07-11 14:26:04 -070087 PFN_vkGetPhysicalDeviceProperties2 GetPhysicalDeviceProperties2;
Chris Forbes6aa30db2017-02-20 17:12:53 +130088 PFN_vkGetPhysicalDeviceProperties2KHR GetPhysicalDeviceProperties2KHR;
Yiwei Zhanga55624b2020-07-05 16:05:26 -070089 PFN_vkGetPhysicalDeviceFormatProperties2 GetPhysicalDeviceFormatProperties2;
90 PFN_vkGetPhysicalDeviceFormatProperties2KHR GetPhysicalDeviceFormatProperties2KHR;
91 PFN_vkGetPhysicalDeviceImageFormatProperties2 GetPhysicalDeviceImageFormatProperties2;
92 PFN_vkGetPhysicalDeviceImageFormatProperties2KHR GetPhysicalDeviceImageFormatProperties2KHR;
93 PFN_vkGetPhysicalDeviceQueueFamilyProperties2 GetPhysicalDeviceQueueFamilyProperties2;
94 PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR GetPhysicalDeviceQueueFamilyProperties2KHR;
95 PFN_vkGetPhysicalDeviceMemoryProperties2 GetPhysicalDeviceMemoryProperties2;
96 PFN_vkGetPhysicalDeviceMemoryProperties2KHR GetPhysicalDeviceMemoryProperties2KHR;
97 PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 GetPhysicalDeviceSparseImageFormatProperties2;
98 PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR GetPhysicalDeviceSparseImageFormatProperties2KHR;
Yiwei Zhange1f35012020-07-05 22:52:04 -070099 PFN_vkGetPhysicalDeviceExternalBufferProperties GetPhysicalDeviceExternalBufferProperties;
100 PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR GetPhysicalDeviceExternalBufferPropertiesKHR;
101 PFN_vkGetPhysicalDeviceExternalSemaphoreProperties GetPhysicalDeviceExternalSemaphoreProperties;
102 PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR GetPhysicalDeviceExternalSemaphorePropertiesKHR;
103 PFN_vkGetPhysicalDeviceExternalFenceProperties GetPhysicalDeviceExternalFenceProperties;
104 PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR GetPhysicalDeviceExternalFencePropertiesKHR;
Adithya Srinivasan8dce9d72019-07-11 14:26:04 -0700105 PFN_vkEnumeratePhysicalDeviceGroups EnumeratePhysicalDeviceGroups;
Yiwei Zhange4f64172020-07-05 15:17:32 -0700106 PFN_vkEnumeratePhysicalDeviceGroupsKHR EnumeratePhysicalDeviceGroupsKHR;
Chia-I Wucc5e2762016-03-24 13:01:16 +0800107 // clang-format on
108};
109
110struct DeviceDriverTable {
111 // clang-format off
112 PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
113 PFN_vkDestroyDevice DestroyDevice;
114 PFN_vkGetDeviceQueue GetDeviceQueue;
Yiwei Zhang899d1752019-09-23 16:05:35 -0700115 PFN_vkQueueSubmit QueueSubmit;
Chia-I Wucc5e2762016-03-24 13:01:16 +0800116 PFN_vkCreateImage CreateImage;
117 PFN_vkDestroyImage DestroyImage;
118 PFN_vkAllocateCommandBuffers AllocateCommandBuffers;
Yiwei Zhang23143102019-04-10 18:24:05 -0700119 PFN_vkBindImageMemory2 BindImageMemory2;
Adithya Srinivasan8dce9d72019-07-11 14:26:04 -0700120 PFN_vkBindImageMemory2KHR BindImageMemory2KHR;
Daniel Kochf25f5bb2017-10-05 00:26:58 -0400121 PFN_vkGetDeviceQueue2 GetDeviceQueue2;
Chia-I Wucc5e2762016-03-24 13:01:16 +0800122 PFN_vkGetSwapchainGrallocUsageANDROID GetSwapchainGrallocUsageANDROID;
Yiwei Zhang4bc489b2019-09-23 15:17:22 -0700123 PFN_vkGetSwapchainGrallocUsage2ANDROID GetSwapchainGrallocUsage2ANDROID;
Chia-I Wucc5e2762016-03-24 13:01:16 +0800124 PFN_vkAcquireImageANDROID AcquireImageANDROID;
125 PFN_vkQueueSignalReleaseImageANDROID QueueSignalReleaseImageANDROID;
126 // clang-format on
127};
128
Chia-I Wueb7db122016-03-24 09:11:06 +0800129const ProcHook* GetProcHook(const char* name);
130ProcHook::Extension GetProcHookExtension(const char* name);
131
Chia-I Wucbe07ef2016-04-13 15:01:00 +0800132bool InitDriverTable(VkInstance instance,
133 PFN_vkGetInstanceProcAddr get_proc,
134 const std::bitset<ProcHook::EXTENSION_COUNT>& extensions);
135bool InitDriverTable(VkDevice dev,
136 PFN_vkGetDeviceProcAddr get_proc,
137 const std::bitset<ProcHook::EXTENSION_COUNT>& extensions);
Chia-I Wucc5e2762016-03-24 13:01:16 +0800138
Yiwei Zhang7c0c07c2020-07-04 23:49:47 -0700139std::optional<uint32_t> GetInstanceExtensionPromotedVersion(const char* name);
140uint32_t CountPromotedInstanceExtensions(uint32_t begin_version,
141 uint32_t end_version);
142std::vector<const char*> GetPromotedInstanceExtensions(uint32_t begin_version,
143 uint32_t end_version);
144
Chia-I Wueb7db122016-03-24 09:11:06 +0800145} // namespace driver
146} // namespace vulkan
147
148#endif // LIBVULKAN_DRIVER_TABLE_H