blob: 1a187d8757fdcc2d56349bb94b3cb34f7f78b83d [file] [log] [blame]
Chia-I Wuc1e0f962014-08-04 08:03:57 +08001/*
Chia-I Wuc1e0f962014-08-04 08:03:57 +08002 *
Jon Ashburn1c75aec2016-02-02 17:47:28 -07003 * Copyright (c) 2014-2016 The Khronos Group Inc.
4 * Copyright (c) 2014-2016 Valve Corporation
5 * Copyright (c) 2014-2016 LunarG, Inc.
Courtney Goeltzenleuchter8e1b8d92015-12-02 14:53:22 -07006 * Copyright (C) 2015 Google Inc.
Chia-I Wuc1e0f962014-08-04 08:03:57 +08007 *
Jon Ashburn4f80d672016-04-19 11:30:31 -06008 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
Chia-I Wuc1e0f962014-08-04 08:03:57 +080011 *
Jon Ashburn4f80d672016-04-19 11:30:31 -060012 * http://www.apache.org/licenses/LICENSE-2.0
Chia-I Wuc1e0f962014-08-04 08:03:57 +080013 *
Jon Ashburn4f80d672016-04-19 11:30:31 -060014 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
Jon Ashburn1c75aec2016-02-02 17:47:28 -070019 *
20 * Author: Jon Ashburn <jon@lunarg.com>
21 * Author: Courtney Goeltzenleuchter <courtney@LunarG.com>
Courtney Goeltzenleuchterb9ce3952015-10-30 11:14:30 -060022 * Author: Chia-I Wu <olvaffe@gmail.com>
23 * Author: Chia-I Wu <olv@lunarg.com>
Jon Ashburn1c75aec2016-02-02 17:47:28 -070024 * Author: Mark Lobodzinski <mark@LunarG.com>
Courtney Goeltzenleuchterb9ce3952015-10-30 11:14:30 -060025 *
Chia-I Wuc1e0f962014-08-04 08:03:57 +080026 */
27
28#ifndef LOADER_H
29#define LOADER_H
30
David Pinedoa5036622015-11-06 12:54:48 -070031#include <vulkan/vulkan.h>
Aaron Karp95c5f952016-03-13 16:41:59 -040032#include "vk_loader_platform.h"
Mark Lobodzinski663818f2016-05-24 16:04:56 -060033#include "vk_loader_layer.h"
David Pinedoa5036622015-11-06 12:54:48 -070034#include <vulkan/vk_layer.h>
Mark Lobodzinski663818f2016-05-24 16:04:56 -060035
David Pinedoa5036622015-11-06 12:54:48 -070036#include <vulkan/vk_icd.h>
Chia-I Wufe333ed2015-04-11 15:34:07 +080037#include <assert.h>
38
Chia-I Wuc1e0f962014-08-04 08:03:57 +080039#if defined(__GNUC__) && __GNUC__ >= 4
Jon Ashburn1c75aec2016-02-02 17:47:28 -070040#define LOADER_EXPORT __attribute__((visibility("default")))
Chia-I Wuc1e0f962014-08-04 08:03:57 +080041#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
Jon Ashburn1c75aec2016-02-02 17:47:28 -070042#define LOADER_EXPORT __attribute__((visibility("default")))
Chia-I Wuc1e0f962014-08-04 08:03:57 +080043#else
Jon Ashburn1c75aec2016-02-02 17:47:28 -070044#define LOADER_EXPORT
Chia-I Wuc1e0f962014-08-04 08:03:57 +080045#endif
46
Mark Young74dd5d12016-06-30 13:02:42 -060047// A debug option to disable allocators at compile time to investigate future issues.
48#define DEBUG_DISABLE_APP_ALLOCATORS 0
49
Jon Ashburnb2379c52015-08-04 10:22:33 -060050#define MAX_STRING_SIZE 1024
Courtney Goeltzenleuchter44667cc2015-06-29 15:39:26 -060051#define VK_MAJOR(version) (version >> 22)
52#define VK_MINOR(version) ((version >> 12) & 0x3ff)
53#define VK_PATCH(version) (version & 0xfff)
Jon Ashburn13482452015-05-12 17:26:48 -060054
Jon Ashburn399c9162015-07-02 09:40:15 -060055enum layer_type {
Jon Ashburnc325bc02016-05-16 14:01:18 -060056 VK_LAYER_TYPE_INSTANCE_EXPLICIT = 0x1,
57 VK_LAYER_TYPE_INSTANCE_IMPLICIT = 0x2,
58 VK_LAYER_TYPE_META_EXPLICT = 0x4,
Jon Ashburn399c9162015-07-02 09:40:15 -060059};
60
Mark Lobodzinski8d325802016-02-02 18:53:34 -070061typedef enum VkStringErrorFlagBits {
Jon Ashburnb1cdf2e2016-02-10 20:50:19 -070062 VK_STRING_ERROR_NONE = 0x00000000,
63 VK_STRING_ERROR_LENGTH = 0x00000001,
64 VK_STRING_ERROR_BAD_DATA = 0x00000002,
Mark Lobodzinski8d325802016-02-02 18:53:34 -070065} VkStringErrorFlagBits;
66typedef VkFlags VkStringErrorFlags;
67
Jon Ashburnb1cdf2e2016-02-10 20:50:19 -070068static const int MaxLoaderStringLength = 256;
69static const char UTF8_ONE_BYTE_CODE = 0xC0;
70static const char UTF8_ONE_BYTE_MASK = 0xE0;
71static const char UTF8_TWO_BYTE_CODE = 0xE0;
72static const char UTF8_TWO_BYTE_MASK = 0xF0;
73static const char UTF8_THREE_BYTE_CODE = 0xF0;
74static const char UTF8_THREE_BYTE_MASK = 0xF8;
75static const char UTF8_DATA_BYTE_CODE = 0x80;
76static const char UTF8_DATA_BYTE_MASK = 0xC0;
Mark Lobodzinski8d325802016-02-02 18:53:34 -070077
Mark Lobodzinskibf266f42016-06-29 14:18:30 -060078static const char std_validation_names[7][VK_MAX_EXTENSION_NAME_SIZE] = {
79 "VK_LAYER_GOOGLE_threading", "VK_LAYER_LUNARG_parameter_validation",
80 "VK_LAYER_LUNARG_object_tracker", "VK_LAYER_LUNARG_image",
81 "VK_LAYER_LUNARG_core_validation", "VK_LAYER_LUNARG_swapchain",
82 "VK_LAYER_GOOGLE_unique_objects"};
Jon Ashburnd1eb3322016-02-10 20:59:26 -070083
Jon Ashburn6b00b472015-12-10 08:51:10 -070084// form of all dynamic lists/arrays
85// only the list element should be changed
86struct loader_generic_list {
87 size_t capacity;
88 uint32_t count;
89 void *list;
90};
91
Courtney Goeltzenleuchter67146d02015-06-10 17:39:03 -060092struct loader_extension_list {
93 size_t capacity;
94 uint32_t count;
Jon Ashburnb7d327c2015-08-04 11:14:18 -060095 VkExtensionProperties *list;
Courtney Goeltzenleuchter67146d02015-06-10 17:39:03 -060096};
97
Jon Ashburn92cdb012015-12-10 18:17:34 -070098struct loader_dev_ext_props {
99 VkExtensionProperties props;
100 uint32_t entrypoint_count;
101 char **entrypoints;
102};
103
104struct loader_device_extension_list {
105 size_t capacity;
106 uint32_t count;
107 struct loader_dev_ext_props *list;
108};
109
Jon Ashburn399c9162015-07-02 09:40:15 -0600110struct loader_name_value {
Jon Ashburnb2379c52015-08-04 10:22:33 -0600111 char name[MAX_STRING_SIZE];
112 char value[MAX_STRING_SIZE];
Jon Ashburn399c9162015-07-02 09:40:15 -0600113};
114
Jon Ashburn399c9162015-07-02 09:40:15 -0600115struct loader_layer_functions {
Jon Ashburnb2379c52015-08-04 10:22:33 -0600116 char str_gipa[MAX_STRING_SIZE];
117 char str_gdpa[MAX_STRING_SIZE];
Jon Ashburn399c9162015-07-02 09:40:15 -0600118 PFN_vkGetInstanceProcAddr get_instance_proc_addr;
119 PFN_vkGetDeviceProcAddr get_device_proc_addr;
120};
Courtney Goeltzenleuchter67146d02015-06-10 17:39:03 -0600121
Jon Ashburn399c9162015-07-02 09:40:15 -0600122struct loader_layer_properties {
Courtney Goeltzenleuchter44667cc2015-06-29 15:39:26 -0600123 VkLayerProperties info;
Jon Ashburn399c9162015-07-02 09:40:15 -0600124 enum layer_type type;
Jon Ashburnb4c24232015-08-20 16:35:30 -0600125 char lib_name[MAX_STRING_SIZE];
Jon Ashburnd3cf9552016-04-20 13:21:17 -0600126 loader_platform_dl_handle lib_handle;
Jon Ashburn399c9162015-07-02 09:40:15 -0600127 struct loader_layer_functions functions;
128 struct loader_extension_list instance_extension_list;
Jon Ashburn92cdb012015-12-10 18:17:34 -0700129 struct loader_device_extension_list device_extension_list;
Jon Ashburn399c9162015-07-02 09:40:15 -0600130 struct loader_name_value disable_env_var;
131 struct loader_name_value enable_env_var;
132};
133
134struct loader_layer_list {
135 size_t capacity;
136 uint32_t count;
137 struct loader_layer_properties *list;
Jon Ashburn13482452015-05-12 17:26:48 -0600138};
139
Jon Ashburn6cb69f42015-11-17 15:31:02 -0700140struct loader_dispatch_hash_list {
141 size_t capacity;
142 uint32_t count;
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700143 uint32_t *index; // index into the dev_ext dispatch table
Jon Ashburn6cb69f42015-11-17 15:31:02 -0700144};
145
146#define MAX_NUM_DEV_EXTS 250
Mark Youngdd904ae2016-09-02 11:41:28 -0600147// loader_dispatch_hash_entry and loader_dev_ext_dispatch_table.dev_ext have
148// one to one correspondence; one loader_dispatch_hash_entry for one dev_ext
149// dispatch entry.
Jon Ashburn6cb69f42015-11-17 15:31:02 -0700150// Also have a one to one correspondence with functions in dev_ext_trampoline.c
151struct loader_dispatch_hash_entry {
152 char *func_name;
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700153 struct loader_dispatch_hash_list list; // to handle hashing collisions
Jon Ashburn6cb69f42015-11-17 15:31:02 -0700154};
155
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700156typedef void(VKAPI_PTR *PFN_vkDevExt)(VkDevice device);
Jon Ashburn6cb69f42015-11-17 15:31:02 -0700157struct loader_dev_ext_dispatch_table {
Mark Youngdd904ae2016-09-02 11:41:28 -0600158 PFN_vkDevExt dev_ext[MAX_NUM_DEV_EXTS];
Jon Ashburn6cb69f42015-11-17 15:31:02 -0700159};
160
161struct loader_dev_dispatch_table {
162 VkLayerDispatchTable core_dispatch;
163 struct loader_dev_ext_dispatch_table ext_dispatch;
164};
165
Mark Young1d645262016-09-07 08:50:32 -0600166// per CreateDevice structure
Jon Ashburn10f4e822015-06-10 10:06:06 -0600167struct loader_device {
Jon Ashburn6cb69f42015-11-17 15:31:02 -0700168 struct loader_dev_dispatch_table loader_dispatch;
Mark Young0f7adeb2016-11-07 13:27:02 -0700169 VkDevice chain_device; // device object from the dispatch chain
170 VkDevice icd_device; // device object from the icd
171 struct loader_physical_device_term *phys_dev_term;
Jon Ashburn10f4e822015-06-10 10:06:06 -0600172
Courtney Goeltzenleuchter44667cc2015-06-29 15:39:26 -0600173 struct loader_layer_list activated_layer_list;
Jon Ashburn10f4e822015-06-10 10:06:06 -0600174
Mark Young74dd5d12016-06-30 13:02:42 -0600175 VkAllocationCallbacks alloc_callbacks;
176
Jon Ashburn10f4e822015-06-10 10:06:06 -0600177 struct loader_device *next;
178};
179
Jon Ashburn392c5622015-06-10 16:11:42 -0600180/* per ICD structure */
Mark Young26c19372016-11-03 14:27:13 -0600181struct loader_icd_term {
Jon Ashburnb4c24232015-08-20 16:35:30 -0600182 // pointers to find other structs
Mark Young26c19372016-11-03 14:27:13 -0600183 const struct loader_scanned_icd *scanned_icd;
Jon Ashburnb4c24232015-08-20 16:35:30 -0600184 const struct loader_instance *this_instance;
Jon Ashburn10f4e822015-06-10 10:06:06 -0600185 struct loader_device *logical_device_list;
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700186 VkInstance instance; // instance object from the icd
Jon Ashburnc89dd4a2015-05-18 13:20:15 -0600187 PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
Jon Ashburnebfa25e2015-05-15 15:09:35 -0600188 PFN_vkDestroyInstance DestroyInstance;
189 PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
Chris Forbes1c946ec2015-06-21 22:55:02 +1200190 PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures;
Courtney Goeltzenleuchter2b6559e2015-07-12 12:52:09 -0600191 PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties;
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700192 PFN_vkGetPhysicalDeviceImageFormatProperties
193 GetPhysicalDeviceImageFormatProperties;
Jon Ashburnebfa25e2015-05-15 15:09:35 -0600194 PFN_vkCreateDevice CreateDevice;
Tony Barbour4e657ba2015-06-24 16:06:58 -0600195 PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700196 PFN_vkGetPhysicalDeviceQueueFamilyProperties
197 GetPhysicalDeviceQueueFamilyProperties;
Tony Barbour4e657ba2015-06-24 16:06:58 -0600198 PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties;
Courtney Goeltzenleuchtere25064c2015-09-14 17:22:16 -0600199 PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700200 PFN_vkGetPhysicalDeviceSparseImageFormatProperties
201 GetPhysicalDeviceSparseImageFormatProperties;
Courtney Goeltzenleuchter725db942015-12-09 15:48:16 -0700202 PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
203 PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
204 PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
Mark Young0f7adeb2016-11-07 13:27:02 -0700205 PFN_vkDebugMarkerSetObjectTagEXT DebugMarkerSetObjectTagEXT;
206 PFN_vkDebugMarkerSetObjectNameEXT DebugMarkerSetObjectNameEXT;
Ian Elliottec736342015-08-21 15:09:33 -0600207 PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR;
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700208 PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR
209 GetPhysicalDeviceSurfaceCapabilitiesKHR;
Ian Elliottea666b22015-11-19 16:05:09 -0700210 PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR;
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700211 PFN_vkGetPhysicalDeviceSurfacePresentModesKHR
212 GetPhysicalDeviceSurfacePresentModesKHR;
Mark Lobodzinskif739d1d2016-08-29 14:21:14 -0600213 PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV
214 GetPhysicalDeviceExternalImageFormatPropertiesNV;
Ian Elliotte851dd62015-11-24 15:39:10 -0700215#ifdef VK_USE_PLATFORM_WIN32_KHR
Mark Young5467d672016-06-28 10:52:43 -0600216 PFN_vkCreateWin32SurfaceKHR CreateWin32SurfaceKHR;
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700217 PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR
218 GetPhysicalDeviceWin32PresentationSupportKHR;
Ian Elliotte851dd62015-11-24 15:39:10 -0700219#endif
220#ifdef VK_USE_PLATFORM_MIR_KHR
Mark Young5467d672016-06-28 10:52:43 -0600221 PFN_vkCreateMirSurfaceKHR CreateMirSurfaceKHR;
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700222 PFN_vkGetPhysicalDeviceMirPresentationSupportKHR
Mark Lobodzinskib16da052016-08-31 09:31:29 -0600223 GetPhysicalDeviceMirPresentationSupportKHR;
Ian Elliotte851dd62015-11-24 15:39:10 -0700224#endif
225#ifdef VK_USE_PLATFORM_WAYLAND_KHR
Mark Young5467d672016-06-28 10:52:43 -0600226 PFN_vkCreateWaylandSurfaceKHR CreateWaylandSurfaceKHR;
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700227 PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR
228 GetPhysicalDeviceWaylandPresentationSupportKHR;
Ian Elliotte851dd62015-11-24 15:39:10 -0700229#endif
230#ifdef VK_USE_PLATFORM_XCB_KHR
Mark Young5467d672016-06-28 10:52:43 -0600231 PFN_vkCreateXcbSurfaceKHR CreateXcbSurfaceKHR;
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700232 PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR
233 GetPhysicalDeviceXcbPresentationSupportKHR;
Ian Elliotte851dd62015-11-24 15:39:10 -0700234#endif
235#ifdef VK_USE_PLATFORM_XLIB_KHR
Mark Young5467d672016-06-28 10:52:43 -0600236 PFN_vkCreateXlibSurfaceKHR CreateXlibSurfaceKHR;
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700237 PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR
238 GetPhysicalDeviceXlibPresentationSupportKHR;
Ian Elliotte851dd62015-11-24 15:39:10 -0700239#endif
Jon Ashburncc370d02016-03-08 09:30:30 -0700240 PFN_vkGetPhysicalDeviceDisplayPropertiesKHR
241 GetPhysicalDeviceDisplayPropertiesKHR;
242 PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR
243 GetPhysicalDeviceDisplayPlanePropertiesKHR;
244 PFN_vkGetDisplayPlaneSupportedDisplaysKHR
245 GetDisplayPlaneSupportedDisplaysKHR;
Jon Ashburnc466da52016-04-15 09:25:03 -0600246 PFN_vkGetDisplayModePropertiesKHR GetDisplayModePropertiesKHR;
247 PFN_vkCreateDisplayModeKHR CreateDisplayModeKHR;
248 PFN_vkGetDisplayPlaneCapabilitiesKHR GetDisplayPlaneCapabilitiesKHR;
249 PFN_vkCreateDisplayPlaneSurfaceKHR CreateDisplayPlaneSurfaceKHR;
250 PFN_vkDestroySurfaceKHR DestroySurfaceKHR;
Mark Young5467d672016-06-28 10:52:43 -0600251 PFN_vkCreateSwapchainKHR CreateSwapchainKHR;
Mark Young4ab55c42016-12-12 16:14:55 -0700252
253 // NVX_device_generated_commands
254 PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX
255 GetPhysicalDeviceGeneratedCommandsPropertiesNVX;
256
Mark Young26c19372016-11-03 14:27:13 -0600257 struct loader_icd_term *next;
Jon Ashburnebfa25e2015-05-15 15:09:35 -0600258};
259
Mark Young1d645262016-09-07 08:50:32 -0600260// per ICD library structure
Mark Young26c19372016-11-03 14:27:13 -0600261struct loader_icd_tramp_list {
Jon Ashburne0367472015-08-18 18:04:47 -0600262 size_t capacity;
263 uint32_t count;
Mark Young26c19372016-11-03 14:27:13 -0600264 struct loader_scanned_icd *scanned_list;
Jon Ashburne0367472015-08-18 18:04:47 -0600265};
266
Mark Young1d645262016-09-07 08:50:32 -0600267union loader_instance_extension_enables {
268 struct {
Mark Young26c19372016-11-03 14:27:13 -0600269 uint8_t ext_debug_report : 1;
Mark Young1d645262016-09-07 08:50:32 -0600270 uint8_t nv_external_memory_capabilities : 1;
271 };
272 uint64_t padding[4];
273};
274
275// per instance structure
Jon Ashburn13482452015-05-12 17:26:48 -0600276struct loader_instance {
Jon Ashburnebfa25e2015-05-15 15:09:35 -0600277 VkLayerInstanceDispatchTable *disp; // must be first entry in structure
278
Mark Young26c19372016-11-03 14:27:13 -0600279 uint32_t total_gpu_count;
280 struct loader_physical_device_term *phys_devs_term;
Lenny Komowaaa115c2016-12-19 17:11:40 -0700281 uint32_t phys_dev_count_tramp;
282 struct loader_physical_device_tramp **phys_devs_tramp;
Mark Young26c19372016-11-03 14:27:13 -0600283
Jon Ashburn13482452015-05-12 17:26:48 -0600284 struct loader_instance *next;
Mark Young26c19372016-11-03 14:27:13 -0600285
286 uint32_t total_icd_count;
287 struct loader_icd_term *icd_terms;
288 struct loader_icd_tramp_list icd_tramp_list;
289
Jon Ashburn6cb69f42015-11-17 15:31:02 -0700290 struct loader_dispatch_hash_entry disp_hash[MAX_NUM_DEV_EXTS];
Jon Ashburnb4c24232015-08-20 16:35:30 -0600291
Courtney Goeltzenleuchter67146d02015-06-10 17:39:03 -0600292 struct loader_msg_callback_map_entry *icd_msg_callback_map;
293
Mark Young26c19372016-11-03 14:27:13 -0600294 struct loader_layer_list instance_layer_list;
Courtney Goeltzenleuchter44667cc2015-06-29 15:39:26 -0600295 struct loader_layer_list activated_layer_list;
Jon Ashburnc325bc02016-05-16 14:01:18 -0600296 bool activated_layers_are_std_val;
Jon Ashburnc466da52016-04-15 09:25:03 -0600297 VkInstance instance; // layers/ICD instance returned to trampoline
Courtney Goeltzenleuchter0bd705c2016-01-08 12:18:43 -0700298
Mark Young26c19372016-11-03 14:27:13 -0600299 struct loader_extension_list ext_list; // icds and loaders extensions
300 union loader_instance_extension_enables enabled_known_extensions;
301
Courtney Goeltzenleuchter67146d02015-06-10 17:39:03 -0600302 VkLayerDbgFunctionNode *DbgFunctionHead;
Ian Elliottdefd6da2016-03-31 10:48:19 -0600303 uint32_t num_tmp_callbacks;
304 VkDebugReportCallbackCreateInfoEXT *tmp_dbg_create_infos;
305 VkDebugReportCallbackEXT *tmp_callbacks;
Courtney Goeltzenleuchter71b454b2015-07-05 11:28:29 -0600306
Chia-I Wu227c8b32015-10-27 18:04:07 +0800307 VkAllocationCallbacks alloc_callbacks;
Ian Elliotted33eb72015-07-06 14:36:13 -0600308
Ian Elliott54cea232015-10-30 15:28:23 -0600309 bool wsi_surface_enabled;
Mark Lobodzinski1ad14b42015-12-10 16:25:21 -0700310#ifdef VK_USE_PLATFORM_WIN32_KHR
Ian Elliott54cea232015-10-30 15:28:23 -0600311 bool wsi_win32_surface_enabled;
Mark Lobodzinski1ad14b42015-12-10 16:25:21 -0700312#endif
313#ifdef VK_USE_PLATFORM_MIR_KHR
Ian Elliott54cea232015-10-30 15:28:23 -0600314 bool wsi_mir_surface_enabled;
Mark Lobodzinski1ad14b42015-12-10 16:25:21 -0700315#endif
316#ifdef VK_USE_PLATFORM_WAYLAND_KHR
Ian Elliott54cea232015-10-30 15:28:23 -0600317 bool wsi_wayland_surface_enabled;
Mark Lobodzinski1ad14b42015-12-10 16:25:21 -0700318#endif
319#ifdef VK_USE_PLATFORM_XCB_KHR
Ian Elliott54cea232015-10-30 15:28:23 -0600320 bool wsi_xcb_surface_enabled;
Mark Lobodzinski1ad14b42015-12-10 16:25:21 -0700321#endif
322#ifdef VK_USE_PLATFORM_XLIB_KHR
Ian Elliott54cea232015-10-30 15:28:23 -0600323 bool wsi_xlib_surface_enabled;
Mark Lobodzinski1ad14b42015-12-10 16:25:21 -0700324#endif
325#ifdef VK_USE_PLATFORM_ANDROID_KHR
326 bool wsi_android_surface_enabled;
327#endif
Jon Ashburncc370d02016-03-08 09:30:30 -0700328 bool wsi_display_enabled;
Courtney Goeltzenleuchter67146d02015-06-10 17:39:03 -0600329};
330
Jon Ashburnfd02a0f2016-03-01 19:51:07 -0700331/* VkPhysicalDevice requires special treatment by loader. Firstly, terminator
Mark Young26c19372016-11-03 14:27:13 -0600332 * code must be able to get the struct loader_icd_term to call into the proper
Jon Ashburnfd02a0f2016-03-01 19:51:07 -0700333 * driver (multiple ICD/gpu case). This can be accomplished by wrapping the
334 * created VkPhysicalDevice in loader terminate_EnumeratePhysicalDevices().
Piers Daniell82107a62016-03-29 11:51:11 -0600335 * Secondly, the loader must be able to handle wrapped by layer VkPhysicalDevice
Jon Ashburnfd02a0f2016-03-01 19:51:07 -0700336 * in trampoline code. This implies, that the loader trampoline code must also
337 * wrap the VkPhysicalDevice object in trampoline code. Thus, loader has to
338 * wrap the VkPhysicalDevice created object twice. In trampoline code it can't
339 * rely on the terminator object wrapping since a layer may also wrap. Since
340 * trampoline code wraps the VkPhysicalDevice this means all loader trampoline
341 * code that passes a VkPhysicalDevice should unwrap it. */
342
343/* per enumerated PhysicalDevice structure, used to wrap in trampoline code and
344 also same structure used to wrap in terminator code */
Jon Ashburnc3519e42016-03-24 15:49:57 -0600345struct loader_physical_device_tramp {
346 VkLayerInstanceDispatchTable *disp; // must be first entry in structure
Piers Daniell82107a62016-03-29 11:51:11 -0600347 struct loader_instance *this_instance;
Jon Ashburnc466da52016-04-15 09:25:03 -0600348 VkPhysicalDevice phys_dev; // object from layers/loader terminator
Jon Ashburnc3519e42016-03-24 15:49:57 -0600349};
350
351/* per enumerated PhysicalDevice structure, used to wrap in terminator code */
Mark Young26c19372016-11-03 14:27:13 -0600352struct loader_physical_device_term {
Jon Ashburn969caa42015-11-01 14:04:06 -0700353 VkLayerInstanceDispatchTable *disp; // must be first entry in structure
Mark Young26c19372016-11-03 14:27:13 -0600354 struct loader_icd_term *this_icd_term;
Mark Young5467d672016-06-28 10:52:43 -0600355 uint8_t icd_index;
Jon Ashburnc3519e42016-03-24 15:49:57 -0600356 VkPhysicalDevice phys_dev; // object from ICD
Jon Ashburn969caa42015-11-01 14:04:06 -0700357};
358
Jon Ashburn13482452015-05-12 17:26:48 -0600359struct loader_struct {
360 struct loader_instance *instances;
Courtney Goeltzenleuchter67146d02015-06-10 17:39:03 -0600361};
362
Mark Young26c19372016-11-03 14:27:13 -0600363struct loader_scanned_icd {
Courtney Goeltzenleuchter67146d02015-06-10 17:39:03 -0600364 char *lib_name;
365 loader_platform_dl_handle handle;
Jon Ashburn27109e82015-11-17 17:35:40 -0700366 uint32_t api_version;
Jon Ashburn68b06d62016-04-25 11:09:37 -0600367 uint32_t interface_version;
Jon Ashburnc7ca48d2015-07-16 10:17:29 -0600368 PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
Courtney Goeltzenleuchter67146d02015-06-10 17:39:03 -0600369 PFN_vkCreateInstance CreateInstance;
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700370 PFN_vkEnumerateInstanceExtensionProperties
371 EnumerateInstanceExtensionProperties;
Jon Ashburn13482452015-05-12 17:26:48 -0600372};
373
Jon Ashburn399c9162015-07-02 09:40:15 -0600374static inline struct loader_instance *loader_instance(VkInstance instance) {
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700375 return (struct loader_instance *)instance;
Jon Ashburn399c9162015-07-02 09:40:15 -0600376}
377
Jon Ashburnfd02a0f2016-03-01 19:51:07 -0700378static inline VkPhysicalDevice
379loader_unwrap_physical_device(VkPhysicalDevice physicalDevice) {
Piers Daniella9ccaed2016-03-31 14:47:57 -0600380 struct loader_physical_device_tramp *phys_dev =
381 (struct loader_physical_device_tramp *)physicalDevice;
Jon Ashburnfd02a0f2016-03-01 19:51:07 -0700382 return phys_dev->phys_dev;
383}
384
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700385static inline void loader_set_dispatch(void *obj, const void *data) {
386 *((const void **)obj) = data;
Chia-I Wufe333ed2015-04-11 15:34:07 +0800387}
388
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700389static inline VkLayerDispatchTable *loader_get_dispatch(const void *obj) {
390 return *((VkLayerDispatchTable **)obj);
Chia-I Wufe333ed2015-04-11 15:34:07 +0800391}
392
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700393static inline struct loader_dev_dispatch_table *
394loader_get_dev_dispatch(const void *obj) {
395 return *((struct loader_dev_dispatch_table **)obj);
Jon Ashburn6cb69f42015-11-17 15:31:02 -0700396}
397
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700398static inline VkLayerInstanceDispatchTable *
399loader_get_instance_dispatch(const void *obj) {
400 return *((VkLayerInstanceDispatchTable **)obj);
Jon Ashburn13482452015-05-12 17:26:48 -0600401}
402
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700403static inline void loader_init_dispatch(void *obj, const void *data) {
Jon Ashburn167b2b12015-04-15 13:34:33 -0600404#ifdef DEBUG
Chia-I Wufe333ed2015-04-11 15:34:07 +0800405 assert(valid_loader_magic_value(obj) &&
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700406 "Incompatible ICD, first dword must be initialized to "
407 "ICD_LOADER_MAGIC. See loader/README.md for details.");
Jon Ashburn167b2b12015-04-15 13:34:33 -0600408#endif
Chia-I Wufe333ed2015-04-11 15:34:07 +0800409
Jon Ashburn62a54d12015-05-01 18:00:33 -0600410 loader_set_dispatch(obj, data);
Chia-I Wufe333ed2015-04-11 15:34:07 +0800411}
412
Jon Ashburn13482452015-05-12 17:26:48 -0600413/* global variables used across files */
414extern struct loader_struct loader;
Jon Ashburnb4dee9c2015-08-28 15:19:27 -0600415extern THREAD_LOCAL_DECL struct loader_instance *tls_instance;
Jon Ashburne0367472015-08-18 18:04:47 -0600416extern LOADER_PLATFORM_THREAD_ONCE_DEFINITION(once_init);
Jon Ashburn7e8d8b42015-05-29 13:15:39 -0600417extern loader_platform_thread_mutex loader_lock;
Jon Ashburn7d4d51c2015-09-22 13:11:00 -0600418extern loader_platform_thread_mutex loader_json_lock;
Jon Ashburn7e8d8b42015-05-29 13:15:39 -0600419extern const VkLayerInstanceDispatchTable instance_disp;
Jon Ashburnd1eb3322016-02-10 20:59:26 -0700420extern const char *std_validation_str;
Jon Ashburn37e7f972015-04-06 10:58:22 -0600421
Courtney Goeltzenleuchter67146d02015-06-10 17:39:03 -0600422struct loader_msg_callback_map_entry {
Courtney Goeltzenleuchter725db942015-12-09 15:48:16 -0700423 VkDebugReportCallbackEXT icd_obj;
424 VkDebugReportCallbackEXT loader_obj;
Courtney Goeltzenleuchter67146d02015-06-10 17:39:03 -0600425};
426
Jon Ashburnc4e9ae62016-02-26 13:14:27 -0700427/* helper function definitions */
Mark Young26c19372016-11-03 14:27:13 -0600428void *loader_instance_heap_alloc(const struct loader_instance *instance,
429 size_t size,
430 VkSystemAllocationScope allocationScope);
431void loader_instance_heap_free(const struct loader_instance *instance,
432 void *pMemory);
433void *loader_instance_heap_realloc(const struct loader_instance *instance,
434 void *pMemory, size_t orig_size, size_t size,
435 VkSystemAllocationScope alloc_scope);
Mark Young74dd5d12016-06-30 13:02:42 -0600436void *loader_instance_tls_heap_alloc(size_t size);
437void loader_instance_tls_heap_free(void *pMemory);
Mark Young26c19372016-11-03 14:27:13 -0600438void *loader_device_heap_alloc(const struct loader_device *device, size_t size,
439 VkSystemAllocationScope allocationScope);
Mark Young74dd5d12016-06-30 13:02:42 -0600440void loader_device_heap_free(const struct loader_device *device, void *pMemory);
Mark Young26c19372016-11-03 14:27:13 -0600441void *loader_device_heap_realloc(const struct loader_device *device,
442 void *pMemory, size_t orig_size, size_t size,
443 VkSystemAllocationScope alloc_scope);
Jon Ashburnc4e9ae62016-02-26 13:14:27 -0700444
Jon Ashburn663f8312016-02-12 08:20:06 -0700445void loader_log(const struct loader_instance *inst, VkFlags msg_type,
Jon Ashburnc4e9ae62016-02-26 13:14:27 -0700446 int32_t msg_code, const char *format, ...);
Jon Ashburn663f8312016-02-12 08:20:06 -0700447
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700448bool compare_vk_extension_properties(const VkExtensionProperties *op1,
449 const VkExtensionProperties *op2);
Courtney Goeltzenleuchter67146d02015-06-10 17:39:03 -0600450
Mark Lobodzinski8d325802016-02-02 18:53:34 -0700451VkResult loader_validate_layers(const struct loader_instance *inst,
452 const uint32_t layer_count,
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700453 const char *const *ppEnabledLayerNames,
454 const struct loader_layer_list *list);
Courtney Goeltzenleuchter76ece702015-07-06 17:45:08 -0600455
456VkResult loader_validate_instance_extensions(
Mark Lobodzinski8d325802016-02-02 18:53:34 -0700457 const struct loader_instance *inst,
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700458 const struct loader_extension_list *icd_exts,
459 const struct loader_layer_list *instance_layer,
460 const VkInstanceCreateInfo *pCreateInfo);
Courtney Goeltzenleuchter76ece702015-07-06 17:45:08 -0600461
Jon Ashburne0367472015-08-18 18:04:47 -0600462void loader_initialize(void);
Mark Young74dd5d12016-06-30 13:02:42 -0600463VkResult loader_copy_layer_properties(const struct loader_instance *inst,
464 struct loader_layer_properties *dst,
465 struct loader_layer_properties *src);
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700466bool has_vk_extension_property_array(const VkExtensionProperties *vk_ext_prop,
467 const uint32_t count,
468 const VkExtensionProperties *ext_array);
469bool has_vk_extension_property(const VkExtensionProperties *vk_ext_prop,
470 const struct loader_extension_list *ext_list);
Jon Ashburn13482452015-05-12 17:26:48 -0600471
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700472VkResult loader_add_to_ext_list(const struct loader_instance *inst,
473 struct loader_extension_list *ext_list,
474 uint32_t prop_list_count,
475 const VkExtensionProperties *props);
Jon Ashburnc466da52016-04-15 09:25:03 -0600476VkResult
477loader_add_to_dev_ext_list(const struct loader_instance *inst,
478 struct loader_device_extension_list *ext_list,
479 const VkExtensionProperties *props,
480 uint32_t entry_count, char **entrys);
Jon Ashburnc4e9ae62016-02-26 13:14:27 -0700481VkResult loader_add_device_extensions(const struct loader_instance *inst,
Jon Ashburnc466da52016-04-15 09:25:03 -0600482 PFN_vkEnumerateDeviceExtensionProperties
483 fpEnumerateDeviceExtensionProperties,
Jon Ashburnc4e9ae62016-02-26 13:14:27 -0700484 VkPhysicalDevice physical_device,
485 const char *lib_name,
486 struct loader_extension_list *ext_list);
Mark Youngce38e312016-08-19 15:25:08 -0600487VkResult loader_init_generic_list(const struct loader_instance *inst,
488 struct loader_generic_list *list_info,
489 size_t element_size);
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700490void loader_destroy_generic_list(const struct loader_instance *inst,
491 struct loader_generic_list *list);
Jon Ashburnc4e9ae62016-02-26 13:14:27 -0700492void loader_destroy_layer_list(const struct loader_instance *inst,
Mark Young74dd5d12016-06-30 13:02:42 -0600493 struct loader_device *device,
Jon Ashburnc4e9ae62016-02-26 13:14:27 -0700494 struct loader_layer_list *layer_list);
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700495void loader_delete_layer_properties(const struct loader_instance *inst,
496 struct loader_layer_list *layer_list);
Mark Young26c19372016-11-03 14:27:13 -0600497bool loader_find_layer_name_array(
498 const char *name, uint32_t layer_count,
499 const char layer_list[][VK_MAX_EXTENSION_NAME_SIZE]);
Mark Young74dd5d12016-06-30 13:02:42 -0600500VkResult loader_expand_layer_names(
Mark Young26c19372016-11-03 14:27:13 -0600501 struct loader_instance *inst, const char *key_name, uint32_t expand_count,
Jon Ashburnd1eb3322016-02-10 20:59:26 -0700502 const char expand_names[][VK_MAX_EXTENSION_NAME_SIZE],
Jon Ashburnc466da52016-04-15 09:25:03 -0600503 uint32_t *layer_count, char const *const **ppp_layer_names);
Jon Ashburnc325bc02016-05-16 14:01:18 -0600504void loader_init_std_validation_props(struct loader_layer_properties *props);
Chris Forbes7333fdd2016-04-06 20:49:02 +1200505void loader_delete_shadow_dev_layer_names(const struct loader_instance *inst,
506 const VkDeviceCreateInfo *orig,
507 VkDeviceCreateInfo *ours);
508void loader_delete_shadow_inst_layer_names(const struct loader_instance *inst,
509 const VkInstanceCreateInfo *orig,
510 VkInstanceCreateInfo *ours);
Mark Young74dd5d12016-06-30 13:02:42 -0600511VkResult loader_add_to_layer_list(const struct loader_instance *inst,
512 struct loader_layer_list *list,
513 uint32_t prop_list_count,
514 const struct loader_layer_properties *props);
Jon Ashburnc466da52016-04-15 09:25:03 -0600515void loader_find_layer_name_add_list(
516 const struct loader_instance *inst, const char *name,
517 const enum layer_type type, const struct loader_layer_list *search_list,
518 struct loader_layer_list *found_list);
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700519void loader_scanned_icd_clear(const struct loader_instance *inst,
Mark Young26c19372016-11-03 14:27:13 -0600520 struct loader_icd_tramp_list *icd_tramp_list);
Mark Young74dd5d12016-06-30 13:02:42 -0600521VkResult loader_icd_scan(const struct loader_instance *inst,
Mark Young26c19372016-11-03 14:27:13 -0600522 struct loader_icd_tramp_list *icd_tramp_list);
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700523void loader_layer_scan(const struct loader_instance *inst,
Jon Ashburnc325bc02016-05-16 14:01:18 -0600524 struct loader_layer_list *instance_layers);
Jeremy Hayes10d78f12016-04-01 11:40:26 -0600525void loader_implicit_layer_scan(const struct loader_instance *inst,
Jon Ashburnc325bc02016-05-16 14:01:18 -0600526 struct loader_layer_list *instance_layers);
Mark Youngce38e312016-08-19 15:25:08 -0600527VkResult loader_get_icd_loader_instance_extensions(
Mark Young26c19372016-11-03 14:27:13 -0600528 const struct loader_instance *inst,
529 struct loader_icd_tramp_list *icd_tramp_list,
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700530 struct loader_extension_list *inst_exts);
Mark Young26c19372016-11-03 14:27:13 -0600531struct loader_icd_term *
532loader_get_icd_and_device(const VkDevice device,
533 struct loader_device **found_dev,
534 uint32_t *icd_index);
Jon Ashburnc4e9ae62016-02-26 13:14:27 -0700535void loader_init_dispatch_dev_ext(struct loader_instance *inst,
536 struct loader_device *dev);
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700537void *loader_dev_ext_gpa(struct loader_instance *inst, const char *funcName);
538void *loader_get_dev_ext_trampoline(uint32_t index);
Mark Young0f7adeb2016-11-07 13:27:02 -0700539void loader_override_terminating_device_proc(struct loader_device *dev);
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700540struct loader_instance *loader_get_instance(const VkInstance instance);
Jon Ashburnd3cf9552016-04-20 13:21:17 -0600541void loader_deactivate_layers(const struct loader_instance *instance,
Mark Young74dd5d12016-06-30 13:02:42 -0600542 struct loader_device *device,
Jon Ashburnd3cf9552016-04-20 13:21:17 -0600543 struct loader_layer_list *list);
Jon Ashburnc4e9ae62016-02-26 13:14:27 -0700544struct loader_device *
Mark Young26c19372016-11-03 14:27:13 -0600545loader_create_logical_device(const struct loader_instance *inst,
546 const VkAllocationCallbacks *pAllocator);
Piers Daniell82107a62016-03-29 11:51:11 -0600547void loader_add_logical_device(const struct loader_instance *inst,
Mark Young26c19372016-11-03 14:27:13 -0600548 struct loader_icd_term *icd_term,
Piers Daniell82107a62016-03-29 11:51:11 -0600549 struct loader_device *found_dev);
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700550void loader_remove_logical_device(const struct loader_instance *inst,
Mark Young26c19372016-11-03 14:27:13 -0600551 struct loader_icd_term *icd_term,
Mark Young74dd5d12016-06-30 13:02:42 -0600552 struct loader_device *found_dev,
553 const VkAllocationCallbacks *pAllocator);
Mark Young26c19372016-11-03 14:27:13 -0600554// NOTE: Outside of loader, this entry-point is only proivided for error
555// cleanup.
Mark Young74dd5d12016-06-30 13:02:42 -0600556void loader_destroy_logical_device(const struct loader_instance *inst,
557 struct loader_device *dev,
558 const VkAllocationCallbacks *pAllocator);
559
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700560VkResult
561loader_enable_instance_layers(struct loader_instance *inst,
562 const VkInstanceCreateInfo *pCreateInfo,
563 const struct loader_layer_list *instance_layers);
Jon Ashburn10f4e822015-06-10 10:06:06 -0600564void loader_deactivate_instance_layers(struct loader_instance *instance);
Courtney Goeltzenleuchter0bd705c2016-01-08 12:18:43 -0700565
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700566VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo,
567 const VkAllocationCallbacks *pAllocator,
568 struct loader_instance *inst,
Jon Ashburnd1205a92016-02-03 12:37:30 -0700569 VkInstance *created_instance);
Courtney Goeltzenleuchter0bd705c2016-01-08 12:18:43 -0700570
Jon Ashburn1c75aec2016-02-02 17:47:28 -0700571void loader_activate_instance_layer_extensions(struct loader_instance *inst,
572 VkInstance created_inst);
Jon Ashburnc4e9ae62016-02-26 13:14:27 -0700573VkResult
574loader_enable_device_layers(const struct loader_instance *inst,
Jon Ashburnc4e9ae62016-02-26 13:14:27 -0700575 struct loader_layer_list *activated_layer_list,
576 const VkDeviceCreateInfo *pCreateInfo,
577 const struct loader_layer_list *device_layers);
Courtney Goeltzenleuchter71b454b2015-07-05 11:28:29 -0600578
Jon Ashburnc466da52016-04-15 09:25:03 -0600579VkResult
580loader_create_device_chain(const struct loader_physical_device_tramp *pd,
581 const VkDeviceCreateInfo *pCreateInfo,
582 const VkAllocationCallbacks *pAllocator,
583 const struct loader_instance *inst,
584 struct loader_device *dev);
Jon Ashburnc4e9ae62016-02-26 13:14:27 -0700585VkResult loader_validate_device_extensions(
Jon Ashburnc3519e42016-03-24 15:49:57 -0600586 struct loader_physical_device_tramp *phys_dev,
Jon Ashburnc4e9ae62016-02-26 13:14:27 -0700587 const struct loader_layer_list *activated_device_layers,
Jon Ashburnfd02a0f2016-03-01 19:51:07 -0700588 const struct loader_extension_list *icd_exts,
Jon Ashburnc4e9ae62016-02-26 13:14:27 -0700589 const VkDeviceCreateInfo *pCreateInfo);
Courtney Goeltzenleuchter71b454b2015-07-05 11:28:29 -0600590
Jon Ashburnc4e9ae62016-02-26 13:14:27 -0700591/* instance layer chain termination entrypoint definitions */
592VKAPI_ATTR VkResult VKAPI_CALL
593terminator_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
594 const VkAllocationCallbacks *pAllocator,
595 VkInstance *pInstance);
Jon Ashburnb4dee9c2015-08-28 15:19:27 -0600596
Jon Ashburnc4e9ae62016-02-26 13:14:27 -0700597VKAPI_ATTR void VKAPI_CALL
598terminator_DestroyInstance(VkInstance instance,
599 const VkAllocationCallbacks *pAllocator);
Jon Ashburnb4dee9c2015-08-28 15:19:27 -0600600
Jon Ashburnc4e9ae62016-02-26 13:14:27 -0700601VKAPI_ATTR VkResult VKAPI_CALL
602terminator_EnumeratePhysicalDevices(VkInstance instance,
603 uint32_t *pPhysicalDeviceCount,
604 VkPhysicalDevice *pPhysicalDevices);
605
606VKAPI_ATTR void VKAPI_CALL
607terminator_GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
608 VkPhysicalDeviceFeatures *pFeatures);
609
610VKAPI_ATTR void VKAPI_CALL
611terminator_GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice,
612 VkFormat format,
613 VkFormatProperties *pFormatInfo);
614
615VKAPI_ATTR VkResult VKAPI_CALL
616terminator_GetPhysicalDeviceImageFormatProperties(
617 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
618 VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
619 VkImageFormatProperties *pImageFormatProperties);
620
621VKAPI_ATTR void VKAPI_CALL
622terminator_GetPhysicalDeviceSparseImageFormatProperties(
623 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
624 VkSampleCountFlagBits samples, VkImageUsageFlags usage,
625 VkImageTiling tiling, uint32_t *pNumProperties,
626 VkSparseImageFormatProperties *pProperties);
627
628VKAPI_ATTR void VKAPI_CALL
629terminator_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
630 VkPhysicalDeviceProperties *pProperties);
631
632VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceExtensionProperties(
633 VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pCount,
634 VkExtensionProperties *pProperties);
635
636VKAPI_ATTR VkResult VKAPI_CALL
637terminator_EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
638 uint32_t *pCount,
639 VkLayerProperties *pProperties);
640
641VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceQueueFamilyProperties(
642 VkPhysicalDevice physicalDevice, uint32_t *pCount,
643 VkQueueFamilyProperties *pProperties);
644
645VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceMemoryProperties(
646 VkPhysicalDevice physicalDevice,
647 VkPhysicalDeviceMemoryProperties *pProperties);
648
649VKAPI_ATTR VkResult VKAPI_CALL
650terminator_CreateDevice(VkPhysicalDevice gpu,
651 const VkDeviceCreateInfo *pCreateInfo,
652 const VkAllocationCallbacks *pAllocator,
653 VkDevice *pDevice);
Mark Lobodzinski8d325802016-02-02 18:53:34 -0700654
Jon Ashburnb1cdf2e2016-02-10 20:50:19 -0700655VkStringErrorFlags vk_string_validate(const int max_length,
656 const char *char_array);
Mark Lobodzinski8d325802016-02-02 18:53:34 -0700657
Chia-I Wuc1e0f962014-08-04 08:03:57 +0800658#endif /* LOADER_H */