blob: f4370a5e62a9b0d2db038464aeb12ff6bd318347 [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;
129 struct loader_extension_list icd_extensions;
130 struct loader_icd_libs icd_libs;
131 uint32_t copy_size;
132
133 tls_instance = NULL;
134 memset(&icd_extensions, 0, sizeof(icd_extensions));
135 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) {
140 if (vk_string_validate(MaxLoaderStringLength, pLayerName) ==
141 VK_STRING_ERROR_NONE) {
142 loader_layer_scan(NULL, &instance_layers, NULL);
143 for (uint32_t i = 0; i < instance_layers.count; i++) {
144 struct loader_layer_properties *props =
145 &instance_layers.list[i];
146 if (strcmp(props->info.layerName, pLayerName) == 0) {
147 global_ext_list = &props->instance_extension_list;
148 }
149 }
150 } else {
151 assert(VK_FALSE && "vkEnumerateInstanceExtensionProperties: "
152 "pLayerName is too long or is badly formed");
153 return VK_ERROR_EXTENSION_NOT_PRESENT;
154 }
155 } else {
156 /* Scan/discover all ICD libraries */
157 memset(&icd_libs, 0, sizeof(struct loader_icd_libs));
158 loader_icd_scan(NULL, &icd_libs);
159 /* get extensions from all ICD's, merge so no duplicates */
160 loader_get_icd_loader_instance_extensions(NULL, &icd_libs,
161 &icd_extensions);
162 loader_scanned_icd_clear(NULL, &icd_libs);
163 global_ext_list = &icd_extensions;
164 }
165
166 if (global_ext_list == NULL) {
167 loader_destroy_layer_list(NULL, &instance_layers);
168 return VK_ERROR_LAYER_NOT_PRESENT;
169 }
170
171 if (pProperties == NULL) {
172 *pPropertyCount = global_ext_list->count;
173 loader_destroy_layer_list(NULL, &instance_layers);
174 loader_destroy_generic_list(
175 NULL, (struct loader_generic_list *)&icd_extensions);
176 return VK_SUCCESS;
177 }
178
179 copy_size = *pPropertyCount < global_ext_list->count
180 ? *pPropertyCount
181 : global_ext_list->count;
182 for (uint32_t i = 0; i < copy_size; i++) {
183 memcpy(&pProperties[i], &global_ext_list->list[i],
184 sizeof(VkExtensionProperties));
185 }
186 *pPropertyCount = copy_size;
187 loader_destroy_generic_list(NULL,
188 (struct loader_generic_list *)&icd_extensions);
189
190 if (copy_size < global_ext_list->count) {
191 loader_destroy_layer_list(NULL, &instance_layers);
192 return VK_INCOMPLETE;
193 }
194
195 loader_destroy_layer_list(NULL, &instance_layers);
196 return VK_SUCCESS;
197}
198
199LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
200vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount,
201 VkLayerProperties *pProperties) {
202
203 struct loader_layer_list instance_layer_list;
204 tls_instance = NULL;
205
206 loader_platform_thread_once(&once_init, loader_initialize);
207
208 uint32_t copy_size;
209
210 /* get layer libraries */
211 memset(&instance_layer_list, 0, sizeof(instance_layer_list));
212 loader_layer_scan(NULL, &instance_layer_list, NULL);
213
214 if (pProperties == NULL) {
215 *pPropertyCount = instance_layer_list.count;
216 loader_destroy_layer_list(NULL, &instance_layer_list);
217 return VK_SUCCESS;
218 }
219
220 copy_size = (*pPropertyCount < instance_layer_list.count)
221 ? *pPropertyCount
222 : instance_layer_list.count;
223 for (uint32_t i = 0; i < copy_size; i++) {
224 memcpy(&pProperties[i], &instance_layer_list.list[i].info,
225 sizeof(VkLayerProperties));
226 }
227
228 *pPropertyCount = copy_size;
229 loader_destroy_layer_list(NULL, &instance_layer_list);
230
231 if (copy_size < instance_layer_list.count) {
232 return VK_INCOMPLETE;
233 }
234
235 return VK_SUCCESS;
236}
237
Jon Ashburn23d36b12016-02-02 17:47:28 -0700238LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
239vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
240 const VkAllocationCallbacks *pAllocator,
241 VkInstance *pInstance) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600242 struct loader_instance *ptr_instance = NULL;
Jon Ashburne5b9bba2016-01-18 12:20:03 -0700243 VkInstance created_instance = VK_NULL_HANDLE;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600244 VkResult res = VK_ERROR_INITIALIZATION_FAILED;
Courtney Goeltzenleuchter7415d5a2015-12-09 15:48:16 -0700245 VkDebugReportCallbackEXT instance_callback = VK_NULL_HANDLE;
Jon Ashburn23d36b12016-02-02 17:47:28 -0700246 void *pNext = (void *)pCreateInfo->pNext;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600247
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600248 loader_platform_thread_once(&once_init, loader_initialize);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600249
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700250#if 0
251 if (pAllocator) {
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800252 ptr_instance = (struct loader_instance *) pAllocator->pfnAllocation(
Chia-I Wuf7458c52015-10-26 21:10:41 +0800253 pAllocator->pUserData,
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600254 sizeof(struct loader_instance),
Jon Ashburn6a118ae2016-01-07 15:21:14 -0700255 sizeof(int *),
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800256 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600257 } else {
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700258#endif
Jon Ashburn23d36b12016-02-02 17:47:28 -0700259 ptr_instance =
260 (struct loader_instance *)malloc(sizeof(struct loader_instance));
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700261 //}
Jon Ashburn27cd5842015-05-12 17:26:48 -0600262 if (ptr_instance == NULL) {
263 return VK_ERROR_OUT_OF_HOST_MEMORY;
264 }
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600265
Jon Ashburn87d6aa92015-08-28 15:19:27 -0600266 tls_instance = ptr_instance;
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600267 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburnb82c1852015-08-11 14:49:54 -0600268 memset(ptr_instance, 0, sizeof(struct loader_instance));
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700269#if 0
Chia-I Wuf7458c52015-10-26 21:10:41 +0800270 if (pAllocator) {
271 ptr_instance->alloc_callbacks = *pAllocator;
Courtney Goeltzenleuchter7f5aafc2015-07-05 11:28:29 -0600272 }
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700273#endif
Courtney Goeltzenleuchter7f5aafc2015-07-05 11:28:29 -0600274
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700275 /*
276 * Look for a debug report create info structure
277 * and setup a callback if found.
278 */
279 while (pNext) {
Jon Ashburn23d36b12016-02-02 17:47:28 -0700280 if (((VkInstanceCreateInfo *)pNext)->sType ==
281 VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT) {
282 instance_callback = (VkDebugReportCallbackEXT)ptr_instance;
283 if (util_CreateDebugReportCallback(ptr_instance, pNext, NULL,
284 instance_callback)) {
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700285 loader_heap_free(ptr_instance, ptr_instance);
Courtney Goeltzenleuchter82887272015-12-02 15:29:33 -0700286 loader_platform_thread_unlock_mutex(&loader_lock);
287 return VK_ERROR_OUT_OF_HOST_MEMORY;
288 }
289 }
Jon Ashburn23d36b12016-02-02 17:47:28 -0700290 pNext = (void *)((VkInstanceCreateInfo *)pNext)->pNext;
Courtney Goeltzenleuchter82887272015-12-02 15:29:33 -0700291 }
292
Jon Ashburn3d002332015-08-20 16:35:30 -0600293 /* Due to implicit layers need to get layer list even if
Jon Ashburnf19916e2016-01-11 13:12:43 -0700294 * enabledLayerCount == 0 and VK_INSTANCE_LAYERS is unset. For now always
Jon Ashburn3d002332015-08-20 16:35:30 -0600295 * get layer list (both instance and device) via loader_layer_scan(). */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700296 memset(&ptr_instance->instance_layer_list, 0,
297 sizeof(ptr_instance->instance_layer_list));
298 memset(&ptr_instance->device_layer_list, 0,
299 sizeof(ptr_instance->device_layer_list));
300 loader_layer_scan(ptr_instance, &ptr_instance->instance_layer_list,
Jon Ashburne39a4f82015-08-28 13:38:21 -0600301 &ptr_instance->device_layer_list);
Jon Ashburn3d002332015-08-20 16:35:30 -0600302
303 /* validate the app requested layers to be enabled */
Jon Ashburnf19916e2016-01-11 13:12:43 -0700304 if (pCreateInfo->enabledLayerCount > 0) {
Jon Ashburnf2b4e382016-02-10 20:50:19 -0700305 res =
306 loader_validate_layers(ptr_instance, pCreateInfo->enabledLayerCount,
307 pCreateInfo->ppEnabledLayerNames,
308 &ptr_instance->instance_layer_list);
Jon Ashburn3d002332015-08-20 16:35:30 -0600309 if (res != VK_SUCCESS) {
Jon Ashburn23d36b12016-02-02 17:47:28 -0700310 util_DestroyDebugReportCallback(ptr_instance, instance_callback,
311 NULL);
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700312 loader_heap_free(ptr_instance, ptr_instance);
Jon Ashburn1ff17592015-10-09 09:40:30 -0600313 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn3d002332015-08-20 16:35:30 -0600314 return res;
315 }
316 }
317
Jon Ashburn86a527a2016-02-10 20:59:26 -0700318 /* convert any meta layers to the actual layers makes a copy of layer name*/
319 uint32_t saved_layer_count = pCreateInfo->enabledLayerCount;
Jon Ashburn71483442016-02-11 18:59:43 -0700320 char **saved_layer_names;
321 char **saved_layer_ptr;
322 saved_layer_names =
323 loader_stack_alloc(sizeof(char *) * pCreateInfo->enabledLayerCount);
Jon Ashburn86a527a2016-02-10 20:59:26 -0700324 for (uint32_t i = 0; i < saved_layer_count; i++) {
325 saved_layer_names[i] = (char *)pCreateInfo->ppEnabledLayerNames[i];
326 }
Jon Ashburn71483442016-02-11 18:59:43 -0700327 saved_layer_ptr = (char **)pCreateInfo->ppEnabledLayerNames;
Jon Ashburn86a527a2016-02-10 20:59:26 -0700328
329 loader_expand_layer_names(
330 ptr_instance, std_validation_str,
331 sizeof(std_validation_names) / sizeof(std_validation_names[0]),
332 std_validation_names, (uint32_t *)&pCreateInfo->enabledLayerCount,
333 (char ***)&pCreateInfo->ppEnabledLayerNames);
334
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600335 /* Scan/discover all ICD libraries */
336 memset(&ptr_instance->icd_libs, 0, sizeof(ptr_instance->icd_libs));
Jon Ashburne39a4f82015-08-28 13:38:21 -0600337 loader_icd_scan(ptr_instance, &ptr_instance->icd_libs);
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600338
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600339 /* get extensions from all ICD's, merge so no duplicates, then validate */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700340 loader_get_icd_loader_instance_extensions(
341 ptr_instance, &ptr_instance->icd_libs, &ptr_instance->ext_list);
342 res = loader_validate_instance_extensions(
Jon Ashburnf2b4e382016-02-10 20:50:19 -0700343 ptr_instance, &ptr_instance->ext_list,
344 &ptr_instance->instance_layer_list, pCreateInfo);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600345 if (res != VK_SUCCESS) {
Jon Ashburn71483442016-02-11 18:59:43 -0700346 loader_unexpand_inst_layer_names(ptr_instance, saved_layer_count,
347 saved_layer_names, saved_layer_ptr,
Jon Ashburn86a527a2016-02-10 20:59:26 -0700348 pCreateInfo);
Jon Ashburne39a4f82015-08-28 13:38:21 -0600349 loader_delete_layer_properties(ptr_instance,
350 &ptr_instance->device_layer_list);
351 loader_delete_layer_properties(ptr_instance,
352 &ptr_instance->instance_layer_list);
353 loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700354 loader_destroy_generic_list(
355 ptr_instance,
356 (struct loader_generic_list *)&ptr_instance->ext_list);
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700357 util_DestroyDebugReportCallback(ptr_instance, instance_callback, NULL);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600358 loader_platform_thread_unlock_mutex(&loader_lock);
359 loader_heap_free(ptr_instance, ptr_instance);
360 return res;
361 }
362
Jon Ashburn23d36b12016-02-02 17:47:28 -0700363 ptr_instance->disp =
364 loader_heap_alloc(ptr_instance, sizeof(VkLayerInstanceDispatchTable),
365 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600366 if (ptr_instance->disp == NULL) {
Jon Ashburn71483442016-02-11 18:59:43 -0700367 loader_unexpand_inst_layer_names(ptr_instance, saved_layer_count,
368 saved_layer_names, saved_layer_ptr,
Jon Ashburn86a527a2016-02-10 20:59:26 -0700369 pCreateInfo);
Jon Ashburne39a4f82015-08-28 13:38:21 -0600370 loader_delete_layer_properties(ptr_instance,
371 &ptr_instance->device_layer_list);
372 loader_delete_layer_properties(ptr_instance,
373 &ptr_instance->instance_layer_list);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700374 loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
375 loader_destroy_generic_list(
376 ptr_instance,
377 (struct loader_generic_list *)&ptr_instance->ext_list);
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700378 util_DestroyDebugReportCallback(ptr_instance, instance_callback, NULL);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600379 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600380 loader_heap_free(ptr_instance, ptr_instance);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600381 return VK_ERROR_OUT_OF_HOST_MEMORY;
382 }
383 memcpy(ptr_instance->disp, &instance_disp, sizeof(instance_disp));
384 ptr_instance->next = loader.instances;
385 loader.instances = ptr_instance;
386
Jon Ashburnb82c1852015-08-11 14:49:54 -0600387 /* activate any layers on instance chain */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700388 res = loader_enable_instance_layers(ptr_instance, pCreateInfo,
Jon Ashburne39a4f82015-08-28 13:38:21 -0600389 &ptr_instance->instance_layer_list);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600390 if (res != VK_SUCCESS) {
Jon Ashburn71483442016-02-11 18:59:43 -0700391 loader_unexpand_inst_layer_names(ptr_instance, saved_layer_count,
392 saved_layer_names, saved_layer_ptr,
Jon Ashburn86a527a2016-02-10 20:59:26 -0700393 pCreateInfo);
Jon Ashburne39a4f82015-08-28 13:38:21 -0600394 loader_delete_layer_properties(ptr_instance,
395 &ptr_instance->device_layer_list);
396 loader_delete_layer_properties(ptr_instance,
397 &ptr_instance->instance_layer_list);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700398 loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
399 loader_destroy_generic_list(
400 ptr_instance,
401 (struct loader_generic_list *)&ptr_instance->ext_list);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600402 loader.instances = ptr_instance->next;
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700403 util_DestroyDebugReportCallback(ptr_instance, instance_callback, NULL);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600404 loader_platform_thread_unlock_mutex(&loader_lock);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600405 loader_heap_free(ptr_instance, ptr_instance->disp);
406 loader_heap_free(ptr_instance, ptr_instance);
407 return res;
408 }
Jon Ashburn07daee72015-05-21 18:13:33 -0600409
Jon Ashburn23d36b12016-02-02 17:47:28 -0700410 created_instance = (VkInstance)ptr_instance;
411 res = loader_create_instance_chain(pCreateInfo, pAllocator, ptr_instance,
Jon Ashburn6e0a2132016-02-03 12:37:30 -0700412 &created_instance);
Jon Ashburneed0c002015-05-21 17:42:17 -0600413
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700414 if (res == VK_SUCCESS) {
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700415 wsi_create_instance(ptr_instance, pCreateInfo);
416 debug_report_create_instance(ptr_instance, pCreateInfo);
417
Jon Ashburne5b9bba2016-01-18 12:20:03 -0700418 *pInstance = created_instance;
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700419
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700420 /*
421 * Finally have the layers in place and everyone has seen
422 * the CreateInstance command go by. This allows the layer's
423 * GetInstanceProcAddr functions to return valid extension functions
424 * if enabled.
425 */
426 loader_activate_instance_layer_extensions(ptr_instance, *pInstance);
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700427 } else {
428 // TODO: cleanup here.
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700429 }
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700430
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700431 /* Remove temporary debug_report callback */
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700432 util_DestroyDebugReportCallback(ptr_instance, instance_callback, NULL);
Jon Ashburn71483442016-02-11 18:59:43 -0700433 loader_unexpand_inst_layer_names(ptr_instance, saved_layer_count,
434 saved_layer_names, saved_layer_ptr,
Jon Ashburn86a527a2016-02-10 20:59:26 -0700435 pCreateInfo);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600436 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600437 return res;
438}
439
Jon Ashburn23d36b12016-02-02 17:47:28 -0700440LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
441vkDestroyInstance(VkInstance instance,
442 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600443 const VkLayerInstanceDispatchTable *disp;
Jon Ashburne0e64572015-09-30 12:56:42 -0600444 struct loader_instance *ptr_instance = NULL;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600445 disp = loader_get_instance_dispatch(instance);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600446
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600447 loader_platform_thread_lock_mutex(&loader_lock);
448
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700449 /* TODO: Do we need a temporary callback here to catch cleanup issues? */
450
Jon Ashburne0e64572015-09-30 12:56:42 -0600451 ptr_instance = loader_get_instance(instance);
Chia-I Wuf7458c52015-10-26 21:10:41 +0800452 disp->DestroyInstance(instance, pAllocator);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600453
Courtney Goeltzenleuchter7d0023c2015-06-08 15:09:22 -0600454 loader_deactivate_instance_layers(ptr_instance);
Jon Ashburn014438f2016-03-01 19:51:07 -0700455 if (ptr_instance->phys_devs)
456 loader_heap_free(ptr_instance, ptr_instance->phys_devs);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600457 loader_heap_free(ptr_instance, ptr_instance->disp);
458 loader_heap_free(ptr_instance, ptr_instance);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600459 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600460}
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600461
Jon Ashburn23d36b12016-02-02 17:47:28 -0700462LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
463vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount,
464 VkPhysicalDevice *pPhysicalDevices) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600465 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600466 VkResult res;
Jon Ashburn014438f2016-03-01 19:51:07 -0700467 uint32_t count, i;
468 struct loader_instance *inst;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600469 disp = loader_get_instance_dispatch(instance);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600470
471 loader_platform_thread_lock_mutex(&loader_lock);
472 res = disp->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount,
Jon Ashburn27cd5842015-05-12 17:26:48 -0600473 pPhysicalDevices);
Jon Ashburn014438f2016-03-01 19:51:07 -0700474
475 if (res != VK_SUCCESS && res != VK_INCOMPLETE) {
476 loader_platform_thread_unlock_mutex(&loader_lock);
477 return res;
478 }
479
480 if (!pPhysicalDevices) {
481 loader_platform_thread_unlock_mutex(&loader_lock);
482 return res;
483 }
484
485 // wrap the PhysDev object for loader usage, return wrapped objects
486 inst = loader_get_instance(instance);
487 if (!inst) {
488 loader_platform_thread_unlock_mutex(&loader_lock);
489 return VK_ERROR_INITIALIZATION_FAILED;
490 }
491 if (inst->phys_devs)
492 loader_heap_free(inst, inst->phys_devs);
493 count = inst->total_gpu_count;
494 inst->phys_devs = (struct loader_physical_device *)loader_heap_alloc(
495 inst, count * sizeof(struct loader_physical_device),
496 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
497 if (!inst->phys_devs) {
498 loader_platform_thread_unlock_mutex(&loader_lock);
499 return VK_ERROR_OUT_OF_HOST_MEMORY;
500 }
501
502 for (i = 0; i < count; i++) {
503
504 // initialize the loader's physicalDevice object
505 loader_set_dispatch((void *)&inst->phys_devs[i], inst->disp);
506 inst->phys_devs[i].this_icd = inst->phys_devs_term[i].this_icd;
507 inst->phys_devs[i].phys_dev = pPhysicalDevices[i];
508
509 // copy wrapped object into Application provided array
510 pPhysicalDevices[i] = (VkPhysicalDevice)&inst->phys_devs[i];
511 }
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600512 loader_platform_thread_unlock_mutex(&loader_lock);
513 return res;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600514}
515
Jon Ashburn23d36b12016-02-02 17:47:28 -0700516LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
Jon Ashburn014438f2016-03-01 19:51:07 -0700517vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700518 VkPhysicalDeviceFeatures *pFeatures) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600519 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700520 VkPhysicalDevice unwrapped_phys_dev =
521 loader_unwrap_physical_device(physicalDevice);
522 disp = loader_get_instance_dispatch(physicalDevice);
523 disp->GetPhysicalDeviceFeatures(unwrapped_phys_dev, pFeatures);
Jon Ashburn754864f2015-07-23 18:49:07 -0600524}
525
Jon Ashburn23d36b12016-02-02 17:47:28 -0700526LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
Jon Ashburn014438f2016-03-01 19:51:07 -0700527vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice,
528 VkFormat format,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700529 VkFormatProperties *pFormatInfo) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600530 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700531 VkPhysicalDevice unwrapped_pd =
532 loader_unwrap_physical_device(physicalDevice);
533 disp = loader_get_instance_dispatch(physicalDevice);
534 disp->GetPhysicalDeviceFormatProperties(unwrapped_pd, format, pFormatInfo);
Jon Ashburn754864f2015-07-23 18:49:07 -0600535}
536
Jon Ashburn23d36b12016-02-02 17:47:28 -0700537LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
538vkGetPhysicalDeviceImageFormatProperties(
539 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
540 VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
541 VkImageFormatProperties *pImageFormatProperties) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600542 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700543 VkPhysicalDevice unwrapped_phys_dev =
544 loader_unwrap_physical_device(physicalDevice);
Jon Ashburn754864f2015-07-23 18:49:07 -0600545 disp = loader_get_instance_dispatch(physicalDevice);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700546 return disp->GetPhysicalDeviceImageFormatProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700547 unwrapped_phys_dev, format, type, tiling, usage, flags,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700548 pImageFormatProperties);
Jon Ashburn754864f2015-07-23 18:49:07 -0600549}
550
Jon Ashburn23d36b12016-02-02 17:47:28 -0700551LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
Jon Ashburn014438f2016-03-01 19:51:07 -0700552vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700553 VkPhysicalDeviceProperties *pProperties) {
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600554 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700555 VkPhysicalDevice unwrapped_phys_dev =
556 loader_unwrap_physical_device(physicalDevice);
557 disp = loader_get_instance_dispatch(physicalDevice);
558 disp->GetPhysicalDeviceProperties(unwrapped_phys_dev, pProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600559}
560
Jon Ashburn23d36b12016-02-02 17:47:28 -0700561LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
562vkGetPhysicalDeviceQueueFamilyProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700563 VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700564 VkQueueFamilyProperties *pQueueProperties) {
Tony Barbour59a47322015-06-24 16:06:58 -0600565 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700566 VkPhysicalDevice unwrapped_phys_dev =
567 loader_unwrap_physical_device(physicalDevice);
568 disp = loader_get_instance_dispatch(physicalDevice);
569 disp->GetPhysicalDeviceQueueFamilyProperties(
570 unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600571}
572
Chia-I Wu9ab61502015-11-06 06:42:02 +0800573LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700574 VkPhysicalDevice physicalDevice,
575 VkPhysicalDeviceMemoryProperties *pMemoryProperties) {
Tony Barbour59a47322015-06-24 16:06:58 -0600576 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700577 VkPhysicalDevice unwrapped_phys_dev =
578 loader_unwrap_physical_device(physicalDevice);
579 disp = loader_get_instance_dispatch(physicalDevice);
580 disp->GetPhysicalDeviceMemoryProperties(unwrapped_phys_dev,
581 pMemoryProperties);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600582}
583
Jon Ashburn23d36b12016-02-02 17:47:28 -0700584LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
Jon Ashburn1530c342016-02-26 13:14:27 -0700585vkCreateDevice(VkPhysicalDevice physicalDevice,
586 const VkDeviceCreateInfo *pCreateInfo,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700587 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600588 VkResult res;
Jon Ashburn1530c342016-02-26 13:14:27 -0700589 struct loader_physical_device *phys_dev;
590 struct loader_icd *icd;
591 struct loader_device *dev;
592 struct loader_instance *inst;
593 struct loader_layer_list activated_layer_list = {0};
594
595 assert(pCreateInfo->queueCreateInfoCount >= 1);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600596
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600597 loader_platform_thread_lock_mutex(&loader_lock);
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600598
Jon Ashburn014438f2016-03-01 19:51:07 -0700599 phys_dev = (struct loader_physical_device *)physicalDevice;
Jon Ashburn1530c342016-02-26 13:14:27 -0700600 icd = phys_dev->this_icd;
601 if (!icd) {
602 loader_platform_thread_unlock_mutex(&loader_lock);
603 return VK_ERROR_INITIALIZATION_FAILED;
604 }
605
Jon Ashburn014438f2016-03-01 19:51:07 -0700606 inst = (struct loader_instance *)phys_dev->this_icd->this_instance;
Jon Ashburn1530c342016-02-26 13:14:27 -0700607
608 if (!icd->CreateDevice) {
609 loader_platform_thread_unlock_mutex(&loader_lock);
610 return VK_ERROR_INITIALIZATION_FAILED;
611 }
612
613 /* validate any app enabled layers are available */
614 if (pCreateInfo->enabledLayerCount > 0) {
615 res = loader_validate_layers(inst, pCreateInfo->enabledLayerCount,
616 pCreateInfo->ppEnabledLayerNames,
617 &inst->device_layer_list);
618 if (res != VK_SUCCESS) {
619 loader_platform_thread_unlock_mutex(&loader_lock);
620 return res;
621 }
622 }
623
Jon Ashburn014438f2016-03-01 19:51:07 -0700624 /* Get the physical device (ICD) extensions */
625 struct loader_extension_list icd_exts;
626 if (!loader_init_generic_list(inst, (struct loader_generic_list *)&icd_exts,
627 sizeof(VkExtensionProperties))) {
628 loader_platform_thread_unlock_mutex(&loader_lock);
629 return VK_ERROR_OUT_OF_HOST_MEMORY;
630 }
Jon Ashburn1530c342016-02-26 13:14:27 -0700631
Jon Ashburn014438f2016-03-01 19:51:07 -0700632 res = loader_add_device_extensions(
633 inst, icd, phys_dev->phys_dev,
634 phys_dev->this_icd->this_icd_lib->lib_name, &icd_exts);
635 if (res != VK_SUCCESS) {
636 loader_platform_thread_unlock_mutex(&loader_lock);
637 return res;
Jon Ashburn1530c342016-02-26 13:14:27 -0700638 }
639
640 /* convert any meta layers to the actual layers makes a copy of layer name*/
641 uint32_t saved_layer_count = pCreateInfo->enabledLayerCount;
642 char **saved_layer_names;
643 char **saved_layer_ptr;
644 saved_layer_names =
645 loader_stack_alloc(sizeof(char *) * pCreateInfo->enabledLayerCount);
646 for (uint32_t i = 0; i < saved_layer_count; i++) {
647 saved_layer_names[i] = (char *)pCreateInfo->ppEnabledLayerNames[i];
648 }
649 saved_layer_ptr = (char **)pCreateInfo->ppEnabledLayerNames;
650
651 loader_expand_layer_names(
652 inst, std_validation_str,
653 sizeof(std_validation_names) / sizeof(std_validation_names[0]),
654 std_validation_names, (uint32_t *)&pCreateInfo->enabledLayerCount,
655 (char ***)&pCreateInfo->ppEnabledLayerNames);
656
657 /* fetch a list of all layers activated, explicit and implicit */
658 res = loader_enable_device_layers(inst, icd, &activated_layer_list,
659 pCreateInfo, &inst->device_layer_list);
660 if (res != VK_SUCCESS) {
661 loader_unexpand_dev_layer_names(inst, saved_layer_count,
662 saved_layer_names, saved_layer_ptr,
663 pCreateInfo);
664 loader_platform_thread_unlock_mutex(&loader_lock);
665 return res;
666 }
667
668 /* make sure requested extensions to be enabled are supported */
669 res = loader_validate_device_extensions(phys_dev, &activated_layer_list,
Jon Ashburn014438f2016-03-01 19:51:07 -0700670 &icd_exts, pCreateInfo);
Jon Ashburn1530c342016-02-26 13:14:27 -0700671 if (res != VK_SUCCESS) {
672 loader_unexpand_dev_layer_names(inst, saved_layer_count,
673 saved_layer_names, saved_layer_ptr,
674 pCreateInfo);
675 loader_destroy_generic_list(
676 inst, (struct loader_generic_list *)&activated_layer_list);
677 loader_platform_thread_unlock_mutex(&loader_lock);
678 return res;
679 }
680
681 dev = loader_add_logical_device(inst, &icd->logical_device_list);
682 if (dev == NULL) {
683 loader_unexpand_dev_layer_names(inst, saved_layer_count,
684 saved_layer_names, saved_layer_ptr,
685 pCreateInfo);
686 loader_destroy_generic_list(
687 inst, (struct loader_generic_list *)&activated_layer_list);
688 loader_platform_thread_unlock_mutex(&loader_lock);
689 return VK_ERROR_OUT_OF_HOST_MEMORY;
690 }
691
692 /* move the locally filled layer list into the device, and pass ownership of
693 * the memory */
694 dev->activated_layer_list.capacity = activated_layer_list.capacity;
695 dev->activated_layer_list.count = activated_layer_list.count;
696 dev->activated_layer_list.list = activated_layer_list.list;
697 memset(&activated_layer_list, 0, sizeof(activated_layer_list));
698
699 /* activate any layers on device chain which terminates with device*/
700 res = loader_enable_device_layers(inst, icd, &dev->activated_layer_list,
701 pCreateInfo, &inst->device_layer_list);
702 if (res != VK_SUCCESS) {
703 loader_unexpand_dev_layer_names(inst, saved_layer_count,
704 saved_layer_names, saved_layer_ptr,
705 pCreateInfo);
706 loader_remove_logical_device(inst, icd, dev);
707 loader_platform_thread_unlock_mutex(&loader_lock);
708 return res;
709 }
710
Jon Ashburn014438f2016-03-01 19:51:07 -0700711 res = loader_create_device_chain(phys_dev, pCreateInfo, pAllocator, inst,
712 icd, dev);
Jon Ashburn1530c342016-02-26 13:14:27 -0700713 if (res != VK_SUCCESS) {
714 loader_unexpand_dev_layer_names(inst, saved_layer_count,
715 saved_layer_names, saved_layer_ptr,
716 pCreateInfo);
717 loader_remove_logical_device(inst, icd, dev);
718 loader_platform_thread_unlock_mutex(&loader_lock);
719 return res;
720 }
721
722 *pDevice = dev->device;
723
724 /* initialize any device extension dispatch entry's from the instance list*/
725 loader_init_dispatch_dev_ext(inst, dev);
726
727 /* initialize WSI device extensions as part of core dispatch since loader
728 * has
729 * dedicated trampoline code for these*/
730 loader_init_device_extension_dispatch_table(
731 &dev->loader_dispatch,
732 dev->loader_dispatch.core_dispatch.GetDeviceProcAddr, *pDevice);
733
734 loader_unexpand_dev_layer_names(inst, saved_layer_count, saved_layer_names,
735 saved_layer_ptr, pCreateInfo);
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600736
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600737 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600738 return res;
739}
740
Jon Ashburn23d36b12016-02-02 17:47:28 -0700741LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
742vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600743 const VkLayerDispatchTable *disp;
Jon Ashburne39a4f82015-08-28 13:38:21 -0600744 struct loader_device *dev;
Andrzej Kotlowskib168b1a2016-02-03 09:41:53 +0100745
746 loader_platform_thread_lock_mutex(&loader_lock);
747
Jon Ashburne39a4f82015-08-28 13:38:21 -0600748 struct loader_icd *icd = loader_get_icd_and_device(device, &dev);
749 const struct loader_instance *inst = icd->this_instance;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600750 disp = loader_get_dispatch(device);
751
Chia-I Wuf7458c52015-10-26 21:10:41 +0800752 disp->DestroyDevice(device, pAllocator);
Jon Ashburn781a7ae2015-11-19 15:43:26 -0700753 dev->device = NULL;
754 loader_remove_logical_device(inst, icd, dev);
755
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600756 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600757}
758
Jon Ashburn23d36b12016-02-02 17:47:28 -0700759LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
760vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
761 const char *pLayerName,
762 uint32_t *pPropertyCount,
763 VkExtensionProperties *pProperties) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700764 VkResult res = VK_SUCCESS;
Jon Ashburn014438f2016-03-01 19:51:07 -0700765 struct loader_physical_device *phys_dev;
766 phys_dev = (struct loader_physical_device *)physicalDevice;
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600767
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600768 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700769
770 /* If pLayerName == NULL, then querying ICD extensions, pass this call
771 down the instance chain which will terminate in the ICD. This allows
772 layers to filter the extensions coming back up the chain.
773 If pLayerName != NULL then get layer extensions from manifest file. */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700774 if (pLayerName == NULL || strlen(pLayerName) == 0) {
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700775 const VkLayerInstanceDispatchTable *disp;
776
777 disp = loader_get_instance_dispatch(physicalDevice);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700778 res = disp->EnumerateDeviceExtensionProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700779 phys_dev->phys_dev, NULL, pPropertyCount, pProperties);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700780 } else {
Jon Ashburn014438f2016-03-01 19:51:07 -0700781
Jon Ashburndc5d9202016-02-29 13:00:51 -0700782 uint32_t count;
783 uint32_t copy_size;
Jon Ashburn014438f2016-03-01 19:51:07 -0700784 const struct loader_instance *inst = phys_dev->this_icd->this_instance;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700785 if (vk_string_validate(MaxLoaderStringLength, pLayerName) ==
Jon Ashburn014438f2016-03-01 19:51:07 -0700786 VK_STRING_ERROR_NONE) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700787
788 struct loader_device_extension_list *dev_ext_list = NULL;
Jon Ashburn014438f2016-03-01 19:51:07 -0700789 for (uint32_t i = 0; i < inst->device_layer_list.count; i++) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700790 struct loader_layer_properties *props =
Jon Ashburn014438f2016-03-01 19:51:07 -0700791 &inst->device_layer_list.list[i];
Jon Ashburndc5d9202016-02-29 13:00:51 -0700792 if (strcmp(props->info.layerName, pLayerName) == 0) {
793 dev_ext_list = &props->device_extension_list;
794 }
795 }
796 count = (dev_ext_list == NULL) ? 0 : dev_ext_list->count;
797 if (pProperties == NULL) {
798 *pPropertyCount = count;
799 loader_platform_thread_unlock_mutex(&loader_lock);
800 return VK_SUCCESS;
801 }
802
803 copy_size = *pPropertyCount < count ? *pPropertyCount : count;
804 for (uint32_t i = 0; i < copy_size; i++) {
805 memcpy(&pProperties[i], &dev_ext_list->list[i].props,
Jon Ashburn014438f2016-03-01 19:51:07 -0700806 sizeof(VkExtensionProperties));
Jon Ashburndc5d9202016-02-29 13:00:51 -0700807 }
808 *pPropertyCount = copy_size;
809
810 if (copy_size < count) {
811 loader_platform_thread_unlock_mutex(&loader_lock);
812 return VK_INCOMPLETE;
813 }
814 } else {
Jon Ashburn014438f2016-03-01 19:51:07 -0700815 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
816 "vkEnumerateDeviceExtensionProperties: pLayerName "
817 "is too long or is badly formed");
818 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700819 return VK_ERROR_EXTENSION_NOT_PRESENT;
820 }
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700821 }
822
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600823 loader_platform_thread_unlock_mutex(&loader_lock);
Tony Barbour59a47322015-06-24 16:06:58 -0600824 return res;
825}
826
Jon Ashburn23d36b12016-02-02 17:47:28 -0700827LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
828vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
829 uint32_t *pPropertyCount,
830 VkLayerProperties *pProperties) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700831 uint32_t copy_size;
832 struct loader_physical_device *phys_dev;
Tony Barbour59a47322015-06-24 16:06:58 -0600833
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600834 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700835
836 /* Don't dispatch this call down the instance chain, want all device layers
837 enumerated and instance chain may not contain all device layers */
Jon Ashburndc5d9202016-02-29 13:00:51 -0700838
Jon Ashburn014438f2016-03-01 19:51:07 -0700839 phys_dev = (struct loader_physical_device *)physicalDevice;
840 const struct loader_instance *inst = phys_dev->this_icd->this_instance;
841 uint32_t count = inst->device_layer_list.count;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700842
843 if (pProperties == NULL) {
844 *pPropertyCount = count;
845 loader_platform_thread_unlock_mutex(&loader_lock);
846 return VK_SUCCESS;
847 }
848
849 copy_size = (*pPropertyCount < count) ? *pPropertyCount : count;
850 for (uint32_t i = 0; i < copy_size; i++) {
Jon Ashburn014438f2016-03-01 19:51:07 -0700851 memcpy(&pProperties[i], &(inst->device_layer_list.list[i].info),
Jon Ashburndc5d9202016-02-29 13:00:51 -0700852 sizeof(VkLayerProperties));
853 }
854 *pPropertyCount = copy_size;
855
856 if (copy_size < count) {
857 loader_platform_thread_unlock_mutex(&loader_lock);
858 return VK_INCOMPLETE;
859 }
860
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600861 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700862 return VK_SUCCESS;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600863}
864
Jon Ashburn23d36b12016-02-02 17:47:28 -0700865LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
866vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex,
867 VkQueue *pQueue) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600868 const VkLayerDispatchTable *disp;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600869
870 disp = loader_get_dispatch(device);
871
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600872 disp->GetDeviceQueue(device, queueNodeIndex, queueIndex, pQueue);
873 loader_set_dispatch(*pQueue, disp);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600874}
875
Jon Ashburn23d36b12016-02-02 17:47:28 -0700876LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
877vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits,
878 VkFence fence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600879 const VkLayerDispatchTable *disp;
880
881 disp = loader_get_dispatch(queue);
882
Chia-I Wu40cf0ae2015-10-26 17:20:32 +0800883 return disp->QueueSubmit(queue, submitCount, pSubmits, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600884}
885
Jon Ashburn23d36b12016-02-02 17:47:28 -0700886LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600887 const VkLayerDispatchTable *disp;
888
889 disp = loader_get_dispatch(queue);
890
891 return disp->QueueWaitIdle(queue);
892}
893
Jon Ashburn23d36b12016-02-02 17:47:28 -0700894LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600895 const VkLayerDispatchTable *disp;
896
897 disp = loader_get_dispatch(device);
898
899 return disp->DeviceWaitIdle(device);
900}
901
Jon Ashburn23d36b12016-02-02 17:47:28 -0700902LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
903vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
904 const VkAllocationCallbacks *pAllocator,
905 VkDeviceMemory *pMemory) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600906 const VkLayerDispatchTable *disp;
907
908 disp = loader_get_dispatch(device);
909
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800910 return disp->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600911}
912
Jon Ashburn23d36b12016-02-02 17:47:28 -0700913LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
914vkFreeMemory(VkDevice device, VkDeviceMemory mem,
915 const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600916 const VkLayerDispatchTable *disp;
917
918 disp = loader_get_dispatch(device);
919
Chia-I Wuf7458c52015-10-26 21:10:41 +0800920 disp->FreeMemory(device, mem, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600921}
922
Jon Ashburn23d36b12016-02-02 17:47:28 -0700923LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
924vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset,
925 VkDeviceSize size, VkFlags flags, void **ppData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600926 const VkLayerDispatchTable *disp;
927
928 disp = loader_get_dispatch(device);
929
930 return disp->MapMemory(device, mem, offset, size, flags, ppData);
931}
932
Jon Ashburn23d36b12016-02-02 17:47:28 -0700933LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
934vkUnmapMemory(VkDevice device, VkDeviceMemory mem) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600935 const VkLayerDispatchTable *disp;
936
937 disp = loader_get_dispatch(device);
938
Mark Lobodzinski2141f652015-09-07 13:59:43 -0600939 disp->UnmapMemory(device, mem);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600940}
941
Jon Ashburn23d36b12016-02-02 17:47:28 -0700942LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
943vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
944 const VkMappedMemoryRange *pMemoryRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600945 const VkLayerDispatchTable *disp;
946
947 disp = loader_get_dispatch(device);
948
Jon Ashburn23d36b12016-02-02 17:47:28 -0700949 return disp->FlushMappedMemoryRanges(device, memoryRangeCount,
950 pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600951}
952
Jon Ashburn23d36b12016-02-02 17:47:28 -0700953LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
954vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
955 const VkMappedMemoryRange *pMemoryRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600956 const VkLayerDispatchTable *disp;
957
958 disp = loader_get_dispatch(device);
959
Jon Ashburn23d36b12016-02-02 17:47:28 -0700960 return disp->InvalidateMappedMemoryRanges(device, memoryRangeCount,
961 pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600962}
963
Jon Ashburn23d36b12016-02-02 17:47:28 -0700964LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
965vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory,
966 VkDeviceSize *pCommittedMemoryInBytes) {
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -0600967 const VkLayerDispatchTable *disp;
968
969 disp = loader_get_dispatch(device);
970
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600971 disp->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes);
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -0600972}
973
Jon Ashburn23d36b12016-02-02 17:47:28 -0700974LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
975vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem,
976 VkDeviceSize offset) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600977 const VkLayerDispatchTable *disp;
978
Mark Lobodzinski942b1722015-05-11 17:21:15 -0500979 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600980
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600981 return disp->BindBufferMemory(device, buffer, mem, offset);
982}
983
Jon Ashburn23d36b12016-02-02 17:47:28 -0700984LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
985vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem,
986 VkDeviceSize offset) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600987 const VkLayerDispatchTable *disp;
988
989 disp = loader_get_dispatch(device);
990
991 return disp->BindImageMemory(device, image, mem, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600992}
993
Jon Ashburn23d36b12016-02-02 17:47:28 -0700994LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
995vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer,
996 VkMemoryRequirements *pMemoryRequirements) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600997 const VkLayerDispatchTable *disp;
998
999 disp = loader_get_dispatch(device);
1000
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001001 disp->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -06001002}
1003
Jon Ashburn23d36b12016-02-02 17:47:28 -07001004LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1005vkGetImageMemoryRequirements(VkDevice device, VkImage image,
1006 VkMemoryRequirements *pMemoryRequirements) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001007 const VkLayerDispatchTable *disp;
1008
1009 disp = loader_get_dispatch(device);
1010
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001011 disp->GetImageMemoryRequirements(device, image, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -06001012}
1013
Jon Ashburn23d36b12016-02-02 17:47:28 -07001014LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements(
1015 VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount,
1016 VkSparseImageMemoryRequirements *pSparseMemoryRequirements) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001017 const VkLayerDispatchTable *disp;
1018
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001019 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001020
Jon Ashburn23d36b12016-02-02 17:47:28 -07001021 disp->GetImageSparseMemoryRequirements(device, image,
1022 pSparseMemoryRequirementCount,
1023 pSparseMemoryRequirements);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001024}
1025
Jon Ashburn23d36b12016-02-02 17:47:28 -07001026LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1027vkGetPhysicalDeviceSparseImageFormatProperties(
1028 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
1029 VkSampleCountFlagBits samples, VkImageUsageFlags usage,
1030 VkImageTiling tiling, uint32_t *pPropertyCount,
1031 VkSparseImageFormatProperties *pProperties) {
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001032 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -07001033 VkPhysicalDevice unwrapped_phys_dev =
1034 loader_unwrap_physical_device(physicalDevice);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001035 disp = loader_get_instance_dispatch(physicalDevice);
1036
Jon Ashburn23d36b12016-02-02 17:47:28 -07001037 disp->GetPhysicalDeviceSparseImageFormatProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -07001038 unwrapped_phys_dev, format, type, samples, usage, tiling,
1039 pPropertyCount, pProperties);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001040}
1041
Jon Ashburn23d36b12016-02-02 17:47:28 -07001042LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1043vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount,
1044 const VkBindSparseInfo *pBindInfo, VkFence fence) {
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001045 const VkLayerDispatchTable *disp;
1046
1047 disp = loader_get_dispatch(queue);
1048
Chia-I Wu1ff4c3d2015-10-26 16:55:27 +08001049 return disp->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001050}
1051
Jon Ashburn23d36b12016-02-02 17:47:28 -07001052LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1053vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo,
1054 const VkAllocationCallbacks *pAllocator, VkFence *pFence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001055 const VkLayerDispatchTable *disp;
1056
1057 disp = loader_get_dispatch(device);
1058
Chia-I Wuf7458c52015-10-26 21:10:41 +08001059 return disp->CreateFence(device, pCreateInfo, pAllocator, pFence);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001060}
1061
Jon Ashburn23d36b12016-02-02 17:47:28 -07001062LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1063vkDestroyFence(VkDevice device, VkFence fence,
1064 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001065 const VkLayerDispatchTable *disp;
1066
1067 disp = loader_get_dispatch(device);
1068
Chia-I Wuf7458c52015-10-26 21:10:41 +08001069 disp->DestroyFence(device, fence, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001070}
1071
Jon Ashburn23d36b12016-02-02 17:47:28 -07001072LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1073vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001074 const VkLayerDispatchTable *disp;
1075
1076 disp = loader_get_dispatch(device);
1077
1078 return disp->ResetFences(device, fenceCount, pFences);
1079}
1080
Jon Ashburn23d36b12016-02-02 17:47:28 -07001081LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1082vkGetFenceStatus(VkDevice device, VkFence fence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001083 const VkLayerDispatchTable *disp;
1084
1085 disp = loader_get_dispatch(device);
1086
1087 return disp->GetFenceStatus(device, fence);
1088}
1089
Jon Ashburn23d36b12016-02-02 17:47:28 -07001090LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1091vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences,
1092 VkBool32 waitAll, uint64_t timeout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001093 const VkLayerDispatchTable *disp;
1094
1095 disp = loader_get_dispatch(device);
1096
1097 return disp->WaitForFences(device, fenceCount, pFences, waitAll, timeout);
1098}
1099
Jon Ashburn23d36b12016-02-02 17:47:28 -07001100LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1101vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo,
1102 const VkAllocationCallbacks *pAllocator,
1103 VkSemaphore *pSemaphore) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001104 const VkLayerDispatchTable *disp;
1105
1106 disp = loader_get_dispatch(device);
1107
Chia-I Wuf7458c52015-10-26 21:10:41 +08001108 return disp->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001109}
1110
Jon Ashburn23d36b12016-02-02 17:47:28 -07001111LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1112vkDestroySemaphore(VkDevice device, VkSemaphore semaphore,
1113 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001114 const VkLayerDispatchTable *disp;
1115
1116 disp = loader_get_dispatch(device);
1117
Chia-I Wuf7458c52015-10-26 21:10:41 +08001118 disp->DestroySemaphore(device, semaphore, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001119}
1120
Jon Ashburn23d36b12016-02-02 17:47:28 -07001121LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1122vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo,
1123 const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001124 const VkLayerDispatchTable *disp;
1125
1126 disp = loader_get_dispatch(device);
1127
Chia-I Wuf7458c52015-10-26 21:10:41 +08001128 return disp->CreateEvent(device, pCreateInfo, pAllocator, pEvent);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001129}
1130
Jon Ashburn23d36b12016-02-02 17:47:28 -07001131LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1132vkDestroyEvent(VkDevice device, VkEvent event,
1133 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001134 const VkLayerDispatchTable *disp;
1135
1136 disp = loader_get_dispatch(device);
1137
Chia-I Wuf7458c52015-10-26 21:10:41 +08001138 disp->DestroyEvent(device, event, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001139}
1140
Jon Ashburn23d36b12016-02-02 17:47:28 -07001141LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1142vkGetEventStatus(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001143 const VkLayerDispatchTable *disp;
1144
1145 disp = loader_get_dispatch(device);
1146
1147 return disp->GetEventStatus(device, event);
1148}
1149
Jon Ashburn23d36b12016-02-02 17:47:28 -07001150LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1151vkSetEvent(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001152 const VkLayerDispatchTable *disp;
1153
1154 disp = loader_get_dispatch(device);
1155
1156 return disp->SetEvent(device, event);
1157}
1158
Jon Ashburn23d36b12016-02-02 17:47:28 -07001159LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1160vkResetEvent(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001161 const VkLayerDispatchTable *disp;
1162
1163 disp = loader_get_dispatch(device);
1164
1165 return disp->ResetEvent(device, event);
1166}
1167
Jon Ashburn23d36b12016-02-02 17:47:28 -07001168LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1169vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo,
1170 const VkAllocationCallbacks *pAllocator,
1171 VkQueryPool *pQueryPool) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001172 const VkLayerDispatchTable *disp;
1173
1174 disp = loader_get_dispatch(device);
1175
Chia-I Wuf7458c52015-10-26 21:10:41 +08001176 return disp->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001177}
1178
Jon Ashburn23d36b12016-02-02 17:47:28 -07001179LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1180vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool,
1181 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001182 const VkLayerDispatchTable *disp;
1183
1184 disp = loader_get_dispatch(device);
1185
Chia-I Wuf7458c52015-10-26 21:10:41 +08001186 disp->DestroyQueryPool(device, queryPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001187}
1188
Jon Ashburn23d36b12016-02-02 17:47:28 -07001189LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1190vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool,
1191 uint32_t firstQuery, uint32_t queryCount, size_t dataSize,
1192 void *pData, VkDeviceSize stride,
1193 VkQueryResultFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001194 const VkLayerDispatchTable *disp;
1195
1196 disp = loader_get_dispatch(device);
1197
Jon Ashburn23d36b12016-02-02 17:47:28 -07001198 return disp->GetQueryPoolResults(device, queryPool, firstQuery, queryCount,
1199 dataSize, pData, stride, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001200}
1201
Jon Ashburn23d36b12016-02-02 17:47:28 -07001202LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1203vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo,
1204 const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001205 const VkLayerDispatchTable *disp;
1206
1207 disp = loader_get_dispatch(device);
1208
Chia-I Wuf7458c52015-10-26 21:10:41 +08001209 return disp->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001210}
1211
Jon Ashburn23d36b12016-02-02 17:47:28 -07001212LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1213vkDestroyBuffer(VkDevice device, VkBuffer buffer,
1214 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001215 const VkLayerDispatchTable *disp;
1216
1217 disp = loader_get_dispatch(device);
1218
Chia-I Wuf7458c52015-10-26 21:10:41 +08001219 disp->DestroyBuffer(device, buffer, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001220}
1221
Jon Ashburn23d36b12016-02-02 17:47:28 -07001222LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1223vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo,
1224 const VkAllocationCallbacks *pAllocator,
1225 VkBufferView *pView) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001226 const VkLayerDispatchTable *disp;
1227
1228 disp = loader_get_dispatch(device);
1229
Chia-I Wuf7458c52015-10-26 21:10:41 +08001230 return disp->CreateBufferView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001231}
1232
Jon Ashburn23d36b12016-02-02 17:47:28 -07001233LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1234vkDestroyBufferView(VkDevice device, VkBufferView bufferView,
1235 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001236 const VkLayerDispatchTable *disp;
1237
1238 disp = loader_get_dispatch(device);
1239
Chia-I Wuf7458c52015-10-26 21:10:41 +08001240 disp->DestroyBufferView(device, bufferView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001241}
1242
Jon Ashburn23d36b12016-02-02 17:47:28 -07001243LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1244vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
1245 const VkAllocationCallbacks *pAllocator, VkImage *pImage) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001246 const VkLayerDispatchTable *disp;
1247
1248 disp = loader_get_dispatch(device);
1249
Chia-I Wuf7458c52015-10-26 21:10:41 +08001250 return disp->CreateImage(device, pCreateInfo, pAllocator, pImage);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001251}
1252
Jon Ashburn23d36b12016-02-02 17:47:28 -07001253LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1254vkDestroyImage(VkDevice device, VkImage image,
1255 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001256 const VkLayerDispatchTable *disp;
1257
1258 disp = loader_get_dispatch(device);
1259
Chia-I Wuf7458c52015-10-26 21:10:41 +08001260 disp->DestroyImage(device, image, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001261}
1262
Jon Ashburn23d36b12016-02-02 17:47:28 -07001263LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1264vkGetImageSubresourceLayout(VkDevice device, VkImage image,
1265 const VkImageSubresource *pSubresource,
1266 VkSubresourceLayout *pLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001267 const VkLayerDispatchTable *disp;
1268
1269 disp = loader_get_dispatch(device);
1270
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001271 disp->GetImageSubresourceLayout(device, image, pSubresource, pLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001272}
1273
Jon Ashburn23d36b12016-02-02 17:47:28 -07001274LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1275vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo,
1276 const VkAllocationCallbacks *pAllocator, VkImageView *pView) {
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->CreateImageView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001282}
1283
Jon Ashburn23d36b12016-02-02 17:47:28 -07001284LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1285vkDestroyImageView(VkDevice device, VkImageView imageView,
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->DestroyImageView(device, imageView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001292}
1293
Jon Ashburn23d36b12016-02-02 17:47:28 -07001294LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1295vkCreateShaderModule(VkDevice device,
1296 const VkShaderModuleCreateInfo *pCreateInfo,
1297 const VkAllocationCallbacks *pAllocator,
1298 VkShaderModule *pShader) {
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -06001299 const VkLayerDispatchTable *disp;
1300
1301 disp = loader_get_dispatch(device);
1302
Chia-I Wuf7458c52015-10-26 21:10:41 +08001303 return disp->CreateShaderModule(device, pCreateInfo, pAllocator, pShader);
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -06001304}
1305
Jon Ashburn23d36b12016-02-02 17:47:28 -07001306LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1307vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule,
1308 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001309 const VkLayerDispatchTable *disp;
1310
1311 disp = loader_get_dispatch(device);
1312
Chia-I Wuf7458c52015-10-26 21:10:41 +08001313 disp->DestroyShaderModule(device, shaderModule, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001314}
1315
Jon Ashburn23d36b12016-02-02 17:47:28 -07001316LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1317vkCreatePipelineCache(VkDevice device,
1318 const VkPipelineCacheCreateInfo *pCreateInfo,
1319 const VkAllocationCallbacks *pAllocator,
1320 VkPipelineCache *pPipelineCache) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001321 const VkLayerDispatchTable *disp;
1322
1323 disp = loader_get_dispatch(device);
1324
Jon Ashburn23d36b12016-02-02 17:47:28 -07001325 return disp->CreatePipelineCache(device, pCreateInfo, pAllocator,
1326 pPipelineCache);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001327}
1328
Jon Ashburn23d36b12016-02-02 17:47:28 -07001329LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1330vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache,
1331 const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001332 const VkLayerDispatchTable *disp;
1333
1334 disp = loader_get_dispatch(device);
1335
Chia-I Wuf7458c52015-10-26 21:10:41 +08001336 disp->DestroyPipelineCache(device, pipelineCache, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001337}
1338
Jon Ashburn23d36b12016-02-02 17:47:28 -07001339LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1340vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache,
1341 size_t *pDataSize, void *pData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001342 const VkLayerDispatchTable *disp;
1343
1344 disp = loader_get_dispatch(device);
1345
Chia-I Wub16facd2015-10-26 19:17:06 +08001346 return disp->GetPipelineCacheData(device, pipelineCache, pDataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001347}
1348
Jon Ashburn23d36b12016-02-02 17:47:28 -07001349LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1350vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache,
1351 uint32_t srcCacheCount,
1352 const VkPipelineCache *pSrcCaches) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001353 const VkLayerDispatchTable *disp;
1354
1355 disp = loader_get_dispatch(device);
1356
Jon Ashburn23d36b12016-02-02 17:47:28 -07001357 return disp->MergePipelineCaches(device, dstCache, srcCacheCount,
1358 pSrcCaches);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001359}
1360
Jon Ashburn23d36b12016-02-02 17:47:28 -07001361LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1362vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache,
1363 uint32_t createInfoCount,
1364 const VkGraphicsPipelineCreateInfo *pCreateInfos,
1365 const VkAllocationCallbacks *pAllocator,
1366 VkPipeline *pPipelines) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001367 const VkLayerDispatchTable *disp;
1368
1369 disp = loader_get_dispatch(device);
1370
Jon Ashburn23d36b12016-02-02 17:47:28 -07001371 return disp->CreateGraphicsPipelines(device, pipelineCache, createInfoCount,
1372 pCreateInfos, pAllocator, pPipelines);
Jon Ashburnc669cc62015-07-09 15:02:25 -06001373}
1374
Jon Ashburn23d36b12016-02-02 17:47:28 -07001375LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1376vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache,
1377 uint32_t createInfoCount,
1378 const VkComputePipelineCreateInfo *pCreateInfos,
1379 const VkAllocationCallbacks *pAllocator,
1380 VkPipeline *pPipelines) {
Jon Ashburnc669cc62015-07-09 15:02:25 -06001381 const VkLayerDispatchTable *disp;
1382
1383 disp = loader_get_dispatch(device);
1384
Jon Ashburn23d36b12016-02-02 17:47:28 -07001385 return disp->CreateComputePipelines(device, pipelineCache, createInfoCount,
1386 pCreateInfos, pAllocator, pPipelines);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001387}
1388
Jon Ashburn23d36b12016-02-02 17:47:28 -07001389LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1390vkDestroyPipeline(VkDevice device, VkPipeline pipeline,
1391 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001392 const VkLayerDispatchTable *disp;
1393
1394 disp = loader_get_dispatch(device);
1395
Chia-I Wuf7458c52015-10-26 21:10:41 +08001396 disp->DestroyPipeline(device, pipeline, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001397}
1398
Jon Ashburn23d36b12016-02-02 17:47:28 -07001399LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1400vkCreatePipelineLayout(VkDevice device,
1401 const VkPipelineLayoutCreateInfo *pCreateInfo,
1402 const VkAllocationCallbacks *pAllocator,
1403 VkPipelineLayout *pPipelineLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001404 const VkLayerDispatchTable *disp;
1405
1406 disp = loader_get_dispatch(device);
1407
Jon Ashburn23d36b12016-02-02 17:47:28 -07001408 return disp->CreatePipelineLayout(device, pCreateInfo, pAllocator,
1409 pPipelineLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001410}
1411
Jon Ashburn23d36b12016-02-02 17:47:28 -07001412LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1413vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout,
1414 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001415 const VkLayerDispatchTable *disp;
1416
1417 disp = loader_get_dispatch(device);
1418
Chia-I Wuf7458c52015-10-26 21:10:41 +08001419 disp->DestroyPipelineLayout(device, pipelineLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001420}
1421
Jon Ashburn23d36b12016-02-02 17:47:28 -07001422LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1423vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo,
1424 const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001425 const VkLayerDispatchTable *disp;
1426
1427 disp = loader_get_dispatch(device);
1428
Chia-I Wuf7458c52015-10-26 21:10:41 +08001429 return disp->CreateSampler(device, pCreateInfo, pAllocator, pSampler);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001430}
1431
Jon Ashburn23d36b12016-02-02 17:47:28 -07001432LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1433vkDestroySampler(VkDevice device, VkSampler sampler,
1434 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001435 const VkLayerDispatchTable *disp;
1436
1437 disp = loader_get_dispatch(device);
1438
Chia-I Wuf7458c52015-10-26 21:10:41 +08001439 disp->DestroySampler(device, sampler, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001440}
1441
Jon Ashburn23d36b12016-02-02 17:47:28 -07001442LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1443vkCreateDescriptorSetLayout(VkDevice device,
1444 const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
1445 const VkAllocationCallbacks *pAllocator,
1446 VkDescriptorSetLayout *pSetLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001447 const VkLayerDispatchTable *disp;
1448
1449 disp = loader_get_dispatch(device);
1450
Jon Ashburn23d36b12016-02-02 17:47:28 -07001451 return disp->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator,
1452 pSetLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001453}
1454
Jon Ashburn23d36b12016-02-02 17:47:28 -07001455LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1456vkDestroyDescriptorSetLayout(VkDevice device,
1457 VkDescriptorSetLayout descriptorSetLayout,
1458 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001459 const VkLayerDispatchTable *disp;
1460
1461 disp = loader_get_dispatch(device);
1462
Chia-I Wuf7458c52015-10-26 21:10:41 +08001463 disp->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001464}
1465
Jon Ashburn23d36b12016-02-02 17:47:28 -07001466LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1467vkCreateDescriptorPool(VkDevice device,
1468 const VkDescriptorPoolCreateInfo *pCreateInfo,
1469 const VkAllocationCallbacks *pAllocator,
1470 VkDescriptorPool *pDescriptorPool) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001471 const VkLayerDispatchTable *disp;
1472
1473 disp = loader_get_dispatch(device);
1474
Jon Ashburn23d36b12016-02-02 17:47:28 -07001475 return disp->CreateDescriptorPool(device, pCreateInfo, pAllocator,
1476 pDescriptorPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001477}
1478
Jon Ashburn23d36b12016-02-02 17:47:28 -07001479LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1480vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
1481 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001482 const VkLayerDispatchTable *disp;
1483
1484 disp = loader_get_dispatch(device);
1485
Chia-I Wuf7458c52015-10-26 21:10:41 +08001486 disp->DestroyDescriptorPool(device, descriptorPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001487}
1488
Jon Ashburn23d36b12016-02-02 17:47:28 -07001489LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1490vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
1491 VkDescriptorPoolResetFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001492 const VkLayerDispatchTable *disp;
1493
1494 disp = loader_get_dispatch(device);
1495
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001496 return disp->ResetDescriptorPool(device, descriptorPool, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001497}
1498
Jon Ashburn23d36b12016-02-02 17:47:28 -07001499LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1500vkAllocateDescriptorSets(VkDevice device,
1501 const VkDescriptorSetAllocateInfo *pAllocateInfo,
1502 VkDescriptorSet *pDescriptorSets) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001503 const VkLayerDispatchTable *disp;
1504
1505 disp = loader_get_dispatch(device);
1506
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001507 return disp->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001508}
1509
Jon Ashburn23d36b12016-02-02 17:47:28 -07001510LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1511vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool,
1512 uint32_t descriptorSetCount,
1513 const VkDescriptorSet *pDescriptorSets) {
Tony Barbour34ec6922015-07-10 10:50:45 -06001514 const VkLayerDispatchTable *disp;
1515
1516 disp = loader_get_dispatch(device);
1517
Jon Ashburn23d36b12016-02-02 17:47:28 -07001518 return disp->FreeDescriptorSets(device, descriptorPool, descriptorSetCount,
1519 pDescriptorSets);
Tony Barbour34ec6922015-07-10 10:50:45 -06001520}
1521
Jon Ashburn23d36b12016-02-02 17:47:28 -07001522LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1523vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount,
1524 const VkWriteDescriptorSet *pDescriptorWrites,
1525 uint32_t descriptorCopyCount,
1526 const VkCopyDescriptorSet *pDescriptorCopies) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001527 const VkLayerDispatchTable *disp;
1528
1529 disp = loader_get_dispatch(device);
1530
Jon Ashburn23d36b12016-02-02 17:47:28 -07001531 disp->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites,
1532 descriptorCopyCount, pDescriptorCopies);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001533}
1534
Jon Ashburn23d36b12016-02-02 17:47:28 -07001535LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1536vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo,
1537 const VkAllocationCallbacks *pAllocator,
1538 VkFramebuffer *pFramebuffer) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001539 const VkLayerDispatchTable *disp;
1540
1541 disp = loader_get_dispatch(device);
1542
Jon Ashburn23d36b12016-02-02 17:47:28 -07001543 return disp->CreateFramebuffer(device, pCreateInfo, pAllocator,
1544 pFramebuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001545}
1546
Jon Ashburn23d36b12016-02-02 17:47:28 -07001547LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1548vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer,
1549 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001550 const VkLayerDispatchTable *disp;
1551
1552 disp = loader_get_dispatch(device);
1553
Chia-I Wuf7458c52015-10-26 21:10:41 +08001554 disp->DestroyFramebuffer(device, framebuffer, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -06001555}
1556
Jon Ashburn23d36b12016-02-02 17:47:28 -07001557LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1558vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
1559 const VkAllocationCallbacks *pAllocator,
1560 VkRenderPass *pRenderPass) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001561 const VkLayerDispatchTable *disp;
1562
1563 disp = loader_get_dispatch(device);
1564
Chia-I Wuf7458c52015-10-26 21:10:41 +08001565 return disp->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
Jon Ashburn754864f2015-07-23 18:49:07 -06001566}
1567
Jon Ashburn23d36b12016-02-02 17:47:28 -07001568LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1569vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass,
1570 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001571 const VkLayerDispatchTable *disp;
1572
1573 disp = loader_get_dispatch(device);
1574
Chia-I Wuf7458c52015-10-26 21:10:41 +08001575 disp->DestroyRenderPass(device, renderPass, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -06001576}
1577
Jon Ashburn23d36b12016-02-02 17:47:28 -07001578LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1579vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass,
1580 VkExtent2D *pGranularity) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001581 const VkLayerDispatchTable *disp;
1582
1583 disp = loader_get_dispatch(device);
1584
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001585 disp->GetRenderAreaGranularity(device, renderPass, pGranularity);
Jon Ashburn754864f2015-07-23 18:49:07 -06001586}
1587
Jon Ashburn23d36b12016-02-02 17:47:28 -07001588LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1589vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo,
1590 const VkAllocationCallbacks *pAllocator,
1591 VkCommandPool *pCommandPool) {
Cody Northrope62183e2015-07-09 18:08:05 -06001592 const VkLayerDispatchTable *disp;
1593
1594 disp = loader_get_dispatch(device);
1595
Jon Ashburn23d36b12016-02-02 17:47:28 -07001596 return disp->CreateCommandPool(device, pCreateInfo, pAllocator,
1597 pCommandPool);
Cody Northrope62183e2015-07-09 18:08:05 -06001598}
1599
Jon Ashburn23d36b12016-02-02 17:47:28 -07001600LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1601vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool,
1602 const VkAllocationCallbacks *pAllocator) {
Cody Northrope62183e2015-07-09 18:08:05 -06001603 const VkLayerDispatchTable *disp;
1604
1605 disp = loader_get_dispatch(device);
1606
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001607 disp->DestroyCommandPool(device, commandPool, pAllocator);
Cody Northrope62183e2015-07-09 18:08:05 -06001608}
1609
Jon Ashburn23d36b12016-02-02 17:47:28 -07001610LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1611vkResetCommandPool(VkDevice device, VkCommandPool commandPool,
1612 VkCommandPoolResetFlags flags) {
Cody Northrope62183e2015-07-09 18:08:05 -06001613 const VkLayerDispatchTable *disp;
1614
1615 disp = loader_get_dispatch(device);
1616
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001617 return disp->ResetCommandPool(device, commandPool, flags);
Cody Northrope62183e2015-07-09 18:08:05 -06001618}
1619
Jon Ashburn23d36b12016-02-02 17:47:28 -07001620LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1621vkAllocateCommandBuffers(VkDevice device,
1622 const VkCommandBufferAllocateInfo *pAllocateInfo,
1623 VkCommandBuffer *pCommandBuffers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001624 const VkLayerDispatchTable *disp;
1625 VkResult res;
1626
1627 disp = loader_get_dispatch(device);
1628
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001629 res = disp->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001630 if (res == VK_SUCCESS) {
Jon Ashburn23d36b12016-02-02 17:47:28 -07001631 for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; i++) {
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001632 if (pCommandBuffers[i]) {
1633 loader_init_dispatch(pCommandBuffers[i], disp);
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001634 }
1635 }
Jon Ashburnd55a3942015-05-06 09:02:10 -06001636 }
1637
1638 return res;
1639}
1640
Jon Ashburn23d36b12016-02-02 17:47:28 -07001641LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1642vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool,
1643 uint32_t commandBufferCount,
1644 const VkCommandBuffer *pCommandBuffers) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001645 const VkLayerDispatchTable *disp;
1646
1647 disp = loader_get_dispatch(device);
1648
Jon Ashburn23d36b12016-02-02 17:47:28 -07001649 disp->FreeCommandBuffers(device, commandPool, commandBufferCount,
1650 pCommandBuffers);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001651}
1652
Jon Ashburn23d36b12016-02-02 17:47:28 -07001653LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1654vkBeginCommandBuffer(VkCommandBuffer commandBuffer,
1655 const VkCommandBufferBeginInfo *pBeginInfo) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001656 const VkLayerDispatchTable *disp;
1657
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001658 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001659
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001660 return disp->BeginCommandBuffer(commandBuffer, pBeginInfo);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001661}
1662
Jon Ashburn23d36b12016-02-02 17:47:28 -07001663LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1664vkEndCommandBuffer(VkCommandBuffer commandBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001665 const VkLayerDispatchTable *disp;
1666
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001667 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001668
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001669 return disp->EndCommandBuffer(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001670}
1671
Jon Ashburn23d36b12016-02-02 17:47:28 -07001672LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1673vkResetCommandBuffer(VkCommandBuffer commandBuffer,
1674 VkCommandBufferResetFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001675 const VkLayerDispatchTable *disp;
1676
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001677 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001678
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001679 return disp->ResetCommandBuffer(commandBuffer, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001680}
1681
Jon Ashburn23d36b12016-02-02 17:47:28 -07001682LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1683vkCmdBindPipeline(VkCommandBuffer commandBuffer,
1684 VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001685 const VkLayerDispatchTable *disp;
1686
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001687 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001688
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001689 disp->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001690}
1691
Jon Ashburn23d36b12016-02-02 17:47:28 -07001692LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1693vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport,
1694 uint32_t viewportCount, const VkViewport *pViewports) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001695 const VkLayerDispatchTable *disp;
1696
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001697 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001698
Jon Ashburn23d36b12016-02-02 17:47:28 -07001699 disp->CmdSetViewport(commandBuffer, firstViewport, viewportCount,
1700 pViewports);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001701}
1702
Jon Ashburn23d36b12016-02-02 17:47:28 -07001703LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1704vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor,
1705 uint32_t scissorCount, const VkRect2D *pScissors) {
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001706 const VkLayerDispatchTable *disp;
1707
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001708 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001709
Jon Ashburn19d3bf12015-12-30 14:06:55 -07001710 disp->CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001711}
1712
Jon Ashburn23d36b12016-02-02 17:47:28 -07001713LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1714vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001715 const VkLayerDispatchTable *disp;
1716
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001717 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001718
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001719 disp->CmdSetLineWidth(commandBuffer, lineWidth);
Cody Northrop12365112015-08-17 11:10:49 -06001720}
1721
Jon Ashburn23d36b12016-02-02 17:47:28 -07001722LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1723vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor,
1724 float depthBiasClamp, float depthBiasSlopeFactor) {
Cody Northrop12365112015-08-17 11:10:49 -06001725 const VkLayerDispatchTable *disp;
1726
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001727 disp = loader_get_dispatch(commandBuffer);
Cody Northrop12365112015-08-17 11:10:49 -06001728
Jon Ashburn23d36b12016-02-02 17:47:28 -07001729 disp->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor,
1730 depthBiasClamp, depthBiasSlopeFactor);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001731}
1732
Jon Ashburn23d36b12016-02-02 17:47:28 -07001733LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1734vkCmdSetBlendConstants(VkCommandBuffer commandBuffer,
1735 const float blendConstants[4]) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001736 const VkLayerDispatchTable *disp;
1737
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001738 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001739
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001740 disp->CmdSetBlendConstants(commandBuffer, blendConstants);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001741}
1742
Jon Ashburn23d36b12016-02-02 17:47:28 -07001743LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1744vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds,
1745 float maxDepthBounds) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001746 const VkLayerDispatchTable *disp;
1747
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001748 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001749
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001750 disp->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
Cody Northrop82485a82015-08-18 15:21:16 -06001751}
1752
Jon Ashburn23d36b12016-02-02 17:47:28 -07001753LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1754vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer,
1755 VkStencilFaceFlags faceMask, uint32_t compareMask) {
Cody Northrop82485a82015-08-18 15:21:16 -06001756 const VkLayerDispatchTable *disp;
1757
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001758 disp = loader_get_dispatch(commandBuffer);
Cody Northrop82485a82015-08-18 15:21:16 -06001759
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001760 disp->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001761}
1762
Jon Ashburn23d36b12016-02-02 17:47:28 -07001763LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1764vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer,
1765 VkStencilFaceFlags faceMask, uint32_t writeMask) {
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001766 const VkLayerDispatchTable *disp;
1767
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001768 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001769
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001770 disp->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001771}
1772
Jon Ashburn23d36b12016-02-02 17:47:28 -07001773LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1774vkCmdSetStencilReference(VkCommandBuffer commandBuffer,
1775 VkStencilFaceFlags faceMask, uint32_t reference) {
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001776 const VkLayerDispatchTable *disp;
1777
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001778 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001779
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001780 disp->CmdSetStencilReference(commandBuffer, faceMask, reference);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001781}
1782
Jon Ashburn23d36b12016-02-02 17:47:28 -07001783LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets(
1784 VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
1785 VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount,
1786 const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount,
1787 const uint32_t *pDynamicOffsets) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001788 const VkLayerDispatchTable *disp;
1789
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001790 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001791
Jon Ashburn23d36b12016-02-02 17:47:28 -07001792 disp->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout,
1793 firstSet, descriptorSetCount, pDescriptorSets,
1794 dynamicOffsetCount, pDynamicOffsets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001795}
1796
Jon Ashburn23d36b12016-02-02 17:47:28 -07001797LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1798vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer,
1799 VkDeviceSize offset, VkIndexType indexType) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001800 const VkLayerDispatchTable *disp;
1801
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001802 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001803
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001804 disp->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001805}
1806
Jon Ashburn23d36b12016-02-02 17:47:28 -07001807LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1808vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding,
1809 uint32_t bindingCount, const VkBuffer *pBuffers,
1810 const VkDeviceSize *pOffsets) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001811 const VkLayerDispatchTable *disp;
1812
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001813 disp = loader_get_dispatch(commandBuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001814
Jon Ashburn23d36b12016-02-02 17:47:28 -07001815 disp->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount,
1816 pBuffers, pOffsets);
Jon Ashburn754864f2015-07-23 18:49:07 -06001817}
1818
Jon Ashburn23d36b12016-02-02 17:47:28 -07001819LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1820vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount,
1821 uint32_t instanceCount, uint32_t firstVertex,
1822 uint32_t firstInstance) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001823 const VkLayerDispatchTable *disp;
1824
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001825 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001826
Jon Ashburn23d36b12016-02-02 17:47:28 -07001827 disp->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex,
1828 firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001829}
1830
Jon Ashburn23d36b12016-02-02 17:47:28 -07001831LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1832vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount,
1833 uint32_t instanceCount, uint32_t firstIndex,
1834 int32_t vertexOffset, uint32_t firstInstance) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001835 const VkLayerDispatchTable *disp;
1836
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001837 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001838
Jon Ashburn23d36b12016-02-02 17:47:28 -07001839 disp->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex,
1840 vertexOffset, firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001841}
1842
Jon Ashburn23d36b12016-02-02 17:47:28 -07001843LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1844vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1845 VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001846 const VkLayerDispatchTable *disp;
1847
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001848 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001849
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001850 disp->CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001851}
1852
Jon Ashburn23d36b12016-02-02 17:47:28 -07001853LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1854vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1855 VkDeviceSize offset, uint32_t drawCount,
1856 uint32_t stride) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001857 const VkLayerDispatchTable *disp;
1858
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001859 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001860
Jon Ashburn23d36b12016-02-02 17:47:28 -07001861 disp->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount,
1862 stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001863}
1864
Jon Ashburn23d36b12016-02-02 17:47:28 -07001865LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1866vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y,
1867 uint32_t z) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001868 const VkLayerDispatchTable *disp;
1869
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001870 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001871
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001872 disp->CmdDispatch(commandBuffer, x, y, z);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001873}
1874
Jon Ashburn23d36b12016-02-02 17:47:28 -07001875LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1876vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1877 VkDeviceSize offset) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001878 const VkLayerDispatchTable *disp;
1879
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001880 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001881
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001882 disp->CmdDispatchIndirect(commandBuffer, buffer, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001883}
1884
Jon Ashburn23d36b12016-02-02 17:47:28 -07001885LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1886vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer,
1887 VkBuffer dstBuffer, uint32_t regionCount,
1888 const VkBufferCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001889 const VkLayerDispatchTable *disp;
1890
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001891 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001892
Jon Ashburn23d36b12016-02-02 17:47:28 -07001893 disp->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount,
1894 pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001895}
1896
Jon Ashburn23d36b12016-02-02 17:47:28 -07001897LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1898vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage,
1899 VkImageLayout srcImageLayout, VkImage dstImage,
1900 VkImageLayout dstImageLayout, uint32_t regionCount,
1901 const VkImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001902 const VkLayerDispatchTable *disp;
1903
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001904 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001905
Jon Ashburn23d36b12016-02-02 17:47:28 -07001906 disp->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage,
1907 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001908}
1909
Jon Ashburn23d36b12016-02-02 17:47:28 -07001910LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1911vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage,
1912 VkImageLayout srcImageLayout, VkImage dstImage,
1913 VkImageLayout dstImageLayout, uint32_t regionCount,
1914 const VkImageBlit *pRegions, VkFilter filter) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001915 const VkLayerDispatchTable *disp;
1916
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001917 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001918
Jon Ashburn23d36b12016-02-02 17:47:28 -07001919 disp->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage,
1920 dstImageLayout, regionCount, pRegions, filter);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001921}
1922
Jon Ashburn23d36b12016-02-02 17:47:28 -07001923LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1924vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer,
1925 VkImage dstImage, VkImageLayout dstImageLayout,
1926 uint32_t regionCount,
1927 const VkBufferImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001928 const VkLayerDispatchTable *disp;
1929
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001930 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001931
Jon Ashburn23d36b12016-02-02 17:47:28 -07001932 disp->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage,
1933 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001934}
1935
Jon Ashburn23d36b12016-02-02 17:47:28 -07001936LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1937vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage,
1938 VkImageLayout srcImageLayout, VkBuffer dstBuffer,
1939 uint32_t regionCount,
1940 const VkBufferImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001941 const VkLayerDispatchTable *disp;
1942
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001943 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001944
Jon Ashburn23d36b12016-02-02 17:47:28 -07001945 disp->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout,
1946 dstBuffer, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001947}
1948
Jon Ashburn23d36b12016-02-02 17:47:28 -07001949LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1950vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
1951 VkDeviceSize dstOffset, VkDeviceSize dataSize,
1952 const uint32_t *pData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001953 const VkLayerDispatchTable *disp;
1954
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001955 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001956
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001957 disp->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001958}
1959
Jon Ashburn23d36b12016-02-02 17:47:28 -07001960LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1961vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
1962 VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001963 const VkLayerDispatchTable *disp;
1964
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001965 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001966
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001967 disp->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001968}
1969
Jon Ashburn23d36b12016-02-02 17:47:28 -07001970LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1971vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image,
1972 VkImageLayout imageLayout, const VkClearColorValue *pColor,
1973 uint32_t rangeCount,
1974 const VkImageSubresourceRange *pRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001975 const VkLayerDispatchTable *disp;
1976
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001977 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001978
Jon Ashburn23d36b12016-02-02 17:47:28 -07001979 disp->CmdClearColorImage(commandBuffer, image, imageLayout, pColor,
1980 rangeCount, pRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001981}
1982
Jon Ashburn23d36b12016-02-02 17:47:28 -07001983LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1984vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image,
1985 VkImageLayout imageLayout,
1986 const VkClearDepthStencilValue *pDepthStencil,
1987 uint32_t rangeCount,
1988 const VkImageSubresourceRange *pRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001989 const VkLayerDispatchTable *disp;
1990
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001991 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001992
Jon Ashburn23d36b12016-02-02 17:47:28 -07001993 disp->CmdClearDepthStencilImage(commandBuffer, image, imageLayout,
1994 pDepthStencil, rangeCount, pRanges);
Chris Forbesd9be82b2015-06-22 17:21:59 +12001995}
1996
Jon Ashburn23d36b12016-02-02 17:47:28 -07001997LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1998vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
1999 const VkClearAttachment *pAttachments, uint32_t rectCount,
2000 const VkClearRect *pRects) {
Chris Forbesd9be82b2015-06-22 17:21:59 +12002001 const VkLayerDispatchTable *disp;
2002
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002003 disp = loader_get_dispatch(commandBuffer);
Chris Forbesd9be82b2015-06-22 17:21:59 +12002004
Jon Ashburn23d36b12016-02-02 17:47:28 -07002005 disp->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments,
2006 rectCount, pRects);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002007}
2008
Jon Ashburn23d36b12016-02-02 17:47:28 -07002009LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2010vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage,
2011 VkImageLayout srcImageLayout, VkImage dstImage,
2012 VkImageLayout dstImageLayout, uint32_t regionCount,
2013 const VkImageResolve *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002014 const VkLayerDispatchTable *disp;
2015
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002016 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002017
Jon Ashburn23d36b12016-02-02 17:47:28 -07002018 disp->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage,
2019 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002020}
2021
Jon Ashburn23d36b12016-02-02 17:47:28 -07002022LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2023vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event,
2024 VkPipelineStageFlags stageMask) {
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->CmdSetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002030}
2031
Jon Ashburn23d36b12016-02-02 17:47:28 -07002032LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2033vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event,
2034 VkPipelineStageFlags stageMask) {
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->CmdResetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002040}
2041
Jon Ashburn23d36b12016-02-02 17:47:28 -07002042LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2043vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount,
2044 const VkEvent *pEvents, VkPipelineStageFlags sourceStageMask,
2045 VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount,
2046 const VkMemoryBarrier *pMemoryBarriers,
2047 uint32_t bufferMemoryBarrierCount,
2048 const VkBufferMemoryBarrier *pBufferMemoryBarriers,
2049 uint32_t imageMemoryBarrierCount,
2050 const VkImageMemoryBarrier *pImageMemoryBarriers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002051 const VkLayerDispatchTable *disp;
2052
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002053 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002054
Jon Ashburnf19916e2016-01-11 13:12:43 -07002055 disp->CmdWaitEvents(commandBuffer, eventCount, pEvents, sourceStageMask,
2056 dstStageMask, memoryBarrierCount, pMemoryBarriers,
2057 bufferMemoryBarrierCount, pBufferMemoryBarriers,
2058 imageMemoryBarrierCount, pImageMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002059}
2060
Jon Ashburnf19916e2016-01-11 13:12:43 -07002061LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier(
Jon Ashburn23d36b12016-02-02 17:47:28 -07002062 VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask,
2063 VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags,
2064 uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers,
2065 uint32_t bufferMemoryBarrierCount,
2066 const VkBufferMemoryBarrier *pBufferMemoryBarriers,
2067 uint32_t imageMemoryBarrierCount,
2068 const VkImageMemoryBarrier *pImageMemoryBarriers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002069 const VkLayerDispatchTable *disp;
2070
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002071 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002072
Jon Ashburn23d36b12016-02-02 17:47:28 -07002073 disp->CmdPipelineBarrier(
2074 commandBuffer, srcStageMask, dstStageMask, dependencyFlags,
2075 memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount,
2076 pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002077}
2078
Jon Ashburn23d36b12016-02-02 17:47:28 -07002079LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2080vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2081 uint32_t slot, VkFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002082 const VkLayerDispatchTable *disp;
2083
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002084 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002085
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002086 disp->CmdBeginQuery(commandBuffer, queryPool, slot, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002087}
2088
Jon Ashburn23d36b12016-02-02 17:47:28 -07002089LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2090vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2091 uint32_t slot) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002092 const VkLayerDispatchTable *disp;
2093
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002094 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002095
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002096 disp->CmdEndQuery(commandBuffer, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002097}
2098
Jon Ashburn23d36b12016-02-02 17:47:28 -07002099LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2100vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2101 uint32_t firstQuery, uint32_t queryCount) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002102 const VkLayerDispatchTable *disp;
2103
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002104 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002105
Jon Ashburn19d3bf12015-12-30 14:06:55 -07002106 disp->CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002107}
2108
Jon Ashburn23d36b12016-02-02 17:47:28 -07002109LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2110vkCmdWriteTimestamp(VkCommandBuffer commandBuffer,
2111 VkPipelineStageFlagBits pipelineStage,
2112 VkQueryPool queryPool, uint32_t slot) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002113 const VkLayerDispatchTable *disp;
2114
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002115 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002116
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002117 disp->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002118}
2119
Jon Ashburn23d36b12016-02-02 17:47:28 -07002120LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2121vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2122 uint32_t firstQuery, uint32_t queryCount,
2123 VkBuffer dstBuffer, VkDeviceSize dstOffset,
2124 VkDeviceSize stride, VkFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002125 const VkLayerDispatchTable *disp;
2126
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002127 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002128
Jon Ashburn23d36b12016-02-02 17:47:28 -07002129 disp->CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery,
2130 queryCount, dstBuffer, dstOffset, stride,
2131 flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002132}
2133
Jon Ashburn23d36b12016-02-02 17:47:28 -07002134LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2135vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout,
2136 VkShaderStageFlags stageFlags, uint32_t offset,
2137 uint32_t size, const void *pValues) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002138 const VkLayerDispatchTable *disp;
2139
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002140 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002141
Jon Ashburn23d36b12016-02-02 17:47:28 -07002142 disp->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size,
2143 pValues);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06002144}
2145
Jon Ashburn23d36b12016-02-02 17:47:28 -07002146LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2147vkCmdBeginRenderPass(VkCommandBuffer commandBuffer,
2148 const VkRenderPassBeginInfo *pRenderPassBegin,
2149 VkSubpassContents contents) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002150 const VkLayerDispatchTable *disp;
2151
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002152 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002153
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002154 disp->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
Chia-I Wu08accc62015-07-07 11:50:03 +08002155}
2156
Jon Ashburn23d36b12016-02-02 17:47:28 -07002157LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2158vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) {
Chia-I Wu08accc62015-07-07 11:50:03 +08002159 const VkLayerDispatchTable *disp;
2160
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002161 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu08accc62015-07-07 11:50:03 +08002162
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002163 disp->CmdNextSubpass(commandBuffer, contents);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002164}
2165
Jon Ashburn23d36b12016-02-02 17:47:28 -07002166LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2167vkCmdEndRenderPass(VkCommandBuffer commandBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002168 const VkLayerDispatchTable *disp;
2169
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002170 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002171
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002172 disp->CmdEndRenderPass(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002173}
2174
Jon Ashburn23d36b12016-02-02 17:47:28 -07002175LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2176vkCmdExecuteCommands(VkCommandBuffer commandBuffer,
2177 uint32_t commandBuffersCount,
2178 const VkCommandBuffer *pCommandBuffers) {
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002179 const VkLayerDispatchTable *disp;
2180
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002181 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002182
Jon Ashburn23d36b12016-02-02 17:47:28 -07002183 disp->CmdExecuteCommands(commandBuffer, commandBuffersCount,
2184 pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002185}