blob: 198430209998da217453dc90c495850aed550275 [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,
39 KHR_surface,
40 KHR_swapchain,
41
42 EXTENSION_CORE, // valid bit
43 EXTENSION_COUNT,
44 EXTENSION_UNKNOWN,
45 };
46
47 const char* name;
48 Type type;
49 Extension extension;
50
51 PFN_vkVoidFunction proc;
52 PFN_vkVoidFunction disabled_proc; // nullptr for global hooks
53 PFN_vkVoidFunction checked_proc; // nullptr for global/instance hooks
54};
55
Chia-I Wucc5e2762016-03-24 13:01:16 +080056struct InstanceDriverTable {
57 // clang-format off
58 PFN_vkDestroyInstance DestroyInstance;
59 PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
60 PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
61 PFN_vkCreateDevice CreateDevice;
Chia-I Wu4901db72016-03-24 16:38:58 +080062 PFN_vkEnumerateDeviceLayerProperties EnumerateDeviceLayerProperties;
Chia-I Wucc5e2762016-03-24 13:01:16 +080063 PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
64 PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
65 PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
66 PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
67 // clang-format on
68};
69
70struct DeviceDriverTable {
71 // clang-format off
72 PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
73 PFN_vkDestroyDevice DestroyDevice;
74 PFN_vkGetDeviceQueue GetDeviceQueue;
75 PFN_vkCreateImage CreateImage;
76 PFN_vkDestroyImage DestroyImage;
77 PFN_vkAllocateCommandBuffers AllocateCommandBuffers;
78 PFN_vkGetSwapchainGrallocUsageANDROID GetSwapchainGrallocUsageANDROID;
79 PFN_vkAcquireImageANDROID AcquireImageANDROID;
80 PFN_vkQueueSignalReleaseImageANDROID QueueSignalReleaseImageANDROID;
81 // clang-format on
82};
83
Chia-I Wueb7db122016-03-24 09:11:06 +080084const ProcHook* GetProcHook(const char* name);
85ProcHook::Extension GetProcHookExtension(const char* name);
86
Chia-I Wucbe07ef2016-04-13 15:01:00 +080087bool InitDriverTable(VkInstance instance,
88 PFN_vkGetInstanceProcAddr get_proc,
89 const std::bitset<ProcHook::EXTENSION_COUNT>& extensions);
90bool InitDriverTable(VkDevice dev,
91 PFN_vkGetDeviceProcAddr get_proc,
92 const std::bitset<ProcHook::EXTENSION_COUNT>& extensions);
Chia-I Wucc5e2762016-03-24 13:01:16 +080093
Chia-I Wueb7db122016-03-24 09:11:06 +080094} // namespace driver
95} // namespace vulkan
96
97#endif // LIBVULKAN_DRIVER_TABLE_H