blob: 9c585a5d22672196e4dcd8399a247be1f78c539d [file] [log] [blame]
Jon Ashburnd55a3942015-05-06 09:02:10 -06001/*
Jon Ashburnd55a3942015-05-06 09:02:10 -06002 *
Jon Ashburn23d36b12016-02-02 17:47:28 -07003 * Copyright (c) 2015-2016 The Khronos Group Inc.
4 * Copyright (c) 2015-2016 Valve Corporation
5 * Copyright (c) 2015-2016 LunarG, Inc.
Courtney Goeltzenleuchterf821dad2015-12-02 14:53:22 -07006 * Copyright (C) 2015 Google Inc.
Jon Ashburnd55a3942015-05-06 09:02:10 -06007 *
Jon Ashburn3ebf1252016-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
Jon Ashburnd55a3942015-05-06 09:02:10 -060011 *
Jon Ashburn3ebf1252016-04-19 11:30:31 -060012 * http://www.apache.org/licenses/LICENSE-2.0
Jon Ashburnd55a3942015-05-06 09:02:10 -060013 *
Jon Ashburn3ebf1252016-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 Ashburn23d36b12016-02-02 17:47:28 -070019 *
20 * Author: Courtney Goeltzenleuchter <courtney@lunarg.com>
Courtney Goeltzenleuchter05559522015-10-30 11:14:30 -060021 * Author: Jon Ashburn <jon@lunarg.com>
22 * Author: Tony Barbour <tony@LunarG.com>
Jon Ashburn23d36b12016-02-02 17:47:28 -070023 * Author: Chia-I Wu <olv@lunarg.com>
Jon Ashburnd55a3942015-05-06 09:02:10 -060024 */
Courtney Goeltzenleuchter7f5aafc2015-07-05 11:28:29 -060025#define _GNU_SOURCE
Jon Ashburn27cd5842015-05-12 17:26:48 -060026#include <stdlib.h>
27#include <string.h>
Jon Ashburnd55a3942015-05-06 09:02:10 -060028
Tobin Ehlisb835d1b2015-07-03 10:34:49 -060029#include "vk_loader_platform.h"
Jon Ashburnd55a3942015-05-06 09:02:10 -060030#include "loader.h"
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -060031#include "debug_report.h"
Ian Elliott954fa342015-10-30 15:28:23 -060032#include "wsi.h"
Mark Young0f183a82017-02-28 09:58:04 -070033#include "vk_loader_extensions.h"
Jon Ashburn1530c342016-02-26 13:14:27 -070034#include "gpa_helper.h"
Jon Ashburnd55a3942015-05-06 09:02:10 -060035
Mark Young0f183a82017-02-28 09:58:04 -070036// Trampoline entrypoints are in this file for core Vulkan commands
37
38// Get an instance level or global level entry point address.
39// @param instance
40// @param pName
41// @return
42// If instance == NULL returns a global level functions only
43// If instance is valid returns a trampoline entry point for all dispatchable Vulkan
44// functions both core and extensions.
Mark Lobodzinski729a8d32017-01-26 12:16:30 -070045LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *pName) {
Jon Ashburn1530c342016-02-26 13:14:27 -070046 void *addr;
47
48 addr = globalGetProcAddr(pName);
Lenny Komow5208de52017-11-10 10:03:08 -070049 if (instance == VK_NULL_HANDLE || addr != NULL) {
Jon Ashburn1530c342016-02-26 13:14:27 -070050 return addr;
Jon Ashburn1530c342016-02-26 13:14:27 -070051 }
52
53 struct loader_instance *ptr_instance = loader_get_instance(instance);
Mark Lobodzinski64318ba2017-01-26 13:34:13 -070054 if (ptr_instance == NULL) return NULL;
Mark Young0f183a82017-02-28 09:58:04 -070055 // Return trampoline code for non-global entrypoints including any extensions.
Jon Ashburn1530c342016-02-26 13:14:27 -070056 // Device extensions are returned if a layer or ICD supports the extension.
57 // Instance extensions are returned if the extension is enabled and the
Michael Jurka5c16c002016-12-19 16:31:43 +010058 // loader or someone else supports the extension
Jon Ashburn1530c342016-02-26 13:14:27 -070059 return trampolineGetProcAddr(ptr_instance, pName);
60}
61
Mark Young0f183a82017-02-28 09:58:04 -070062// Get a device level or global level entry point address.
63// @param device
64// @param pName
65// @return
66// If device is valid, returns a device relative entry point for device level
67// entry points both core and extensions.
68// Device relative means call down the device chain.
Mark Lobodzinski729a8d32017-01-26 12:16:30 -070069LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char *pName) {
Jon Ashburn1530c342016-02-26 13:14:27 -070070 void *addr;
71
Mark Young0f183a82017-02-28 09:58:04 -070072 // For entrypoints that loader must handle (ie non-dispatchable or create object)
73 // make sure the loader entrypoint is returned
Jon Ashburn1530c342016-02-26 13:14:27 -070074 addr = loader_non_passthrough_gdpa(pName);
75 if (addr) {
76 return addr;
77 }
78
Mark Young0f183a82017-02-28 09:58:04 -070079 // Although CreateDevice is on device chain it's dispatchable object isn't
80 // a VkDevice or child of VkDevice so return NULL.
Mark Lobodzinski64318ba2017-01-26 13:34:13 -070081 if (!strcmp(pName, "CreateDevice")) return NULL;
Jon Ashburn1530c342016-02-26 13:14:27 -070082
Mark Young0f183a82017-02-28 09:58:04 -070083 // Return the dispatch table entrypoint for the fastest case
Jon Ashburn1530c342016-02-26 13:14:27 -070084 const VkLayerDispatchTable *disp_table = *(VkLayerDispatchTable **)device;
Mark Lobodzinski64318ba2017-01-26 13:34:13 -070085 if (disp_table == NULL) return NULL;
Jon Ashburn1530c342016-02-26 13:14:27 -070086
87 addr = loader_lookup_device_dispatch_table(disp_table, pName);
Mark Lobodzinski64318ba2017-01-26 13:34:13 -070088 if (addr) return addr;
Jon Ashburn1530c342016-02-26 13:14:27 -070089
Mark Lobodzinski64318ba2017-01-26 13:34:13 -070090 if (disp_table->GetDeviceProcAddr == NULL) return NULL;
Jon Ashburn1530c342016-02-26 13:14:27 -070091 return disp_table->GetDeviceProcAddr(device, pName);
92}
93
Mark Lobodzinski729a8d32017-01-26 12:16:30 -070094LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *pLayerName,
95 uint32_t *pPropertyCount,
96 VkExtensionProperties *pProperties) {
Jon Ashburn1530c342016-02-26 13:14:27 -070097 tls_instance = NULL;
Lenny Komow23342982018-01-19 11:22:28 -070098 LOADER_PLATFORM_THREAD_ONCE(&once_init, loader_initialize);
Jon Ashburn1530c342016-02-26 13:14:27 -070099
Lenny Komow3cf3ac72017-12-19 16:38:37 -0700100 // We know we need to call at least the terminator
101 VkResult res = VK_SUCCESS;
102 VkEnumerateInstanceExtensionPropertiesChain chain_tail = {
103 .header =
104 {
105 .type = VK_CHAIN_TYPE_ENUMERATE_INSTANCE_EXTENSION_PROPERTIES,
106 .version = VK_CURRENT_CHAIN_VERSION,
107 .size = sizeof(chain_tail),
108 },
109 .pfnNextLayer = &terminator_EnumerateInstanceExtensionProperties,
110 .pNextLink = NULL,
111 };
112 VkEnumerateInstanceExtensionPropertiesChain *chain_head = &chain_tail;
113
114 // Get the implicit layers
115 struct loader_layer_list layers;
116 memset(&layers, 0, sizeof(layers));
117 loader_implicit_layer_scan(NULL, &layers);
118
119 // We'll need to save the dl handles so we can close them later
120 loader_platform_dl_handle *libs = malloc(sizeof(loader_platform_dl_handle) * layers.count);
121 if (libs == NULL) {
122 return VK_ERROR_OUT_OF_HOST_MEMORY;
123 }
124 size_t lib_count = 0;
125
126 // Prepend layers onto the chain if they implment this entry point
127 for (uint32_t i = 0; i < layers.count; ++i) {
128 if (!loader_is_implicit_layer_enabled(NULL, layers.list + i) ||
129 layers.list[i].pre_instance_functions.enumerate_instance_extension_properties[0] == '\0') {
130 continue;
Jon Ashburn1530c342016-02-26 13:14:27 -0700131 }
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600132
Lenny Komow3cf3ac72017-12-19 16:38:37 -0700133 loader_platform_dl_handle layer_lib = loader_platform_open_library(layers.list[i].lib_name);
134 libs[lib_count++] = layer_lib;
135 void *pfn = loader_platform_get_proc_address(layer_lib,
136 layers.list[i].pre_instance_functions.enumerate_instance_extension_properties);
137 if (pfn == NULL) {
138 loader_log(NULL, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0,
139 "%s: Unable to resolve symbol \"%s\" in implicit layer library \"%s\"", __FUNCTION__,
140 layers.list[i].pre_instance_functions.enumerate_instance_extension_properties, layers.list[i].lib_name);
141 continue;
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600142 }
143
Lenny Komow3cf3ac72017-12-19 16:38:37 -0700144 VkEnumerateInstanceExtensionPropertiesChain *chain_link = malloc(sizeof(VkEnumerateInstanceExtensionPropertiesChain));
145 if (chain_link == NULL) {
146 res = VK_ERROR_OUT_OF_HOST_MEMORY;
147 break;
148 }
149
150 chain_link->header.type = VK_CHAIN_TYPE_ENUMERATE_INSTANCE_EXTENSION_PROPERTIES;
151 chain_link->header.version = VK_CURRENT_CHAIN_VERSION;
152 chain_link->header.size = sizeof(*chain_link);
153 chain_link->pfnNextLayer = pfn;
154 chain_link->pNextLink = chain_head;
155
156 chain_head = chain_link;
Jon Ashburn1530c342016-02-26 13:14:27 -0700157 }
158
Lenny Komow3cf3ac72017-12-19 16:38:37 -0700159 // Call down the chain
160 if (res == VK_SUCCESS) {
161 res = chain_head->pfnNextLayer(chain_head->pNextLink, pLayerName, pPropertyCount, pProperties);
Jon Ashburn1530c342016-02-26 13:14:27 -0700162 }
163
Lenny Komow3cf3ac72017-12-19 16:38:37 -0700164 // Free up the layers
165 loader_delete_layer_properties(NULL, &layers);
166
167 // Tear down the chain
168 while (chain_head != &chain_tail) {
169 VkEnumerateInstanceExtensionPropertiesChain *holder = chain_head;
170 chain_head = (VkEnumerateInstanceExtensionPropertiesChain *)chain_head->pNextLink;
171 free(holder);
Jon Ashburn1530c342016-02-26 13:14:27 -0700172 }
173
Lenny Komow3cf3ac72017-12-19 16:38:37 -0700174 // Close the dl handles
175 for (size_t i = 0; i < lib_count; ++i) {
176 loader_platform_close_library(libs[i]);
Jon Ashburn1530c342016-02-26 13:14:27 -0700177 }
Lenny Komow3cf3ac72017-12-19 16:38:37 -0700178 free(libs);
Jon Ashburn1530c342016-02-26 13:14:27 -0700179
Mark Young0ad83132016-06-30 13:02:42 -0600180 return res;
Jon Ashburn1530c342016-02-26 13:14:27 -0700181}
182
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700183LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount,
184 VkLayerProperties *pProperties) {
Jon Ashburn1530c342016-02-26 13:14:27 -0700185 tls_instance = NULL;
Lenny Komow23342982018-01-19 11:22:28 -0700186 LOADER_PLATFORM_THREAD_ONCE(&once_init, loader_initialize);
Jon Ashburn1530c342016-02-26 13:14:27 -0700187
Lenny Komow3cf3ac72017-12-19 16:38:37 -0700188 // We know we need to call at least the terminator
189 VkResult res = VK_SUCCESS;
190 VkEnumerateInstanceLayerPropertiesChain chain_tail = {
191 .header =
192 {
193 .type = VK_CHAIN_TYPE_ENUMERATE_INSTANCE_LAYER_PROPERTIES,
194 .version = VK_CURRENT_CHAIN_VERSION,
195 .size = sizeof(chain_tail),
196 },
197 .pfnNextLayer = &terminator_EnumerateInstanceLayerProperties,
198 .pNextLink = NULL,
199 };
200 VkEnumerateInstanceLayerPropertiesChain *chain_head = &chain_tail;
Jon Ashburn1530c342016-02-26 13:14:27 -0700201
Lenny Komow3cf3ac72017-12-19 16:38:37 -0700202 // Get the implicit layers
203 struct loader_layer_list layers;
204 memset(&layers, 0, sizeof(layers));
205 loader_implicit_layer_scan(NULL, &layers);
Jon Ashburn1530c342016-02-26 13:14:27 -0700206
Lenny Komow3cf3ac72017-12-19 16:38:37 -0700207 // We'll need to save the dl handles so we can close them later
208 loader_platform_dl_handle *libs = malloc(sizeof(loader_platform_dl_handle) * layers.count);
209 if (libs == NULL) {
210 return VK_ERROR_OUT_OF_HOST_MEMORY;
211 }
212 size_t lib_count = 0;
213
214 // Prepend layers onto the chain if they implment this entry point
215 for (uint32_t i = 0; i < layers.count; ++i) {
216 if (!loader_is_implicit_layer_enabled(NULL, layers.list + i) ||
217 layers.list[i].pre_instance_functions.enumerate_instance_layer_properties[0] == '\0') {
218 continue;
219 }
220
221 loader_platform_dl_handle layer_lib = loader_platform_open_library(layers.list[i].lib_name);
222 libs[lib_count++] = layer_lib;
223 void *pfn =
224 loader_platform_get_proc_address(layer_lib, layers.list[i].pre_instance_functions.enumerate_instance_layer_properties);
225 if (pfn == NULL) {
226 loader_log(NULL, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0,
227 "%s: Unable to resolve symbol \"%s\" in implicit layer library \"%s\"", __FUNCTION__,
228 layers.list[i].pre_instance_functions.enumerate_instance_layer_properties, layers.list[i].lib_name);
229 continue;
230 }
231
232 VkEnumerateInstanceLayerPropertiesChain *chain_link = malloc(sizeof(VkEnumerateInstanceLayerPropertiesChain));
233 if (chain_link == NULL) {
234 res = VK_ERROR_OUT_OF_HOST_MEMORY;
235 break;
236 }
237
238 chain_link->header.type = VK_CHAIN_TYPE_ENUMERATE_INSTANCE_LAYER_PROPERTIES;
239 chain_link->header.version = VK_CURRENT_CHAIN_VERSION;
240 chain_link->header.size = sizeof(*chain_link);
241 chain_link->pfnNextLayer = pfn;
242 chain_link->pNextLink = chain_head;
243
244 chain_head = chain_link;
Jon Ashburn1530c342016-02-26 13:14:27 -0700245 }
246
Lenny Komow3cf3ac72017-12-19 16:38:37 -0700247 // Call down the chain
248 if (res == VK_SUCCESS) {
249 res = chain_head->pfnNextLayer(chain_head->pNextLink, pPropertyCount, pProperties);
Jon Ashburn1530c342016-02-26 13:14:27 -0700250 }
251
Lenny Komow3cf3ac72017-12-19 16:38:37 -0700252 // Free up the layers
253 loader_delete_layer_properties(NULL, &layers);
Jon Ashburn1530c342016-02-26 13:14:27 -0700254
Lenny Komow3cf3ac72017-12-19 16:38:37 -0700255 // Tear down the chain
256 while (chain_head != &chain_tail) {
257 VkEnumerateInstanceLayerPropertiesChain *holder = chain_head;
258 chain_head = (VkEnumerateInstanceLayerPropertiesChain *)chain_head->pNextLink;
259 free(holder);
Jon Ashburn1530c342016-02-26 13:14:27 -0700260 }
261
Lenny Komow3cf3ac72017-12-19 16:38:37 -0700262 // Close the dl handles
263 for (size_t i = 0; i < lib_count; ++i) {
264 loader_platform_close_library(libs[i]);
265 }
266 free(libs);
Jeremy Hayese852f132016-07-06 12:02:03 -0600267
Lenny Komow3cf3ac72017-12-19 16:38:37 -0700268 return res;
Jon Ashburn1530c342016-02-26 13:14:27 -0700269}
270
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700271LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
272 const VkAllocationCallbacks *pAllocator, VkInstance *pInstance) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600273 struct loader_instance *ptr_instance = NULL;
Jon Ashburne5b9bba2016-01-18 12:20:03 -0700274 VkInstance created_instance = VK_NULL_HANDLE;
Mark Young0ad83132016-06-30 13:02:42 -0600275 bool loaderLocked = false;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600276 VkResult res = VK_ERROR_INITIALIZATION_FAILED;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600277
Lenny Komow23342982018-01-19 11:22:28 -0700278 LOADER_PLATFORM_THREAD_ONCE(&once_init, loader_initialize);
279
Mark Young02df1a82017-04-18 19:52:18 -0600280 // Fail if the requested Vulkan apiVersion is > 1.0 since the loader only supports 1.0.
281 // Having pCreateInfo == NULL, pCreateInfo->pApplication == NULL, or
282 // pCreateInfo->pApplicationInfo->apiVersion == 0 all indicate that the application is
283 // only requesting a 1.0 instance, which this loader will always support.
284 uint32_t loader_major_version = 1;
285 uint32_t loader_minor_version = 0;
286 if (NULL != pCreateInfo && NULL != pCreateInfo->pApplicationInfo &&
287 pCreateInfo->pApplicationInfo->apiVersion >= VK_MAKE_VERSION(loader_major_version, loader_minor_version + 1, 0)) {
288 loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
289 "vkCreateInstance: Called with invalid API version %d.%d. Loader only supports %d.%d",
290 VK_VERSION_MAJOR(pCreateInfo->pApplicationInfo->apiVersion),
291 VK_VERSION_MINOR(pCreateInfo->pApplicationInfo->apiVersion), loader_major_version, loader_minor_version);
292 res = VK_ERROR_INCOMPATIBLE_DRIVER;
293 goto out;
294 }
295
Mark Young0ad83132016-06-30 13:02:42 -0600296#if (DEBUG_DISABLE_APP_ALLOCATORS == 1)
297 {
298#else
299 if (pAllocator) {
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700300 ptr_instance = (struct loader_instance *)pAllocator->pfnAllocation(pAllocator->pUserData, sizeof(struct loader_instance),
301 sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600302 } else {
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700303#endif
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700304 ptr_instance = (struct loader_instance *)malloc(sizeof(struct loader_instance));
Mark Young0ad83132016-06-30 13:02:42 -0600305 }
306
307 VkInstanceCreateInfo ici = *pCreateInfo;
308
Jon Ashburn27cd5842015-05-12 17:26:48 -0600309 if (ptr_instance == NULL) {
Mark Young0ad83132016-06-30 13:02:42 -0600310 res = VK_ERROR_OUT_OF_HOST_MEMORY;
311 goto out;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600312 }
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600313
Jon Ashburn87d6aa92015-08-28 15:19:27 -0600314 tls_instance = ptr_instance;
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600315 loader_platform_thread_lock_mutex(&loader_lock);
Mark Young0ad83132016-06-30 13:02:42 -0600316 loaderLocked = true;
Jon Ashburnb82c1852015-08-11 14:49:54 -0600317 memset(ptr_instance, 0, sizeof(struct loader_instance));
Chia-I Wuf7458c52015-10-26 21:10:41 +0800318 if (pAllocator) {
319 ptr_instance->alloc_callbacks = *pAllocator;
Courtney Goeltzenleuchter7f5aafc2015-07-05 11:28:29 -0600320 }
321
Mark Young0f183a82017-02-28 09:58:04 -0700322 // Look for one or more debug report create info structures
323 // and setup a callback(s) for each one found.
Ian Elliottad6300f2016-03-31 10:48:19 -0600324 ptr_instance->num_tmp_callbacks = 0;
325 ptr_instance->tmp_dbg_create_infos = NULL;
326 ptr_instance->tmp_callbacks = NULL;
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700327 if (util_CopyDebugReportCreateInfos(pCreateInfo->pNext, pAllocator, &ptr_instance->num_tmp_callbacks,
328 &ptr_instance->tmp_dbg_create_infos, &ptr_instance->tmp_callbacks)) {
Ian Elliottad6300f2016-03-31 10:48:19 -0600329 // One or more were found, but allocation failed. Therefore, clean up
330 // and fail this function:
Mark Young0ad83132016-06-30 13:02:42 -0600331 res = VK_ERROR_OUT_OF_HOST_MEMORY;
332 goto out;
Ian Elliottad6300f2016-03-31 10:48:19 -0600333 } else if (ptr_instance->num_tmp_callbacks > 0) {
334 // Setup the temporary callback(s) here to catch early issues:
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700335 if (util_CreateDebugReportCallbacks(ptr_instance, pAllocator, ptr_instance->num_tmp_callbacks,
336 ptr_instance->tmp_dbg_create_infos, ptr_instance->tmp_callbacks)) {
Ian Elliottad6300f2016-03-31 10:48:19 -0600337 // Failure of setting up one or more of the callback. Therefore,
338 // clean up and fail this function:
Mark Young0ad83132016-06-30 13:02:42 -0600339 res = VK_ERROR_OUT_OF_HOST_MEMORY;
340 goto out;
Courtney Goeltzenleuchter82887272015-12-02 15:29:33 -0700341 }
342 }
343
Mark Young0f183a82017-02-28 09:58:04 -0700344 // Due to implicit layers need to get layer list even if
345 // enabledLayerCount == 0 and VK_INSTANCE_LAYERS is unset. For now always
346 // get layer list via loader_layer_scan().
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700347 memset(&ptr_instance->instance_layer_list, 0, sizeof(ptr_instance->instance_layer_list));
Jon Ashburn491cd042016-05-16 14:01:18 -0600348 loader_layer_scan(ptr_instance, &ptr_instance->instance_layer_list);
Jon Ashburn3d002332015-08-20 16:35:30 -0600349
Mark Young0f183a82017-02-28 09:58:04 -0700350 // Validate the app requested layers to be enabled
Jon Ashburnf19916e2016-01-11 13:12:43 -0700351 if (pCreateInfo->enabledLayerCount > 0) {
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700352 res = loader_validate_layers(ptr_instance, pCreateInfo->enabledLayerCount, pCreateInfo->ppEnabledLayerNames,
353 &ptr_instance->instance_layer_list);
Jon Ashburn3d002332015-08-20 16:35:30 -0600354 if (res != VK_SUCCESS) {
Mark Young0ad83132016-06-30 13:02:42 -0600355 goto out;
Jon Ashburn3d002332015-08-20 16:35:30 -0600356 }
357 }
358
Mark Young0f183a82017-02-28 09:58:04 -0700359 // Scan/discover all ICD libraries
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700360 memset(&ptr_instance->icd_tramp_list, 0, sizeof(ptr_instance->icd_tramp_list));
Mark Young0153e0b2016-11-03 14:27:13 -0600361 res = loader_icd_scan(ptr_instance, &ptr_instance->icd_tramp_list);
Mark Young0ad83132016-06-30 13:02:42 -0600362 if (res != VK_SUCCESS) {
363 goto out;
364 }
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600365
Mark Young0f183a82017-02-28 09:58:04 -0700366 // Get extensions from all ICD's, merge so no duplicates, then validate
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700367 res = loader_get_icd_loader_instance_extensions(ptr_instance, &ptr_instance->icd_tramp_list, &ptr_instance->ext_list);
Mark Young3a587792016-08-19 15:25:08 -0600368 if (res != VK_SUCCESS) {
369 goto out;
370 }
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700371 res = loader_validate_instance_extensions(ptr_instance, &ptr_instance->ext_list, &ptr_instance->instance_layer_list, &ici);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600372 if (res != VK_SUCCESS) {
Mark Young0ad83132016-06-30 13:02:42 -0600373 goto out;
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600374 }
375
Mark Young1b1d8962017-06-15 08:36:58 -0600376 ptr_instance->disp = loader_instance_heap_alloc(ptr_instance, sizeof(struct loader_instance_dispatch_table),
377 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600378 if (ptr_instance->disp == NULL) {
Mark Lobodzinski64318ba2017-01-26 13:34:13 -0700379 loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
Mark Young1b1d8962017-06-15 08:36:58 -0600380 "vkCreateInstance: Failed to allocate Loader's full Instance dispatch table.");
Mark Young0ad83132016-06-30 13:02:42 -0600381 res = VK_ERROR_OUT_OF_HOST_MEMORY;
382 goto out;
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600383 }
Mark Young1b1d8962017-06-15 08:36:58 -0600384 memcpy(&ptr_instance->disp->layer_inst_disp, &instance_disp, sizeof(instance_disp));
385
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600386 ptr_instance->next = loader.instances;
387 loader.instances = ptr_instance;
388
Mark Young0f183a82017-02-28 09:58:04 -0700389 // Activate any layers on instance chain
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700390 res = loader_enable_instance_layers(ptr_instance, &ici, &ptr_instance->instance_layer_list);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600391 if (res != VK_SUCCESS) {
Mark Young0ad83132016-06-30 13:02:42 -0600392 goto out;
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600393 }
Jon Ashburn07daee72015-05-21 18:13:33 -0600394
Jon Ashburn23d36b12016-02-02 17:47:28 -0700395 created_instance = (VkInstance)ptr_instance;
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700396 res = loader_create_instance_chain(&ici, pAllocator, ptr_instance, &created_instance);
Jon Ashburneed0c002015-05-21 17:42:17 -0600397
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700398 if (res == VK_SUCCESS) {
Mark Young39389872017-01-19 21:10:49 -0700399 memset(ptr_instance->enabled_known_extensions.padding, 0, sizeof(uint64_t) * 4);
400
Chris Forbesbd9de052016-04-06 20:49:02 +1200401 wsi_create_instance(ptr_instance, &ici);
402 debug_report_create_instance(ptr_instance, &ici);
Mark Lobodzinski317574e2016-08-29 14:21:14 -0600403 extensions_create_instance(ptr_instance, &ici);
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700404
Jon Ashburne5b9bba2016-01-18 12:20:03 -0700405 *pInstance = created_instance;
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700406
Mark Young0f183a82017-02-28 09:58:04 -0700407 // Finally have the layers in place and everyone has seen
408 // the CreateInstance command go by. This allows the layer's
409 // GetInstanceProcAddr functions to return valid extension functions
410 // if enabled.
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700411 loader_activate_instance_layer_extensions(ptr_instance, *pInstance);
412 }
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700413
Mark Young0ad83132016-06-30 13:02:42 -0600414out:
415
416 if (NULL != ptr_instance) {
417 if (res != VK_SUCCESS) {
418 if (NULL != ptr_instance->next) {
419 loader.instances = ptr_instance->next;
420 }
421 if (NULL != ptr_instance->disp) {
422 loader_instance_heap_free(ptr_instance, ptr_instance->disp);
423 }
424 if (ptr_instance->num_tmp_callbacks > 0) {
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700425 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator, ptr_instance->num_tmp_callbacks,
426 ptr_instance->tmp_callbacks);
427 util_FreeDebugReportCreateInfos(pAllocator, ptr_instance->tmp_dbg_create_infos, ptr_instance->tmp_callbacks);
Mark Young0ad83132016-06-30 13:02:42 -0600428 }
429
Mark Young283fe1c2017-05-04 12:16:35 -0600430 if (NULL != ptr_instance->expanded_activated_layer_list.list) {
431 loader_deactivate_layers(ptr_instance, NULL, &ptr_instance->expanded_activated_layer_list);
432 }
433 if (NULL != ptr_instance->app_activated_layer_list.list) {
434 loader_destroy_layer_list(ptr_instance, NULL, &ptr_instance->app_activated_layer_list);
435 }
Mark Young0ad83132016-06-30 13:02:42 -0600436
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700437 loader_delete_layer_properties(ptr_instance, &ptr_instance->instance_layer_list);
438 loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_tramp_list);
439 loader_destroy_generic_list(ptr_instance, (struct loader_generic_list *)&ptr_instance->ext_list);
Mark Young0ad83132016-06-30 13:02:42 -0600440
441 loader_instance_heap_free(ptr_instance, ptr_instance);
442 } else {
Mark Young0f183a82017-02-28 09:58:04 -0700443 // Remove temporary debug_report callback
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700444 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator, ptr_instance->num_tmp_callbacks,
Mark Young0ad83132016-06-30 13:02:42 -0600445 ptr_instance->tmp_callbacks);
Mark Young0ad83132016-06-30 13:02:42 -0600446 }
447
448 if (loaderLocked) {
449 loader_platform_thread_unlock_mutex(&loader_lock);
450 }
451 }
452
Jon Ashburn27cd5842015-05-12 17:26:48 -0600453 return res;
454}
455
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700456LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600457 const VkLayerInstanceDispatchTable *disp;
Jon Ashburne0e64572015-09-30 12:56:42 -0600458 struct loader_instance *ptr_instance = NULL;
Ian Elliott3b354cf2016-03-25 08:43:01 -0600459 bool callback_setup = false;
460
Jeremy Hayesd8726c22016-04-21 13:19:41 -0600461 if (instance == VK_NULL_HANDLE) {
462 return;
463 }
464
Mark Young39389872017-01-19 21:10:49 -0700465 disp = loader_get_instance_layer_dispatch(instance);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600466
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600467 loader_platform_thread_lock_mutex(&loader_lock);
468
Jon Ashburne0e64572015-09-30 12:56:42 -0600469 ptr_instance = loader_get_instance(instance);
Ian Elliott3b354cf2016-03-25 08:43:01 -0600470
Mark Young0ad83132016-06-30 13:02:42 -0600471 if (pAllocator) {
472 ptr_instance->alloc_callbacks = *pAllocator;
473 }
474
Ian Elliottad6300f2016-03-31 10:48:19 -0600475 if (ptr_instance->num_tmp_callbacks > 0) {
476 // Setup the temporary callback(s) here to catch cleanup issues:
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700477 if (!util_CreateDebugReportCallbacks(ptr_instance, pAllocator, ptr_instance->num_tmp_callbacks,
478 ptr_instance->tmp_dbg_create_infos, ptr_instance->tmp_callbacks)) {
Ian Elliott3b354cf2016-03-25 08:43:01 -0600479 callback_setup = true;
480 }
481 }
482
Chia-I Wuf7458c52015-10-26 21:10:41 +0800483 disp->DestroyInstance(instance, pAllocator);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600484
Mark Young283fe1c2017-05-04 12:16:35 -0600485 if (NULL != ptr_instance->expanded_activated_layer_list.list) {
486 loader_deactivate_layers(ptr_instance, NULL, &ptr_instance->expanded_activated_layer_list);
487 }
488 if (NULL != ptr_instance->app_activated_layer_list.list) {
489 loader_destroy_layer_list(ptr_instance, NULL, &ptr_instance->app_activated_layer_list);
490 }
Mark Young39389872017-01-19 21:10:49 -0700491
Mark Young0153e0b2016-11-03 14:27:13 -0600492 if (ptr_instance->phys_devs_tramp) {
Lenny Komowb9f70c32016-12-19 17:11:40 -0700493 for (uint32_t i = 0; i < ptr_instance->phys_dev_count_tramp; i++) {
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700494 loader_instance_heap_free(ptr_instance, ptr_instance->phys_devs_tramp[i]);
Lenny Komowb9f70c32016-12-19 17:11:40 -0700495 }
Mark Young0153e0b2016-11-03 14:27:13 -0600496 loader_instance_heap_free(ptr_instance, ptr_instance->phys_devs_tramp);
Mark Young0ad83132016-06-30 13:02:42 -0600497 }
Mark Young39389872017-01-19 21:10:49 -0700498
Mark Youngd66edd52017-03-10 17:31:18 -0700499 if (ptr_instance->phys_dev_groups_tramp) {
500 for (uint32_t i = 0; i < ptr_instance->phys_dev_group_count_tramp; i++) {
501 loader_instance_heap_free(ptr_instance, ptr_instance->phys_dev_groups_tramp[i]);
502 }
503 loader_instance_heap_free(ptr_instance, ptr_instance->phys_dev_groups_tramp);
504 }
505
Ian Elliott3b354cf2016-03-25 08:43:01 -0600506 if (callback_setup) {
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700507 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator, ptr_instance->num_tmp_callbacks, ptr_instance->tmp_callbacks);
508 util_FreeDebugReportCreateInfos(pAllocator, ptr_instance->tmp_dbg_create_infos, ptr_instance->tmp_callbacks);
Ian Elliott3b354cf2016-03-25 08:43:01 -0600509 }
Mark Young0ad83132016-06-30 13:02:42 -0600510 loader_instance_heap_free(ptr_instance, ptr_instance->disp);
511 loader_instance_heap_free(ptr_instance, ptr_instance);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600512 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600513}
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600514
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700515LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount,
516 VkPhysicalDevice *pPhysicalDevices) {
Mark Youngd8382d72016-12-23 16:59:58 -0700517 VkResult res = VK_SUCCESS;
Mark Youngd66edd52017-03-10 17:31:18 -0700518 uint32_t count;
519 uint32_t i;
Mark Young6267ae62017-01-12 12:27:19 -0700520 struct loader_instance *inst;
Mark Youngd8382d72016-12-23 16:59:58 -0700521
Mark Young6267ae62017-01-12 12:27:19 -0700522 loader_platform_thread_lock_mutex(&loader_lock);
523
524 inst = loader_get_instance(instance);
Mark Youngd8382d72016-12-23 16:59:58 -0700525 if (NULL == inst) {
526 res = VK_ERROR_INITIALIZATION_FAILED;
527 goto out;
528 }
529
Mark Youngd66edd52017-03-10 17:31:18 -0700530 if (NULL == pPhysicalDeviceCount) {
531 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
532 "vkEnumeratePhysicalDevices: Received NULL pointer for physical device count return value.");
533 res = VK_ERROR_INITIALIZATION_FAILED;
Mark Young6267ae62017-01-12 12:27:19 -0700534 goto out;
535 }
536
Mark Youngd66edd52017-03-10 17:31:18 -0700537 // Setup the trampoline loader physical devices. This will actually
538 // call down and setup the terminator loader physical devices during the
539 // process.
Mark Young6267ae62017-01-12 12:27:19 -0700540 VkResult setup_res = setupLoaderTrampPhysDevs(instance);
541 if (setup_res != VK_SUCCESS && setup_res != VK_INCOMPLETE) {
542 res = setup_res;
543 goto out;
544 }
545
Mark Youngd66edd52017-03-10 17:31:18 -0700546 count = inst->phys_dev_count_tramp;
547
Mark Young6267ae62017-01-12 12:27:19 -0700548 // Wrap the PhysDev object for loader usage, return wrapped objects
Mark Youngd66edd52017-03-10 17:31:18 -0700549 if (NULL != pPhysicalDevices) {
550 if (inst->phys_dev_count_tramp > *pPhysicalDeviceCount) {
551 loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0,
552 "vkEnumeratePhysicalDevices: Trimming device count down"
553 " by application request from %d to %d physical devices",
554 inst->phys_dev_count_tramp, *pPhysicalDeviceCount);
555 count = *pPhysicalDeviceCount;
556 res = VK_INCOMPLETE;
557 }
558 for (i = 0; i < count; i++) {
559 pPhysicalDevices[i] = (VkPhysicalDevice)inst->phys_devs_tramp[i];
560 }
Mark Young6267ae62017-01-12 12:27:19 -0700561 }
562
Mark Youngd66edd52017-03-10 17:31:18 -0700563 *pPhysicalDeviceCount = count;
Lenny Komowb9f70c32016-12-19 17:11:40 -0700564
Lenny Komowa5e01122016-12-22 15:29:43 -0700565out:
Mark Youngd8382d72016-12-23 16:59:58 -0700566
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600567 loader_platform_thread_unlock_mutex(&loader_lock);
568 return res;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600569}
570
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700571LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
572 VkPhysicalDeviceFeatures *pFeatures) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600573 const VkLayerInstanceDispatchTable *disp;
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700574 VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
Mark Young39389872017-01-19 21:10:49 -0700575 disp = loader_get_instance_layer_dispatch(physicalDevice);
Jon Ashburn014438f2016-03-01 19:51:07 -0700576 disp->GetPhysicalDeviceFeatures(unwrapped_phys_dev, pFeatures);
Jon Ashburn754864f2015-07-23 18:49:07 -0600577}
578
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700579LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format,
580 VkFormatProperties *pFormatInfo) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600581 const VkLayerInstanceDispatchTable *disp;
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700582 VkPhysicalDevice unwrapped_pd = loader_unwrap_physical_device(physicalDevice);
Mark Young39389872017-01-19 21:10:49 -0700583 disp = loader_get_instance_layer_dispatch(physicalDevice);
Jon Ashburn014438f2016-03-01 19:51:07 -0700584 disp->GetPhysicalDeviceFormatProperties(unwrapped_pd, format, pFormatInfo);
Jon Ashburn754864f2015-07-23 18:49:07 -0600585}
586
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700587LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties(
588 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage,
589 VkImageCreateFlags flags, VkImageFormatProperties *pImageFormatProperties) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600590 const VkLayerInstanceDispatchTable *disp;
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700591 VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
Mark Young39389872017-01-19 21:10:49 -0700592 disp = loader_get_instance_layer_dispatch(physicalDevice);
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700593 return disp->GetPhysicalDeviceImageFormatProperties(unwrapped_phys_dev, format, type, tiling, usage, flags,
594 pImageFormatProperties);
Jon Ashburn754864f2015-07-23 18:49:07 -0600595}
596
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700597LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
598 VkPhysicalDeviceProperties *pProperties) {
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600599 const VkLayerInstanceDispatchTable *disp;
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700600 VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
Mark Young39389872017-01-19 21:10:49 -0700601 disp = loader_get_instance_layer_dispatch(physicalDevice);
Jon Ashburn014438f2016-03-01 19:51:07 -0700602 disp->GetPhysicalDeviceProperties(unwrapped_phys_dev, pProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600603}
604
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700605LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice,
606 uint32_t *pQueueFamilyPropertyCount,
607 VkQueueFamilyProperties *pQueueProperties) {
Tony Barbour59a47322015-06-24 16:06:58 -0600608 const VkLayerInstanceDispatchTable *disp;
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700609 VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
Mark Young39389872017-01-19 21:10:49 -0700610 disp = loader_get_instance_layer_dispatch(physicalDevice);
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700611 disp->GetPhysicalDeviceQueueFamilyProperties(unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600612}
613
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700614LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice,
615 VkPhysicalDeviceMemoryProperties *pMemoryProperties) {
Tony Barbour59a47322015-06-24 16:06:58 -0600616 const VkLayerInstanceDispatchTable *disp;
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700617 VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
Mark Young39389872017-01-19 21:10:49 -0700618 disp = loader_get_instance_layer_dispatch(physicalDevice);
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700619 disp->GetPhysicalDeviceMemoryProperties(unwrapped_phys_dev, pMemoryProperties);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600620}
621
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700622LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
623 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600624 VkResult res;
Mark Young0ad83132016-06-30 13:02:42 -0600625 struct loader_physical_device_tramp *phys_dev = NULL;
626 struct loader_device *dev = NULL;
627 struct loader_instance *inst = NULL;
Jon Ashburn1530c342016-02-26 13:14:27 -0700628
629 assert(pCreateInfo->queueCreateInfoCount >= 1);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600630
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600631 loader_platform_thread_lock_mutex(&loader_lock);
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600632
Jon Ashburn787eb252016-03-24 15:49:57 -0600633 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Piers Daniell295fe402016-03-29 11:51:11 -0600634 inst = (struct loader_instance *)phys_dev->this_instance;
Jon Ashburn1530c342016-02-26 13:14:27 -0700635
Mark Young0f183a82017-02-28 09:58:04 -0700636 // Get the physical device (ICD) extensions
Jon Ashburn014438f2016-03-01 19:51:07 -0700637 struct loader_extension_list icd_exts;
Mark Young0ad83132016-06-30 13:02:42 -0600638 icd_exts.list = NULL;
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700639 res = loader_init_generic_list(inst, (struct loader_generic_list *)&icd_exts, sizeof(VkExtensionProperties));
Mark Young3a587792016-08-19 15:25:08 -0600640 if (VK_SUCCESS != res) {
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700641 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkCreateDevice: Failed to create ICD extension list");
Mark Young0ad83132016-06-30 13:02:42 -0600642 goto out;
Jon Ashburn014438f2016-03-01 19:51:07 -0700643 }
Jon Ashburn1530c342016-02-26 13:14:27 -0700644
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700645 res = loader_add_device_extensions(inst, inst->disp->layer_inst_disp.EnumerateDeviceExtensionProperties, phys_dev->phys_dev,
646 "Unknown", &icd_exts);
Jon Ashburn014438f2016-03-01 19:51:07 -0700647 if (res != VK_SUCCESS) {
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700648 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkCreateDevice: Failed to add extensions to list");
Mark Young0ad83132016-06-30 13:02:42 -0600649 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700650 }
651
Mark Young0f183a82017-02-28 09:58:04 -0700652 // Make sure requested extensions to be enabled are supported
Mark Young283fe1c2017-05-04 12:16:35 -0600653 res = loader_validate_device_extensions(phys_dev, &inst->expanded_activated_layer_list, &icd_exts, pCreateInfo);
Jon Ashburn1530c342016-02-26 13:14:27 -0700654 if (res != VK_SUCCESS) {
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700655 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkCreateDevice: Failed to validate extensions in list");
Mark Young0ad83132016-06-30 13:02:42 -0600656 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700657 }
658
Mark Young0ad83132016-06-30 13:02:42 -0600659 dev = loader_create_logical_device(inst, pAllocator);
Jon Ashburn1530c342016-02-26 13:14:27 -0700660 if (dev == NULL) {
Mark Young0ad83132016-06-30 13:02:42 -0600661 res = VK_ERROR_OUT_OF_HOST_MEMORY;
662 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700663 }
664
Mark Young283fe1c2017-05-04 12:16:35 -0600665 // Copy the application enabled instance layer list into the device
666 if (NULL != inst->app_activated_layer_list.list) {
667 dev->app_activated_layer_list.capacity = inst->app_activated_layer_list.capacity;
668 dev->app_activated_layer_list.count = inst->app_activated_layer_list.count;
669 dev->app_activated_layer_list.list =
670 loader_device_heap_alloc(dev, inst->app_activated_layer_list.capacity, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
671 if (dev->app_activated_layer_list.list == NULL) {
672 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
673 "vkCreateDevice: Failed to allocate application activated layer list of size %d.",
674 inst->app_activated_layer_list.capacity);
675 res = VK_ERROR_OUT_OF_HOST_MEMORY;
676 goto out;
677 }
678 memcpy(dev->app_activated_layer_list.list, inst->app_activated_layer_list.list,
679 sizeof(*dev->app_activated_layer_list.list) * dev->app_activated_layer_list.count);
680 } else {
681 dev->app_activated_layer_list.capacity = 0;
682 dev->app_activated_layer_list.count = 0;
683 dev->app_activated_layer_list.list = NULL;
Jon Ashburn1530c342016-02-26 13:14:27 -0700684 }
Mark Young283fe1c2017-05-04 12:16:35 -0600685
686 // Copy the expanded enabled instance layer list into the device
687 if (NULL != inst->expanded_activated_layer_list.list) {
688 dev->expanded_activated_layer_list.capacity = inst->expanded_activated_layer_list.capacity;
689 dev->expanded_activated_layer_list.count = inst->expanded_activated_layer_list.count;
690 dev->expanded_activated_layer_list.list =
691 loader_device_heap_alloc(dev, inst->expanded_activated_layer_list.capacity, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
692 if (dev->expanded_activated_layer_list.list == NULL) {
693 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
694 "vkCreateDevice: Failed to allocate expanded activated layer list of size %d.",
695 inst->expanded_activated_layer_list.capacity);
696 res = VK_ERROR_OUT_OF_HOST_MEMORY;
697 goto out;
698 }
699 memcpy(dev->expanded_activated_layer_list.list, inst->expanded_activated_layer_list.list,
700 sizeof(*dev->expanded_activated_layer_list.list) * dev->expanded_activated_layer_list.count);
701 } else {
702 dev->expanded_activated_layer_list.capacity = 0;
703 dev->expanded_activated_layer_list.count = 0;
704 dev->expanded_activated_layer_list.list = NULL;
705 }
Jon Ashburn1530c342016-02-26 13:14:27 -0700706
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700707 res = loader_create_device_chain(phys_dev, pCreateInfo, pAllocator, inst, dev);
Jon Ashburn1530c342016-02-26 13:14:27 -0700708 if (res != VK_SUCCESS) {
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700709 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkCreateDevice: Failed to create device chain.");
Mark Young0ad83132016-06-30 13:02:42 -0600710 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700711 }
712
Mark Young65cb3662016-11-07 13:27:02 -0700713 *pDevice = dev->chain_device;
Jon Ashburn1530c342016-02-26 13:14:27 -0700714
Mark Younga7c51fd2016-09-16 10:18:42 -0600715 // Initialize any device extension dispatch entry's from the instance list
Jon Ashburn1530c342016-02-26 13:14:27 -0700716 loader_init_dispatch_dev_ext(inst, dev);
717
Mark Younga7c51fd2016-09-16 10:18:42 -0600718 // Initialize WSI device extensions as part of core dispatch since loader
719 // has dedicated trampoline code for these*/
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700720 loader_init_device_extension_dispatch_table(&dev->loader_dispatch, dev->loader_dispatch.core_dispatch.GetDeviceProcAddr,
721 *pDevice);
Mark Younga7c51fd2016-09-16 10:18:42 -0600722
Mark Young0ad83132016-06-30 13:02:42 -0600723out:
724
725 // Failure cleanup
726 if (VK_SUCCESS != res) {
727 if (NULL != dev) {
728 loader_destroy_logical_device(inst, dev, pAllocator);
729 }
730 }
731
732 if (NULL != icd_exts.list) {
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700733 loader_destroy_generic_list(inst, (struct loader_generic_list *)&icd_exts);
Mark Young0ad83132016-06-30 13:02:42 -0600734 }
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600735 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600736 return res;
737}
738
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700739LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600740 const VkLayerDispatchTable *disp;
Jon Ashburne39a4f82015-08-28 13:38:21 -0600741 struct loader_device *dev;
Andrzej Kotlowskib168b1a2016-02-03 09:41:53 +0100742
Jeremy Hayesd8726c22016-04-21 13:19:41 -0600743 if (device == VK_NULL_HANDLE) {
744 return;
745 }
746
Andrzej Kotlowskib168b1a2016-02-03 09:41:53 +0100747 loader_platform_thread_lock_mutex(&loader_lock);
748
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700749 struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, NULL);
Mark Young0153e0b2016-11-03 14:27:13 -0600750 const struct loader_instance *inst = icd_term->this_instance;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600751 disp = loader_get_dispatch(device);
752
Chia-I Wuf7458c52015-10-26 21:10:41 +0800753 disp->DestroyDevice(device, pAllocator);
Mark Young65cb3662016-11-07 13:27:02 -0700754 dev->chain_device = NULL;
Mark Young65cb3662016-11-07 13:27:02 -0700755 dev->icd_device = NULL;
Mark Young95ed4952016-11-14 15:03:34 -0700756 loader_remove_logical_device(inst, icd_term, dev, pAllocator);
Jon Ashburn781a7ae2015-11-19 15:43:26 -0700757
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600758 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600759}
760
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700761LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
762 const char *pLayerName, uint32_t *pPropertyCount,
763 VkExtensionProperties *pProperties) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700764 VkResult res = VK_SUCCESS;
Jon Ashburn787eb252016-03-24 15:49:57 -0600765 struct loader_physical_device_tramp *phys_dev;
766 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600767
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600768 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700769
Mark Young0f183a82017-02-28 09:58:04 -0700770 // If pLayerName == NULL, then querying ICD extensions, pass this call
771 // down the instance chain which will terminate in the ICD. This allows
772 // layers to filter the extensions coming back up the chain.
773 // If pLayerName != NULL then get layer extensions from manifest file.
Jon Ashburn23d36b12016-02-02 17:47:28 -0700774 if (pLayerName == NULL || strlen(pLayerName) == 0) {
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700775 const VkLayerInstanceDispatchTable *disp;
776
Mark Young39389872017-01-19 21:10:49 -0700777 disp = loader_get_instance_layer_dispatch(physicalDevice);
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700778 res = disp->EnumerateDeviceExtensionProperties(phys_dev->phys_dev, NULL, pPropertyCount, pProperties);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700779 } else {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700780 uint32_t count;
781 uint32_t copy_size;
Piers Daniell295fe402016-03-29 11:51:11 -0600782 const struct loader_instance *inst = phys_dev->this_instance;
Jon Ashburnb8726962016-04-08 15:03:35 -0600783 struct loader_device_extension_list *dev_ext_list = NULL;
784 struct loader_device_extension_list local_ext_list;
785 memset(&local_ext_list, 0, sizeof(local_ext_list));
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700786 if (vk_string_validate(MaxLoaderStringLength, pLayerName) == VK_STRING_ERROR_NONE) {
Mark Youngf2079b92017-05-02 10:49:46 -0600787 for (uint32_t i = 0; i < inst->instance_layer_list.count; i++) {
788 struct loader_layer_properties *props = &inst->instance_layer_list.list[i];
789 if (strcmp(props->info.layerName, pLayerName) == 0) {
790 dev_ext_list = &props->device_extension_list;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700791 }
792 }
Jon Ashburnb8726962016-04-08 15:03:35 -0600793
Jon Ashburndc5d9202016-02-29 13:00:51 -0700794 count = (dev_ext_list == NULL) ? 0 : dev_ext_list->count;
795 if (pProperties == NULL) {
796 *pPropertyCount = count;
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700797 loader_destroy_generic_list(inst, (struct loader_generic_list *)&local_ext_list);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700798 loader_platform_thread_unlock_mutex(&loader_lock);
799 return VK_SUCCESS;
800 }
801
802 copy_size = *pPropertyCount < count ? *pPropertyCount : count;
803 for (uint32_t i = 0; i < copy_size; i++) {
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700804 memcpy(&pProperties[i], &dev_ext_list->list[i].props, sizeof(VkExtensionProperties));
Jon Ashburndc5d9202016-02-29 13:00:51 -0700805 }
806 *pPropertyCount = copy_size;
807
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700808 loader_destroy_generic_list(inst, (struct loader_generic_list *)&local_ext_list);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700809 if (copy_size < count) {
810 loader_platform_thread_unlock_mutex(&loader_lock);
811 return VK_INCOMPLETE;
812 }
813 } else {
Mark Lobodzinski64318ba2017-01-26 13:34:13 -0700814 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
815 "vkEnumerateDeviceExtensionProperties: pLayerName "
816 "is too long or is badly formed");
Jon Ashburn014438f2016-03-01 19:51:07 -0700817 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700818 return VK_ERROR_EXTENSION_NOT_PRESENT;
819 }
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700820 }
821
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600822 loader_platform_thread_unlock_mutex(&loader_lock);
Tony Barbour59a47322015-06-24 16:06:58 -0600823 return res;
824}
825
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700826LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
827 uint32_t *pPropertyCount,
828 VkLayerProperties *pProperties) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700829 uint32_t copy_size;
Jon Ashburn787eb252016-03-24 15:49:57 -0600830 struct loader_physical_device_tramp *phys_dev;
Jon Ashburn491cd042016-05-16 14:01:18 -0600831 struct loader_layer_list *enabled_layers, layers_list;
Jon Ashburn491cd042016-05-16 14:01:18 -0600832 memset(&layers_list, 0, sizeof(layers_list));
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600833 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700834
Mark Young0f183a82017-02-28 09:58:04 -0700835 // Don't dispatch this call down the instance chain, want all device layers
836 // enumerated and instance chain may not contain all device layers
Jon Ashburn491cd042016-05-16 14:01:18 -0600837 // TODO re-evaluate the above statement we maybe able to start calling
838 // down the chain
Jon Ashburndc5d9202016-02-29 13:00:51 -0700839
Jon Ashburn787eb252016-03-24 15:49:57 -0600840 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Piers Daniell295fe402016-03-29 11:51:11 -0600841 const struct loader_instance *inst = phys_dev->this_instance;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700842
Mark Young283fe1c2017-05-04 12:16:35 -0600843 uint32_t count = inst->app_activated_layer_list.count;
844 if (count == 0 || pProperties == NULL) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700845 *pPropertyCount = count;
846 loader_platform_thread_unlock_mutex(&loader_lock);
847 return VK_SUCCESS;
848 }
Mark Young283fe1c2017-05-04 12:16:35 -0600849 enabled_layers = (struct loader_layer_list *)&inst->app_activated_layer_list;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700850
851 copy_size = (*pPropertyCount < count) ? *pPropertyCount : count;
852 for (uint32_t i = 0; i < copy_size; i++) {
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700853 memcpy(&pProperties[i], &(enabled_layers->list[i].info), sizeof(VkLayerProperties));
Jon Ashburndc5d9202016-02-29 13:00:51 -0700854 }
855 *pPropertyCount = copy_size;
856
857 if (copy_size < count) {
858 loader_platform_thread_unlock_mutex(&loader_lock);
859 return VK_INCOMPLETE;
860 }
861
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600862 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700863 return VK_SUCCESS;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600864}
865
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700866LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex,
867 VkQueue *pQueue) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600868 const VkLayerDispatchTable *disp;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600869
870 disp = loader_get_dispatch(device);
871
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600872 disp->GetDeviceQueue(device, queueNodeIndex, queueIndex, pQueue);
873 loader_set_dispatch(*pQueue, disp);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600874}
875
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700876LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits,
877 VkFence fence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600878 const VkLayerDispatchTable *disp;
879
880 disp = loader_get_dispatch(queue);
881
Chia-I Wu40cf0ae2015-10-26 17:20:32 +0800882 return disp->QueueSubmit(queue, submitCount, pSubmits, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600883}
884
Jon Ashburn23d36b12016-02-02 17:47:28 -0700885LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600886 const VkLayerDispatchTable *disp;
887
888 disp = loader_get_dispatch(queue);
889
890 return disp->QueueWaitIdle(queue);
891}
892
Jon Ashburn23d36b12016-02-02 17:47:28 -0700893LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600894 const VkLayerDispatchTable *disp;
895
896 disp = loader_get_dispatch(device);
897
898 return disp->DeviceWaitIdle(device);
899}
900
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700901LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
902 const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600903 const VkLayerDispatchTable *disp;
904
905 disp = loader_get_dispatch(device);
906
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800907 return disp->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600908}
909
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700910LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkFreeMemory(VkDevice device, VkDeviceMemory mem,
911 const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600912 const VkLayerDispatchTable *disp;
913
914 disp = loader_get_dispatch(device);
915
Chia-I Wuf7458c52015-10-26 21:10:41 +0800916 disp->FreeMemory(device, mem, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600917}
918
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700919LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset,
920 VkDeviceSize size, VkFlags flags, void **ppData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600921 const VkLayerDispatchTable *disp;
922
923 disp = loader_get_dispatch(device);
924
925 return disp->MapMemory(device, mem, offset, size, flags, ppData);
926}
927
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700928LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkUnmapMemory(VkDevice device, VkDeviceMemory mem) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600929 const VkLayerDispatchTable *disp;
930
931 disp = loader_get_dispatch(device);
932
Mark Lobodzinski2141f652015-09-07 13:59:43 -0600933 disp->UnmapMemory(device, mem);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600934}
935
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700936LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
937 const VkMappedMemoryRange *pMemoryRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600938 const VkLayerDispatchTable *disp;
939
940 disp = loader_get_dispatch(device);
941
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700942 return disp->FlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600943}
944
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700945LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
946 const VkMappedMemoryRange *pMemoryRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600947 const VkLayerDispatchTable *disp;
948
949 disp = loader_get_dispatch(device);
950
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700951 return disp->InvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600952}
953
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700954LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory,
955 VkDeviceSize *pCommittedMemoryInBytes) {
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -0600956 const VkLayerDispatchTable *disp;
957
958 disp = loader_get_dispatch(device);
959
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600960 disp->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes);
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -0600961}
962
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700963LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem,
964 VkDeviceSize offset) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600965 const VkLayerDispatchTable *disp;
966
Mark Lobodzinski942b1722015-05-11 17:21:15 -0500967 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600968
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600969 return disp->BindBufferMemory(device, buffer, mem, offset);
970}
971
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700972LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem,
973 VkDeviceSize offset) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600974 const VkLayerDispatchTable *disp;
975
976 disp = loader_get_dispatch(device);
977
978 return disp->BindImageMemory(device, image, mem, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600979}
980
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700981LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer,
982 VkMemoryRequirements *pMemoryRequirements) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600983 const VkLayerDispatchTable *disp;
984
985 disp = loader_get_dispatch(device);
986
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600987 disp->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -0600988}
989
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700990LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements(VkDevice device, VkImage image,
991 VkMemoryRequirements *pMemoryRequirements) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600992 const VkLayerDispatchTable *disp;
993
994 disp = loader_get_dispatch(device);
995
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600996 disp->GetImageMemoryRequirements(device, image, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -0600997}
998
Mark Lobodzinski729a8d32017-01-26 12:16:30 -0700999LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1000vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount,
1001 VkSparseImageMemoryRequirements *pSparseMemoryRequirements) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001002 const VkLayerDispatchTable *disp;
1003
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001004 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001005
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001006 disp->GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001007}
1008
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001009LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties(
1010 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage,
1011 VkImageTiling tiling, uint32_t *pPropertyCount, VkSparseImageFormatProperties *pProperties) {
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001012 const VkLayerInstanceDispatchTable *disp;
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001013 VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
Mark Young39389872017-01-19 21:10:49 -07001014 disp = loader_get_instance_layer_dispatch(physicalDevice);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001015
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001016 disp->GetPhysicalDeviceSparseImageFormatProperties(unwrapped_phys_dev, format, type, samples, usage, tiling, pPropertyCount,
1017 pProperties);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001018}
1019
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001020LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount,
1021 const VkBindSparseInfo *pBindInfo, VkFence fence) {
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001022 const VkLayerDispatchTable *disp;
1023
1024 disp = loader_get_dispatch(queue);
1025
Chia-I Wu1ff4c3d2015-10-26 16:55:27 +08001026 return disp->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001027}
1028
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001029LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo,
1030 const VkAllocationCallbacks *pAllocator, VkFence *pFence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001031 const VkLayerDispatchTable *disp;
1032
1033 disp = loader_get_dispatch(device);
1034
Chia-I Wuf7458c52015-10-26 21:10:41 +08001035 return disp->CreateFence(device, pCreateInfo, pAllocator, pFence);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001036}
1037
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001038LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001039 const VkLayerDispatchTable *disp;
1040
1041 disp = loader_get_dispatch(device);
1042
Chia-I Wuf7458c52015-10-26 21:10:41 +08001043 disp->DestroyFence(device, fence, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001044}
1045
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001046LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001047 const VkLayerDispatchTable *disp;
1048
1049 disp = loader_get_dispatch(device);
1050
1051 return disp->ResetFences(device, fenceCount, pFences);
1052}
1053
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001054LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceStatus(VkDevice device, VkFence fence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001055 const VkLayerDispatchTable *disp;
1056
1057 disp = loader_get_dispatch(device);
1058
1059 return disp->GetFenceStatus(device, fence);
1060}
1061
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001062LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences,
1063 VkBool32 waitAll, uint64_t timeout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001064 const VkLayerDispatchTable *disp;
1065
1066 disp = loader_get_dispatch(device);
1067
1068 return disp->WaitForFences(device, fenceCount, pFences, waitAll, timeout);
1069}
1070
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001071LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo,
1072 const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001073 const VkLayerDispatchTable *disp;
1074
1075 disp = loader_get_dispatch(device);
1076
Chia-I Wuf7458c52015-10-26 21:10:41 +08001077 return disp->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001078}
1079
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001080LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySemaphore(VkDevice device, VkSemaphore semaphore,
1081 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001082 const VkLayerDispatchTable *disp;
1083
1084 disp = loader_get_dispatch(device);
1085
Chia-I Wuf7458c52015-10-26 21:10:41 +08001086 disp->DestroySemaphore(device, semaphore, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001087}
1088
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001089LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo,
1090 const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001091 const VkLayerDispatchTable *disp;
1092
1093 disp = loader_get_dispatch(device);
1094
Chia-I Wuf7458c52015-10-26 21:10:41 +08001095 return disp->CreateEvent(device, pCreateInfo, pAllocator, pEvent);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001096}
1097
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001098LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001099 const VkLayerDispatchTable *disp;
1100
1101 disp = loader_get_dispatch(device);
1102
Chia-I Wuf7458c52015-10-26 21:10:41 +08001103 disp->DestroyEvent(device, event, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001104}
1105
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001106LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetEventStatus(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001107 const VkLayerDispatchTable *disp;
1108
1109 disp = loader_get_dispatch(device);
1110
1111 return disp->GetEventStatus(device, event);
1112}
1113
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001114LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001115 const VkLayerDispatchTable *disp;
1116
1117 disp = loader_get_dispatch(device);
1118
1119 return disp->SetEvent(device, event);
1120}
1121
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001122LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001123 const VkLayerDispatchTable *disp;
1124
1125 disp = loader_get_dispatch(device);
1126
1127 return disp->ResetEvent(device, event);
1128}
1129
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001130LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo,
1131 const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001132 const VkLayerDispatchTable *disp;
1133
1134 disp = loader_get_dispatch(device);
1135
Chia-I Wuf7458c52015-10-26 21:10:41 +08001136 return disp->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001137}
1138
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001139LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool,
1140 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001141 const VkLayerDispatchTable *disp;
1142
1143 disp = loader_get_dispatch(device);
1144
Chia-I Wuf7458c52015-10-26 21:10:41 +08001145 disp->DestroyQueryPool(device, queryPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001146}
1147
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001148LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery,
1149 uint32_t queryCount, size_t dataSize, void *pData,
1150 VkDeviceSize stride, VkQueryResultFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001151 const VkLayerDispatchTable *disp;
1152
1153 disp = loader_get_dispatch(device);
1154
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001155 return disp->GetQueryPoolResults(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001156}
1157
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001158LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo,
1159 const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001160 const VkLayerDispatchTable *disp;
1161
1162 disp = loader_get_dispatch(device);
1163
Chia-I Wuf7458c52015-10-26 21:10:41 +08001164 return disp->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001165}
1166
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001167LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer(VkDevice device, VkBuffer buffer,
1168 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001169 const VkLayerDispatchTable *disp;
1170
1171 disp = loader_get_dispatch(device);
1172
Chia-I Wuf7458c52015-10-26 21:10:41 +08001173 disp->DestroyBuffer(device, buffer, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001174}
1175
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001176LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo,
1177 const VkAllocationCallbacks *pAllocator, VkBufferView *pView) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001178 const VkLayerDispatchTable *disp;
1179
1180 disp = loader_get_dispatch(device);
1181
Chia-I Wuf7458c52015-10-26 21:10:41 +08001182 return disp->CreateBufferView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001183}
1184
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001185LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyBufferView(VkDevice device, VkBufferView bufferView,
1186 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001187 const VkLayerDispatchTable *disp;
1188
1189 disp = loader_get_dispatch(device);
1190
Chia-I Wuf7458c52015-10-26 21:10:41 +08001191 disp->DestroyBufferView(device, bufferView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001192}
1193
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001194LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
1195 const VkAllocationCallbacks *pAllocator, VkImage *pImage) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001196 const VkLayerDispatchTable *disp;
1197
1198 disp = loader_get_dispatch(device);
1199
Chia-I Wuf7458c52015-10-26 21:10:41 +08001200 return disp->CreateImage(device, pCreateInfo, pAllocator, pImage);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001201}
1202
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001203LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001204 const VkLayerDispatchTable *disp;
1205
1206 disp = loader_get_dispatch(device);
1207
Chia-I Wuf7458c52015-10-26 21:10:41 +08001208 disp->DestroyImage(device, image, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001209}
1210
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001211LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout(VkDevice device, VkImage image,
1212 const VkImageSubresource *pSubresource,
1213 VkSubresourceLayout *pLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001214 const VkLayerDispatchTable *disp;
1215
1216 disp = loader_get_dispatch(device);
1217
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001218 disp->GetImageSubresourceLayout(device, image, pSubresource, pLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001219}
1220
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001221LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo,
1222 const VkAllocationCallbacks *pAllocator, VkImageView *pView) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001223 const VkLayerDispatchTable *disp;
1224
1225 disp = loader_get_dispatch(device);
1226
Chia-I Wuf7458c52015-10-26 21:10:41 +08001227 return disp->CreateImageView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001228}
1229
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001230LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyImageView(VkDevice device, VkImageView imageView,
1231 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001232 const VkLayerDispatchTable *disp;
1233
1234 disp = loader_get_dispatch(device);
1235
Chia-I Wuf7458c52015-10-26 21:10:41 +08001236 disp->DestroyImageView(device, imageView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001237}
1238
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001239LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo *pCreateInfo,
1240 const VkAllocationCallbacks *pAllocator,
1241 VkShaderModule *pShader) {
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -06001242 const VkLayerDispatchTable *disp;
1243
1244 disp = loader_get_dispatch(device);
1245
Chia-I Wuf7458c52015-10-26 21:10:41 +08001246 return disp->CreateShaderModule(device, pCreateInfo, pAllocator, pShader);
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -06001247}
1248
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001249LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule,
1250 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001251 const VkLayerDispatchTable *disp;
1252
1253 disp = loader_get_dispatch(device);
1254
Chia-I Wuf7458c52015-10-26 21:10:41 +08001255 disp->DestroyShaderModule(device, shaderModule, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001256}
1257
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001258LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo *pCreateInfo,
1259 const VkAllocationCallbacks *pAllocator,
1260 VkPipelineCache *pPipelineCache) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001261 const VkLayerDispatchTable *disp;
1262
1263 disp = loader_get_dispatch(device);
1264
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001265 return disp->CreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001266}
1267
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001268LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache,
1269 const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001270 const VkLayerDispatchTable *disp;
1271
1272 disp = loader_get_dispatch(device);
1273
Chia-I Wuf7458c52015-10-26 21:10:41 +08001274 disp->DestroyPipelineCache(device, pipelineCache, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001275}
1276
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001277LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache,
1278 size_t *pDataSize, void *pData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001279 const VkLayerDispatchTable *disp;
1280
1281 disp = loader_get_dispatch(device);
1282
Chia-I Wub16facd2015-10-26 19:17:06 +08001283 return disp->GetPipelineCacheData(device, pipelineCache, pDataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001284}
1285
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001286LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache,
1287 uint32_t srcCacheCount, const VkPipelineCache *pSrcCaches) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001288 const VkLayerDispatchTable *disp;
1289
1290 disp = loader_get_dispatch(device);
1291
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001292 return disp->MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001293}
1294
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001295LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache,
1296 uint32_t createInfoCount,
1297 const VkGraphicsPipelineCreateInfo *pCreateInfos,
1298 const VkAllocationCallbacks *pAllocator,
1299 VkPipeline *pPipelines) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001300 const VkLayerDispatchTable *disp;
1301
1302 disp = loader_get_dispatch(device);
1303
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001304 return disp->CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
Jon Ashburnc669cc62015-07-09 15:02:25 -06001305}
1306
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001307LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache,
1308 uint32_t createInfoCount,
1309 const VkComputePipelineCreateInfo *pCreateInfos,
1310 const VkAllocationCallbacks *pAllocator,
1311 VkPipeline *pPipelines) {
Jon Ashburnc669cc62015-07-09 15:02:25 -06001312 const VkLayerDispatchTable *disp;
1313
1314 disp = loader_get_dispatch(device);
1315
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001316 return disp->CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001317}
1318
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001319LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyPipeline(VkDevice device, VkPipeline pipeline,
1320 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001321 const VkLayerDispatchTable *disp;
1322
1323 disp = loader_get_dispatch(device);
1324
Chia-I Wuf7458c52015-10-26 21:10:41 +08001325 disp->DestroyPipeline(device, pipeline, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001326}
1327
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001328LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo,
1329 const VkAllocationCallbacks *pAllocator,
1330 VkPipelineLayout *pPipelineLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001331 const VkLayerDispatchTable *disp;
1332
1333 disp = loader_get_dispatch(device);
1334
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001335 return disp->CreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001336}
1337
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001338LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout,
1339 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001340 const VkLayerDispatchTable *disp;
1341
1342 disp = loader_get_dispatch(device);
1343
Chia-I Wuf7458c52015-10-26 21:10:41 +08001344 disp->DestroyPipelineLayout(device, pipelineLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001345}
1346
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001347LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo,
1348 const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001349 const VkLayerDispatchTable *disp;
1350
1351 disp = loader_get_dispatch(device);
1352
Chia-I Wuf7458c52015-10-26 21:10:41 +08001353 return disp->CreateSampler(device, pCreateInfo, pAllocator, pSampler);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001354}
1355
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001356LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySampler(VkDevice device, VkSampler sampler,
1357 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001358 const VkLayerDispatchTable *disp;
1359
1360 disp = loader_get_dispatch(device);
1361
Chia-I Wuf7458c52015-10-26 21:10:41 +08001362 disp->DestroySampler(device, sampler, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001363}
1364
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001365LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorSetLayout(VkDevice device,
1366 const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
1367 const VkAllocationCallbacks *pAllocator,
1368 VkDescriptorSetLayout *pSetLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001369 const VkLayerDispatchTable *disp;
1370
1371 disp = loader_get_dispatch(device);
1372
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001373 return disp->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001374}
1375
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001376LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout,
1377 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001378 const VkLayerDispatchTable *disp;
1379
1380 disp = loader_get_dispatch(device);
1381
Chia-I Wuf7458c52015-10-26 21:10:41 +08001382 disp->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001383}
1384
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001385LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo,
1386 const VkAllocationCallbacks *pAllocator,
1387 VkDescriptorPool *pDescriptorPool) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001388 const VkLayerDispatchTable *disp;
1389
1390 disp = loader_get_dispatch(device);
1391
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001392 return disp->CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001393}
1394
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001395LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
1396 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001397 const VkLayerDispatchTable *disp;
1398
1399 disp = loader_get_dispatch(device);
1400
Chia-I Wuf7458c52015-10-26 21:10:41 +08001401 disp->DestroyDescriptorPool(device, descriptorPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001402}
1403
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001404LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
1405 VkDescriptorPoolResetFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001406 const VkLayerDispatchTable *disp;
1407
1408 disp = loader_get_dispatch(device);
1409
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001410 return disp->ResetDescriptorPool(device, descriptorPool, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001411}
1412
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001413LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAllocateDescriptorSets(VkDevice device,
1414 const VkDescriptorSetAllocateInfo *pAllocateInfo,
1415 VkDescriptorSet *pDescriptorSets) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001416 const VkLayerDispatchTable *disp;
1417
1418 disp = loader_get_dispatch(device);
1419
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001420 return disp->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001421}
1422
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001423LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool,
1424 uint32_t descriptorSetCount,
1425 const VkDescriptorSet *pDescriptorSets) {
Tony Barbour34ec6922015-07-10 10:50:45 -06001426 const VkLayerDispatchTable *disp;
1427
1428 disp = loader_get_dispatch(device);
1429
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001430 return disp->FreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets);
Tony Barbour34ec6922015-07-10 10:50:45 -06001431}
1432
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001433LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount,
1434 const VkWriteDescriptorSet *pDescriptorWrites,
1435 uint32_t descriptorCopyCount,
1436 const VkCopyDescriptorSet *pDescriptorCopies) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001437 const VkLayerDispatchTable *disp;
1438
1439 disp = loader_get_dispatch(device);
1440
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001441 disp->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001442}
1443
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001444LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo,
1445 const VkAllocationCallbacks *pAllocator,
1446 VkFramebuffer *pFramebuffer) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001447 const VkLayerDispatchTable *disp;
1448
1449 disp = loader_get_dispatch(device);
1450
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001451 return disp->CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001452}
1453
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001454LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer,
1455 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001456 const VkLayerDispatchTable *disp;
1457
1458 disp = loader_get_dispatch(device);
1459
Chia-I Wuf7458c52015-10-26 21:10:41 +08001460 disp->DestroyFramebuffer(device, framebuffer, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -06001461}
1462
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001463LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
1464 const VkAllocationCallbacks *pAllocator,
1465 VkRenderPass *pRenderPass) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001466 const VkLayerDispatchTable *disp;
1467
1468 disp = loader_get_dispatch(device);
1469
Chia-I Wuf7458c52015-10-26 21:10:41 +08001470 return disp->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
Jon Ashburn754864f2015-07-23 18:49:07 -06001471}
1472
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001473LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass,
1474 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001475 const VkLayerDispatchTable *disp;
1476
1477 disp = loader_get_dispatch(device);
1478
Chia-I Wuf7458c52015-10-26 21:10:41 +08001479 disp->DestroyRenderPass(device, renderPass, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -06001480}
1481
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001482LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass,
1483 VkExtent2D *pGranularity) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001484 const VkLayerDispatchTable *disp;
1485
1486 disp = loader_get_dispatch(device);
1487
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001488 disp->GetRenderAreaGranularity(device, renderPass, pGranularity);
Jon Ashburn754864f2015-07-23 18:49:07 -06001489}
1490
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001491LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo,
1492 const VkAllocationCallbacks *pAllocator,
1493 VkCommandPool *pCommandPool) {
Cody Northrope62183e2015-07-09 18:08:05 -06001494 const VkLayerDispatchTable *disp;
1495
1496 disp = loader_get_dispatch(device);
1497
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001498 return disp->CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool);
Cody Northrope62183e2015-07-09 18:08:05 -06001499}
1500
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001501LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool,
1502 const VkAllocationCallbacks *pAllocator) {
Cody Northrope62183e2015-07-09 18:08:05 -06001503 const VkLayerDispatchTable *disp;
1504
1505 disp = loader_get_dispatch(device);
1506
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001507 disp->DestroyCommandPool(device, commandPool, pAllocator);
Cody Northrope62183e2015-07-09 18:08:05 -06001508}
1509
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001510LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool(VkDevice device, VkCommandPool commandPool,
1511 VkCommandPoolResetFlags flags) {
Cody Northrope62183e2015-07-09 18:08:05 -06001512 const VkLayerDispatchTable *disp;
1513
1514 disp = loader_get_dispatch(device);
1515
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001516 return disp->ResetCommandPool(device, commandPool, flags);
Cody Northrope62183e2015-07-09 18:08:05 -06001517}
1518
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001519LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAllocateCommandBuffers(VkDevice device,
1520 const VkCommandBufferAllocateInfo *pAllocateInfo,
1521 VkCommandBuffer *pCommandBuffers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001522 const VkLayerDispatchTable *disp;
1523 VkResult res;
1524
1525 disp = loader_get_dispatch(device);
1526
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001527 res = disp->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001528 if (res == VK_SUCCESS) {
Jon Ashburn23d36b12016-02-02 17:47:28 -07001529 for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; i++) {
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001530 if (pCommandBuffers[i]) {
1531 loader_init_dispatch(pCommandBuffers[i], disp);
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001532 }
1533 }
Jon Ashburnd55a3942015-05-06 09:02:10 -06001534 }
1535
1536 return res;
1537}
1538
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001539LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool,
1540 uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001541 const VkLayerDispatchTable *disp;
1542
1543 disp = loader_get_dispatch(device);
1544
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001545 disp->FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001546}
1547
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001548LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer(VkCommandBuffer commandBuffer,
1549 const VkCommandBufferBeginInfo *pBeginInfo) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001550 const VkLayerDispatchTable *disp;
1551
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001552 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001553
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001554 return disp->BeginCommandBuffer(commandBuffer, pBeginInfo);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001555}
1556
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001557LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer(VkCommandBuffer commandBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001558 const VkLayerDispatchTable *disp;
1559
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001560 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001561
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001562 return disp->EndCommandBuffer(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001563}
1564
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001565LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001566 const VkLayerDispatchTable *disp;
1567
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001568 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001569
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001570 return disp->ResetCommandBuffer(commandBuffer, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001571}
1572
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001573LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
1574 VkPipeline pipeline) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001575 const VkLayerDispatchTable *disp;
1576
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001577 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001578
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001579 disp->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001580}
1581
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001582LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport,
1583 uint32_t viewportCount, const VkViewport *pViewports) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001584 const VkLayerDispatchTable *disp;
1585
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001586 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001587
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001588 disp->CmdSetViewport(commandBuffer, firstViewport, viewportCount, pViewports);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001589}
1590
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001591LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor,
1592 uint32_t scissorCount, const VkRect2D *pScissors) {
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001593 const VkLayerDispatchTable *disp;
1594
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001595 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001596
Jon Ashburn19d3bf12015-12-30 14:06:55 -07001597 disp->CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001598}
1599
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001600LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001601 const VkLayerDispatchTable *disp;
1602
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001603 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001604
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001605 disp->CmdSetLineWidth(commandBuffer, lineWidth);
Cody Northrop12365112015-08-17 11:10:49 -06001606}
1607
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001608LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor,
1609 float depthBiasClamp, float depthBiasSlopeFactor) {
Cody Northrop12365112015-08-17 11:10:49 -06001610 const VkLayerDispatchTable *disp;
1611
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001612 disp = loader_get_dispatch(commandBuffer);
Cody Northrop12365112015-08-17 11:10:49 -06001613
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001614 disp->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001615}
1616
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001617LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001618 const VkLayerDispatchTable *disp;
1619
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001620 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001621
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001622 disp->CmdSetBlendConstants(commandBuffer, blendConstants);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001623}
1624
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001625LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds,
1626 float maxDepthBounds) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001627 const VkLayerDispatchTable *disp;
1628
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001629 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001630
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001631 disp->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
Cody Northrop82485a82015-08-18 15:21:16 -06001632}
1633
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001634LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask,
1635 uint32_t compareMask) {
Cody Northrop82485a82015-08-18 15:21:16 -06001636 const VkLayerDispatchTable *disp;
1637
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001638 disp = loader_get_dispatch(commandBuffer);
Cody Northrop82485a82015-08-18 15:21:16 -06001639
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001640 disp->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001641}
1642
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001643LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask,
1644 uint32_t writeMask) {
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001645 const VkLayerDispatchTable *disp;
1646
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001647 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001648
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001649 disp->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001650}
1651
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001652LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask,
1653 uint32_t reference) {
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001654 const VkLayerDispatchTable *disp;
1655
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001656 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001657
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001658 disp->CmdSetStencilReference(commandBuffer, faceMask, reference);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001659}
1660
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001661LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer,
1662 VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout,
1663 uint32_t firstSet, uint32_t descriptorSetCount,
1664 const VkDescriptorSet *pDescriptorSets,
1665 uint32_t dynamicOffsetCount, const uint32_t *pDynamicOffsets) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001666 const VkLayerDispatchTable *disp;
1667
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001668 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001669
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001670 disp->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets,
Jon Ashburn23d36b12016-02-02 17:47:28 -07001671 dynamicOffsetCount, pDynamicOffsets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001672}
1673
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001674LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1675 VkIndexType indexType) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001676 const VkLayerDispatchTable *disp;
1677
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001678 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001679
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001680 disp->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001681}
1682
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001683LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding,
1684 uint32_t bindingCount, const VkBuffer *pBuffers,
1685 const VkDeviceSize *pOffsets) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001686 const VkLayerDispatchTable *disp;
1687
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001688 disp = loader_get_dispatch(commandBuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001689
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001690 disp->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets);
Jon Ashburn754864f2015-07-23 18:49:07 -06001691}
1692
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001693LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount,
1694 uint32_t firstVertex, uint32_t firstInstance) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001695 const VkLayerDispatchTable *disp;
1696
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001697 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001698
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001699 disp->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001700}
1701
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001702LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount,
1703 uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset,
1704 uint32_t firstInstance) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001705 const VkLayerDispatchTable *disp;
1706
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001707 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001708
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001709 disp->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001710}
1711
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001712LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1713 uint32_t drawCount, uint32_t stride) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001714 const VkLayerDispatchTable *disp;
1715
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001716 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001717
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001718 disp->CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001719}
1720
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001721LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1722 VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001723 const VkLayerDispatchTable *disp;
1724
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001725 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001726
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001727 disp->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount, stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001728}
1729
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001730LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001731 const VkLayerDispatchTable *disp;
1732
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001733 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001734
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001735 disp->CmdDispatch(commandBuffer, x, y, z);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001736}
1737
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001738LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1739 VkDeviceSize offset) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001740 const VkLayerDispatchTable *disp;
1741
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001742 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001743
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001744 disp->CmdDispatchIndirect(commandBuffer, buffer, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001745}
1746
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001747LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer,
1748 uint32_t regionCount, const VkBufferCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001749 const VkLayerDispatchTable *disp;
1750
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001751 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001752
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001753 disp->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001754}
1755
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001756LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage,
1757 VkImageLayout srcImageLayout, VkImage dstImage,
1758 VkImageLayout dstImageLayout, uint32_t regionCount,
1759 const VkImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001760 const VkLayerDispatchTable *disp;
1761
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001762 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001763
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001764 disp->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001765}
1766
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001767LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage,
1768 VkImageLayout srcImageLayout, VkImage dstImage,
1769 VkImageLayout dstImageLayout, uint32_t regionCount,
1770 const VkImageBlit *pRegions, VkFilter filter) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001771 const VkLayerDispatchTable *disp;
1772
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001773 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001774
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001775 disp->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001776}
1777
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001778LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage,
1779 VkImageLayout dstImageLayout, uint32_t regionCount,
1780 const VkBufferImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001781 const VkLayerDispatchTable *disp;
1782
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001783 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001784
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001785 disp->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001786}
1787
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001788LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage,
1789 VkImageLayout srcImageLayout, VkBuffer dstBuffer,
1790 uint32_t regionCount, const VkBufferImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001791 const VkLayerDispatchTable *disp;
1792
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001793 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001794
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001795 disp->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001796}
1797
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001798LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
1799 VkDeviceSize dstOffset, VkDeviceSize dataSize, const void *pData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001800 const VkLayerDispatchTable *disp;
1801
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001802 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001803
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001804 disp->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001805}
1806
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001807LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset,
1808 VkDeviceSize size, uint32_t data) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001809 const VkLayerDispatchTable *disp;
1810
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001811 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001812
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001813 disp->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001814}
1815
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001816LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image,
1817 VkImageLayout imageLayout, const VkClearColorValue *pColor,
1818 uint32_t rangeCount, const VkImageSubresourceRange *pRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001819 const VkLayerDispatchTable *disp;
1820
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001821 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001822
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001823 disp->CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001824}
1825
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001826LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image,
1827 VkImageLayout imageLayout,
1828 const VkClearDepthStencilValue *pDepthStencil,
1829 uint32_t rangeCount, const VkImageSubresourceRange *pRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001830 const VkLayerDispatchTable *disp;
1831
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001832 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001833
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001834 disp->CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges);
Chris Forbesd9be82b2015-06-22 17:21:59 +12001835}
1836
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001837LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
1838 const VkClearAttachment *pAttachments, uint32_t rectCount,
1839 const VkClearRect *pRects) {
Chris Forbesd9be82b2015-06-22 17:21:59 +12001840 const VkLayerDispatchTable *disp;
1841
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001842 disp = loader_get_dispatch(commandBuffer);
Chris Forbesd9be82b2015-06-22 17:21:59 +12001843
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001844 disp->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001845}
1846
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001847LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage,
1848 VkImageLayout srcImageLayout, VkImage dstImage,
1849 VkImageLayout dstImageLayout, uint32_t regionCount,
1850 const VkImageResolve *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001851 const VkLayerDispatchTable *disp;
1852
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001853 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001854
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001855 disp->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001856}
1857
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001858LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event,
1859 VkPipelineStageFlags stageMask) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001860 const VkLayerDispatchTable *disp;
1861
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001862 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001863
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001864 disp->CmdSetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001865}
1866
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001867LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event,
1868 VkPipelineStageFlags stageMask) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001869 const VkLayerDispatchTable *disp;
1870
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001871 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001872
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001873 disp->CmdResetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001874}
1875
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001876LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent *pEvents,
1877 VkPipelineStageFlags sourceStageMask, VkPipelineStageFlags dstStageMask,
1878 uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers,
1879 uint32_t bufferMemoryBarrierCount,
1880 const VkBufferMemoryBarrier *pBufferMemoryBarriers,
1881 uint32_t imageMemoryBarrierCount,
1882 const VkImageMemoryBarrier *pImageMemoryBarriers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001883 const VkLayerDispatchTable *disp;
1884
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001885 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001886
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001887 disp->CmdWaitEvents(commandBuffer, eventCount, pEvents, sourceStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers,
1888 bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001889}
1890
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001891LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask,
1892 VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags,
1893 uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers,
1894 uint32_t bufferMemoryBarrierCount,
1895 const VkBufferMemoryBarrier *pBufferMemoryBarriers,
1896 uint32_t imageMemoryBarrierCount,
1897 const VkImageMemoryBarrier *pImageMemoryBarriers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001898 const VkLayerDispatchTable *disp;
1899
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001900 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001901
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001902 disp->CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers,
1903 bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001904}
1905
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001906LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot,
1907 VkFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001908 const VkLayerDispatchTable *disp;
1909
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001910 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001911
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001912 disp->CmdBeginQuery(commandBuffer, queryPool, slot, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001913}
1914
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001915LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001916 const VkLayerDispatchTable *disp;
1917
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001918 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001919
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001920 disp->CmdEndQuery(commandBuffer, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001921}
1922
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001923LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
1924 uint32_t firstQuery, uint32_t queryCount) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001925 const VkLayerDispatchTable *disp;
1926
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001927 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001928
Jon Ashburn19d3bf12015-12-30 14:06:55 -07001929 disp->CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001930}
1931
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001932LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage,
1933 VkQueryPool queryPool, uint32_t slot) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001934 const VkLayerDispatchTable *disp;
1935
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001936 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001937
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001938 disp->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001939}
1940
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001941LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
1942 uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer,
1943 VkDeviceSize dstOffset, VkDeviceSize stride, VkFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001944 const VkLayerDispatchTable *disp;
1945
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001946 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001947
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001948 disp->CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001949}
1950
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001951LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout,
1952 VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size,
1953 const void *pValues) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001954 const VkLayerDispatchTable *disp;
1955
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001956 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001957
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001958 disp->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001959}
1960
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001961LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass(VkCommandBuffer commandBuffer,
1962 const VkRenderPassBeginInfo *pRenderPassBegin,
1963 VkSubpassContents contents) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001964 const VkLayerDispatchTable *disp;
1965
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001966 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001967
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001968 disp->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
Chia-I Wu08accc62015-07-07 11:50:03 +08001969}
1970
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001971LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) {
Chia-I Wu08accc62015-07-07 11:50:03 +08001972 const VkLayerDispatchTable *disp;
1973
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001974 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu08accc62015-07-07 11:50:03 +08001975
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001976 disp->CmdNextSubpass(commandBuffer, contents);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001977}
1978
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001979LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass(VkCommandBuffer commandBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001980 const VkLayerDispatchTable *disp;
1981
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001982 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001983
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001984 disp->CmdEndRenderPass(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08001985}
1986
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001987LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBuffersCount,
1988 const VkCommandBuffer *pCommandBuffers) {
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08001989 const VkLayerDispatchTable *disp;
1990
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001991 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08001992
Mark Lobodzinski729a8d32017-01-26 12:16:30 -07001993 disp->CmdExecuteCommands(commandBuffer, commandBuffersCount, pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001994}
Lenny Komow82e15e02017-10-02 15:08:53 -06001995
1996// ---- Vulkan core 1.1 trampolines
1997
1998// TODO: The following functions need to be added tp GPA:
1999// - vkEnumeratePhysicalDeviceGroups
2000// - vkGetPhysicalDeviceFeatures2
2001// - vkGetPhysicalDeviceProperties2
2002// - vkGetPhysicalDeviceFormatProperties2
2003// - vkGetPhysicalDeviceImageFormatProperties2
2004// - vkGetPhysicalDeviceQueueFamilyProperties2
2005// - vkGetPhysicalDeviceMemoryProperties2
2006// - vkGetPhysicalDeviceSparseImageFormatProperties2
2007// - vkGetPhysicalDeviceExternalBufferProperties
2008// - vkGetPhysicalDeviceExternalSemaphoreProperties
2009// - vkGetPhysicalDeviceExternalFenceProperties
2010
2011VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroups(
2012 VkInstance instance, uint32_t *pPhysicalDeviceGroupCount,
2013 VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties) {
2014 VkResult res = VK_SUCCESS;
2015 uint32_t count;
2016 uint32_t i;
2017 struct loader_instance *inst = NULL;
2018
2019 loader_platform_thread_lock_mutex(&loader_lock);
2020
2021 inst = loader_get_instance(instance);
2022 if (NULL == inst) {
2023 res = VK_ERROR_INITIALIZATION_FAILED;
2024 goto out;
2025 }
2026
2027 if (NULL == pPhysicalDeviceGroupCount) {
2028 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
2029 "vkEnumeratePhysicalDeviceGroupsKHR: Received NULL pointer for physical "
2030 "device group count return value.");
2031 res = VK_ERROR_INITIALIZATION_FAILED;
2032 goto out;
2033 }
2034
2035 VkResult setup_res = setupLoaderTrampPhysDevGroups(instance);
2036 if (VK_SUCCESS != setup_res) {
2037 res = setup_res;
2038 goto out;
2039 }
2040
2041 count = inst->phys_dev_group_count_tramp;
2042
2043 // Wrap the PhysDev object for loader usage, return wrapped objects
2044 if (NULL != pPhysicalDeviceGroupProperties) {
2045 if (inst->phys_dev_group_count_tramp > *pPhysicalDeviceGroupCount) {
2046 loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0,
2047 "vkEnumeratePhysicalDeviceGroupsKHR: Trimming device group count down"
2048 " by application request from %d to %d physical device groups",
2049 inst->phys_dev_group_count_tramp, *pPhysicalDeviceGroupCount);
2050 count = *pPhysicalDeviceGroupCount;
2051 res = VK_INCOMPLETE;
2052 }
2053 for (i = 0; i < count; i++) {
2054 memcpy(&pPhysicalDeviceGroupProperties[i], inst->phys_dev_groups_tramp[i],
2055 sizeof(VkPhysicalDeviceGroupPropertiesKHR));
2056 }
2057 }
2058
2059 *pPhysicalDeviceGroupCount = count;
2060
2061out:
2062
2063 loader_platform_thread_unlock_mutex(&loader_lock);
2064 return res;
2065}
2066
2067VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2 *pFeatures) {
2068 const VkLayerInstanceDispatchTable *disp;
2069 VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
2070 disp = loader_get_instance_layer_dispatch(physicalDevice);
2071 disp->GetPhysicalDeviceFeatures2(unwrapped_phys_dev, pFeatures);
2072}
2073
2074VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
2075 VkPhysicalDeviceProperties2 *pProperties) {
2076 const VkLayerInstanceDispatchTable *disp;
2077 VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
2078 disp = loader_get_instance_layer_dispatch(physicalDevice);
2079 disp->GetPhysicalDeviceProperties2(unwrapped_phys_dev, pProperties);
2080}
2081
2082VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice, VkFormat format,
2083 VkFormatProperties2 *pFormatProperties) {
2084 const VkLayerInstanceDispatchTable *disp;
2085 VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
2086 disp = loader_get_instance_layer_dispatch(physicalDevice);
2087 disp->GetPhysicalDeviceFormatProperties2(unwrapped_phys_dev, format, pFormatProperties);
2088}
2089
2090VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties2(
2091 VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
2092 VkImageFormatProperties2 *pImageFormatProperties) {
2093 const VkLayerInstanceDispatchTable *disp;
2094 VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
2095 disp = loader_get_instance_layer_dispatch(physicalDevice);
2096 return disp->GetPhysicalDeviceImageFormatProperties2(unwrapped_phys_dev, pImageFormatInfo, pImageFormatProperties);
2097}
2098
2099VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice,
2100 uint32_t *pQueueFamilyPropertyCount,
2101 VkQueueFamilyProperties2 *pQueueFamilyProperties) {
2102 const VkLayerInstanceDispatchTable *disp;
2103 VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
2104 disp = loader_get_instance_layer_dispatch(physicalDevice);
2105 disp->GetPhysicalDeviceQueueFamilyProperties2(unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueFamilyProperties);
2106}
2107
2108VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice,
2109 VkPhysicalDeviceMemoryProperties2 *pMemoryProperties) {
2110 const VkLayerInstanceDispatchTable *disp;
2111 VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
2112 disp = loader_get_instance_layer_dispatch(physicalDevice);
2113 disp->GetPhysicalDeviceMemoryProperties2(unwrapped_phys_dev, pMemoryProperties);
2114}
2115
2116VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2(
2117 VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *pFormatInfo, uint32_t *pPropertyCount,
2118 VkSparseImageFormatProperties2 *pProperties) {
2119 const VkLayerInstanceDispatchTable *disp;
2120 VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
2121 disp = loader_get_instance_layer_dispatch(physicalDevice);
2122 disp->GetPhysicalDeviceSparseImageFormatProperties2(unwrapped_phys_dev, pFormatInfo, pPropertyCount, pProperties);
2123}
2124
2125VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferProperties(
2126 VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo,
2127 VkExternalBufferProperties *pExternalBufferProperties) {
2128 const VkLayerInstanceDispatchTable *disp;
2129 VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
2130 disp = loader_get_instance_layer_dispatch(physicalDevice);
2131 disp->GetPhysicalDeviceExternalBufferProperties(unwrapped_phys_dev, pExternalBufferInfo, pExternalBufferProperties);
2132}
2133
2134VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphoreProperties(
2135 VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfoKHR *pExternalSemaphoreInfo,
2136 VkExternalSemaphoreProperties *pExternalSemaphoreProperties) {
2137 const VkLayerInstanceDispatchTable *disp;
2138 VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
2139 disp = loader_get_instance_layer_dispatch(physicalDevice);
2140 disp->GetPhysicalDeviceExternalSemaphoreProperties(unwrapped_phys_dev, pExternalSemaphoreInfo, pExternalSemaphoreProperties);
2141}
2142
2143VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFenceProperties(
2144 VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo,
2145 VkExternalFenceProperties *pExternalFenceProperties) {
2146 const VkLayerInstanceDispatchTable *disp;
2147 VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
2148 disp = loader_get_instance_layer_dispatch(physicalDevice);
2149 disp->GetPhysicalDeviceExternalFenceProperties(unwrapped_phys_dev, pExternalFenceInfo, pExternalFenceProperties);
2150}