blob: 9f3b7054a14a0e987c415ee142028b5ae47af45c [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 Wucbe07ef2016-04-13 15:01:00 +080022#include <bitset>
Chia-I Wueb7db122016-03-24 09:11:06 +080023#include <vulkan/vulkan.h>
24#include <vulkan/vk_android_native_buffer.h>
25
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,
38 KHR_android_surface,
Chris Forbes48853712017-01-12 14:09:33 +130039 KHR_incremental_present,
Chia-I Wueb7db122016-03-24 09:11:06 +080040 KHR_surface,
41 KHR_swapchain,
Ian Elliott4c8bb2a2016-12-29 11:07:26 -070042 GOOGLE_display_timing,
Chris Forbes1d5f68c2017-01-31 10:17:01 +130043 KHR_shared_presentable_image,
Chia-I Wueb7db122016-03-24 09:11:06 +080044
45 EXTENSION_CORE, // valid bit
46 EXTENSION_COUNT,
47 EXTENSION_UNKNOWN,
48 };
49
50 const char* name;
51 Type type;
52 Extension extension;
53
54 PFN_vkVoidFunction proc;
Chia-I Wu36cc00a2016-04-13 16:52:06 +080055 PFN_vkVoidFunction checked_proc; // always nullptr for non-device hooks
Chia-I Wueb7db122016-03-24 09:11:06 +080056};
57
Chia-I Wucc5e2762016-03-24 13:01:16 +080058struct InstanceDriverTable {
59 // clang-format off
60 PFN_vkDestroyInstance DestroyInstance;
61 PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
62 PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
63 PFN_vkCreateDevice CreateDevice;
64 PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
65 PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
66 PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
67 PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
68 // clang-format on
69};
70
71struct DeviceDriverTable {
72 // clang-format off
73 PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
74 PFN_vkDestroyDevice DestroyDevice;
75 PFN_vkGetDeviceQueue GetDeviceQueue;
76 PFN_vkCreateImage CreateImage;
77 PFN_vkDestroyImage DestroyImage;
78 PFN_vkAllocateCommandBuffers AllocateCommandBuffers;
79 PFN_vkGetSwapchainGrallocUsageANDROID GetSwapchainGrallocUsageANDROID;
Chris Forbes8e4438b2016-12-07 16:26:49 +130080 PFN_vkGetSwapchainGrallocUsage2ANDROID GetSwapchainGrallocUsage2ANDROID;
Chia-I Wucc5e2762016-03-24 13:01:16 +080081 PFN_vkAcquireImageANDROID AcquireImageANDROID;
82 PFN_vkQueueSignalReleaseImageANDROID QueueSignalReleaseImageANDROID;
83 // clang-format on
84};
85
Chia-I Wueb7db122016-03-24 09:11:06 +080086const ProcHook* GetProcHook(const char* name);
87ProcHook::Extension GetProcHookExtension(const char* name);
88
Chia-I Wucbe07ef2016-04-13 15:01:00 +080089bool InitDriverTable(VkInstance instance,
90 PFN_vkGetInstanceProcAddr get_proc,
91 const std::bitset<ProcHook::EXTENSION_COUNT>& extensions);
92bool InitDriverTable(VkDevice dev,
93 PFN_vkGetDeviceProcAddr get_proc,
94 const std::bitset<ProcHook::EXTENSION_COUNT>& extensions);
Chia-I Wucc5e2762016-03-24 13:01:16 +080095
Chia-I Wueb7db122016-03-24 09:11:06 +080096} // namespace driver
97} // namespace vulkan
98
99#endif // LIBVULKAN_DRIVER_TABLE_H