blob: 21e997dec724852274346a274c5a20fbd1bad438 [file] [log] [blame]
Chia-I Wu468e3c32014-08-04 08:03:57 +08001/*
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002 * Vulkan
Chia-I Wu468e3c32014-08-04 08:03:57 +08003 *
4 * Copyright (C) 2014 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
Chia-I Wu44e42362014-09-02 08:32:09 +080023 *
24 * Authors:
25 * Chia-I Wu <olv@lunarg.com>
Chia-I Wu468e3c32014-08-04 08:03:57 +080026 */
27
28#ifndef LOADER_H
29#define LOADER_H
30
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060031#include <vulkan.h>
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060032#include <vk_debug_report_lunarg.h>
Ian Elliott1d73e662015-07-06 14:36:13 -060033#include <vk_wsi_swapchain.h>
Tobin Ehlis2d1d9702015-07-03 09:42:57 -060034#include <vk_layer.h>
35#include <vk_icd.h>
Chia-I Wu1d6731b2015-04-11 15:34:07 +080036#include <assert.h>
37
Chia-I Wu468e3c32014-08-04 08:03:57 +080038#if defined(__GNUC__) && __GNUC__ >= 4
39# define LOADER_EXPORT __attribute__((visibility("default")))
40#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
41# define LOADER_EXPORT __attribute__((visibility("default")))
42#else
43# define LOADER_EXPORT
44#endif
45
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -060046#define MAX_EXTENSION_NAME_SIZE (VK_MAX_EXTENSION_NAME-1)
Jon Ashburncb5a5ac2015-06-10 10:06:06 -060047#define MAX_GPUS_PER_ICD 16
Jon Ashburn0b728052015-08-04 10:22:33 -060048#define MAX_STRING_SIZE 1024
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -060049#define VK_MAJOR(version) (version >> 22)
50#define VK_MINOR(version) ((version >> 12) & 0x3ff)
51#define VK_PATCH(version) (version & 0xfff)
Jon Ashburnfce93d92015-05-12 17:26:48 -060052
Jon Ashburn68a63922015-07-02 09:40:15 -060053enum layer_type {
Jon Ashburn535bd002015-07-02 16:10:32 -060054 VK_LAYER_TYPE_DEVICE_EXPLICIT = 0x1,
55 VK_LAYER_TYPE_INSTANCE_EXPLICIT = 0x2,
56 VK_LAYER_TYPE_GLOBAL_EXPLICIT = 0x3, // both instance and device layer, bitwise
57 VK_LAYER_TYPE_DEVICE_IMPLICIT = 0x4,
58 VK_LAYER_TYPE_INSTANCE_IMPLICIT = 0x8,
59 VK_LAYER_TYPE_GLOBAL_IMPLICIT = 0xc, // both instance and device layer, bitwise
Jon Ashburn68a63922015-07-02 09:40:15 -060060};
61
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060062struct loader_extension_list {
63 size_t capacity;
64 uint32_t count;
Jon Ashburnc4748dc2015-08-04 11:14:18 -060065 VkExtensionProperties *list;
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060066};
67
Jon Ashburn68a63922015-07-02 09:40:15 -060068struct loader_name_value {
Jon Ashburn0b728052015-08-04 10:22:33 -060069 char name[MAX_STRING_SIZE];
70 char value[MAX_STRING_SIZE];
Jon Ashburn68a63922015-07-02 09:40:15 -060071};
72
73struct loader_lib_info {
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060074 char *lib_name;
Jon Ashburn68a63922015-07-02 09:40:15 -060075 uint32_t ref_count;
76 loader_platform_dl_handle lib_handle;
77};
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060078
Jon Ashburn68a63922015-07-02 09:40:15 -060079struct loader_layer_functions {
Jon Ashburn0b728052015-08-04 10:22:33 -060080 char str_gipa[MAX_STRING_SIZE];
81 char str_gdpa[MAX_STRING_SIZE];
Jon Ashburn68a63922015-07-02 09:40:15 -060082 PFN_vkGetInstanceProcAddr get_instance_proc_addr;
83 PFN_vkGetDeviceProcAddr get_device_proc_addr;
84};
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060085
Jon Ashburn68a63922015-07-02 09:40:15 -060086struct loader_layer_properties {
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -060087 VkLayerProperties info;
Jon Ashburn68a63922015-07-02 09:40:15 -060088 enum layer_type type;
89 struct loader_lib_info lib_info;
Jon Ashburn68a63922015-07-02 09:40:15 -060090 struct loader_layer_functions functions;
91 struct loader_extension_list instance_extension_list;
92 struct loader_extension_list device_extension_list;
93 struct loader_name_value disable_env_var;
94 struct loader_name_value enable_env_var;
95};
96
97struct loader_layer_list {
98 size_t capacity;
99 uint32_t count;
100 struct loader_layer_properties *list;
Jon Ashburnfce93d92015-05-12 17:26:48 -0600101};
102
Courtney Goeltzenleuchterc5cf7d72015-07-05 12:53:31 -0600103struct loader_layer_library_list {
104 size_t capacity;
105 uint32_t count;
106 struct loader_lib_info *list;
107};
108
Jon Ashburncb5a5ac2015-06-10 10:06:06 -0600109/* per CreateDevice structure */
110struct loader_device {
111 VkLayerDispatchTable loader_dispatch;
112 VkDevice device; // device object from the icd
113
114 uint32_t app_extension_count;
115 VkExtensionProperties *app_extension_props;
116
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600117 struct loader_layer_list activated_layer_list;
Jon Ashburncb5a5ac2015-06-10 10:06:06 -0600118
119 struct loader_device *next;
120};
121
Jon Ashburn60699262015-06-10 16:11:42 -0600122/* per ICD structure */
Jon Ashburn2666e2f2015-05-15 15:09:35 -0600123struct loader_icd {
124 const struct loader_scanned_icds *scanned_icds;
125
Jon Ashburncb5a5ac2015-06-10 10:06:06 -0600126 struct loader_device *logical_device_list;
Jon Ashburn2666e2f2015-05-15 15:09:35 -0600127 uint32_t gpu_count;
Jon Ashburn60699262015-06-10 16:11:42 -0600128 VkPhysicalDevice *gpus; // enumerated PhysicalDevices
Jon Ashburn2666e2f2015-05-15 15:09:35 -0600129 VkInstance instance; // instance object from the icd
Jon Ashburn1245cec2015-05-18 13:20:15 -0600130 PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
Jon Ashburn2666e2f2015-05-15 15:09:35 -0600131 PFN_vkDestroyInstance DestroyInstance;
132 PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
Chris Forbesd7576302015-06-21 22:55:02 +1200133 PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures;
Courtney Goeltzenleuchter4da96aa2015-07-12 12:52:09 -0600134 PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties;
Jon Ashburn4e189562015-07-23 18:49:07 -0600135 PFN_vkGetPhysicalDeviceImageFormatProperties GetPhysicalDeviceImageFormatProperties;
Chris Forbesd7576302015-06-21 22:55:02 +1200136 PFN_vkGetPhysicalDeviceLimits GetPhysicalDeviceLimits;
Jon Ashburn2666e2f2015-05-15 15:09:35 -0600137 PFN_vkCreateDevice CreateDevice;
Tony Barbour426b9052015-06-24 16:06:58 -0600138 PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
Tony Barbour426b9052015-06-24 16:06:58 -0600139 PFN_vkGetPhysicalDeviceQueueCount GetPhysicalDeviceQueueCount;
140 PFN_vkGetPhysicalDeviceQueueProperties GetPhysicalDeviceQueueProperties;
141 PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties;
Tony Barbour426b9052015-06-24 16:06:58 -0600142 PFN_vkGetPhysicalDeviceExtensionProperties GetPhysicalDeviceExtensionProperties;
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -0600143 PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties;
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600144 PFN_vkDbgCreateMsgCallback DbgCreateMsgCallback;
145 PFN_vkDbgDestroyMsgCallback DbgDestroyMsgCallback;
Jon Ashburnce7e3d92015-07-16 10:17:29 -0600146 PFN_vkGetPhysicalDeviceSurfaceSupportWSI GetPhysicalDeviceSurfaceSupportWSI;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600147
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600148 /*
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600149 * Fill in the cache of available global extensions that operate
150 * with this physical device. This cache will be used to satisfy
151 * calls to GetPhysicalDeviceExtensionProperties
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600152 */
Jon Ashburncb5a5ac2015-06-10 10:06:06 -0600153 struct loader_extension_list device_extension_cache[MAX_GPUS_PER_ICD];
154 struct loader_icd *next;
Jon Ashburn2666e2f2015-05-15 15:09:35 -0600155};
156
Jon Ashburn60699262015-06-10 16:11:42 -0600157/* per instance structure */
Jon Ashburnfce93d92015-05-12 17:26:48 -0600158struct loader_instance {
Jon Ashburn2666e2f2015-05-15 15:09:35 -0600159 VkLayerInstanceDispatchTable *disp; // must be first entry in structure
160
Jon Ashburnfce93d92015-05-12 17:26:48 -0600161 uint32_t total_gpu_count;
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600162 uint32_t total_icd_count;
Jon Ashburnfce93d92015-05-12 17:26:48 -0600163 struct loader_icd *icds;
164 struct loader_instance *next;
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600165
166 /* TODO: Should keep track of application provided allocation functions */
167
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600168 struct loader_msg_callback_map_entry *icd_msg_callback_map;
169
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600170 struct loader_layer_list activated_layer_list;
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600171
172 bool debug_report_enabled;
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600173 VkLayerDbgFunctionNode *DbgFunctionHead;
Courtney Goeltzenleuchterb620ace2015-07-05 11:28:29 -0600174
175 VkAllocCallbacks alloc_callbacks;
Ian Elliott1d73e662015-07-06 14:36:13 -0600176
177 bool wsi_swapchain_enabled;
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600178};
179
Jon Ashburnfce93d92015-05-12 17:26:48 -0600180struct loader_struct {
181 struct loader_instance *instances;
Jon Ashburnfce93d92015-05-12 17:26:48 -0600182 struct loader_scanned_icds *scanned_icd_list;
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600183
184 unsigned int loaded_layer_lib_count;
185 struct loader_lib_info *loaded_layer_lib_list;
186
Jon Ashburnfce93d92015-05-12 17:26:48 -0600187 char *layer_dirs;
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600188
Jon Ashburn1b111de2015-07-06 15:40:35 -0600189 // TODO use this struct loader_layer_library_list scanned_layer_libraries;
Jon Ashburn0bf6a182015-07-16 17:19:31 -0600190 struct loader_layer_list scanned_instance_layers;
191 struct loader_layer_list scanned_device_layers;
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600192
Tony Barbour426b9052015-06-24 16:06:58 -0600193 /* Keep track of all the extensions available via GetGlobalExtensionProperties */
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600194 struct loader_extension_list global_extensions;
195};
196
197struct loader_scanned_icds {
198 char *lib_name;
199 loader_platform_dl_handle handle;
200
Jon Ashburnce7e3d92015-07-16 10:17:29 -0600201 PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600202 PFN_vkCreateInstance CreateInstance;
Tony Barbour426b9052015-06-24 16:06:58 -0600203 PFN_vkGetGlobalExtensionProperties GetGlobalExtensionProperties;
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600204 VkInstance instance;
205 struct loader_scanned_icds *next;
206
207 /* cache of global extensions for specific ICD */
208 struct loader_extension_list global_extension_list;
209
210 /*
211 * cache of device extensions for specific ICD,
212 * filled in at CreateInstance time
213 */
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600214 struct loader_extension_list device_extension_list;
Jon Ashburnfce93d92015-05-12 17:26:48 -0600215};
216
Jon Ashburn68a63922015-07-02 09:40:15 -0600217static inline struct loader_instance *loader_instance(VkInstance instance) {
218 return (struct loader_instance *) instance;
219}
220
Tony Barbourde4124d2015-07-03 10:33:54 -0600221static inline void loader_set_dispatch(void* obj, const void *data)
Chia-I Wu1d6731b2015-04-11 15:34:07 +0800222{
223 *((const void **) obj) = data;
224}
225
Tony Barbourde4124d2015-07-03 10:33:54 -0600226static inline VkLayerDispatchTable *loader_get_dispatch(const void* obj)
Chia-I Wu1d6731b2015-04-11 15:34:07 +0800227{
Jon Ashburnda7c20d2015-05-01 18:00:33 -0600228 return *((VkLayerDispatchTable **) obj);
Chia-I Wu1d6731b2015-04-11 15:34:07 +0800229}
230
Tony Barbourde4124d2015-07-03 10:33:54 -0600231static inline VkLayerInstanceDispatchTable *loader_get_instance_dispatch(const void* obj)
Jon Ashburnfce93d92015-05-12 17:26:48 -0600232{
233 return *((VkLayerInstanceDispatchTable **) obj);
234}
235
Tony Barbourde4124d2015-07-03 10:33:54 -0600236static inline void loader_init_dispatch(void* obj, const void *data)
Chia-I Wu1d6731b2015-04-11 15:34:07 +0800237{
Jon Ashburn166641e2015-04-15 13:34:33 -0600238#ifdef DEBUG
Chia-I Wu1d6731b2015-04-11 15:34:07 +0800239 assert(valid_loader_magic_value(obj) &&
240 "Incompatible ICD, first dword must be initialized to ICD_LOADER_MAGIC. See loader/README.md for details.");
Jon Ashburn166641e2015-04-15 13:34:33 -0600241#endif
Chia-I Wu1d6731b2015-04-11 15:34:07 +0800242
Jon Ashburnda7c20d2015-05-01 18:00:33 -0600243 loader_set_dispatch(obj, data);
Chia-I Wu1d6731b2015-04-11 15:34:07 +0800244}
245
Jon Ashburnfce93d92015-05-12 17:26:48 -0600246/* global variables used across files */
247extern struct loader_struct loader;
248extern LOADER_PLATFORM_THREAD_ONCE_DEFINITION(once_icd);
249extern LOADER_PLATFORM_THREAD_ONCE_DEFINITION(once_layer);
250extern LOADER_PLATFORM_THREAD_ONCE_DEFINITION(once_exts);
Jon Ashburnb40f2562015-05-29 13:15:39 -0600251extern loader_platform_thread_mutex loader_lock;
252extern const VkLayerInstanceDispatchTable instance_disp;
Jon Ashburn301c5f02015-04-06 10:58:22 -0600253
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600254struct loader_msg_callback_map_entry {
255 VkDbgMsgCallback icd_obj;
256 VkDbgMsgCallback loader_obj;
257};
258
259bool compare_vk_extension_properties(
260 const VkExtensionProperties* op1,
261 const VkExtensionProperties* op2);
262
Courtney Goeltzenleuchtera17697f2015-07-06 20:14:18 -0600263VkResult loader_validate_layers(const uint32_t layer_count, const char * const *ppEnabledLayerNames, struct loader_layer_list *list);
Courtney Goeltzenleuchter5d9f29b2015-07-06 17:45:08 -0600264
265VkResult loader_validate_instance_extensions(
266 const VkInstanceCreateInfo* pCreateInfo);
267
Jon Ashburnfce93d92015-05-12 17:26:48 -0600268/* instance layer chain termination entrypoint definitions */
Dan Ginsburgf99e4102015-07-23 13:15:00 -0400269VkResult VKAPI loader_CreateInstance(
Jon Ashburnfce93d92015-05-12 17:26:48 -0600270 const VkInstanceCreateInfo* pCreateInfo,
271 VkInstance* pInstance);
Chia-I Wu1d6731b2015-04-11 15:34:07 +0800272
Dan Ginsburgf99e4102015-07-23 13:15:00 -0400273VkResult VKAPI loader_DestroyInstance(
Jon Ashburnfce93d92015-05-12 17:26:48 -0600274 VkInstance instance);
275
Dan Ginsburgf99e4102015-07-23 13:15:00 -0400276VkResult VKAPI loader_EnumeratePhysicalDevices(
Jon Ashburnfce93d92015-05-12 17:26:48 -0600277 VkInstance instance,
278 uint32_t* pPhysicalDeviceCount,
279 VkPhysicalDevice* pPhysicalDevices);
Chris Forbesd7576302015-06-21 22:55:02 +1200280
Dan Ginsburgf99e4102015-07-23 13:15:00 -0400281VkResult VKAPI loader_GetPhysicalDeviceFeatures(
Chris Forbesd7576302015-06-21 22:55:02 +1200282 VkPhysicalDevice physicalDevice,
283 VkPhysicalDeviceFeatures* pFeatures);
284
Dan Ginsburgf99e4102015-07-23 13:15:00 -0400285VkResult VKAPI loader_GetPhysicalDeviceFormatProperties(
Chris Forbesd7576302015-06-21 22:55:02 +1200286 VkPhysicalDevice physicalDevice,
287 VkFormat format,
288 VkFormatProperties* pFormatInfo);
289
Jon Ashburn4e189562015-07-23 18:49:07 -0600290VkResult VKAPI loader_GetPhysicalDeviceImageFormatProperties(
291 VkPhysicalDevice physicalDevice,
292 VkFormat format,
293 VkImageType type,
294 VkImageTiling tiling,
295 VkImageUsageFlags usage,
296 VkImageFormatProperties* pImageFormatProperties);
297
Dan Ginsburgf99e4102015-07-23 13:15:00 -0400298VkResult VKAPI loader_GetPhysicalDeviceLimits(
Chris Forbesd7576302015-06-21 22:55:02 +1200299 VkPhysicalDevice physicalDevice,
300 VkPhysicalDeviceLimits* pLimits);
301
Dan Ginsburgf99e4102015-07-23 13:15:00 -0400302VkResult VKAPI loader_GetPhysicalDeviceSparseImageFormatProperties(
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -0600303 VkPhysicalDevice physicalDevice,
304 VkFormat format,
305 VkImageType type,
306 uint32_t samples,
307 VkImageUsageFlags usage,
308 VkImageTiling tiling,
309 uint32_t* pNumProperties,
310 VkSparseImageFormatProperties* pProperties);
Tony Barbour426b9052015-06-24 16:06:58 -0600311
Dan Ginsburgf99e4102015-07-23 13:15:00 -0400312VkResult VKAPI loader_GetPhysicalDeviceProperties (
Tony Barbour426b9052015-06-24 16:06:58 -0600313 VkPhysicalDevice physicalDevice,
314 VkPhysicalDeviceProperties* pProperties);
315
Dan Ginsburgf99e4102015-07-23 13:15:00 -0400316VkResult VKAPI loader_GetPhysicalDeviceExtensionProperties (VkPhysicalDevice physicalDevice,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600317 const char *pLayerName, uint32_t *pCount,
Tony Barbour426b9052015-06-24 16:06:58 -0600318 VkExtensionProperties* pProperties);
319
Dan Ginsburgf99e4102015-07-23 13:15:00 -0400320VkResult VKAPI loader_GetPhysicalDeviceLayerProperties (VkPhysicalDevice physicalDevice,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600321 uint32_t *pCount,
322 VkLayerProperties* pProperties);
Tony Barbour426b9052015-06-24 16:06:58 -0600323
Dan Ginsburgf99e4102015-07-23 13:15:00 -0400324VkResult VKAPI loader_GetPhysicalDeviceQueueCount (
Tony Barbour426b9052015-06-24 16:06:58 -0600325 VkPhysicalDevice physicalDevice,
326 uint32_t* pCount);
327
Dan Ginsburgf99e4102015-07-23 13:15:00 -0400328VkResult VKAPI loader_GetPhysicalDeviceQueueProperties (
Tony Barbour426b9052015-06-24 16:06:58 -0600329 VkPhysicalDevice physicalDevice,
330 uint32_t count,
331 VkPhysicalDeviceQueueProperties * pProperties);
332
Dan Ginsburgf99e4102015-07-23 13:15:00 -0400333VkResult VKAPI loader_GetPhysicalDeviceMemoryProperties (
Tony Barbour426b9052015-06-24 16:06:58 -0600334 VkPhysicalDevice physicalDevice,
335 VkPhysicalDeviceMemoryProperties * pProperties);
Jon Ashburnb40f2562015-05-29 13:15:39 -0600336
Dan Ginsburgf99e4102015-07-23 13:15:00 -0400337VkResult VKAPI loader_CreateDevice(
Jon Ashburn2666e2f2015-05-15 15:09:35 -0600338 VkPhysicalDevice gpu,
339 const VkDeviceCreateInfo* pCreateInfo,
340 VkDevice* pDevice);
Jon Ashburnfce93d92015-05-12 17:26:48 -0600341
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600342/* helper function definitions */
Jon Ashburn60378412015-07-02 12:59:25 -0600343bool has_vk_extension_property_array(
344 const VkExtensionProperties *vk_ext_prop,
345 const uint32_t count,
346 const VkExtensionProperties *ext_array);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600347bool has_vk_extension_property(
348 const VkExtensionProperties *vk_ext_prop,
349 const struct loader_extension_list *ext_list);
Jon Ashburnfce93d92015-05-12 17:26:48 -0600350
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600351void loader_add_to_ext_list(
352 struct loader_extension_list *ext_list,
353 uint32_t prop_list_count,
Jon Ashburnc4748dc2015-08-04 11:14:18 -0600354 const VkExtensionProperties *props);
Courtney Goeltzenleuchter3d8dc1f2015-06-08 15:09:22 -0600355void loader_destroy_ext_list(struct loader_extension_list *ext_info);
Jon Ashburnfce93d92015-05-12 17:26:48 -0600356
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600357void loader_add_to_layer_list(
358 struct loader_layer_list *list,
359 uint32_t prop_list_count,
360 const struct loader_layer_properties *props);
Jon Ashburnfce93d92015-05-12 17:26:48 -0600361void loader_icd_scan(void);
Jon Ashburn68a63922015-07-02 09:40:15 -0600362void loader_layer_scan(void);
Jon Ashburnfce93d92015-05-12 17:26:48 -0600363void loader_coalesce_extensions(void);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600364
Jon Ashburnd5df54d2015-05-28 19:16:58 -0600365struct loader_icd * loader_get_icd(const VkPhysicalDevice gpu,
Jon Ashburn2666e2f2015-05-15 15:09:35 -0600366 uint32_t *gpu_index);
Jon Ashburncb5a5ac2015-06-10 10:06:06 -0600367void loader_remove_logical_device(VkDevice device);
Courtney Goeltzenleuchter1fcceeb2015-07-06 09:06:34 -0600368VkResult loader_enable_instance_layers(struct loader_instance *inst, const VkInstanceCreateInfo *pCreateInfo);
Jon Ashburncb5a5ac2015-06-10 10:06:06 -0600369void loader_deactivate_instance_layers(struct loader_instance *instance);
Jon Ashburnfce93d92015-05-12 17:26:48 -0600370uint32_t loader_activate_instance_layers(struct loader_instance *inst);
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600371void loader_activate_instance_layer_extensions(struct loader_instance *inst);
Courtney Goeltzenleuchterb620ace2015-07-05 11:28:29 -0600372
373void* loader_heap_alloc(
374 struct loader_instance *instance,
375 size_t size,
376 VkSystemAllocType allocType);
377
378void* loader_aligned_heap_alloc(
379 struct loader_instance *instance,
380 size_t size,
381 size_t alignment,
382 VkSystemAllocType allocType);
383
384void loader_heap_free(
385 struct loader_instance *instance,
386 void *pMem);
Chia-I Wu468e3c32014-08-04 08:03:57 +0800387#endif /* LOADER_H */