blob: e7e3b997134db2589fea83053128967d5dc073bd [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>
24#include <bitset>
Chia-I Wueb7db122016-03-24 09:11:06 +080025
26namespace vulkan {
27namespace driver {
28
29struct ProcHook {
30 enum Type {
31 GLOBAL,
32 INSTANCE,
33 DEVICE,
34 };
35 enum Extension {
36 ANDROID_native_buffer,
37 EXT_debug_report,
Courtney Goeltzenleuchterd634c482017-01-05 15:55:31 -070038 EXT_hdr_metadata,
Courtney Goeltzenleuchtere278daf2017-02-02 16:54:57 -070039 EXT_swapchain_colorspace,
Courtney Goeltzenleuchterd634c482017-01-05 15:55:31 -070040 GOOGLE_display_timing,
Chia-I Wueb7db122016-03-24 09:11:06 +080041 KHR_android_surface,
Chris Forbes48853712017-01-12 14:09:33 +130042 KHR_incremental_present,
Courtney Goeltzenleuchtere278daf2017-02-02 16:54:57 -070043 KHR_shared_presentable_image,
Chia-I Wueb7db122016-03-24 09:11:06 +080044 KHR_surface,
45 KHR_swapchain,
Chris Forbes2452cf72017-03-16 16:30:17 +130046 KHR_get_surface_capabilities2,
Chris Forbes6aa30db2017-02-20 17:12:53 +130047 KHR_get_physical_device_properties2,
Chia-I Wueb7db122016-03-24 09:11:06 +080048
49 EXTENSION_CORE, // valid bit
50 EXTENSION_COUNT,
51 EXTENSION_UNKNOWN,
52 };
53
54 const char* name;
55 Type type;
56 Extension extension;
57
58 PFN_vkVoidFunction proc;
Chia-I Wu36cc00a2016-04-13 16:52:06 +080059 PFN_vkVoidFunction checked_proc; // always nullptr for non-device hooks
Chia-I Wueb7db122016-03-24 09:11:06 +080060};
61
Chia-I Wucc5e2762016-03-24 13:01:16 +080062struct InstanceDriverTable {
63 // clang-format off
64 PFN_vkDestroyInstance DestroyInstance;
65 PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
66 PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
Jesse Hall85bb0c52017-02-09 22:13:02 -080067 PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
Chia-I Wucc5e2762016-03-24 13:01:16 +080068 PFN_vkCreateDevice CreateDevice;
69 PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
Daniel Kochf25f5bb2017-10-05 00:26:58 -040070 PFN_vkEnumeratePhysicalDeviceGroups EnumeratePhysicalDeviceGroups;
71 PFN_vkGetPhysicalDevicePresentRectanglesKHR GetPhysicalDevicePresentRectanglesKHR;
Chia-I Wucc5e2762016-03-24 13:01:16 +080072 PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
73 PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
74 PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
Chris Forbes6aa30db2017-02-20 17:12:53 +130075 PFN_vkGetPhysicalDeviceProperties2KHR GetPhysicalDeviceProperties2KHR;
Chia-I Wucc5e2762016-03-24 13:01:16 +080076 // clang-format on
77};
78
79struct DeviceDriverTable {
80 // clang-format off
81 PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
82 PFN_vkDestroyDevice DestroyDevice;
83 PFN_vkGetDeviceQueue GetDeviceQueue;
84 PFN_vkCreateImage CreateImage;
85 PFN_vkDestroyImage DestroyImage;
86 PFN_vkAllocateCommandBuffers AllocateCommandBuffers;
Daniel Kochf25f5bb2017-10-05 00:26:58 -040087 PFN_vkGetDeviceQueue2 GetDeviceQueue2;
88 PFN_vkGetDeviceGroupPresentCapabilitiesKHR GetDeviceGroupPresentCapabilitiesKHR;
89 PFN_vkGetDeviceGroupSurfacePresentModesKHR GetDeviceGroupSurfacePresentModesKHR;
Chia-I Wucc5e2762016-03-24 13:01:16 +080090 PFN_vkGetSwapchainGrallocUsageANDROID GetSwapchainGrallocUsageANDROID;
Chris Forbes8e4438b2016-12-07 16:26:49 +130091 PFN_vkGetSwapchainGrallocUsage2ANDROID GetSwapchainGrallocUsage2ANDROID;
Chia-I Wucc5e2762016-03-24 13:01:16 +080092 PFN_vkAcquireImageANDROID AcquireImageANDROID;
93 PFN_vkQueueSignalReleaseImageANDROID QueueSignalReleaseImageANDROID;
94 // clang-format on
95};
96
Chia-I Wueb7db122016-03-24 09:11:06 +080097const ProcHook* GetProcHook(const char* name);
98ProcHook::Extension GetProcHookExtension(const char* name);
99
Chia-I Wucbe07ef2016-04-13 15:01:00 +0800100bool InitDriverTable(VkInstance instance,
101 PFN_vkGetInstanceProcAddr get_proc,
102 const std::bitset<ProcHook::EXTENSION_COUNT>& extensions);
103bool InitDriverTable(VkDevice dev,
104 PFN_vkGetDeviceProcAddr get_proc,
105 const std::bitset<ProcHook::EXTENSION_COUNT>& extensions);
Chia-I Wucc5e2762016-03-24 13:01:16 +0800106
Chia-I Wueb7db122016-03-24 09:11:06 +0800107} // namespace driver
108} // namespace vulkan
109
110#endif // LIBVULKAN_DRIVER_TABLE_H