blob: c9dba788ea2cecc16e54390543969e817d2dd04e [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,
Courtney Goeltzenleuchterd634c482017-01-05 15:55:31 -070038 EXT_hdr_metadata,
39 GOOGLE_display_timing,
Chia-I Wueb7db122016-03-24 09:11:06 +080040 KHR_android_surface,
Chris Forbes48853712017-01-12 14:09:33 +130041 KHR_incremental_present,
Chia-I Wueb7db122016-03-24 09:11:06 +080042 KHR_surface,
43 KHR_swapchain,
Chris Forbes1d5f68c2017-01-31 10:17:01 +130044 KHR_shared_presentable_image,
Chris Forbes6aa30db2017-02-20 17:12:53 +130045 KHR_get_physical_device_properties2,
Chia-I Wueb7db122016-03-24 09:11:06 +080046
47 EXTENSION_CORE, // valid bit
48 EXTENSION_COUNT,
49 EXTENSION_UNKNOWN,
50 };
51
52 const char* name;
53 Type type;
54 Extension extension;
55
56 PFN_vkVoidFunction proc;
Chia-I Wu36cc00a2016-04-13 16:52:06 +080057 PFN_vkVoidFunction checked_proc; // always nullptr for non-device hooks
Chia-I Wueb7db122016-03-24 09:11:06 +080058};
59
Chia-I Wucc5e2762016-03-24 13:01:16 +080060struct InstanceDriverTable {
61 // clang-format off
62 PFN_vkDestroyInstance DestroyInstance;
63 PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
64 PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
Jesse Hall85bb0c52017-02-09 22:13:02 -080065 PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
Chia-I Wucc5e2762016-03-24 13:01:16 +080066 PFN_vkCreateDevice CreateDevice;
67 PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
68 PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
69 PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
70 PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
Chris Forbes6aa30db2017-02-20 17:12:53 +130071 PFN_vkGetPhysicalDeviceProperties2KHR GetPhysicalDeviceProperties2KHR;
Chia-I Wucc5e2762016-03-24 13:01:16 +080072 // clang-format on
73};
74
75struct DeviceDriverTable {
76 // clang-format off
77 PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
78 PFN_vkDestroyDevice DestroyDevice;
79 PFN_vkGetDeviceQueue GetDeviceQueue;
80 PFN_vkCreateImage CreateImage;
81 PFN_vkDestroyImage DestroyImage;
82 PFN_vkAllocateCommandBuffers AllocateCommandBuffers;
83 PFN_vkGetSwapchainGrallocUsageANDROID GetSwapchainGrallocUsageANDROID;
Chris Forbes8e4438b2016-12-07 16:26:49 +130084 PFN_vkGetSwapchainGrallocUsage2ANDROID GetSwapchainGrallocUsage2ANDROID;
Chia-I Wucc5e2762016-03-24 13:01:16 +080085 PFN_vkAcquireImageANDROID AcquireImageANDROID;
86 PFN_vkQueueSignalReleaseImageANDROID QueueSignalReleaseImageANDROID;
87 // clang-format on
88};
89
Chia-I Wueb7db122016-03-24 09:11:06 +080090const ProcHook* GetProcHook(const char* name);
91ProcHook::Extension GetProcHookExtension(const char* name);
92
Chia-I Wucbe07ef2016-04-13 15:01:00 +080093bool InitDriverTable(VkInstance instance,
94 PFN_vkGetInstanceProcAddr get_proc,
95 const std::bitset<ProcHook::EXTENSION_COUNT>& extensions);
96bool InitDriverTable(VkDevice dev,
97 PFN_vkGetDeviceProcAddr get_proc,
98 const std::bitset<ProcHook::EXTENSION_COUNT>& extensions);
Chia-I Wucc5e2762016-03-24 13:01:16 +080099
Chia-I Wueb7db122016-03-24 09:11:06 +0800100} // namespace driver
101} // namespace vulkan
102
103#endif // LIBVULKAN_DRIVER_TABLE_H