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 <bitset> 23 #include <vulkan/vulkan.h> 24 #include <vulkan/vk_android_native_buffer.h> 25 26 namespace vulkan { 27 namespace driver { 28 29 struct 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 checked_proc; // always nullptr for non-device hooks 53 }; 54 55 struct InstanceDriverTable { 56 // clang-format off 57 PFN_vkDestroyInstance DestroyInstance; 58 PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices; 59 PFN_vkGetInstanceProcAddr GetInstanceProcAddr; 60 PFN_vkCreateDevice CreateDevice; 61 PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties; 62 PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT; 63 PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT; 64 PFN_vkDebugReportMessageEXT DebugReportMessageEXT; 65 // clang-format on 66 }; 67 68 struct DeviceDriverTable { 69 // clang-format off 70 PFN_vkGetDeviceProcAddr GetDeviceProcAddr; 71 PFN_vkDestroyDevice DestroyDevice; 72 PFN_vkGetDeviceQueue GetDeviceQueue; 73 PFN_vkCreateImage CreateImage; 74 PFN_vkDestroyImage DestroyImage; 75 PFN_vkAllocateCommandBuffers AllocateCommandBuffers; 76 PFN_vkGetSwapchainGrallocUsageANDROID GetSwapchainGrallocUsageANDROID; 77 PFN_vkAcquireImageANDROID AcquireImageANDROID; 78 PFN_vkQueueSignalReleaseImageANDROID QueueSignalReleaseImageANDROID; 79 // clang-format on 80 }; 81 82 const ProcHook* GetProcHook(const char* name); 83 ProcHook::Extension GetProcHookExtension(const char* name); 84 85 bool InitDriverTable(VkInstance instance, 86 PFN_vkGetInstanceProcAddr get_proc, 87 const std::bitset<ProcHook::EXTENSION_COUNT>& extensions); 88 bool InitDriverTable(VkDevice dev, 89 PFN_vkGetDeviceProcAddr get_proc, 90 const std::bitset<ProcHook::EXTENSION_COUNT>& extensions); 91 92 } // namespace driver 93 } // namespace vulkan 94 95 #endif // LIBVULKAN_DRIVER_TABLE_H 96