Jesse Hall | d02edcb | 2015-09-08 07:44:48 -0700 | [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 | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 17 | #ifndef LIBVULKAN_LOADER_H |
| 18 | #define LIBVULKAN_LOADER_H 1 |
| 19 | |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 20 | #include "dispatch_gen.h" |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 21 | |
| 22 | namespace vulkan { |
| 23 | |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 24 | inline const InstanceDispatchTable& GetDispatchTable(VkInstance instance) { |
| 25 | return **reinterpret_cast<InstanceDispatchTable**>(instance); |
| 26 | } |
Jesse Hall | b1352bc | 2015-09-04 16:12:33 -0700 | [diff] [blame] | 27 | |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 28 | inline const InstanceDispatchTable& GetDispatchTable( |
| 29 | VkPhysicalDevice physical_device) { |
| 30 | return **reinterpret_cast<InstanceDispatchTable**>(physical_device); |
| 31 | } |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 32 | |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 33 | inline const DeviceDispatchTable& GetDispatchTable(VkDevice device) { |
| 34 | return **reinterpret_cast<DeviceDispatchTable**>(device); |
| 35 | } |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 36 | |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 37 | inline const DeviceDispatchTable& GetDispatchTable(VkQueue queue) { |
| 38 | return **reinterpret_cast<DeviceDispatchTable**>(queue); |
| 39 | } |
Jesse Hall | b1352bc | 2015-09-04 16:12:33 -0700 | [diff] [blame] | 40 | |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 41 | inline const DeviceDispatchTable& GetDispatchTable( |
| 42 | VkCommandBuffer command_buffer) { |
| 43 | return **reinterpret_cast<DeviceDispatchTable**>(command_buffer); |
| 44 | } |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 45 | |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 46 | // ----------------------------------------------------------------------------- |
| 47 | // dispatch_gen.cpp |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 48 | |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 49 | PFN_vkVoidFunction GetLoaderExportProcAddr(const char* name); |
| 50 | PFN_vkVoidFunction GetLoaderGlobalProcAddr(const char* name); |
| 51 | PFN_vkVoidFunction GetLoaderTopProcAddr(const char* name); |
| 52 | PFN_vkVoidFunction GetLoaderBottomProcAddr(const char* name); |
| 53 | PFN_vkVoidFunction GetDispatchProcAddr(const InstanceDispatchTable& dispatch, |
| 54 | const char* name); |
| 55 | PFN_vkVoidFunction GetDispatchProcAddr(const DeviceDispatchTable& dispatch, |
| 56 | const char* name); |
| 57 | bool LoadInstanceDispatchTable(VkInstance instance, |
| 58 | PFN_vkGetInstanceProcAddr get_proc_addr, |
| 59 | InstanceDispatchTable& dispatch); |
| 60 | bool LoadDeviceDispatchTable(VkDevice device, |
| 61 | PFN_vkGetDeviceProcAddr get_proc_addr, |
| 62 | DeviceDispatchTable& dispatch); |
| 63 | bool LoadDriverDispatchTable(VkInstance instance, |
| 64 | PFN_vkGetInstanceProcAddr get_proc_addr, |
| 65 | DriverDispatchTable& dispatch); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 66 | |
| 67 | // ----------------------------------------------------------------------------- |
| 68 | // loader.cpp |
| 69 | |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 70 | // clang-format off |
| 71 | VKAPI_ATTR VkResult EnumerateInstanceExtensionProperties_Top(const char* layer_name, uint32_t* count, VkExtensionProperties* properties); |
| 72 | VKAPI_ATTR VkResult EnumerateInstanceLayerProperties_Top(uint32_t* count, VkLayerProperties* properties); |
| 73 | VKAPI_ATTR VkResult CreateInstance_Top(const VkInstanceCreateInfo* create_info, const VkAllocationCallbacks* allocator, VkInstance* instance_out); |
| 74 | VKAPI_ATTR PFN_vkVoidFunction GetInstanceProcAddr_Top(VkInstance instance, const char* name); |
| 75 | VKAPI_ATTR void DestroyInstance_Top(VkInstance instance, const VkAllocationCallbacks* allocator); |
| 76 | VKAPI_ATTR PFN_vkVoidFunction GetDeviceProcAddr_Top(VkDevice drv_device, const char* name); |
| 77 | VKAPI_ATTR void GetDeviceQueue_Top(VkDevice drv_device, uint32_t family, uint32_t index, VkQueue* out_queue); |
| 78 | VKAPI_ATTR VkResult AllocateCommandBuffers_Top(VkDevice device, const VkCommandBufferAllocateInfo* alloc_info, VkCommandBuffer* cmdbufs); |
| 79 | VKAPI_ATTR void DestroyDevice_Top(VkDevice drv_device, const VkAllocationCallbacks* allocator); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 80 | |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 81 | VKAPI_ATTR VkResult CreateInstance_Bottom(const VkInstanceCreateInfo* create_info, const VkAllocationCallbacks* allocator, VkInstance* vkinstance); |
| 82 | VKAPI_ATTR PFN_vkVoidFunction GetInstanceProcAddr_Bottom(VkInstance, const char* name); |
| 83 | VKAPI_ATTR VkResult EnumeratePhysicalDevices_Bottom(VkInstance vkinstance, uint32_t* pdev_count, VkPhysicalDevice* pdevs); |
| 84 | VKAPI_ATTR void GetPhysicalDeviceProperties_Bottom(VkPhysicalDevice pdev, VkPhysicalDeviceProperties* properties); |
| 85 | VKAPI_ATTR void GetPhysicalDeviceFeatures_Bottom(VkPhysicalDevice pdev, VkPhysicalDeviceFeatures* features); |
| 86 | VKAPI_ATTR void GetPhysicalDeviceMemoryProperties_Bottom(VkPhysicalDevice pdev, VkPhysicalDeviceMemoryProperties* properties); |
| 87 | VKAPI_ATTR void GetPhysicalDeviceQueueFamilyProperties_Bottom(VkPhysicalDevice pdev, uint32_t* properties_count, VkQueueFamilyProperties* properties); |
| 88 | VKAPI_ATTR void GetPhysicalDeviceFormatProperties_Bottom(VkPhysicalDevice pdev, VkFormat format, VkFormatProperties* properties); |
| 89 | VKAPI_ATTR VkResult GetPhysicalDeviceImageFormatProperties_Bottom(VkPhysicalDevice pdev, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* properties); |
| 90 | VKAPI_ATTR void GetPhysicalDeviceSparseImageFormatProperties_Bottom(VkPhysicalDevice pdev, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* properties_count, VkSparseImageFormatProperties* properties); |
| 91 | VKAPI_ATTR VkResult EnumerateDeviceExtensionProperties_Bottom(VkPhysicalDevice pdev, const char* layer_name, uint32_t* properties_count, VkExtensionProperties* properties); |
| 92 | VKAPI_ATTR VkResult EnumerateDeviceLayerProperties_Bottom(VkPhysicalDevice pdev, uint32_t* properties_count, VkLayerProperties* properties); |
| 93 | VKAPI_ATTR VkResult CreateDevice_Bottom(VkPhysicalDevice pdev, const VkDeviceCreateInfo* create_info, const VkAllocationCallbacks* allocator, VkDevice* device_out); |
| 94 | VKAPI_ATTR void DestroyInstance_Bottom(VkInstance vkinstance, const VkAllocationCallbacks* allocator); |
| 95 | VKAPI_ATTR PFN_vkVoidFunction GetDeviceProcAddr_Bottom(VkDevice vkdevice, const char* name); |
| 96 | // clang-format on |
Jesse Hall | d7b994a | 2015-09-07 14:17:37 -0700 | [diff] [blame] | 97 | |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 98 | const VkAllocationCallbacks* GetAllocator(VkInstance instance); |
| 99 | const VkAllocationCallbacks* GetAllocator(VkDevice device); |
| 100 | const DriverDispatchTable& GetDriverDispatch(VkDevice device); |
| 101 | const DriverDispatchTable& GetDriverDispatch(VkQueue queue); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 102 | |
Jesse Hall | b1352bc | 2015-09-04 16:12:33 -0700 | [diff] [blame] | 103 | // ----------------------------------------------------------------------------- |
| 104 | // swapchain.cpp |
| 105 | |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 106 | // clang-format off |
| 107 | VKAPI_ATTR VkResult CreateAndroidSurfaceKHR_Bottom(VkInstance instance, ANativeWindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); |
| 108 | VKAPI_ATTR void DestroySurfaceKHR_Bottom(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* allocator); |
| 109 | VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceSupportKHR_Bottom(VkPhysicalDevice pdev, uint32_t queue_family, VkSurfaceKHR surface, VkBool32* pSupported); |
| 110 | VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceCapabilitiesKHR_Bottom(VkPhysicalDevice pdev, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* capabilities); |
| 111 | VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceFormatsKHR_Bottom(VkPhysicalDevice pdev, VkSurfaceKHR surface, uint32_t* count, VkSurfaceFormatKHR* formats); |
| 112 | VKAPI_ATTR VkResult GetPhysicalDeviceSurfacePresentModesKHR_Bottom(VkPhysicalDevice pdev, VkSurfaceKHR surface, uint32_t* count, VkPresentModeKHR* modes); |
| 113 | VKAPI_ATTR VkResult CreateSwapchainKHR_Bottom(VkDevice device, const VkSwapchainCreateInfoKHR* create_info, const VkAllocationCallbacks* allocator, VkSwapchainKHR* swapchain_handle); |
| 114 | VKAPI_ATTR void DestroySwapchainKHR_Bottom(VkDevice device, VkSwapchainKHR swapchain_handle, const VkAllocationCallbacks* allocator); |
| 115 | VKAPI_ATTR VkResult GetSwapchainImagesKHR_Bottom(VkDevice device, VkSwapchainKHR swapchain_handle, uint32_t* count, VkImage* images); |
| 116 | VKAPI_ATTR VkResult AcquireNextImageKHR_Bottom(VkDevice device, VkSwapchainKHR swapchain_handle, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* image_index); |
| 117 | VKAPI_ATTR VkResult QueuePresentKHR_Bottom(VkQueue queue, const VkPresentInfoKHR* present_info); |
| 118 | // clang-format on |
Jesse Hall | b1352bc | 2015-09-04 16:12:33 -0700 | [diff] [blame] | 119 | |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 120 | } // namespace vulkan |
| 121 | |
| 122 | #endif // LIBVULKAN_LOADER_H |