blob: 7b2293f653c04d2c7819775d01611366dfc30c02 [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 Ashburn23d36b12016-02-02 17:47:28 -07008 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and/or associated documentation files (the "Materials"), to
10 * deal in the Materials without restriction, including without limitation the
11 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 * sell copies of the Materials, and to permit persons to whom the Materials are
13 * furnished to do so, subject to the following conditions:
Jon Ashburnd55a3942015-05-06 09:02:10 -060014 *
Jon Ashburn23d36b12016-02-02 17:47:28 -070015 * The above copyright notice(s) and this permission notice shall be included in
16 * all copies or substantial portions of the Materials.
Jon Ashburnd55a3942015-05-06 09:02:10 -060017 *
Jon Ashburn23d36b12016-02-02 17:47:28 -070018 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Jon Ashburnd55a3942015-05-06 09:02:10 -060019 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Jon Ashburn23d36b12016-02-02 17:47:28 -070020 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Courtney Goeltzenleuchter05559522015-10-30 11:14:30 -060021 *
Jon Ashburn23d36b12016-02-02 17:47:28 -070022 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
23 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
25 * USE OR OTHER DEALINGS IN THE MATERIALS.
26 *
27 * Author: Courtney Goeltzenleuchter <courtney@lunarg.com>
Courtney Goeltzenleuchter05559522015-10-30 11:14:30 -060028 * Author: Jon Ashburn <jon@lunarg.com>
29 * Author: Tony Barbour <tony@LunarG.com>
Jon Ashburn23d36b12016-02-02 17:47:28 -070030 * Author: Chia-I Wu <olv@lunarg.com>
Jon Ashburnd55a3942015-05-06 09:02:10 -060031 */
Courtney Goeltzenleuchter7f5aafc2015-07-05 11:28:29 -060032#define _GNU_SOURCE
Jon Ashburn27cd5842015-05-12 17:26:48 -060033#include <stdlib.h>
34#include <string.h>
Jon Ashburnd55a3942015-05-06 09:02:10 -060035
Tobin Ehlisb835d1b2015-07-03 10:34:49 -060036#include "vk_loader_platform.h"
Jon Ashburnd55a3942015-05-06 09:02:10 -060037#include "loader.h"
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -060038#include "debug_report.h"
Ian Elliott954fa342015-10-30 15:28:23 -060039#include "wsi.h"
Jon Ashburn1530c342016-02-26 13:14:27 -070040#include "gpa_helper.h"
41#include "table_ops.h"
Jon Ashburnd55a3942015-05-06 09:02:10 -060042
Jon Ashburn1530c342016-02-26 13:14:27 -070043/* Trampoline entrypoints are in this file for core Vulkan commands */
44/**
45 * Get an instance level or global level entry point address.
46 * @param instance
47 * @param pName
48 * @return
49 * If instance == NULL returns a global level functions only
50 * If instance is valid returns a trampoline entry point for all dispatchable
51 * Vulkan
52 * functions both core and extensions.
53 */
54LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
55vkGetInstanceProcAddr(VkInstance instance, const char *pName) {
56
57 void *addr;
58
59 addr = globalGetProcAddr(pName);
60 if (instance == VK_NULL_HANDLE) {
61 // get entrypoint addresses that are global (no dispatchable object)
62
63 return addr;
64 } else {
65 // if a global entrypoint return NULL
66 if (addr)
67 return NULL;
68 }
69
70 struct loader_instance *ptr_instance = loader_get_instance(instance);
71 if (ptr_instance == NULL)
72 return NULL;
73 // Return trampoline code for non-global entrypoints including any
74 // extensions.
75 // Device extensions are returned if a layer or ICD supports the extension.
76 // Instance extensions are returned if the extension is enabled and the
77 // loader
78 // or someone else supports the extension
79 return trampolineGetProcAddr(ptr_instance, pName);
80}
81
82/**
83 * Get a device level or global level entry point address.
84 * @param device
85 * @param pName
86 * @return
87 * If device is valid, returns a device relative entry point for device level
88 * entry points both core and extensions.
89 * Device relative means call down the device chain.
90 */
91LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
92vkGetDeviceProcAddr(VkDevice device, const char *pName) {
93 void *addr;
94
95 /* for entrypoints that loader must handle (ie non-dispatchable or create
96 object)
97 make sure the loader entrypoint is returned */
98 addr = loader_non_passthrough_gdpa(pName);
99 if (addr) {
100 return addr;
101 }
102
103 /* Although CreateDevice is on device chain it's dispatchable object isn't
104 * a VkDevice or child of VkDevice so return NULL.
105 */
106 if (!strcmp(pName, "CreateDevice"))
107 return NULL;
108
109 /* return the dispatch table entrypoint for the fastest case */
110 const VkLayerDispatchTable *disp_table = *(VkLayerDispatchTable **)device;
111 if (disp_table == NULL)
112 return NULL;
113
114 addr = loader_lookup_device_dispatch_table(disp_table, pName);
115 if (addr)
116 return addr;
117
118 if (disp_table->GetDeviceProcAddr == NULL)
119 return NULL;
120 return disp_table->GetDeviceProcAddr(device, pName);
121}
122
123LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
124vkEnumerateInstanceExtensionProperties(const char *pLayerName,
125 uint32_t *pPropertyCount,
126 VkExtensionProperties *pProperties) {
127 struct loader_extension_list *global_ext_list = NULL;
128 struct loader_layer_list instance_layers;
Jon Ashburnb8726962016-04-08 15:03:35 -0600129 struct loader_extension_list local_ext_list;
Jon Ashburn1530c342016-02-26 13:14:27 -0700130 struct loader_icd_libs icd_libs;
131 uint32_t copy_size;
132
133 tls_instance = NULL;
Jon Ashburnb8726962016-04-08 15:03:35 -0600134 memset(&local_ext_list, 0, sizeof(local_ext_list));
Jon Ashburn1530c342016-02-26 13:14:27 -0700135 memset(&instance_layers, 0, sizeof(instance_layers));
136 loader_platform_thread_once(&once_init, loader_initialize);
137
138 /* get layer libraries if needed */
139 if (pLayerName && strlen(pLayerName) != 0) {
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600140 if (vk_string_validate(MaxLoaderStringLength, pLayerName) !=
Jon Ashburn1530c342016-02-26 13:14:27 -0700141 VK_STRING_ERROR_NONE) {
Jon Ashburn1530c342016-02-26 13:14:27 -0700142 assert(VK_FALSE && "vkEnumerateInstanceExtensionProperties: "
143 "pLayerName is too long or is badly formed");
144 return VK_ERROR_EXTENSION_NOT_PRESENT;
145 }
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600146
147 loader_layer_scan(NULL, &instance_layers, NULL);
Jon Ashburnb8726962016-04-08 15:03:35 -0600148 if (strcmp(pLayerName, std_validation_str) == 0) {
149 struct loader_layer_list local_list;
150 memset(&local_list, 0, sizeof(local_list));
151 for (uint32_t i = 0; i < sizeof(std_validation_names) /
152 sizeof(std_validation_names[0]);
153 i++) {
154 loader_find_layer_name_add_list(NULL, std_validation_names[i],
155 VK_LAYER_TYPE_INSTANCE_EXPLICIT,
156 &instance_layers, &local_list);
157 }
158 for (uint32_t i = 0; i < local_list.count; i++) {
159 struct loader_extension_list *ext_list =
160 &local_list.list[i].instance_extension_list;
161 loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count,
162 ext_list->list);
163 }
164 loader_destroy_layer_list(NULL, &local_list);
165 global_ext_list = &local_ext_list;
166
167 } else {
168 for (uint32_t i = 0; i < instance_layers.count; i++) {
169 struct loader_layer_properties *props =
170 &instance_layers.list[i];
171 if (strcmp(props->info.layerName, pLayerName) == 0) {
172 global_ext_list = &props->instance_extension_list;
173 break;
174 }
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600175 }
176 }
Jon Ashburn1530c342016-02-26 13:14:27 -0700177 } else {
178 /* Scan/discover all ICD libraries */
179 memset(&icd_libs, 0, sizeof(struct loader_icd_libs));
180 loader_icd_scan(NULL, &icd_libs);
181 /* get extensions from all ICD's, merge so no duplicates */
182 loader_get_icd_loader_instance_extensions(NULL, &icd_libs,
Jon Ashburnb8726962016-04-08 15:03:35 -0600183 &local_ext_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700184 loader_scanned_icd_clear(NULL, &icd_libs);
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600185
186 // Append implicit layers.
187 loader_implicit_layer_scan(NULL, &instance_layers, NULL);
188 for (uint32_t i = 0; i < instance_layers.count; i++) {
189 struct loader_extension_list *ext_list = &instance_layers.list[i].instance_extension_list;
Jon Ashburnb8726962016-04-08 15:03:35 -0600190 loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count, ext_list->list);
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600191 }
192
Jon Ashburnb8726962016-04-08 15:03:35 -0600193 global_ext_list = &local_ext_list;
Jon Ashburn1530c342016-02-26 13:14:27 -0700194 }
195
196 if (global_ext_list == NULL) {
197 loader_destroy_layer_list(NULL, &instance_layers);
198 return VK_ERROR_LAYER_NOT_PRESENT;
199 }
200
201 if (pProperties == NULL) {
202 *pPropertyCount = global_ext_list->count;
203 loader_destroy_layer_list(NULL, &instance_layers);
204 loader_destroy_generic_list(
Jon Ashburnb8726962016-04-08 15:03:35 -0600205 NULL, (struct loader_generic_list *)&local_ext_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700206 return VK_SUCCESS;
207 }
208
209 copy_size = *pPropertyCount < global_ext_list->count
210 ? *pPropertyCount
211 : global_ext_list->count;
212 for (uint32_t i = 0; i < copy_size; i++) {
213 memcpy(&pProperties[i], &global_ext_list->list[i],
214 sizeof(VkExtensionProperties));
215 }
216 *pPropertyCount = copy_size;
217 loader_destroy_generic_list(NULL,
Jon Ashburnb8726962016-04-08 15:03:35 -0600218 (struct loader_generic_list *)&local_ext_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700219
220 if (copy_size < global_ext_list->count) {
221 loader_destroy_layer_list(NULL, &instance_layers);
222 return VK_INCOMPLETE;
223 }
224
225 loader_destroy_layer_list(NULL, &instance_layers);
226 return VK_SUCCESS;
227}
228
229LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
230vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount,
231 VkLayerProperties *pProperties) {
232
233 struct loader_layer_list instance_layer_list;
234 tls_instance = NULL;
235
236 loader_platform_thread_once(&once_init, loader_initialize);
237
238 uint32_t copy_size;
239
240 /* get layer libraries */
241 memset(&instance_layer_list, 0, sizeof(instance_layer_list));
242 loader_layer_scan(NULL, &instance_layer_list, NULL);
243
244 if (pProperties == NULL) {
245 *pPropertyCount = instance_layer_list.count;
246 loader_destroy_layer_list(NULL, &instance_layer_list);
247 return VK_SUCCESS;
248 }
249
250 copy_size = (*pPropertyCount < instance_layer_list.count)
251 ? *pPropertyCount
252 : instance_layer_list.count;
253 for (uint32_t i = 0; i < copy_size; i++) {
254 memcpy(&pProperties[i], &instance_layer_list.list[i].info,
255 sizeof(VkLayerProperties));
256 }
257
258 *pPropertyCount = copy_size;
259 loader_destroy_layer_list(NULL, &instance_layer_list);
260
261 if (copy_size < instance_layer_list.count) {
262 return VK_INCOMPLETE;
263 }
264
265 return VK_SUCCESS;
266}
267
Jon Ashburn23d36b12016-02-02 17:47:28 -0700268LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
269vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
270 const VkAllocationCallbacks *pAllocator,
271 VkInstance *pInstance) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600272 struct loader_instance *ptr_instance = NULL;
Jon Ashburne5b9bba2016-01-18 12:20:03 -0700273 VkInstance created_instance = VK_NULL_HANDLE;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600274 VkResult res = VK_ERROR_INITIALIZATION_FAILED;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600275
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600276 loader_platform_thread_once(&once_init, loader_initialize);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600277
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700278#if 0
279 if (pAllocator) {
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800280 ptr_instance = (struct loader_instance *) pAllocator->pfnAllocation(
Chia-I Wuf7458c52015-10-26 21:10:41 +0800281 pAllocator->pUserData,
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600282 sizeof(struct loader_instance),
Jon Ashburn6a118ae2016-01-07 15:21:14 -0700283 sizeof(int *),
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800284 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600285 } else {
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700286#endif
Jon Ashburn23d36b12016-02-02 17:47:28 -0700287 ptr_instance =
288 (struct loader_instance *)malloc(sizeof(struct loader_instance));
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700289 //}
Jon Ashburn27cd5842015-05-12 17:26:48 -0600290 if (ptr_instance == NULL) {
291 return VK_ERROR_OUT_OF_HOST_MEMORY;
292 }
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600293
Jon Ashburn87d6aa92015-08-28 15:19:27 -0600294 tls_instance = ptr_instance;
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600295 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburnb82c1852015-08-11 14:49:54 -0600296 memset(ptr_instance, 0, sizeof(struct loader_instance));
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700297#if 0
Chia-I Wuf7458c52015-10-26 21:10:41 +0800298 if (pAllocator) {
299 ptr_instance->alloc_callbacks = *pAllocator;
Courtney Goeltzenleuchter7f5aafc2015-07-05 11:28:29 -0600300 }
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700301#endif
Courtney Goeltzenleuchter7f5aafc2015-07-05 11:28:29 -0600302
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700303 /*
Ian Elliottad6300f2016-03-31 10:48:19 -0600304 * Look for one or more debug report create info structures
305 * and setup a callback(s) for each one found.
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700306 */
Ian Elliottad6300f2016-03-31 10:48:19 -0600307 ptr_instance->num_tmp_callbacks = 0;
308 ptr_instance->tmp_dbg_create_infos = NULL;
309 ptr_instance->tmp_callbacks = NULL;
310 if (util_CopyDebugReportCreateInfos(pCreateInfo->pNext,
311 pAllocator,
312 &ptr_instance->num_tmp_callbacks,
313 &ptr_instance->tmp_dbg_create_infos,
314 &ptr_instance->tmp_callbacks)) {
315 // One or more were found, but allocation failed. Therefore, clean up
316 // and fail this function:
317 loader_heap_free(ptr_instance, ptr_instance);
318 loader_platform_thread_unlock_mutex(&loader_lock);
319 return VK_ERROR_OUT_OF_HOST_MEMORY;
320 } else if (ptr_instance->num_tmp_callbacks > 0) {
321 // Setup the temporary callback(s) here to catch early issues:
322 if (util_CreateDebugReportCallbacks(ptr_instance,
323 pAllocator,
324 ptr_instance->num_tmp_callbacks,
325 ptr_instance->tmp_dbg_create_infos,
326 ptr_instance->tmp_callbacks)) {
327 // Failure of setting up one or more of the callback. Therefore,
328 // clean up and fail this function:
329 util_FreeDebugReportCreateInfos(pAllocator,
330 ptr_instance->tmp_dbg_create_infos,
331 ptr_instance->tmp_callbacks);
332 loader_heap_free(ptr_instance, ptr_instance);
333 loader_platform_thread_unlock_mutex(&loader_lock);
334 return VK_ERROR_OUT_OF_HOST_MEMORY;
Courtney Goeltzenleuchter82887272015-12-02 15:29:33 -0700335 }
336 }
337
Jon Ashburn3d002332015-08-20 16:35:30 -0600338 /* Due to implicit layers need to get layer list even if
Jon Ashburnf19916e2016-01-11 13:12:43 -0700339 * enabledLayerCount == 0 and VK_INSTANCE_LAYERS is unset. For now always
Jon Ashburn3d002332015-08-20 16:35:30 -0600340 * get layer list (both instance and device) via loader_layer_scan(). */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700341 memset(&ptr_instance->instance_layer_list, 0,
342 sizeof(ptr_instance->instance_layer_list));
343 memset(&ptr_instance->device_layer_list, 0,
344 sizeof(ptr_instance->device_layer_list));
345 loader_layer_scan(ptr_instance, &ptr_instance->instance_layer_list,
Jon Ashburne39a4f82015-08-28 13:38:21 -0600346 &ptr_instance->device_layer_list);
Jon Ashburn3d002332015-08-20 16:35:30 -0600347
348 /* validate the app requested layers to be enabled */
Jon Ashburnf19916e2016-01-11 13:12:43 -0700349 if (pCreateInfo->enabledLayerCount > 0) {
Jon Ashburnf2b4e382016-02-10 20:50:19 -0700350 res =
351 loader_validate_layers(ptr_instance, pCreateInfo->enabledLayerCount,
352 pCreateInfo->ppEnabledLayerNames,
353 &ptr_instance->instance_layer_list);
Jon Ashburn3d002332015-08-20 16:35:30 -0600354 if (res != VK_SUCCESS) {
Ian Elliottad6300f2016-03-31 10:48:19 -0600355 util_DestroyDebugReportCallbacks(ptr_instance,
356 pAllocator,
357 ptr_instance->num_tmp_callbacks,
358 ptr_instance->tmp_callbacks);
359 util_FreeDebugReportCreateInfos(pAllocator,
360 ptr_instance->tmp_dbg_create_infos,
361 ptr_instance->tmp_callbacks);
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700362 loader_heap_free(ptr_instance, ptr_instance);
Jon Ashburn1ff17592015-10-09 09:40:30 -0600363 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn3d002332015-08-20 16:35:30 -0600364 return res;
365 }
366 }
367
Jon Ashburn86a527a2016-02-10 20:59:26 -0700368 /* convert any meta layers to the actual layers makes a copy of layer name*/
Chris Forbesbd9de052016-04-06 20:49:02 +1200369 VkInstanceCreateInfo ici = *pCreateInfo;
Jon Ashburn86a527a2016-02-10 20:59:26 -0700370 loader_expand_layer_names(
371 ptr_instance, std_validation_str,
372 sizeof(std_validation_names) / sizeof(std_validation_names[0]),
Chris Forbesbd9de052016-04-06 20:49:02 +1200373 std_validation_names, &ici.enabledLayerCount,
374 &ici.ppEnabledLayerNames);
Jon Ashburn86a527a2016-02-10 20:59:26 -0700375
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600376 /* Scan/discover all ICD libraries */
377 memset(&ptr_instance->icd_libs, 0, sizeof(ptr_instance->icd_libs));
Jon Ashburne39a4f82015-08-28 13:38:21 -0600378 loader_icd_scan(ptr_instance, &ptr_instance->icd_libs);
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600379
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600380 /* get extensions from all ICD's, merge so no duplicates, then validate */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700381 loader_get_icd_loader_instance_extensions(
382 ptr_instance, &ptr_instance->icd_libs, &ptr_instance->ext_list);
383 res = loader_validate_instance_extensions(
Jon Ashburnf2b4e382016-02-10 20:50:19 -0700384 ptr_instance, &ptr_instance->ext_list,
Chris Forbesbd9de052016-04-06 20:49:02 +1200385 &ptr_instance->instance_layer_list, &ici);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600386 if (res != VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200387 loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
Jon Ashburne39a4f82015-08-28 13:38:21 -0600388 loader_delete_layer_properties(ptr_instance,
389 &ptr_instance->device_layer_list);
390 loader_delete_layer_properties(ptr_instance,
391 &ptr_instance->instance_layer_list);
392 loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700393 loader_destroy_generic_list(
394 ptr_instance,
395 (struct loader_generic_list *)&ptr_instance->ext_list);
Ian Elliottad6300f2016-03-31 10:48:19 -0600396 util_DestroyDebugReportCallbacks(ptr_instance,
397 pAllocator,
398 ptr_instance->num_tmp_callbacks,
399 ptr_instance->tmp_callbacks);
400 util_FreeDebugReportCreateInfos(pAllocator,
401 ptr_instance->tmp_dbg_create_infos,
402 ptr_instance->tmp_callbacks);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600403 loader_platform_thread_unlock_mutex(&loader_lock);
404 loader_heap_free(ptr_instance, ptr_instance);
405 return res;
406 }
407
Jon Ashburn23d36b12016-02-02 17:47:28 -0700408 ptr_instance->disp =
409 loader_heap_alloc(ptr_instance, sizeof(VkLayerInstanceDispatchTable),
410 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600411 if (ptr_instance->disp == NULL) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200412 loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
Jon Ashburne39a4f82015-08-28 13:38:21 -0600413 loader_delete_layer_properties(ptr_instance,
414 &ptr_instance->device_layer_list);
415 loader_delete_layer_properties(ptr_instance,
416 &ptr_instance->instance_layer_list);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700417 loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
418 loader_destroy_generic_list(
419 ptr_instance,
420 (struct loader_generic_list *)&ptr_instance->ext_list);
Ian Elliottad6300f2016-03-31 10:48:19 -0600421 util_DestroyDebugReportCallbacks(ptr_instance,
422 pAllocator,
423 ptr_instance->num_tmp_callbacks,
424 ptr_instance->tmp_callbacks);
425 util_FreeDebugReportCreateInfos(pAllocator,
426 ptr_instance->tmp_dbg_create_infos,
427 ptr_instance->tmp_callbacks);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600428 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600429 loader_heap_free(ptr_instance, ptr_instance);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600430 return VK_ERROR_OUT_OF_HOST_MEMORY;
431 }
432 memcpy(ptr_instance->disp, &instance_disp, sizeof(instance_disp));
433 ptr_instance->next = loader.instances;
434 loader.instances = ptr_instance;
435
Jon Ashburnb82c1852015-08-11 14:49:54 -0600436 /* activate any layers on instance chain */
Chris Forbesbd9de052016-04-06 20:49:02 +1200437 res = loader_enable_instance_layers(ptr_instance, &ici,
Jon Ashburne39a4f82015-08-28 13:38:21 -0600438 &ptr_instance->instance_layer_list);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600439 if (res != VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200440 loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
Jon Ashburne39a4f82015-08-28 13:38:21 -0600441 loader_delete_layer_properties(ptr_instance,
442 &ptr_instance->device_layer_list);
443 loader_delete_layer_properties(ptr_instance,
444 &ptr_instance->instance_layer_list);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700445 loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
446 loader_destroy_generic_list(
447 ptr_instance,
448 (struct loader_generic_list *)&ptr_instance->ext_list);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600449 loader.instances = ptr_instance->next;
Ian Elliottad6300f2016-03-31 10:48:19 -0600450 util_DestroyDebugReportCallbacks(ptr_instance,
451 pAllocator,
452 ptr_instance->num_tmp_callbacks,
453 ptr_instance->tmp_callbacks);
454 util_FreeDebugReportCreateInfos(pAllocator,
455 ptr_instance->tmp_dbg_create_infos,
456 ptr_instance->tmp_callbacks);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600457 loader_platform_thread_unlock_mutex(&loader_lock);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600458 loader_heap_free(ptr_instance, ptr_instance->disp);
459 loader_heap_free(ptr_instance, ptr_instance);
460 return res;
461 }
Jon Ashburn07daee72015-05-21 18:13:33 -0600462
Jon Ashburn23d36b12016-02-02 17:47:28 -0700463 created_instance = (VkInstance)ptr_instance;
Chris Forbesbd9de052016-04-06 20:49:02 +1200464 res = loader_create_instance_chain(&ici, pAllocator, ptr_instance,
Jon Ashburn6e0a2132016-02-03 12:37:30 -0700465 &created_instance);
Jon Ashburneed0c002015-05-21 17:42:17 -0600466
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700467 if (res == VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200468 wsi_create_instance(ptr_instance, &ici);
469 debug_report_create_instance(ptr_instance, &ici);
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700470
Jon Ashburne5b9bba2016-01-18 12:20:03 -0700471 *pInstance = created_instance;
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700472
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700473 /*
474 * Finally have the layers in place and everyone has seen
475 * the CreateInstance command go by. This allows the layer's
476 * GetInstanceProcAddr functions to return valid extension functions
477 * if enabled.
478 */
479 loader_activate_instance_layer_extensions(ptr_instance, *pInstance);
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700480 } else {
481 // TODO: cleanup here.
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700482 }
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700483
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700484 /* Remove temporary debug_report callback */
Ian Elliottad6300f2016-03-31 10:48:19 -0600485 util_DestroyDebugReportCallbacks(ptr_instance,
486 pAllocator,
487 ptr_instance->num_tmp_callbacks,
488 ptr_instance->tmp_callbacks);
Chris Forbesbd9de052016-04-06 20:49:02 +1200489 loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600490 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600491 return res;
492}
493
Jon Ashburn23d36b12016-02-02 17:47:28 -0700494LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
495vkDestroyInstance(VkInstance instance,
496 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600497 const VkLayerInstanceDispatchTable *disp;
Jon Ashburne0e64572015-09-30 12:56:42 -0600498 struct loader_instance *ptr_instance = NULL;
Ian Elliott3b354cf2016-03-25 08:43:01 -0600499 bool callback_setup = false;
500
Jon Ashburn27cd5842015-05-12 17:26:48 -0600501 disp = loader_get_instance_dispatch(instance);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600502
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600503 loader_platform_thread_lock_mutex(&loader_lock);
504
Jon Ashburne0e64572015-09-30 12:56:42 -0600505 ptr_instance = loader_get_instance(instance);
Ian Elliott3b354cf2016-03-25 08:43:01 -0600506
Ian Elliottad6300f2016-03-31 10:48:19 -0600507 if (ptr_instance->num_tmp_callbacks > 0) {
508 // Setup the temporary callback(s) here to catch cleanup issues:
509 if (!util_CreateDebugReportCallbacks(ptr_instance,
510 pAllocator,
511 ptr_instance->num_tmp_callbacks,
512 ptr_instance->tmp_dbg_create_infos,
513 ptr_instance->tmp_callbacks)) {
Ian Elliott3b354cf2016-03-25 08:43:01 -0600514 callback_setup = true;
515 }
516 }
517
Chia-I Wuf7458c52015-10-26 21:10:41 +0800518 disp->DestroyInstance(instance, pAllocator);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600519
Courtney Goeltzenleuchter7d0023c2015-06-08 15:09:22 -0600520 loader_deactivate_instance_layers(ptr_instance);
Jon Ashburn014438f2016-03-01 19:51:07 -0700521 if (ptr_instance->phys_devs)
522 loader_heap_free(ptr_instance, ptr_instance->phys_devs);
Ian Elliott3b354cf2016-03-25 08:43:01 -0600523 if (callback_setup) {
Ian Elliottad6300f2016-03-31 10:48:19 -0600524 util_DestroyDebugReportCallbacks(ptr_instance,
525 pAllocator,
526 ptr_instance->num_tmp_callbacks,
527 ptr_instance->tmp_callbacks);
528 util_FreeDebugReportCreateInfos(pAllocator,
529 ptr_instance->tmp_dbg_create_infos,
530 ptr_instance->tmp_callbacks);
Ian Elliott3b354cf2016-03-25 08:43:01 -0600531 }
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600532 loader_heap_free(ptr_instance, ptr_instance->disp);
533 loader_heap_free(ptr_instance, ptr_instance);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600534 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600535}
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600536
Jon Ashburn23d36b12016-02-02 17:47:28 -0700537LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
538vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount,
539 VkPhysicalDevice *pPhysicalDevices) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600540 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600541 VkResult res;
Jon Ashburn014438f2016-03-01 19:51:07 -0700542 uint32_t count, i;
543 struct loader_instance *inst;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600544 disp = loader_get_instance_dispatch(instance);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600545
546 loader_platform_thread_lock_mutex(&loader_lock);
547 res = disp->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount,
Jon Ashburn27cd5842015-05-12 17:26:48 -0600548 pPhysicalDevices);
Jon Ashburn014438f2016-03-01 19:51:07 -0700549
550 if (res != VK_SUCCESS && res != VK_INCOMPLETE) {
551 loader_platform_thread_unlock_mutex(&loader_lock);
552 return res;
553 }
554
555 if (!pPhysicalDevices) {
556 loader_platform_thread_unlock_mutex(&loader_lock);
557 return res;
558 }
559
560 // wrap the PhysDev object for loader usage, return wrapped objects
561 inst = loader_get_instance(instance);
562 if (!inst) {
563 loader_platform_thread_unlock_mutex(&loader_lock);
564 return VK_ERROR_INITIALIZATION_FAILED;
565 }
Piers Daniell295fe402016-03-29 11:51:11 -0600566 count = (inst->total_gpu_count < *pPhysicalDeviceCount) ?
567 inst->total_gpu_count : *pPhysicalDeviceCount;
568 *pPhysicalDeviceCount = count;
Jeannot Breton32ad8d82016-04-12 15:46:20 -0500569 if (!inst->phys_devs) {
570 inst->phys_devs = (struct loader_physical_device_tramp *)loader_heap_alloc(
571 inst, inst->total_gpu_count * sizeof(struct loader_physical_device_tramp),
572 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
573 }
Jon Ashburn014438f2016-03-01 19:51:07 -0700574 if (!inst->phys_devs) {
575 loader_platform_thread_unlock_mutex(&loader_lock);
576 return VK_ERROR_OUT_OF_HOST_MEMORY;
577 }
578
579 for (i = 0; i < count; i++) {
580
581 // initialize the loader's physicalDevice object
582 loader_set_dispatch((void *)&inst->phys_devs[i], inst->disp);
Piers Daniell295fe402016-03-29 11:51:11 -0600583 inst->phys_devs[i].this_instance = inst;
Jon Ashburn014438f2016-03-01 19:51:07 -0700584 inst->phys_devs[i].phys_dev = pPhysicalDevices[i];
585
586 // copy wrapped object into Application provided array
587 pPhysicalDevices[i] = (VkPhysicalDevice)&inst->phys_devs[i];
588 }
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600589 loader_platform_thread_unlock_mutex(&loader_lock);
590 return res;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600591}
592
Jon Ashburn23d36b12016-02-02 17:47:28 -0700593LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
Jon Ashburn014438f2016-03-01 19:51:07 -0700594vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700595 VkPhysicalDeviceFeatures *pFeatures) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600596 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700597 VkPhysicalDevice unwrapped_phys_dev =
598 loader_unwrap_physical_device(physicalDevice);
599 disp = loader_get_instance_dispatch(physicalDevice);
600 disp->GetPhysicalDeviceFeatures(unwrapped_phys_dev, pFeatures);
Jon Ashburn754864f2015-07-23 18:49:07 -0600601}
602
Jon Ashburn23d36b12016-02-02 17:47:28 -0700603LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
Jon Ashburn014438f2016-03-01 19:51:07 -0700604vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice,
605 VkFormat format,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700606 VkFormatProperties *pFormatInfo) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600607 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700608 VkPhysicalDevice unwrapped_pd =
609 loader_unwrap_physical_device(physicalDevice);
610 disp = loader_get_instance_dispatch(physicalDevice);
611 disp->GetPhysicalDeviceFormatProperties(unwrapped_pd, format, pFormatInfo);
Jon Ashburn754864f2015-07-23 18:49:07 -0600612}
613
Jon Ashburn23d36b12016-02-02 17:47:28 -0700614LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
615vkGetPhysicalDeviceImageFormatProperties(
616 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
617 VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
618 VkImageFormatProperties *pImageFormatProperties) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600619 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700620 VkPhysicalDevice unwrapped_phys_dev =
621 loader_unwrap_physical_device(physicalDevice);
Jon Ashburn754864f2015-07-23 18:49:07 -0600622 disp = loader_get_instance_dispatch(physicalDevice);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700623 return disp->GetPhysicalDeviceImageFormatProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700624 unwrapped_phys_dev, format, type, tiling, usage, flags,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700625 pImageFormatProperties);
Jon Ashburn754864f2015-07-23 18:49:07 -0600626}
627
Jon Ashburn23d36b12016-02-02 17:47:28 -0700628LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
Jon Ashburn014438f2016-03-01 19:51:07 -0700629vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700630 VkPhysicalDeviceProperties *pProperties) {
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600631 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700632 VkPhysicalDevice unwrapped_phys_dev =
633 loader_unwrap_physical_device(physicalDevice);
634 disp = loader_get_instance_dispatch(physicalDevice);
635 disp->GetPhysicalDeviceProperties(unwrapped_phys_dev, pProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600636}
637
Jon Ashburn23d36b12016-02-02 17:47:28 -0700638LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
639vkGetPhysicalDeviceQueueFamilyProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700640 VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700641 VkQueueFamilyProperties *pQueueProperties) {
Tony Barbour59a47322015-06-24 16:06:58 -0600642 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700643 VkPhysicalDevice unwrapped_phys_dev =
644 loader_unwrap_physical_device(physicalDevice);
645 disp = loader_get_instance_dispatch(physicalDevice);
646 disp->GetPhysicalDeviceQueueFamilyProperties(
647 unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600648}
649
Chia-I Wu9ab61502015-11-06 06:42:02 +0800650LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700651 VkPhysicalDevice physicalDevice,
652 VkPhysicalDeviceMemoryProperties *pMemoryProperties) {
Tony Barbour59a47322015-06-24 16:06:58 -0600653 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700654 VkPhysicalDevice unwrapped_phys_dev =
655 loader_unwrap_physical_device(physicalDevice);
656 disp = loader_get_instance_dispatch(physicalDevice);
657 disp->GetPhysicalDeviceMemoryProperties(unwrapped_phys_dev,
658 pMemoryProperties);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600659}
660
Jon Ashburn23d36b12016-02-02 17:47:28 -0700661LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
Jon Ashburn1530c342016-02-26 13:14:27 -0700662vkCreateDevice(VkPhysicalDevice physicalDevice,
663 const VkDeviceCreateInfo *pCreateInfo,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700664 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600665 VkResult res;
Jon Ashburn787eb252016-03-24 15:49:57 -0600666 struct loader_physical_device_tramp *phys_dev;
Jon Ashburn1530c342016-02-26 13:14:27 -0700667 struct loader_device *dev;
668 struct loader_instance *inst;
669 struct loader_layer_list activated_layer_list = {0};
670
671 assert(pCreateInfo->queueCreateInfoCount >= 1);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600672
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600673 loader_platform_thread_lock_mutex(&loader_lock);
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600674
Jon Ashburn787eb252016-03-24 15:49:57 -0600675 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Piers Daniell295fe402016-03-29 11:51:11 -0600676 inst = (struct loader_instance *)phys_dev->this_instance;
Jon Ashburn1530c342016-02-26 13:14:27 -0700677
678 /* validate any app enabled layers are available */
679 if (pCreateInfo->enabledLayerCount > 0) {
680 res = loader_validate_layers(inst, pCreateInfo->enabledLayerCount,
681 pCreateInfo->ppEnabledLayerNames,
682 &inst->device_layer_list);
683 if (res != VK_SUCCESS) {
684 loader_platform_thread_unlock_mutex(&loader_lock);
685 return res;
686 }
687 }
688
Jon Ashburn014438f2016-03-01 19:51:07 -0700689 /* Get the physical device (ICD) extensions */
690 struct loader_extension_list icd_exts;
691 if (!loader_init_generic_list(inst, (struct loader_generic_list *)&icd_exts,
692 sizeof(VkExtensionProperties))) {
693 loader_platform_thread_unlock_mutex(&loader_lock);
694 return VK_ERROR_OUT_OF_HOST_MEMORY;
695 }
Jon Ashburn1530c342016-02-26 13:14:27 -0700696
Jon Ashburn014438f2016-03-01 19:51:07 -0700697 res = loader_add_device_extensions(
Piers Daniell295fe402016-03-29 11:51:11 -0600698 inst, inst->disp->EnumerateDeviceExtensionProperties, phys_dev->phys_dev,
699 "Unknown", &icd_exts);
Jon Ashburn014438f2016-03-01 19:51:07 -0700700 if (res != VK_SUCCESS) {
701 loader_platform_thread_unlock_mutex(&loader_lock);
702 return res;
Jon Ashburn1530c342016-02-26 13:14:27 -0700703 }
704
705 /* convert any meta layers to the actual layers makes a copy of layer name*/
Chris Forbesbd9de052016-04-06 20:49:02 +1200706 VkDeviceCreateInfo dci = *pCreateInfo;
Jon Ashburn1530c342016-02-26 13:14:27 -0700707 loader_expand_layer_names(
708 inst, std_validation_str,
709 sizeof(std_validation_names) / sizeof(std_validation_names[0]),
Chris Forbesbd9de052016-04-06 20:49:02 +1200710 std_validation_names, &dci.enabledLayerCount,
711 &dci.ppEnabledLayerNames);
Jon Ashburn1530c342016-02-26 13:14:27 -0700712
713 /* fetch a list of all layers activated, explicit and implicit */
Piers Daniell295fe402016-03-29 11:51:11 -0600714 res = loader_enable_device_layers(inst, &activated_layer_list,
Chris Forbesbd9de052016-04-06 20:49:02 +1200715 &dci, &inst->device_layer_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700716 if (res != VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200717 loader_delete_shadow_dev_layer_names(inst, pCreateInfo, &dci);
Jon Ashburn1530c342016-02-26 13:14:27 -0700718 loader_platform_thread_unlock_mutex(&loader_lock);
719 return res;
720 }
721
722 /* make sure requested extensions to be enabled are supported */
723 res = loader_validate_device_extensions(phys_dev, &activated_layer_list,
Chris Forbesbd9de052016-04-06 20:49:02 +1200724 &icd_exts, &dci);
Jon Ashburn1530c342016-02-26 13:14:27 -0700725 if (res != VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200726 loader_delete_shadow_dev_layer_names(inst, pCreateInfo, &dci);
Jon Ashburn1530c342016-02-26 13:14:27 -0700727 loader_destroy_generic_list(
728 inst, (struct loader_generic_list *)&activated_layer_list);
729 loader_platform_thread_unlock_mutex(&loader_lock);
730 return res;
731 }
732
Piers Daniell295fe402016-03-29 11:51:11 -0600733 dev = loader_create_logical_device(inst);
Jon Ashburn1530c342016-02-26 13:14:27 -0700734 if (dev == NULL) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200735 loader_delete_shadow_dev_layer_names(inst, pCreateInfo, &dci);
Jon Ashburn1530c342016-02-26 13:14:27 -0700736 loader_destroy_generic_list(
737 inst, (struct loader_generic_list *)&activated_layer_list);
738 loader_platform_thread_unlock_mutex(&loader_lock);
739 return VK_ERROR_OUT_OF_HOST_MEMORY;
740 }
741
742 /* move the locally filled layer list into the device, and pass ownership of
743 * the memory */
744 dev->activated_layer_list.capacity = activated_layer_list.capacity;
745 dev->activated_layer_list.count = activated_layer_list.count;
746 dev->activated_layer_list.list = activated_layer_list.list;
747 memset(&activated_layer_list, 0, sizeof(activated_layer_list));
748
749 /* activate any layers on device chain which terminates with device*/
Piers Daniell295fe402016-03-29 11:51:11 -0600750 res = loader_enable_device_layers(inst, &dev->activated_layer_list,
Chris Forbesbd9de052016-04-06 20:49:02 +1200751 &dci, &inst->device_layer_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700752 if (res != VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200753 loader_delete_shadow_dev_layer_names(inst, pCreateInfo, &dci);
Jon Ashburn1530c342016-02-26 13:14:27 -0700754 loader_platform_thread_unlock_mutex(&loader_lock);
755 return res;
756 }
757
Chris Forbesbd9de052016-04-06 20:49:02 +1200758 res = loader_create_device_chain(phys_dev, &dci, pAllocator, inst,
Piers Daniell295fe402016-03-29 11:51:11 -0600759 dev);
Jon Ashburn1530c342016-02-26 13:14:27 -0700760 if (res != VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200761 loader_delete_shadow_dev_layer_names(inst, pCreateInfo, &dci);
Jon Ashburn1530c342016-02-26 13:14:27 -0700762 loader_platform_thread_unlock_mutex(&loader_lock);
763 return res;
764 }
765
766 *pDevice = dev->device;
767
768 /* initialize any device extension dispatch entry's from the instance list*/
769 loader_init_dispatch_dev_ext(inst, dev);
770
771 /* initialize WSI device extensions as part of core dispatch since loader
772 * has
773 * dedicated trampoline code for these*/
774 loader_init_device_extension_dispatch_table(
775 &dev->loader_dispatch,
776 dev->loader_dispatch.core_dispatch.GetDeviceProcAddr, *pDevice);
777
Chris Forbesbd9de052016-04-06 20:49:02 +1200778 loader_delete_shadow_dev_layer_names(inst, pCreateInfo, &dci);
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600779
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600780 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600781 return res;
782}
783
Jon Ashburn23d36b12016-02-02 17:47:28 -0700784LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
785vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600786 const VkLayerDispatchTable *disp;
Jon Ashburne39a4f82015-08-28 13:38:21 -0600787 struct loader_device *dev;
Andrzej Kotlowskib168b1a2016-02-03 09:41:53 +0100788
789 loader_platform_thread_lock_mutex(&loader_lock);
790
Jon Ashburne39a4f82015-08-28 13:38:21 -0600791 struct loader_icd *icd = loader_get_icd_and_device(device, &dev);
792 const struct loader_instance *inst = icd->this_instance;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600793 disp = loader_get_dispatch(device);
794
Chia-I Wuf7458c52015-10-26 21:10:41 +0800795 disp->DestroyDevice(device, pAllocator);
Jon Ashburn781a7ae2015-11-19 15:43:26 -0700796 dev->device = NULL;
797 loader_remove_logical_device(inst, icd, dev);
798
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600799 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600800}
801
Jon Ashburn23d36b12016-02-02 17:47:28 -0700802LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
803vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
804 const char *pLayerName,
805 uint32_t *pPropertyCount,
806 VkExtensionProperties *pProperties) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700807 VkResult res = VK_SUCCESS;
Jon Ashburn787eb252016-03-24 15:49:57 -0600808 struct loader_physical_device_tramp *phys_dev;
809 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600810
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600811 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700812
813 /* If pLayerName == NULL, then querying ICD extensions, pass this call
814 down the instance chain which will terminate in the ICD. This allows
815 layers to filter the extensions coming back up the chain.
816 If pLayerName != NULL then get layer extensions from manifest file. */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700817 if (pLayerName == NULL || strlen(pLayerName) == 0) {
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700818 const VkLayerInstanceDispatchTable *disp;
819
820 disp = loader_get_instance_dispatch(physicalDevice);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700821 res = disp->EnumerateDeviceExtensionProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700822 phys_dev->phys_dev, NULL, pPropertyCount, pProperties);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700823 } else {
Jon Ashburn014438f2016-03-01 19:51:07 -0700824
Jon Ashburndc5d9202016-02-29 13:00:51 -0700825 uint32_t count;
826 uint32_t copy_size;
Piers Daniell295fe402016-03-29 11:51:11 -0600827 const struct loader_instance *inst = phys_dev->this_instance;
Jon Ashburnb8726962016-04-08 15:03:35 -0600828 struct loader_device_extension_list *dev_ext_list = NULL;
829 struct loader_device_extension_list local_ext_list;
830 memset(&local_ext_list, 0, sizeof(local_ext_list));
Jon Ashburndc5d9202016-02-29 13:00:51 -0700831 if (vk_string_validate(MaxLoaderStringLength, pLayerName) ==
Jon Ashburn014438f2016-03-01 19:51:07 -0700832 VK_STRING_ERROR_NONE) {
Jon Ashburnb8726962016-04-08 15:03:35 -0600833 if (strcmp(pLayerName, std_validation_str) == 0) {
834 struct loader_layer_list local_list;
835 memset(&local_list, 0, sizeof(local_list));
836 for (uint32_t i = 0; i < sizeof(std_validation_names) /
837 sizeof(std_validation_names[0]);
838 i++) {
839 loader_find_layer_name_add_list(NULL, std_validation_names[i],
840 VK_LAYER_TYPE_DEVICE_EXPLICIT,
841 &inst->device_layer_list, &local_list);
842 }
843 for (uint32_t i = 0; i < local_list.count; i++) {
844 struct loader_device_extension_list *ext_list =
845 &local_list.list[i].device_extension_list;
846 for (uint32_t j = 0; j < ext_list->count; j++) {
847 loader_add_to_dev_ext_list(NULL, &local_ext_list,
848 &ext_list->list[j].props, 0,
849 NULL);
850 }
851 }
852 dev_ext_list = &local_ext_list;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700853
Jon Ashburnb8726962016-04-08 15:03:35 -0600854 } else {
855 for (uint32_t i = 0; i < inst->device_layer_list.count; i++) {
856 struct loader_layer_properties *props =
857 &inst->device_layer_list.list[i];
858 if (strcmp(props->info.layerName, pLayerName) == 0) {
859 dev_ext_list = &props->device_extension_list;
860 }
Jon Ashburndc5d9202016-02-29 13:00:51 -0700861 }
862 }
Jon Ashburnb8726962016-04-08 15:03:35 -0600863
Jon Ashburndc5d9202016-02-29 13:00:51 -0700864 count = (dev_ext_list == NULL) ? 0 : dev_ext_list->count;
865 if (pProperties == NULL) {
866 *pPropertyCount = count;
Jon Ashburnb8726962016-04-08 15:03:35 -0600867 loader_destroy_generic_list(inst,
868 (struct loader_generic_list *) &local_ext_list);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700869 loader_platform_thread_unlock_mutex(&loader_lock);
870 return VK_SUCCESS;
871 }
872
873 copy_size = *pPropertyCount < count ? *pPropertyCount : count;
874 for (uint32_t i = 0; i < copy_size; i++) {
875 memcpy(&pProperties[i], &dev_ext_list->list[i].props,
Jon Ashburn014438f2016-03-01 19:51:07 -0700876 sizeof(VkExtensionProperties));
Jon Ashburndc5d9202016-02-29 13:00:51 -0700877 }
878 *pPropertyCount = copy_size;
879
Jon Ashburnb8726962016-04-08 15:03:35 -0600880 loader_destroy_generic_list(inst,
881 (struct loader_generic_list *) &local_ext_list);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700882 if (copy_size < count) {
883 loader_platform_thread_unlock_mutex(&loader_lock);
884 return VK_INCOMPLETE;
885 }
886 } else {
Jon Ashburn014438f2016-03-01 19:51:07 -0700887 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
888 "vkEnumerateDeviceExtensionProperties: pLayerName "
889 "is too long or is badly formed");
890 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700891 return VK_ERROR_EXTENSION_NOT_PRESENT;
892 }
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700893 }
894
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600895 loader_platform_thread_unlock_mutex(&loader_lock);
Tony Barbour59a47322015-06-24 16:06:58 -0600896 return res;
897}
898
Jon Ashburn23d36b12016-02-02 17:47:28 -0700899LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
900vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
901 uint32_t *pPropertyCount,
902 VkLayerProperties *pProperties) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700903 uint32_t copy_size;
Jon Ashburn787eb252016-03-24 15:49:57 -0600904 struct loader_physical_device_tramp *phys_dev;
Tony Barbour59a47322015-06-24 16:06:58 -0600905
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600906 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700907
908 /* Don't dispatch this call down the instance chain, want all device layers
909 enumerated and instance chain may not contain all device layers */
Jon Ashburndc5d9202016-02-29 13:00:51 -0700910
Jon Ashburn787eb252016-03-24 15:49:57 -0600911 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Piers Daniell295fe402016-03-29 11:51:11 -0600912 const struct loader_instance *inst = phys_dev->this_instance;
Jon Ashburn014438f2016-03-01 19:51:07 -0700913 uint32_t count = inst->device_layer_list.count;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700914
915 if (pProperties == NULL) {
916 *pPropertyCount = count;
917 loader_platform_thread_unlock_mutex(&loader_lock);
918 return VK_SUCCESS;
919 }
920
921 copy_size = (*pPropertyCount < count) ? *pPropertyCount : count;
922 for (uint32_t i = 0; i < copy_size; i++) {
Jon Ashburn014438f2016-03-01 19:51:07 -0700923 memcpy(&pProperties[i], &(inst->device_layer_list.list[i].info),
Jon Ashburndc5d9202016-02-29 13:00:51 -0700924 sizeof(VkLayerProperties));
925 }
926 *pPropertyCount = copy_size;
927
928 if (copy_size < count) {
929 loader_platform_thread_unlock_mutex(&loader_lock);
930 return VK_INCOMPLETE;
931 }
932
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600933 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700934 return VK_SUCCESS;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600935}
936
Jon Ashburn23d36b12016-02-02 17:47:28 -0700937LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
938vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex,
939 VkQueue *pQueue) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600940 const VkLayerDispatchTable *disp;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600941
942 disp = loader_get_dispatch(device);
943
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600944 disp->GetDeviceQueue(device, queueNodeIndex, queueIndex, pQueue);
945 loader_set_dispatch(*pQueue, disp);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600946}
947
Jon Ashburn23d36b12016-02-02 17:47:28 -0700948LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
949vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits,
950 VkFence fence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600951 const VkLayerDispatchTable *disp;
952
953 disp = loader_get_dispatch(queue);
954
Chia-I Wu40cf0ae2015-10-26 17:20:32 +0800955 return disp->QueueSubmit(queue, submitCount, pSubmits, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600956}
957
Jon Ashburn23d36b12016-02-02 17:47:28 -0700958LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600959 const VkLayerDispatchTable *disp;
960
961 disp = loader_get_dispatch(queue);
962
963 return disp->QueueWaitIdle(queue);
964}
965
Jon Ashburn23d36b12016-02-02 17:47:28 -0700966LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600967 const VkLayerDispatchTable *disp;
968
969 disp = loader_get_dispatch(device);
970
971 return disp->DeviceWaitIdle(device);
972}
973
Jon Ashburn23d36b12016-02-02 17:47:28 -0700974LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
975vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
976 const VkAllocationCallbacks *pAllocator,
977 VkDeviceMemory *pMemory) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600978 const VkLayerDispatchTable *disp;
979
980 disp = loader_get_dispatch(device);
981
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800982 return disp->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600983}
984
Jon Ashburn23d36b12016-02-02 17:47:28 -0700985LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
986vkFreeMemory(VkDevice device, VkDeviceMemory mem,
987 const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600988 const VkLayerDispatchTable *disp;
989
990 disp = loader_get_dispatch(device);
991
Chia-I Wuf7458c52015-10-26 21:10:41 +0800992 disp->FreeMemory(device, mem, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600993}
994
Jon Ashburn23d36b12016-02-02 17:47:28 -0700995LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
996vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset,
997 VkDeviceSize size, VkFlags flags, void **ppData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600998 const VkLayerDispatchTable *disp;
999
1000 disp = loader_get_dispatch(device);
1001
1002 return disp->MapMemory(device, mem, offset, size, flags, ppData);
1003}
1004
Jon Ashburn23d36b12016-02-02 17:47:28 -07001005LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1006vkUnmapMemory(VkDevice device, VkDeviceMemory mem) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001007 const VkLayerDispatchTable *disp;
1008
1009 disp = loader_get_dispatch(device);
1010
Mark Lobodzinski2141f652015-09-07 13:59:43 -06001011 disp->UnmapMemory(device, mem);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001012}
1013
Jon Ashburn23d36b12016-02-02 17:47:28 -07001014LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1015vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
1016 const VkMappedMemoryRange *pMemoryRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001017 const VkLayerDispatchTable *disp;
1018
1019 disp = loader_get_dispatch(device);
1020
Jon Ashburn23d36b12016-02-02 17:47:28 -07001021 return disp->FlushMappedMemoryRanges(device, memoryRangeCount,
1022 pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001023}
1024
Jon Ashburn23d36b12016-02-02 17:47:28 -07001025LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1026vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
1027 const VkMappedMemoryRange *pMemoryRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001028 const VkLayerDispatchTable *disp;
1029
1030 disp = loader_get_dispatch(device);
1031
Jon Ashburn23d36b12016-02-02 17:47:28 -07001032 return disp->InvalidateMappedMemoryRanges(device, memoryRangeCount,
1033 pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001034}
1035
Jon Ashburn23d36b12016-02-02 17:47:28 -07001036LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1037vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory,
1038 VkDeviceSize *pCommittedMemoryInBytes) {
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -06001039 const VkLayerDispatchTable *disp;
1040
1041 disp = loader_get_dispatch(device);
1042
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001043 disp->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes);
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -06001044}
1045
Jon Ashburn23d36b12016-02-02 17:47:28 -07001046LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1047vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem,
1048 VkDeviceSize offset) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001049 const VkLayerDispatchTable *disp;
1050
Mark Lobodzinski942b1722015-05-11 17:21:15 -05001051 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001052
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001053 return disp->BindBufferMemory(device, buffer, mem, offset);
1054}
1055
Jon Ashburn23d36b12016-02-02 17:47:28 -07001056LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1057vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem,
1058 VkDeviceSize offset) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001059 const VkLayerDispatchTable *disp;
1060
1061 disp = loader_get_dispatch(device);
1062
1063 return disp->BindImageMemory(device, image, mem, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001064}
1065
Jon Ashburn23d36b12016-02-02 17:47:28 -07001066LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1067vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer,
1068 VkMemoryRequirements *pMemoryRequirements) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001069 const VkLayerDispatchTable *disp;
1070
1071 disp = loader_get_dispatch(device);
1072
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001073 disp->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -06001074}
1075
Jon Ashburn23d36b12016-02-02 17:47:28 -07001076LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1077vkGetImageMemoryRequirements(VkDevice device, VkImage image,
1078 VkMemoryRequirements *pMemoryRequirements) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001079 const VkLayerDispatchTable *disp;
1080
1081 disp = loader_get_dispatch(device);
1082
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001083 disp->GetImageMemoryRequirements(device, image, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -06001084}
1085
Jon Ashburn23d36b12016-02-02 17:47:28 -07001086LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements(
1087 VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount,
1088 VkSparseImageMemoryRequirements *pSparseMemoryRequirements) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001089 const VkLayerDispatchTable *disp;
1090
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001091 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001092
Jon Ashburn23d36b12016-02-02 17:47:28 -07001093 disp->GetImageSparseMemoryRequirements(device, image,
1094 pSparseMemoryRequirementCount,
1095 pSparseMemoryRequirements);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001096}
1097
Jon Ashburn23d36b12016-02-02 17:47:28 -07001098LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1099vkGetPhysicalDeviceSparseImageFormatProperties(
1100 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
1101 VkSampleCountFlagBits samples, VkImageUsageFlags usage,
1102 VkImageTiling tiling, uint32_t *pPropertyCount,
1103 VkSparseImageFormatProperties *pProperties) {
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001104 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -07001105 VkPhysicalDevice unwrapped_phys_dev =
1106 loader_unwrap_physical_device(physicalDevice);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001107 disp = loader_get_instance_dispatch(physicalDevice);
1108
Jon Ashburn23d36b12016-02-02 17:47:28 -07001109 disp->GetPhysicalDeviceSparseImageFormatProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -07001110 unwrapped_phys_dev, format, type, samples, usage, tiling,
1111 pPropertyCount, pProperties);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001112}
1113
Jon Ashburn23d36b12016-02-02 17:47:28 -07001114LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1115vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount,
1116 const VkBindSparseInfo *pBindInfo, VkFence fence) {
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001117 const VkLayerDispatchTable *disp;
1118
1119 disp = loader_get_dispatch(queue);
1120
Chia-I Wu1ff4c3d2015-10-26 16:55:27 +08001121 return disp->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001122}
1123
Jon Ashburn23d36b12016-02-02 17:47:28 -07001124LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1125vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo,
1126 const VkAllocationCallbacks *pAllocator, VkFence *pFence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001127 const VkLayerDispatchTable *disp;
1128
1129 disp = loader_get_dispatch(device);
1130
Chia-I Wuf7458c52015-10-26 21:10:41 +08001131 return disp->CreateFence(device, pCreateInfo, pAllocator, pFence);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001132}
1133
Jon Ashburn23d36b12016-02-02 17:47:28 -07001134LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1135vkDestroyFence(VkDevice device, VkFence fence,
1136 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001137 const VkLayerDispatchTable *disp;
1138
1139 disp = loader_get_dispatch(device);
1140
Chia-I Wuf7458c52015-10-26 21:10:41 +08001141 disp->DestroyFence(device, fence, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001142}
1143
Jon Ashburn23d36b12016-02-02 17:47:28 -07001144LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1145vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001146 const VkLayerDispatchTable *disp;
1147
1148 disp = loader_get_dispatch(device);
1149
1150 return disp->ResetFences(device, fenceCount, pFences);
1151}
1152
Jon Ashburn23d36b12016-02-02 17:47:28 -07001153LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1154vkGetFenceStatus(VkDevice device, VkFence fence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001155 const VkLayerDispatchTable *disp;
1156
1157 disp = loader_get_dispatch(device);
1158
1159 return disp->GetFenceStatus(device, fence);
1160}
1161
Jon Ashburn23d36b12016-02-02 17:47:28 -07001162LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1163vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences,
1164 VkBool32 waitAll, uint64_t timeout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001165 const VkLayerDispatchTable *disp;
1166
1167 disp = loader_get_dispatch(device);
1168
1169 return disp->WaitForFences(device, fenceCount, pFences, waitAll, timeout);
1170}
1171
Jon Ashburn23d36b12016-02-02 17:47:28 -07001172LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1173vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo,
1174 const VkAllocationCallbacks *pAllocator,
1175 VkSemaphore *pSemaphore) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001176 const VkLayerDispatchTable *disp;
1177
1178 disp = loader_get_dispatch(device);
1179
Chia-I Wuf7458c52015-10-26 21:10:41 +08001180 return disp->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001181}
1182
Jon Ashburn23d36b12016-02-02 17:47:28 -07001183LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1184vkDestroySemaphore(VkDevice device, VkSemaphore semaphore,
1185 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001186 const VkLayerDispatchTable *disp;
1187
1188 disp = loader_get_dispatch(device);
1189
Chia-I Wuf7458c52015-10-26 21:10:41 +08001190 disp->DestroySemaphore(device, semaphore, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001191}
1192
Jon Ashburn23d36b12016-02-02 17:47:28 -07001193LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1194vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo,
1195 const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) {
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->CreateEvent(device, pCreateInfo, pAllocator, pEvent);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001201}
1202
Jon Ashburn23d36b12016-02-02 17:47:28 -07001203LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1204vkDestroyEvent(VkDevice device, VkEvent event,
1205 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001206 const VkLayerDispatchTable *disp;
1207
1208 disp = loader_get_dispatch(device);
1209
Chia-I Wuf7458c52015-10-26 21:10:41 +08001210 disp->DestroyEvent(device, event, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001211}
1212
Jon Ashburn23d36b12016-02-02 17:47:28 -07001213LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1214vkGetEventStatus(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001215 const VkLayerDispatchTable *disp;
1216
1217 disp = loader_get_dispatch(device);
1218
1219 return disp->GetEventStatus(device, event);
1220}
1221
Jon Ashburn23d36b12016-02-02 17:47:28 -07001222LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1223vkSetEvent(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001224 const VkLayerDispatchTable *disp;
1225
1226 disp = loader_get_dispatch(device);
1227
1228 return disp->SetEvent(device, event);
1229}
1230
Jon Ashburn23d36b12016-02-02 17:47:28 -07001231LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1232vkResetEvent(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001233 const VkLayerDispatchTable *disp;
1234
1235 disp = loader_get_dispatch(device);
1236
1237 return disp->ResetEvent(device, event);
1238}
1239
Jon Ashburn23d36b12016-02-02 17:47:28 -07001240LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1241vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo,
1242 const VkAllocationCallbacks *pAllocator,
1243 VkQueryPool *pQueryPool) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001244 const VkLayerDispatchTable *disp;
1245
1246 disp = loader_get_dispatch(device);
1247
Chia-I Wuf7458c52015-10-26 21:10:41 +08001248 return disp->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001249}
1250
Jon Ashburn23d36b12016-02-02 17:47:28 -07001251LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1252vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool,
1253 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001254 const VkLayerDispatchTable *disp;
1255
1256 disp = loader_get_dispatch(device);
1257
Chia-I Wuf7458c52015-10-26 21:10:41 +08001258 disp->DestroyQueryPool(device, queryPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001259}
1260
Jon Ashburn23d36b12016-02-02 17:47:28 -07001261LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1262vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool,
1263 uint32_t firstQuery, uint32_t queryCount, size_t dataSize,
1264 void *pData, VkDeviceSize stride,
1265 VkQueryResultFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001266 const VkLayerDispatchTable *disp;
1267
1268 disp = loader_get_dispatch(device);
1269
Jon Ashburn23d36b12016-02-02 17:47:28 -07001270 return disp->GetQueryPoolResults(device, queryPool, firstQuery, queryCount,
1271 dataSize, pData, stride, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001272}
1273
Jon Ashburn23d36b12016-02-02 17:47:28 -07001274LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1275vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo,
1276 const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001277 const VkLayerDispatchTable *disp;
1278
1279 disp = loader_get_dispatch(device);
1280
Chia-I Wuf7458c52015-10-26 21:10:41 +08001281 return disp->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001282}
1283
Jon Ashburn23d36b12016-02-02 17:47:28 -07001284LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1285vkDestroyBuffer(VkDevice device, VkBuffer buffer,
1286 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001287 const VkLayerDispatchTable *disp;
1288
1289 disp = loader_get_dispatch(device);
1290
Chia-I Wuf7458c52015-10-26 21:10:41 +08001291 disp->DestroyBuffer(device, buffer, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001292}
1293
Jon Ashburn23d36b12016-02-02 17:47:28 -07001294LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1295vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo,
1296 const VkAllocationCallbacks *pAllocator,
1297 VkBufferView *pView) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001298 const VkLayerDispatchTable *disp;
1299
1300 disp = loader_get_dispatch(device);
1301
Chia-I Wuf7458c52015-10-26 21:10:41 +08001302 return disp->CreateBufferView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001303}
1304
Jon Ashburn23d36b12016-02-02 17:47:28 -07001305LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1306vkDestroyBufferView(VkDevice device, VkBufferView bufferView,
1307 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001308 const VkLayerDispatchTable *disp;
1309
1310 disp = loader_get_dispatch(device);
1311
Chia-I Wuf7458c52015-10-26 21:10:41 +08001312 disp->DestroyBufferView(device, bufferView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001313}
1314
Jon Ashburn23d36b12016-02-02 17:47:28 -07001315LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1316vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
1317 const VkAllocationCallbacks *pAllocator, VkImage *pImage) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001318 const VkLayerDispatchTable *disp;
1319
1320 disp = loader_get_dispatch(device);
1321
Chia-I Wuf7458c52015-10-26 21:10:41 +08001322 return disp->CreateImage(device, pCreateInfo, pAllocator, pImage);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001323}
1324
Jon Ashburn23d36b12016-02-02 17:47:28 -07001325LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1326vkDestroyImage(VkDevice device, VkImage image,
1327 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001328 const VkLayerDispatchTable *disp;
1329
1330 disp = loader_get_dispatch(device);
1331
Chia-I Wuf7458c52015-10-26 21:10:41 +08001332 disp->DestroyImage(device, image, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001333}
1334
Jon Ashburn23d36b12016-02-02 17:47:28 -07001335LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1336vkGetImageSubresourceLayout(VkDevice device, VkImage image,
1337 const VkImageSubresource *pSubresource,
1338 VkSubresourceLayout *pLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001339 const VkLayerDispatchTable *disp;
1340
1341 disp = loader_get_dispatch(device);
1342
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001343 disp->GetImageSubresourceLayout(device, image, pSubresource, pLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001344}
1345
Jon Ashburn23d36b12016-02-02 17:47:28 -07001346LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1347vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo,
1348 const VkAllocationCallbacks *pAllocator, VkImageView *pView) {
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->CreateImageView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001354}
1355
Jon Ashburn23d36b12016-02-02 17:47:28 -07001356LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1357vkDestroyImageView(VkDevice device, VkImageView imageView,
1358 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001359 const VkLayerDispatchTable *disp;
1360
1361 disp = loader_get_dispatch(device);
1362
Chia-I Wuf7458c52015-10-26 21:10:41 +08001363 disp->DestroyImageView(device, imageView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001364}
1365
Jon Ashburn23d36b12016-02-02 17:47:28 -07001366LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1367vkCreateShaderModule(VkDevice device,
1368 const VkShaderModuleCreateInfo *pCreateInfo,
1369 const VkAllocationCallbacks *pAllocator,
1370 VkShaderModule *pShader) {
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -06001371 const VkLayerDispatchTable *disp;
1372
1373 disp = loader_get_dispatch(device);
1374
Chia-I Wuf7458c52015-10-26 21:10:41 +08001375 return disp->CreateShaderModule(device, pCreateInfo, pAllocator, pShader);
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -06001376}
1377
Jon Ashburn23d36b12016-02-02 17:47:28 -07001378LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1379vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule,
1380 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001381 const VkLayerDispatchTable *disp;
1382
1383 disp = loader_get_dispatch(device);
1384
Chia-I Wuf7458c52015-10-26 21:10:41 +08001385 disp->DestroyShaderModule(device, shaderModule, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001386}
1387
Jon Ashburn23d36b12016-02-02 17:47:28 -07001388LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1389vkCreatePipelineCache(VkDevice device,
1390 const VkPipelineCacheCreateInfo *pCreateInfo,
1391 const VkAllocationCallbacks *pAllocator,
1392 VkPipelineCache *pPipelineCache) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001393 const VkLayerDispatchTable *disp;
1394
1395 disp = loader_get_dispatch(device);
1396
Jon Ashburn23d36b12016-02-02 17:47:28 -07001397 return disp->CreatePipelineCache(device, pCreateInfo, pAllocator,
1398 pPipelineCache);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001399}
1400
Jon Ashburn23d36b12016-02-02 17:47:28 -07001401LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1402vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache,
1403 const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001404 const VkLayerDispatchTable *disp;
1405
1406 disp = loader_get_dispatch(device);
1407
Chia-I Wuf7458c52015-10-26 21:10:41 +08001408 disp->DestroyPipelineCache(device, pipelineCache, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001409}
1410
Jon Ashburn23d36b12016-02-02 17:47:28 -07001411LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1412vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache,
1413 size_t *pDataSize, void *pData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001414 const VkLayerDispatchTable *disp;
1415
1416 disp = loader_get_dispatch(device);
1417
Chia-I Wub16facd2015-10-26 19:17:06 +08001418 return disp->GetPipelineCacheData(device, pipelineCache, pDataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001419}
1420
Jon Ashburn23d36b12016-02-02 17:47:28 -07001421LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1422vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache,
1423 uint32_t srcCacheCount,
1424 const VkPipelineCache *pSrcCaches) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001425 const VkLayerDispatchTable *disp;
1426
1427 disp = loader_get_dispatch(device);
1428
Jon Ashburn23d36b12016-02-02 17:47:28 -07001429 return disp->MergePipelineCaches(device, dstCache, srcCacheCount,
1430 pSrcCaches);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001431}
1432
Jon Ashburn23d36b12016-02-02 17:47:28 -07001433LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1434vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache,
1435 uint32_t createInfoCount,
1436 const VkGraphicsPipelineCreateInfo *pCreateInfos,
1437 const VkAllocationCallbacks *pAllocator,
1438 VkPipeline *pPipelines) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001439 const VkLayerDispatchTable *disp;
1440
1441 disp = loader_get_dispatch(device);
1442
Jon Ashburn23d36b12016-02-02 17:47:28 -07001443 return disp->CreateGraphicsPipelines(device, pipelineCache, createInfoCount,
1444 pCreateInfos, pAllocator, pPipelines);
Jon Ashburnc669cc62015-07-09 15:02:25 -06001445}
1446
Jon Ashburn23d36b12016-02-02 17:47:28 -07001447LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1448vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache,
1449 uint32_t createInfoCount,
1450 const VkComputePipelineCreateInfo *pCreateInfos,
1451 const VkAllocationCallbacks *pAllocator,
1452 VkPipeline *pPipelines) {
Jon Ashburnc669cc62015-07-09 15:02:25 -06001453 const VkLayerDispatchTable *disp;
1454
1455 disp = loader_get_dispatch(device);
1456
Jon Ashburn23d36b12016-02-02 17:47:28 -07001457 return disp->CreateComputePipelines(device, pipelineCache, createInfoCount,
1458 pCreateInfos, pAllocator, pPipelines);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001459}
1460
Jon Ashburn23d36b12016-02-02 17:47:28 -07001461LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1462vkDestroyPipeline(VkDevice device, VkPipeline pipeline,
1463 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001464 const VkLayerDispatchTable *disp;
1465
1466 disp = loader_get_dispatch(device);
1467
Chia-I Wuf7458c52015-10-26 21:10:41 +08001468 disp->DestroyPipeline(device, pipeline, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001469}
1470
Jon Ashburn23d36b12016-02-02 17:47:28 -07001471LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1472vkCreatePipelineLayout(VkDevice device,
1473 const VkPipelineLayoutCreateInfo *pCreateInfo,
1474 const VkAllocationCallbacks *pAllocator,
1475 VkPipelineLayout *pPipelineLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001476 const VkLayerDispatchTable *disp;
1477
1478 disp = loader_get_dispatch(device);
1479
Jon Ashburn23d36b12016-02-02 17:47:28 -07001480 return disp->CreatePipelineLayout(device, pCreateInfo, pAllocator,
1481 pPipelineLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001482}
1483
Jon Ashburn23d36b12016-02-02 17:47:28 -07001484LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1485vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout,
1486 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001487 const VkLayerDispatchTable *disp;
1488
1489 disp = loader_get_dispatch(device);
1490
Chia-I Wuf7458c52015-10-26 21:10:41 +08001491 disp->DestroyPipelineLayout(device, pipelineLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001492}
1493
Jon Ashburn23d36b12016-02-02 17:47:28 -07001494LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1495vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo,
1496 const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001497 const VkLayerDispatchTable *disp;
1498
1499 disp = loader_get_dispatch(device);
1500
Chia-I Wuf7458c52015-10-26 21:10:41 +08001501 return disp->CreateSampler(device, pCreateInfo, pAllocator, pSampler);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001502}
1503
Jon Ashburn23d36b12016-02-02 17:47:28 -07001504LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1505vkDestroySampler(VkDevice device, VkSampler sampler,
1506 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001507 const VkLayerDispatchTable *disp;
1508
1509 disp = loader_get_dispatch(device);
1510
Chia-I Wuf7458c52015-10-26 21:10:41 +08001511 disp->DestroySampler(device, sampler, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001512}
1513
Jon Ashburn23d36b12016-02-02 17:47:28 -07001514LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1515vkCreateDescriptorSetLayout(VkDevice device,
1516 const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
1517 const VkAllocationCallbacks *pAllocator,
1518 VkDescriptorSetLayout *pSetLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001519 const VkLayerDispatchTable *disp;
1520
1521 disp = loader_get_dispatch(device);
1522
Jon Ashburn23d36b12016-02-02 17:47:28 -07001523 return disp->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator,
1524 pSetLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001525}
1526
Jon Ashburn23d36b12016-02-02 17:47:28 -07001527LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1528vkDestroyDescriptorSetLayout(VkDevice device,
1529 VkDescriptorSetLayout descriptorSetLayout,
1530 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001531 const VkLayerDispatchTable *disp;
1532
1533 disp = loader_get_dispatch(device);
1534
Chia-I Wuf7458c52015-10-26 21:10:41 +08001535 disp->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001536}
1537
Jon Ashburn23d36b12016-02-02 17:47:28 -07001538LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1539vkCreateDescriptorPool(VkDevice device,
1540 const VkDescriptorPoolCreateInfo *pCreateInfo,
1541 const VkAllocationCallbacks *pAllocator,
1542 VkDescriptorPool *pDescriptorPool) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001543 const VkLayerDispatchTable *disp;
1544
1545 disp = loader_get_dispatch(device);
1546
Jon Ashburn23d36b12016-02-02 17:47:28 -07001547 return disp->CreateDescriptorPool(device, pCreateInfo, pAllocator,
1548 pDescriptorPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001549}
1550
Jon Ashburn23d36b12016-02-02 17:47:28 -07001551LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1552vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
1553 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001554 const VkLayerDispatchTable *disp;
1555
1556 disp = loader_get_dispatch(device);
1557
Chia-I Wuf7458c52015-10-26 21:10:41 +08001558 disp->DestroyDescriptorPool(device, descriptorPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001559}
1560
Jon Ashburn23d36b12016-02-02 17:47:28 -07001561LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1562vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
1563 VkDescriptorPoolResetFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001564 const VkLayerDispatchTable *disp;
1565
1566 disp = loader_get_dispatch(device);
1567
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001568 return disp->ResetDescriptorPool(device, descriptorPool, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001569}
1570
Jon Ashburn23d36b12016-02-02 17:47:28 -07001571LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1572vkAllocateDescriptorSets(VkDevice device,
1573 const VkDescriptorSetAllocateInfo *pAllocateInfo,
1574 VkDescriptorSet *pDescriptorSets) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001575 const VkLayerDispatchTable *disp;
1576
1577 disp = loader_get_dispatch(device);
1578
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001579 return disp->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001580}
1581
Jon Ashburn23d36b12016-02-02 17:47:28 -07001582LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1583vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool,
1584 uint32_t descriptorSetCount,
1585 const VkDescriptorSet *pDescriptorSets) {
Tony Barbour34ec6922015-07-10 10:50:45 -06001586 const VkLayerDispatchTable *disp;
1587
1588 disp = loader_get_dispatch(device);
1589
Jon Ashburn23d36b12016-02-02 17:47:28 -07001590 return disp->FreeDescriptorSets(device, descriptorPool, descriptorSetCount,
1591 pDescriptorSets);
Tony Barbour34ec6922015-07-10 10:50:45 -06001592}
1593
Jon Ashburn23d36b12016-02-02 17:47:28 -07001594LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1595vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount,
1596 const VkWriteDescriptorSet *pDescriptorWrites,
1597 uint32_t descriptorCopyCount,
1598 const VkCopyDescriptorSet *pDescriptorCopies) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001599 const VkLayerDispatchTable *disp;
1600
1601 disp = loader_get_dispatch(device);
1602
Jon Ashburn23d36b12016-02-02 17:47:28 -07001603 disp->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites,
1604 descriptorCopyCount, pDescriptorCopies);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001605}
1606
Jon Ashburn23d36b12016-02-02 17:47:28 -07001607LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1608vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo,
1609 const VkAllocationCallbacks *pAllocator,
1610 VkFramebuffer *pFramebuffer) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001611 const VkLayerDispatchTable *disp;
1612
1613 disp = loader_get_dispatch(device);
1614
Jon Ashburn23d36b12016-02-02 17:47:28 -07001615 return disp->CreateFramebuffer(device, pCreateInfo, pAllocator,
1616 pFramebuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001617}
1618
Jon Ashburn23d36b12016-02-02 17:47:28 -07001619LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1620vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer,
1621 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001622 const VkLayerDispatchTable *disp;
1623
1624 disp = loader_get_dispatch(device);
1625
Chia-I Wuf7458c52015-10-26 21:10:41 +08001626 disp->DestroyFramebuffer(device, framebuffer, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -06001627}
1628
Jon Ashburn23d36b12016-02-02 17:47:28 -07001629LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1630vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
1631 const VkAllocationCallbacks *pAllocator,
1632 VkRenderPass *pRenderPass) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001633 const VkLayerDispatchTable *disp;
1634
1635 disp = loader_get_dispatch(device);
1636
Chia-I Wuf7458c52015-10-26 21:10:41 +08001637 return disp->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
Jon Ashburn754864f2015-07-23 18:49:07 -06001638}
1639
Jon Ashburn23d36b12016-02-02 17:47:28 -07001640LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1641vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass,
1642 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001643 const VkLayerDispatchTable *disp;
1644
1645 disp = loader_get_dispatch(device);
1646
Chia-I Wuf7458c52015-10-26 21:10:41 +08001647 disp->DestroyRenderPass(device, renderPass, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -06001648}
1649
Jon Ashburn23d36b12016-02-02 17:47:28 -07001650LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1651vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass,
1652 VkExtent2D *pGranularity) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001653 const VkLayerDispatchTable *disp;
1654
1655 disp = loader_get_dispatch(device);
1656
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001657 disp->GetRenderAreaGranularity(device, renderPass, pGranularity);
Jon Ashburn754864f2015-07-23 18:49:07 -06001658}
1659
Jon Ashburn23d36b12016-02-02 17:47:28 -07001660LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1661vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo,
1662 const VkAllocationCallbacks *pAllocator,
1663 VkCommandPool *pCommandPool) {
Cody Northrope62183e2015-07-09 18:08:05 -06001664 const VkLayerDispatchTable *disp;
1665
1666 disp = loader_get_dispatch(device);
1667
Jon Ashburn23d36b12016-02-02 17:47:28 -07001668 return disp->CreateCommandPool(device, pCreateInfo, pAllocator,
1669 pCommandPool);
Cody Northrope62183e2015-07-09 18:08:05 -06001670}
1671
Jon Ashburn23d36b12016-02-02 17:47:28 -07001672LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1673vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool,
1674 const VkAllocationCallbacks *pAllocator) {
Cody Northrope62183e2015-07-09 18:08:05 -06001675 const VkLayerDispatchTable *disp;
1676
1677 disp = loader_get_dispatch(device);
1678
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001679 disp->DestroyCommandPool(device, commandPool, pAllocator);
Cody Northrope62183e2015-07-09 18:08:05 -06001680}
1681
Jon Ashburn23d36b12016-02-02 17:47:28 -07001682LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1683vkResetCommandPool(VkDevice device, VkCommandPool commandPool,
1684 VkCommandPoolResetFlags flags) {
Cody Northrope62183e2015-07-09 18:08:05 -06001685 const VkLayerDispatchTable *disp;
1686
1687 disp = loader_get_dispatch(device);
1688
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001689 return disp->ResetCommandPool(device, commandPool, flags);
Cody Northrope62183e2015-07-09 18:08:05 -06001690}
1691
Jon Ashburn23d36b12016-02-02 17:47:28 -07001692LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1693vkAllocateCommandBuffers(VkDevice device,
1694 const VkCommandBufferAllocateInfo *pAllocateInfo,
1695 VkCommandBuffer *pCommandBuffers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001696 const VkLayerDispatchTable *disp;
1697 VkResult res;
1698
1699 disp = loader_get_dispatch(device);
1700
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001701 res = disp->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001702 if (res == VK_SUCCESS) {
Jon Ashburn23d36b12016-02-02 17:47:28 -07001703 for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; i++) {
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001704 if (pCommandBuffers[i]) {
1705 loader_init_dispatch(pCommandBuffers[i], disp);
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001706 }
1707 }
Jon Ashburnd55a3942015-05-06 09:02:10 -06001708 }
1709
1710 return res;
1711}
1712
Jon Ashburn23d36b12016-02-02 17:47:28 -07001713LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1714vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool,
1715 uint32_t commandBufferCount,
1716 const VkCommandBuffer *pCommandBuffers) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001717 const VkLayerDispatchTable *disp;
1718
1719 disp = loader_get_dispatch(device);
1720
Jon Ashburn23d36b12016-02-02 17:47:28 -07001721 disp->FreeCommandBuffers(device, commandPool, commandBufferCount,
1722 pCommandBuffers);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001723}
1724
Jon Ashburn23d36b12016-02-02 17:47:28 -07001725LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1726vkBeginCommandBuffer(VkCommandBuffer commandBuffer,
1727 const VkCommandBufferBeginInfo *pBeginInfo) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001728 const VkLayerDispatchTable *disp;
1729
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001730 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001731
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001732 return disp->BeginCommandBuffer(commandBuffer, pBeginInfo);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001733}
1734
Jon Ashburn23d36b12016-02-02 17:47:28 -07001735LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1736vkEndCommandBuffer(VkCommandBuffer commandBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001737 const VkLayerDispatchTable *disp;
1738
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001739 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001740
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001741 return disp->EndCommandBuffer(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001742}
1743
Jon Ashburn23d36b12016-02-02 17:47:28 -07001744LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1745vkResetCommandBuffer(VkCommandBuffer commandBuffer,
1746 VkCommandBufferResetFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001747 const VkLayerDispatchTable *disp;
1748
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001749 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001750
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001751 return disp->ResetCommandBuffer(commandBuffer, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001752}
1753
Jon Ashburn23d36b12016-02-02 17:47:28 -07001754LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1755vkCmdBindPipeline(VkCommandBuffer commandBuffer,
1756 VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001757 const VkLayerDispatchTable *disp;
1758
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001759 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001760
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001761 disp->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001762}
1763
Jon Ashburn23d36b12016-02-02 17:47:28 -07001764LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1765vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport,
1766 uint32_t viewportCount, const VkViewport *pViewports) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001767 const VkLayerDispatchTable *disp;
1768
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001769 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001770
Jon Ashburn23d36b12016-02-02 17:47:28 -07001771 disp->CmdSetViewport(commandBuffer, firstViewport, viewportCount,
1772 pViewports);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001773}
1774
Jon Ashburn23d36b12016-02-02 17:47:28 -07001775LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1776vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor,
1777 uint32_t scissorCount, const VkRect2D *pScissors) {
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001778 const VkLayerDispatchTable *disp;
1779
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001780 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001781
Jon Ashburn19d3bf12015-12-30 14:06:55 -07001782 disp->CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001783}
1784
Jon Ashburn23d36b12016-02-02 17:47:28 -07001785LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1786vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001787 const VkLayerDispatchTable *disp;
1788
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001789 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001790
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001791 disp->CmdSetLineWidth(commandBuffer, lineWidth);
Cody Northrop12365112015-08-17 11:10:49 -06001792}
1793
Jon Ashburn23d36b12016-02-02 17:47:28 -07001794LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1795vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor,
1796 float depthBiasClamp, float depthBiasSlopeFactor) {
Cody Northrop12365112015-08-17 11:10:49 -06001797 const VkLayerDispatchTable *disp;
1798
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001799 disp = loader_get_dispatch(commandBuffer);
Cody Northrop12365112015-08-17 11:10:49 -06001800
Jon Ashburn23d36b12016-02-02 17:47:28 -07001801 disp->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor,
1802 depthBiasClamp, depthBiasSlopeFactor);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001803}
1804
Jon Ashburn23d36b12016-02-02 17:47:28 -07001805LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1806vkCmdSetBlendConstants(VkCommandBuffer commandBuffer,
1807 const float blendConstants[4]) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001808 const VkLayerDispatchTable *disp;
1809
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001810 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001811
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001812 disp->CmdSetBlendConstants(commandBuffer, blendConstants);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001813}
1814
Jon Ashburn23d36b12016-02-02 17:47:28 -07001815LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1816vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds,
1817 float maxDepthBounds) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001818 const VkLayerDispatchTable *disp;
1819
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001820 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001821
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001822 disp->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
Cody Northrop82485a82015-08-18 15:21:16 -06001823}
1824
Jon Ashburn23d36b12016-02-02 17:47:28 -07001825LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1826vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer,
1827 VkStencilFaceFlags faceMask, uint32_t compareMask) {
Cody Northrop82485a82015-08-18 15:21:16 -06001828 const VkLayerDispatchTable *disp;
1829
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001830 disp = loader_get_dispatch(commandBuffer);
Cody Northrop82485a82015-08-18 15:21:16 -06001831
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001832 disp->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001833}
1834
Jon Ashburn23d36b12016-02-02 17:47:28 -07001835LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1836vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer,
1837 VkStencilFaceFlags faceMask, uint32_t writeMask) {
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001838 const VkLayerDispatchTable *disp;
1839
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001840 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001841
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001842 disp->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001843}
1844
Jon Ashburn23d36b12016-02-02 17:47:28 -07001845LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1846vkCmdSetStencilReference(VkCommandBuffer commandBuffer,
1847 VkStencilFaceFlags faceMask, uint32_t reference) {
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001848 const VkLayerDispatchTable *disp;
1849
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001850 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001851
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001852 disp->CmdSetStencilReference(commandBuffer, faceMask, reference);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001853}
1854
Jon Ashburn23d36b12016-02-02 17:47:28 -07001855LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets(
1856 VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
1857 VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount,
1858 const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount,
1859 const uint32_t *pDynamicOffsets) {
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
Jon Ashburn23d36b12016-02-02 17:47:28 -07001864 disp->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout,
1865 firstSet, descriptorSetCount, pDescriptorSets,
1866 dynamicOffsetCount, pDynamicOffsets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001867}
1868
Jon Ashburn23d36b12016-02-02 17:47:28 -07001869LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1870vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer,
1871 VkDeviceSize offset, VkIndexType indexType) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001872 const VkLayerDispatchTable *disp;
1873
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001874 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001875
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001876 disp->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001877}
1878
Jon Ashburn23d36b12016-02-02 17:47:28 -07001879LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1880vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding,
1881 uint32_t bindingCount, const VkBuffer *pBuffers,
1882 const VkDeviceSize *pOffsets) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001883 const VkLayerDispatchTable *disp;
1884
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001885 disp = loader_get_dispatch(commandBuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001886
Jon Ashburn23d36b12016-02-02 17:47:28 -07001887 disp->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount,
1888 pBuffers, pOffsets);
Jon Ashburn754864f2015-07-23 18:49:07 -06001889}
1890
Jon Ashburn23d36b12016-02-02 17:47:28 -07001891LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1892vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount,
1893 uint32_t instanceCount, uint32_t firstVertex,
1894 uint32_t firstInstance) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001895 const VkLayerDispatchTable *disp;
1896
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001897 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001898
Jon Ashburn23d36b12016-02-02 17:47:28 -07001899 disp->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex,
1900 firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001901}
1902
Jon Ashburn23d36b12016-02-02 17:47:28 -07001903LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1904vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount,
1905 uint32_t instanceCount, uint32_t firstIndex,
1906 int32_t vertexOffset, uint32_t firstInstance) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001907 const VkLayerDispatchTable *disp;
1908
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001909 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001910
Jon Ashburn23d36b12016-02-02 17:47:28 -07001911 disp->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex,
1912 vertexOffset, firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001913}
1914
Jon Ashburn23d36b12016-02-02 17:47:28 -07001915LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1916vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1917 VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001918 const VkLayerDispatchTable *disp;
1919
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001920 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001921
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001922 disp->CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001923}
1924
Jon Ashburn23d36b12016-02-02 17:47:28 -07001925LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1926vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1927 VkDeviceSize offset, uint32_t drawCount,
1928 uint32_t stride) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001929 const VkLayerDispatchTable *disp;
1930
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001931 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001932
Jon Ashburn23d36b12016-02-02 17:47:28 -07001933 disp->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount,
1934 stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001935}
1936
Jon Ashburn23d36b12016-02-02 17:47:28 -07001937LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1938vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y,
1939 uint32_t z) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001940 const VkLayerDispatchTable *disp;
1941
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001942 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001943
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001944 disp->CmdDispatch(commandBuffer, x, y, z);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001945}
1946
Jon Ashburn23d36b12016-02-02 17:47:28 -07001947LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1948vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1949 VkDeviceSize offset) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001950 const VkLayerDispatchTable *disp;
1951
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001952 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001953
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001954 disp->CmdDispatchIndirect(commandBuffer, buffer, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001955}
1956
Jon Ashburn23d36b12016-02-02 17:47:28 -07001957LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1958vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer,
1959 VkBuffer dstBuffer, uint32_t regionCount,
1960 const VkBufferCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001961 const VkLayerDispatchTable *disp;
1962
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001963 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001964
Jon Ashburn23d36b12016-02-02 17:47:28 -07001965 disp->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount,
1966 pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001967}
1968
Jon Ashburn23d36b12016-02-02 17:47:28 -07001969LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1970vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage,
1971 VkImageLayout srcImageLayout, VkImage dstImage,
1972 VkImageLayout dstImageLayout, uint32_t regionCount,
1973 const VkImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001974 const VkLayerDispatchTable *disp;
1975
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001976 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001977
Jon Ashburn23d36b12016-02-02 17:47:28 -07001978 disp->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage,
1979 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001980}
1981
Jon Ashburn23d36b12016-02-02 17:47:28 -07001982LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1983vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage,
1984 VkImageLayout srcImageLayout, VkImage dstImage,
1985 VkImageLayout dstImageLayout, uint32_t regionCount,
1986 const VkImageBlit *pRegions, VkFilter filter) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001987 const VkLayerDispatchTable *disp;
1988
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001989 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001990
Jon Ashburn23d36b12016-02-02 17:47:28 -07001991 disp->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage,
1992 dstImageLayout, regionCount, pRegions, filter);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001993}
1994
Jon Ashburn23d36b12016-02-02 17:47:28 -07001995LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1996vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer,
1997 VkImage dstImage, VkImageLayout dstImageLayout,
1998 uint32_t regionCount,
1999 const VkBufferImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002000 const VkLayerDispatchTable *disp;
2001
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002002 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002003
Jon Ashburn23d36b12016-02-02 17:47:28 -07002004 disp->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage,
2005 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002006}
2007
Jon Ashburn23d36b12016-02-02 17:47:28 -07002008LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2009vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage,
2010 VkImageLayout srcImageLayout, VkBuffer dstBuffer,
2011 uint32_t regionCount,
2012 const VkBufferImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002013 const VkLayerDispatchTable *disp;
2014
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002015 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002016
Jon Ashburn23d36b12016-02-02 17:47:28 -07002017 disp->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout,
2018 dstBuffer, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002019}
2020
Jon Ashburn23d36b12016-02-02 17:47:28 -07002021LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2022vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
2023 VkDeviceSize dstOffset, VkDeviceSize dataSize,
2024 const uint32_t *pData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002025 const VkLayerDispatchTable *disp;
2026
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002027 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002028
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002029 disp->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002030}
2031
Jon Ashburn23d36b12016-02-02 17:47:28 -07002032LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2033vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
2034 VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002035 const VkLayerDispatchTable *disp;
2036
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002037 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002038
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002039 disp->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002040}
2041
Jon Ashburn23d36b12016-02-02 17:47:28 -07002042LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2043vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image,
2044 VkImageLayout imageLayout, const VkClearColorValue *pColor,
2045 uint32_t rangeCount,
2046 const VkImageSubresourceRange *pRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002047 const VkLayerDispatchTable *disp;
2048
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002049 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002050
Jon Ashburn23d36b12016-02-02 17:47:28 -07002051 disp->CmdClearColorImage(commandBuffer, image, imageLayout, pColor,
2052 rangeCount, pRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002053}
2054
Jon Ashburn23d36b12016-02-02 17:47:28 -07002055LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2056vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image,
2057 VkImageLayout imageLayout,
2058 const VkClearDepthStencilValue *pDepthStencil,
2059 uint32_t rangeCount,
2060 const VkImageSubresourceRange *pRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002061 const VkLayerDispatchTable *disp;
2062
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002063 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002064
Jon Ashburn23d36b12016-02-02 17:47:28 -07002065 disp->CmdClearDepthStencilImage(commandBuffer, image, imageLayout,
2066 pDepthStencil, rangeCount, pRanges);
Chris Forbesd9be82b2015-06-22 17:21:59 +12002067}
2068
Jon Ashburn23d36b12016-02-02 17:47:28 -07002069LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2070vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
2071 const VkClearAttachment *pAttachments, uint32_t rectCount,
2072 const VkClearRect *pRects) {
Chris Forbesd9be82b2015-06-22 17:21:59 +12002073 const VkLayerDispatchTable *disp;
2074
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002075 disp = loader_get_dispatch(commandBuffer);
Chris Forbesd9be82b2015-06-22 17:21:59 +12002076
Jon Ashburn23d36b12016-02-02 17:47:28 -07002077 disp->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments,
2078 rectCount, pRects);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002079}
2080
Jon Ashburn23d36b12016-02-02 17:47:28 -07002081LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2082vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage,
2083 VkImageLayout srcImageLayout, VkImage dstImage,
2084 VkImageLayout dstImageLayout, uint32_t regionCount,
2085 const VkImageResolve *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002086 const VkLayerDispatchTable *disp;
2087
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002088 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002089
Jon Ashburn23d36b12016-02-02 17:47:28 -07002090 disp->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage,
2091 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002092}
2093
Jon Ashburn23d36b12016-02-02 17:47:28 -07002094LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2095vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event,
2096 VkPipelineStageFlags stageMask) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002097 const VkLayerDispatchTable *disp;
2098
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002099 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002100
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002101 disp->CmdSetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002102}
2103
Jon Ashburn23d36b12016-02-02 17:47:28 -07002104LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2105vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event,
2106 VkPipelineStageFlags stageMask) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002107 const VkLayerDispatchTable *disp;
2108
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002109 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002110
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002111 disp->CmdResetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002112}
2113
Jon Ashburn23d36b12016-02-02 17:47:28 -07002114LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2115vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount,
2116 const VkEvent *pEvents, VkPipelineStageFlags sourceStageMask,
2117 VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount,
2118 const VkMemoryBarrier *pMemoryBarriers,
2119 uint32_t bufferMemoryBarrierCount,
2120 const VkBufferMemoryBarrier *pBufferMemoryBarriers,
2121 uint32_t imageMemoryBarrierCount,
2122 const VkImageMemoryBarrier *pImageMemoryBarriers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002123 const VkLayerDispatchTable *disp;
2124
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002125 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002126
Jon Ashburnf19916e2016-01-11 13:12:43 -07002127 disp->CmdWaitEvents(commandBuffer, eventCount, pEvents, sourceStageMask,
2128 dstStageMask, memoryBarrierCount, pMemoryBarriers,
2129 bufferMemoryBarrierCount, pBufferMemoryBarriers,
2130 imageMemoryBarrierCount, pImageMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002131}
2132
Jon Ashburnf19916e2016-01-11 13:12:43 -07002133LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier(
Jon Ashburn23d36b12016-02-02 17:47:28 -07002134 VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask,
2135 VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags,
2136 uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers,
2137 uint32_t bufferMemoryBarrierCount,
2138 const VkBufferMemoryBarrier *pBufferMemoryBarriers,
2139 uint32_t imageMemoryBarrierCount,
2140 const VkImageMemoryBarrier *pImageMemoryBarriers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002141 const VkLayerDispatchTable *disp;
2142
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002143 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002144
Jon Ashburn23d36b12016-02-02 17:47:28 -07002145 disp->CmdPipelineBarrier(
2146 commandBuffer, srcStageMask, dstStageMask, dependencyFlags,
2147 memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount,
2148 pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002149}
2150
Jon Ashburn23d36b12016-02-02 17:47:28 -07002151LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2152vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2153 uint32_t slot, VkFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002154 const VkLayerDispatchTable *disp;
2155
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002156 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002157
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002158 disp->CmdBeginQuery(commandBuffer, queryPool, slot, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002159}
2160
Jon Ashburn23d36b12016-02-02 17:47:28 -07002161LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2162vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2163 uint32_t slot) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002164 const VkLayerDispatchTable *disp;
2165
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002166 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002167
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002168 disp->CmdEndQuery(commandBuffer, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002169}
2170
Jon Ashburn23d36b12016-02-02 17:47:28 -07002171LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2172vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2173 uint32_t firstQuery, uint32_t queryCount) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002174 const VkLayerDispatchTable *disp;
2175
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002176 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002177
Jon Ashburn19d3bf12015-12-30 14:06:55 -07002178 disp->CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002179}
2180
Jon Ashburn23d36b12016-02-02 17:47:28 -07002181LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2182vkCmdWriteTimestamp(VkCommandBuffer commandBuffer,
2183 VkPipelineStageFlagBits pipelineStage,
2184 VkQueryPool queryPool, uint32_t slot) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002185 const VkLayerDispatchTable *disp;
2186
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002187 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002188
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002189 disp->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002190}
2191
Jon Ashburn23d36b12016-02-02 17:47:28 -07002192LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2193vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2194 uint32_t firstQuery, uint32_t queryCount,
2195 VkBuffer dstBuffer, VkDeviceSize dstOffset,
2196 VkDeviceSize stride, VkFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002197 const VkLayerDispatchTable *disp;
2198
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002199 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002200
Jon Ashburn23d36b12016-02-02 17:47:28 -07002201 disp->CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery,
2202 queryCount, dstBuffer, dstOffset, stride,
2203 flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002204}
2205
Jon Ashburn23d36b12016-02-02 17:47:28 -07002206LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2207vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout,
2208 VkShaderStageFlags stageFlags, uint32_t offset,
2209 uint32_t size, const void *pValues) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002210 const VkLayerDispatchTable *disp;
2211
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002212 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002213
Jon Ashburn23d36b12016-02-02 17:47:28 -07002214 disp->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size,
2215 pValues);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06002216}
2217
Jon Ashburn23d36b12016-02-02 17:47:28 -07002218LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2219vkCmdBeginRenderPass(VkCommandBuffer commandBuffer,
2220 const VkRenderPassBeginInfo *pRenderPassBegin,
2221 VkSubpassContents contents) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002222 const VkLayerDispatchTable *disp;
2223
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002224 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002225
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002226 disp->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
Chia-I Wu08accc62015-07-07 11:50:03 +08002227}
2228
Jon Ashburn23d36b12016-02-02 17:47:28 -07002229LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2230vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) {
Chia-I Wu08accc62015-07-07 11:50:03 +08002231 const VkLayerDispatchTable *disp;
2232
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002233 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu08accc62015-07-07 11:50:03 +08002234
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002235 disp->CmdNextSubpass(commandBuffer, contents);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002236}
2237
Jon Ashburn23d36b12016-02-02 17:47:28 -07002238LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2239vkCmdEndRenderPass(VkCommandBuffer commandBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002240 const VkLayerDispatchTable *disp;
2241
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002242 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002243
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002244 disp->CmdEndRenderPass(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002245}
2246
Jon Ashburn23d36b12016-02-02 17:47:28 -07002247LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2248vkCmdExecuteCommands(VkCommandBuffer commandBuffer,
2249 uint32_t commandBuffersCount,
2250 const VkCommandBuffer *pCommandBuffers) {
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002251 const VkLayerDispatchTable *disp;
2252
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002253 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002254
Jon Ashburn23d36b12016-02-02 17:47:28 -07002255 disp->CmdExecuteCommands(commandBuffer, commandBuffersCount,
2256 pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002257}