1 /* 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 22 #include <vulkan/vk_android_native_buffer.h> 23 #include <vulkan/vulkan.h> 24 25 #include <bitset> 26 #include <optional> 27 #include <vector> 28 29 namespace vulkan { 30 namespace driver { 31 32 struct ProcHook { 33 enum Type { 34 GLOBAL, 35 INSTANCE, 36 DEVICE, 37 }; 38 enum Extension { 39 ANDROID_native_buffer, 40 EXT_debug_report, 41 EXT_hdr_metadata, 42 EXT_swapchain_colorspace, 43 GOOGLE_display_timing, 44 KHR_android_surface, 45 KHR_get_surface_capabilities2, 46 KHR_incremental_present, 47 KHR_shared_presentable_image, 48 KHR_surface, 49 KHR_swapchain, 50 ANDROID_external_memory_android_hardware_buffer, 51 KHR_bind_memory2, 52 KHR_get_physical_device_properties2, 53 KHR_device_group_creation, 54 KHR_external_memory_capabilities, 55 KHR_external_semaphore_capabilities, 56 KHR_external_fence_capabilities, 57 58 EXTENSION_CORE_1_0, 59 EXTENSION_CORE_1_1, 60 EXTENSION_CORE_1_2, 61 EXTENSION_COUNT, 62 EXTENSION_UNKNOWN, 63 }; 64 65 const char* name; 66 Type type; 67 Extension extension; 68 69 PFN_vkVoidFunction proc; 70 PFN_vkVoidFunction checked_proc; // always nullptr for non-device hooks 71 }; 72 73 struct InstanceDriverTable { 74 // clang-format off 75 PFN_vkDestroyInstance DestroyInstance; 76 PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices; 77 PFN_vkGetInstanceProcAddr GetInstanceProcAddr; 78 PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties; 79 PFN_vkCreateDevice CreateDevice; 80 PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties; 81 PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT; 82 PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT; 83 PFN_vkDebugReportMessageEXT DebugReportMessageEXT; 84 PFN_vkGetPhysicalDeviceFeatures2 GetPhysicalDeviceFeatures2; 85 PFN_vkGetPhysicalDeviceFeatures2KHR GetPhysicalDeviceFeatures2KHR; 86 PFN_vkGetPhysicalDeviceProperties2 GetPhysicalDeviceProperties2; 87 PFN_vkGetPhysicalDeviceProperties2KHR GetPhysicalDeviceProperties2KHR; 88 PFN_vkGetPhysicalDeviceFormatProperties2 GetPhysicalDeviceFormatProperties2; 89 PFN_vkGetPhysicalDeviceFormatProperties2KHR GetPhysicalDeviceFormatProperties2KHR; 90 PFN_vkGetPhysicalDeviceImageFormatProperties2 GetPhysicalDeviceImageFormatProperties2; 91 PFN_vkGetPhysicalDeviceImageFormatProperties2KHR GetPhysicalDeviceImageFormatProperties2KHR; 92 PFN_vkGetPhysicalDeviceQueueFamilyProperties2 GetPhysicalDeviceQueueFamilyProperties2; 93 PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR GetPhysicalDeviceQueueFamilyProperties2KHR; 94 PFN_vkGetPhysicalDeviceMemoryProperties2 GetPhysicalDeviceMemoryProperties2; 95 PFN_vkGetPhysicalDeviceMemoryProperties2KHR GetPhysicalDeviceMemoryProperties2KHR; 96 PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 GetPhysicalDeviceSparseImageFormatProperties2; 97 PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR GetPhysicalDeviceSparseImageFormatProperties2KHR; 98 PFN_vkGetPhysicalDeviceExternalBufferProperties GetPhysicalDeviceExternalBufferProperties; 99 PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR GetPhysicalDeviceExternalBufferPropertiesKHR; 100 PFN_vkGetPhysicalDeviceExternalSemaphoreProperties GetPhysicalDeviceExternalSemaphoreProperties; 101 PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR GetPhysicalDeviceExternalSemaphorePropertiesKHR; 102 PFN_vkGetPhysicalDeviceExternalFenceProperties GetPhysicalDeviceExternalFenceProperties; 103 PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR GetPhysicalDeviceExternalFencePropertiesKHR; 104 PFN_vkEnumeratePhysicalDeviceGroups EnumeratePhysicalDeviceGroups; 105 PFN_vkEnumeratePhysicalDeviceGroupsKHR EnumeratePhysicalDeviceGroupsKHR; 106 // clang-format on 107 }; 108 109 struct DeviceDriverTable { 110 // clang-format off 111 PFN_vkGetDeviceProcAddr GetDeviceProcAddr; 112 PFN_vkDestroyDevice DestroyDevice; 113 PFN_vkGetDeviceQueue GetDeviceQueue; 114 PFN_vkQueueSubmit QueueSubmit; 115 PFN_vkCreateImage CreateImage; 116 PFN_vkDestroyImage DestroyImage; 117 PFN_vkAllocateCommandBuffers AllocateCommandBuffers; 118 PFN_vkBindImageMemory2 BindImageMemory2; 119 PFN_vkBindImageMemory2KHR BindImageMemory2KHR; 120 PFN_vkGetDeviceQueue2 GetDeviceQueue2; 121 PFN_vkGetSwapchainGrallocUsageANDROID GetSwapchainGrallocUsageANDROID; 122 PFN_vkGetSwapchainGrallocUsage2ANDROID GetSwapchainGrallocUsage2ANDROID; 123 PFN_vkAcquireImageANDROID AcquireImageANDROID; 124 PFN_vkQueueSignalReleaseImageANDROID QueueSignalReleaseImageANDROID; 125 // clang-format on 126 }; 127 128 const ProcHook* GetProcHook(const char* name); 129 ProcHook::Extension GetProcHookExtension(const char* name); 130 131 bool InitDriverTable(VkInstance instance, 132 PFN_vkGetInstanceProcAddr get_proc, 133 const std::bitset<ProcHook::EXTENSION_COUNT>& extensions); 134 bool InitDriverTable(VkDevice dev, 135 PFN_vkGetDeviceProcAddr get_proc, 136 const std::bitset<ProcHook::EXTENSION_COUNT>& extensions); 137 138 std::optional<uint32_t> GetInstanceExtensionPromotedVersion(const char* name); 139 uint32_t CountPromotedInstanceExtensions(uint32_t begin_version, 140 uint32_t end_version); 141 std::vector<const char*> GetPromotedInstanceExtensions(uint32_t begin_version, 142 uint32_t end_version); 143 144 } // namespace driver 145 } // namespace vulkan 146 147 #endif // LIBVULKAN_DRIVER_TABLE_H 148