Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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 | |
Jesse Hall | 0a40209 | 2016-02-01 14:43:47 -0800 | [diff] [blame] | 17 | // WARNING: This file is generated. See ../README.md for instructions. |
| 18 | |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 19 | #include <log/log.h> |
| 20 | #include <algorithm> |
| 21 | #include "loader.h" |
| 22 | |
| 23 | #define UNLIKELY(expr) __builtin_expect((expr), 0) |
| 24 | |
| 25 | using namespace vulkan; |
| 26 | |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 27 | namespace vulkan { |
| 28 | |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 29 | bool LoadDriverDispatchTable(VkInstance instance, |
| 30 | PFN_vkGetInstanceProcAddr get_proc_addr, |
Jesse Hall | 6bd5dfa | 2016-01-16 17:13:30 -0800 | [diff] [blame] | 31 | const InstanceExtensionSet& extensions, |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 32 | DriverDispatchTable& dispatch) { |
| 33 | bool success = true; |
| 34 | // clang-format off |
| 35 | dispatch.DestroyInstance = reinterpret_cast<PFN_vkDestroyInstance>(get_proc_addr(instance, "vkDestroyInstance")); |
| 36 | if (UNLIKELY(!dispatch.DestroyInstance)) { |
| 37 | ALOGE("missing driver proc: %s", "vkDestroyInstance"); |
| 38 | success = false; |
| 39 | } |
| 40 | dispatch.EnumeratePhysicalDevices = reinterpret_cast<PFN_vkEnumeratePhysicalDevices>(get_proc_addr(instance, "vkEnumeratePhysicalDevices")); |
| 41 | if (UNLIKELY(!dispatch.EnumeratePhysicalDevices)) { |
| 42 | ALOGE("missing driver proc: %s", "vkEnumeratePhysicalDevices"); |
| 43 | success = false; |
| 44 | } |
| 45 | dispatch.GetPhysicalDeviceProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceProperties")); |
| 46 | if (UNLIKELY(!dispatch.GetPhysicalDeviceProperties)) { |
| 47 | ALOGE("missing driver proc: %s", "vkGetPhysicalDeviceProperties"); |
| 48 | success = false; |
| 49 | } |
| 50 | dispatch.GetPhysicalDeviceQueueFamilyProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceQueueFamilyProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceQueueFamilyProperties")); |
| 51 | if (UNLIKELY(!dispatch.GetPhysicalDeviceQueueFamilyProperties)) { |
| 52 | ALOGE("missing driver proc: %s", "vkGetPhysicalDeviceQueueFamilyProperties"); |
| 53 | success = false; |
| 54 | } |
| 55 | dispatch.GetPhysicalDeviceMemoryProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceMemoryProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceMemoryProperties")); |
| 56 | if (UNLIKELY(!dispatch.GetPhysicalDeviceMemoryProperties)) { |
| 57 | ALOGE("missing driver proc: %s", "vkGetPhysicalDeviceMemoryProperties"); |
| 58 | success = false; |
| 59 | } |
| 60 | dispatch.GetPhysicalDeviceFeatures = reinterpret_cast<PFN_vkGetPhysicalDeviceFeatures>(get_proc_addr(instance, "vkGetPhysicalDeviceFeatures")); |
| 61 | if (UNLIKELY(!dispatch.GetPhysicalDeviceFeatures)) { |
| 62 | ALOGE("missing driver proc: %s", "vkGetPhysicalDeviceFeatures"); |
| 63 | success = false; |
| 64 | } |
| 65 | dispatch.GetPhysicalDeviceFormatProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceFormatProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceFormatProperties")); |
| 66 | if (UNLIKELY(!dispatch.GetPhysicalDeviceFormatProperties)) { |
| 67 | ALOGE("missing driver proc: %s", "vkGetPhysicalDeviceFormatProperties"); |
| 68 | success = false; |
| 69 | } |
| 70 | dispatch.GetPhysicalDeviceImageFormatProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceImageFormatProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceImageFormatProperties")); |
| 71 | if (UNLIKELY(!dispatch.GetPhysicalDeviceImageFormatProperties)) { |
| 72 | ALOGE("missing driver proc: %s", "vkGetPhysicalDeviceImageFormatProperties"); |
| 73 | success = false; |
| 74 | } |
| 75 | dispatch.CreateDevice = reinterpret_cast<PFN_vkCreateDevice>(get_proc_addr(instance, "vkCreateDevice")); |
| 76 | if (UNLIKELY(!dispatch.CreateDevice)) { |
| 77 | ALOGE("missing driver proc: %s", "vkCreateDevice"); |
| 78 | success = false; |
| 79 | } |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 80 | dispatch.EnumerateDeviceExtensionProperties = reinterpret_cast<PFN_vkEnumerateDeviceExtensionProperties>(get_proc_addr(instance, "vkEnumerateDeviceExtensionProperties")); |
| 81 | if (UNLIKELY(!dispatch.EnumerateDeviceExtensionProperties)) { |
| 82 | ALOGE("missing driver proc: %s", "vkEnumerateDeviceExtensionProperties"); |
| 83 | success = false; |
| 84 | } |
| 85 | dispatch.GetPhysicalDeviceSparseImageFormatProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceSparseImageFormatProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceSparseImageFormatProperties")); |
| 86 | if (UNLIKELY(!dispatch.GetPhysicalDeviceSparseImageFormatProperties)) { |
| 87 | ALOGE("missing driver proc: %s", "vkGetPhysicalDeviceSparseImageFormatProperties"); |
| 88 | success = false; |
| 89 | } |
Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 90 | if (extensions[kEXT_debug_report]) { |
| 91 | dispatch.CreateDebugReportCallbackEXT = reinterpret_cast<PFN_vkCreateDebugReportCallbackEXT>(get_proc_addr(instance, "vkCreateDebugReportCallbackEXT")); |
| 92 | if (UNLIKELY(!dispatch.CreateDebugReportCallbackEXT)) { |
| 93 | ALOGE("missing driver proc: %s", "vkCreateDebugReportCallbackEXT"); |
| 94 | success = false; |
| 95 | } |
| 96 | } |
| 97 | if (extensions[kEXT_debug_report]) { |
| 98 | dispatch.DestroyDebugReportCallbackEXT = reinterpret_cast<PFN_vkDestroyDebugReportCallbackEXT>(get_proc_addr(instance, "vkDestroyDebugReportCallbackEXT")); |
| 99 | if (UNLIKELY(!dispatch.DestroyDebugReportCallbackEXT)) { |
| 100 | ALOGE("missing driver proc: %s", "vkDestroyDebugReportCallbackEXT"); |
| 101 | success = false; |
| 102 | } |
| 103 | } |
| 104 | if (extensions[kEXT_debug_report]) { |
| 105 | dispatch.DebugReportMessageEXT = reinterpret_cast<PFN_vkDebugReportMessageEXT>(get_proc_addr(instance, "vkDebugReportMessageEXT")); |
| 106 | if (UNLIKELY(!dispatch.DebugReportMessageEXT)) { |
| 107 | ALOGE("missing driver proc: %s", "vkDebugReportMessageEXT"); |
| 108 | success = false; |
| 109 | } |
| 110 | } |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 111 | dispatch.GetDeviceProcAddr = reinterpret_cast<PFN_vkGetDeviceProcAddr>(get_proc_addr(instance, "vkGetDeviceProcAddr")); |
| 112 | if (UNLIKELY(!dispatch.GetDeviceProcAddr)) { |
| 113 | ALOGE("missing driver proc: %s", "vkGetDeviceProcAddr"); |
| 114 | success = false; |
| 115 | } |
Chia-I Wu | 0c20324 | 2016-03-15 13:44:51 +0800 | [diff] [blame] | 116 | dispatch.DestroyDevice = reinterpret_cast<PFN_vkDestroyDevice>(get_proc_addr(instance, "vkDestroyDevice")); |
| 117 | if (UNLIKELY(!dispatch.DestroyDevice)) { |
| 118 | ALOGE("missing driver proc: %s", "vkDestroyDevice"); |
| 119 | success = false; |
| 120 | } |
| 121 | dispatch.GetDeviceQueue = reinterpret_cast<PFN_vkGetDeviceQueue>(get_proc_addr(instance, "vkGetDeviceQueue")); |
| 122 | if (UNLIKELY(!dispatch.GetDeviceQueue)) { |
| 123 | ALOGE("missing driver proc: %s", "vkGetDeviceQueue"); |
| 124 | success = false; |
| 125 | } |
| 126 | dispatch.AllocateCommandBuffers = reinterpret_cast<PFN_vkAllocateCommandBuffers>(get_proc_addr(instance, "vkAllocateCommandBuffers")); |
| 127 | if (UNLIKELY(!dispatch.AllocateCommandBuffers)) { |
| 128 | ALOGE("missing driver proc: %s", "vkAllocateCommandBuffers"); |
| 129 | success = false; |
| 130 | } |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 131 | dispatch.CreateImage = reinterpret_cast<PFN_vkCreateImage>(get_proc_addr(instance, "vkCreateImage")); |
| 132 | if (UNLIKELY(!dispatch.CreateImage)) { |
| 133 | ALOGE("missing driver proc: %s", "vkCreateImage"); |
| 134 | success = false; |
| 135 | } |
| 136 | dispatch.DestroyImage = reinterpret_cast<PFN_vkDestroyImage>(get_proc_addr(instance, "vkDestroyImage")); |
| 137 | if (UNLIKELY(!dispatch.DestroyImage)) { |
| 138 | ALOGE("missing driver proc: %s", "vkDestroyImage"); |
| 139 | success = false; |
| 140 | } |
Jesse Hall | d913282 | 2016-01-14 15:50:52 -0800 | [diff] [blame] | 141 | dispatch.GetSwapchainGrallocUsageANDROID = reinterpret_cast<PFN_vkGetSwapchainGrallocUsageANDROID>(get_proc_addr(instance, "vkGetSwapchainGrallocUsageANDROID")); |
| 142 | if (UNLIKELY(!dispatch.GetSwapchainGrallocUsageANDROID)) { |
| 143 | ALOGE("missing driver proc: %s", "vkGetSwapchainGrallocUsageANDROID"); |
| 144 | success = false; |
| 145 | } |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 146 | dispatch.AcquireImageANDROID = reinterpret_cast<PFN_vkAcquireImageANDROID>(get_proc_addr(instance, "vkAcquireImageANDROID")); |
| 147 | if (UNLIKELY(!dispatch.AcquireImageANDROID)) { |
| 148 | ALOGE("missing driver proc: %s", "vkAcquireImageANDROID"); |
| 149 | success = false; |
| 150 | } |
| 151 | dispatch.QueueSignalReleaseImageANDROID = reinterpret_cast<PFN_vkQueueSignalReleaseImageANDROID>(get_proc_addr(instance, "vkQueueSignalReleaseImageANDROID")); |
| 152 | if (UNLIKELY(!dispatch.QueueSignalReleaseImageANDROID)) { |
| 153 | ALOGE("missing driver proc: %s", "vkQueueSignalReleaseImageANDROID"); |
| 154 | success = false; |
| 155 | } |
| 156 | // clang-format on |
| 157 | return success; |
| 158 | } |
| 159 | |
| 160 | } // namespace vulkan |