blob: f9264d7b6c528451d472d005f3e44b7c3964b69d [file] [log] [blame]
Jon Ashburnd55a3942015-05-06 09:02:10 -06001/*
Jon Ashburnd55a3942015-05-06 09:02:10 -06002 *
Jon Ashburn23d36b12016-02-02 17:47:28 -07003 * Copyright (c) 2015-2016 The Khronos Group Inc.
4 * Copyright (c) 2015-2016 Valve Corporation
5 * Copyright (c) 2015-2016 LunarG, Inc.
Courtney Goeltzenleuchterf821dad2015-12-02 14:53:22 -07006 * Copyright (C) 2015 Google Inc.
Jon Ashburnd55a3942015-05-06 09:02:10 -06007 *
Jon Ashburn3ebf1252016-04-19 11:30:31 -06008 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
Jon Ashburnd55a3942015-05-06 09:02:10 -060011 *
Jon Ashburn3ebf1252016-04-19 11:30:31 -060012 * http://www.apache.org/licenses/LICENSE-2.0
Jon Ashburnd55a3942015-05-06 09:02:10 -060013 *
Jon Ashburn3ebf1252016-04-19 11:30:31 -060014 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
Jon Ashburn23d36b12016-02-02 17:47:28 -070019 *
20 * Author: Courtney Goeltzenleuchter <courtney@lunarg.com>
Courtney Goeltzenleuchter05559522015-10-30 11:14:30 -060021 * Author: Jon Ashburn <jon@lunarg.com>
22 * Author: Tony Barbour <tony@LunarG.com>
Jon Ashburn23d36b12016-02-02 17:47:28 -070023 * Author: Chia-I Wu <olv@lunarg.com>
Jon Ashburnd55a3942015-05-06 09:02:10 -060024 */
Courtney Goeltzenleuchter7f5aafc2015-07-05 11:28:29 -060025#define _GNU_SOURCE
Jon Ashburn27cd5842015-05-12 17:26:48 -060026#include <stdlib.h>
27#include <string.h>
Jon Ashburnd55a3942015-05-06 09:02:10 -060028
Tobin Ehlisb835d1b2015-07-03 10:34:49 -060029#include "vk_loader_platform.h"
Jon Ashburnd55a3942015-05-06 09:02:10 -060030#include "loader.h"
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -060031#include "debug_report.h"
Ian Elliott954fa342015-10-30 15:28:23 -060032#include "wsi.h"
Jon Ashburn1530c342016-02-26 13:14:27 -070033#include "gpa_helper.h"
34#include "table_ops.h"
Jon Ashburnd55a3942015-05-06 09:02:10 -060035
Jon Ashburn1530c342016-02-26 13:14:27 -070036/* Trampoline entrypoints are in this file for core Vulkan commands */
37/**
38 * Get an instance level or global level entry point address.
39 * @param instance
40 * @param pName
41 * @return
42 * If instance == NULL returns a global level functions only
43 * If instance is valid returns a trampoline entry point for all dispatchable
44 * Vulkan
45 * functions both core and extensions.
46 */
47LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
48vkGetInstanceProcAddr(VkInstance instance, const char *pName) {
49
50 void *addr;
51
52 addr = globalGetProcAddr(pName);
53 if (instance == VK_NULL_HANDLE) {
54 // get entrypoint addresses that are global (no dispatchable object)
55
56 return addr;
57 } else {
58 // if a global entrypoint return NULL
59 if (addr)
60 return NULL;
61 }
62
63 struct loader_instance *ptr_instance = loader_get_instance(instance);
64 if (ptr_instance == NULL)
65 return NULL;
66 // Return trampoline code for non-global entrypoints including any
67 // extensions.
68 // Device extensions are returned if a layer or ICD supports the extension.
69 // Instance extensions are returned if the extension is enabled and the
70 // loader
71 // or someone else supports the extension
72 return trampolineGetProcAddr(ptr_instance, pName);
73}
74
75/**
76 * Get a device level or global level entry point address.
77 * @param device
78 * @param pName
79 * @return
80 * If device is valid, returns a device relative entry point for device level
81 * entry points both core and extensions.
82 * Device relative means call down the device chain.
83 */
84LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
85vkGetDeviceProcAddr(VkDevice device, const char *pName) {
86 void *addr;
87
88 /* for entrypoints that loader must handle (ie non-dispatchable or create
89 object)
90 make sure the loader entrypoint is returned */
91 addr = loader_non_passthrough_gdpa(pName);
92 if (addr) {
93 return addr;
94 }
95
96 /* Although CreateDevice is on device chain it's dispatchable object isn't
97 * a VkDevice or child of VkDevice so return NULL.
98 */
99 if (!strcmp(pName, "CreateDevice"))
100 return NULL;
101
102 /* return the dispatch table entrypoint for the fastest case */
103 const VkLayerDispatchTable *disp_table = *(VkLayerDispatchTable **)device;
104 if (disp_table == NULL)
105 return NULL;
106
107 addr = loader_lookup_device_dispatch_table(disp_table, pName);
108 if (addr)
109 return addr;
110
111 if (disp_table->GetDeviceProcAddr == NULL)
112 return NULL;
113 return disp_table->GetDeviceProcAddr(device, pName);
114}
115
116LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
117vkEnumerateInstanceExtensionProperties(const char *pLayerName,
118 uint32_t *pPropertyCount,
119 VkExtensionProperties *pProperties) {
120 struct loader_extension_list *global_ext_list = NULL;
121 struct loader_layer_list instance_layers;
Jon Ashburnb8726962016-04-08 15:03:35 -0600122 struct loader_extension_list local_ext_list;
Jon Ashburn1530c342016-02-26 13:14:27 -0700123 struct loader_icd_libs icd_libs;
124 uint32_t copy_size;
125
126 tls_instance = NULL;
Jon Ashburnb8726962016-04-08 15:03:35 -0600127 memset(&local_ext_list, 0, sizeof(local_ext_list));
Jon Ashburn1530c342016-02-26 13:14:27 -0700128 memset(&instance_layers, 0, sizeof(instance_layers));
129 loader_platform_thread_once(&once_init, loader_initialize);
130
131 /* get layer libraries if needed */
132 if (pLayerName && strlen(pLayerName) != 0) {
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600133 if (vk_string_validate(MaxLoaderStringLength, pLayerName) !=
Jon Ashburn1530c342016-02-26 13:14:27 -0700134 VK_STRING_ERROR_NONE) {
Jon Ashburn1530c342016-02-26 13:14:27 -0700135 assert(VK_FALSE && "vkEnumerateInstanceExtensionProperties: "
136 "pLayerName is too long or is badly formed");
137 return VK_ERROR_EXTENSION_NOT_PRESENT;
138 }
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600139
140 loader_layer_scan(NULL, &instance_layers, NULL);
Jon Ashburnb8726962016-04-08 15:03:35 -0600141 if (strcmp(pLayerName, std_validation_str) == 0) {
142 struct loader_layer_list local_list;
143 memset(&local_list, 0, sizeof(local_list));
144 for (uint32_t i = 0; i < sizeof(std_validation_names) /
145 sizeof(std_validation_names[0]);
146 i++) {
147 loader_find_layer_name_add_list(NULL, std_validation_names[i],
148 VK_LAYER_TYPE_INSTANCE_EXPLICIT,
149 &instance_layers, &local_list);
150 }
151 for (uint32_t i = 0; i < local_list.count; i++) {
152 struct loader_extension_list *ext_list =
Jon Ashburncc407a22016-04-15 09:25:03 -0600153 &local_list.list[i].instance_extension_list;
Jon Ashburnb8726962016-04-08 15:03:35 -0600154 loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count,
155 ext_list->list);
156 }
157 loader_destroy_layer_list(NULL, &local_list);
158 global_ext_list = &local_ext_list;
159
160 } else {
161 for (uint32_t i = 0; i < instance_layers.count; i++) {
162 struct loader_layer_properties *props =
163 &instance_layers.list[i];
164 if (strcmp(props->info.layerName, pLayerName) == 0) {
165 global_ext_list = &props->instance_extension_list;
166 break;
167 }
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600168 }
169 }
Jon Ashburn1530c342016-02-26 13:14:27 -0700170 } else {
171 /* Scan/discover all ICD libraries */
172 memset(&icd_libs, 0, sizeof(struct loader_icd_libs));
173 loader_icd_scan(NULL, &icd_libs);
174 /* get extensions from all ICD's, merge so no duplicates */
175 loader_get_icd_loader_instance_extensions(NULL, &icd_libs,
Jon Ashburnb8726962016-04-08 15:03:35 -0600176 &local_ext_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700177 loader_scanned_icd_clear(NULL, &icd_libs);
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600178
179 // Append implicit layers.
180 loader_implicit_layer_scan(NULL, &instance_layers, NULL);
181 for (uint32_t i = 0; i < instance_layers.count; i++) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600182 struct loader_extension_list *ext_list =
183 &instance_layers.list[i].instance_extension_list;
184 loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count,
185 ext_list->list);
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600186 }
187
Jon Ashburnb8726962016-04-08 15:03:35 -0600188 global_ext_list = &local_ext_list;
Jon Ashburn1530c342016-02-26 13:14:27 -0700189 }
190
191 if (global_ext_list == NULL) {
192 loader_destroy_layer_list(NULL, &instance_layers);
193 return VK_ERROR_LAYER_NOT_PRESENT;
194 }
195
196 if (pProperties == NULL) {
197 *pPropertyCount = global_ext_list->count;
198 loader_destroy_layer_list(NULL, &instance_layers);
199 loader_destroy_generic_list(
Jon Ashburnb8726962016-04-08 15:03:35 -0600200 NULL, (struct loader_generic_list *)&local_ext_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700201 return VK_SUCCESS;
202 }
203
204 copy_size = *pPropertyCount < global_ext_list->count
205 ? *pPropertyCount
206 : global_ext_list->count;
207 for (uint32_t i = 0; i < copy_size; i++) {
208 memcpy(&pProperties[i], &global_ext_list->list[i],
209 sizeof(VkExtensionProperties));
210 }
211 *pPropertyCount = copy_size;
212 loader_destroy_generic_list(NULL,
Jon Ashburnb8726962016-04-08 15:03:35 -0600213 (struct loader_generic_list *)&local_ext_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700214
215 if (copy_size < global_ext_list->count) {
216 loader_destroy_layer_list(NULL, &instance_layers);
217 return VK_INCOMPLETE;
218 }
219
220 loader_destroy_layer_list(NULL, &instance_layers);
221 return VK_SUCCESS;
222}
223
224LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
225vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount,
226 VkLayerProperties *pProperties) {
227
228 struct loader_layer_list instance_layer_list;
229 tls_instance = NULL;
230
231 loader_platform_thread_once(&once_init, loader_initialize);
232
233 uint32_t copy_size;
234
235 /* get layer libraries */
236 memset(&instance_layer_list, 0, sizeof(instance_layer_list));
237 loader_layer_scan(NULL, &instance_layer_list, NULL);
238
239 if (pProperties == NULL) {
240 *pPropertyCount = instance_layer_list.count;
241 loader_destroy_layer_list(NULL, &instance_layer_list);
242 return VK_SUCCESS;
243 }
244
245 copy_size = (*pPropertyCount < instance_layer_list.count)
246 ? *pPropertyCount
247 : instance_layer_list.count;
248 for (uint32_t i = 0; i < copy_size; i++) {
249 memcpy(&pProperties[i], &instance_layer_list.list[i].info,
250 sizeof(VkLayerProperties));
251 }
252
253 *pPropertyCount = copy_size;
254 loader_destroy_layer_list(NULL, &instance_layer_list);
255
256 if (copy_size < instance_layer_list.count) {
257 return VK_INCOMPLETE;
258 }
259
260 return VK_SUCCESS;
261}
262
Jon Ashburn23d36b12016-02-02 17:47:28 -0700263LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
264vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
265 const VkAllocationCallbacks *pAllocator,
266 VkInstance *pInstance) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600267 struct loader_instance *ptr_instance = NULL;
Jon Ashburne5b9bba2016-01-18 12:20:03 -0700268 VkInstance created_instance = VK_NULL_HANDLE;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600269 VkResult res = VK_ERROR_INITIALIZATION_FAILED;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600270
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600271 loader_platform_thread_once(&once_init, loader_initialize);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600272
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700273#if 0
274 if (pAllocator) {
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800275 ptr_instance = (struct loader_instance *) pAllocator->pfnAllocation(
Chia-I Wuf7458c52015-10-26 21:10:41 +0800276 pAllocator->pUserData,
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600277 sizeof(struct loader_instance),
Jon Ashburn6a118ae2016-01-07 15:21:14 -0700278 sizeof(int *),
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800279 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600280 } else {
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700281#endif
Jon Ashburn23d36b12016-02-02 17:47:28 -0700282 ptr_instance =
283 (struct loader_instance *)malloc(sizeof(struct loader_instance));
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700284 //}
Jon Ashburn27cd5842015-05-12 17:26:48 -0600285 if (ptr_instance == NULL) {
286 return VK_ERROR_OUT_OF_HOST_MEMORY;
287 }
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600288
Jon Ashburn87d6aa92015-08-28 15:19:27 -0600289 tls_instance = ptr_instance;
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600290 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburnb82c1852015-08-11 14:49:54 -0600291 memset(ptr_instance, 0, sizeof(struct loader_instance));
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700292#if 0
Chia-I Wuf7458c52015-10-26 21:10:41 +0800293 if (pAllocator) {
294 ptr_instance->alloc_callbacks = *pAllocator;
Courtney Goeltzenleuchter7f5aafc2015-07-05 11:28:29 -0600295 }
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700296#endif
Courtney Goeltzenleuchter7f5aafc2015-07-05 11:28:29 -0600297
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700298 /*
Ian Elliottad6300f2016-03-31 10:48:19 -0600299 * Look for one or more debug report create info structures
300 * and setup a callback(s) for each one found.
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700301 */
Ian Elliottad6300f2016-03-31 10:48:19 -0600302 ptr_instance->num_tmp_callbacks = 0;
303 ptr_instance->tmp_dbg_create_infos = NULL;
304 ptr_instance->tmp_callbacks = NULL;
Jon Ashburncc407a22016-04-15 09:25:03 -0600305 if (util_CopyDebugReportCreateInfos(pCreateInfo->pNext, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600306 &ptr_instance->num_tmp_callbacks,
307 &ptr_instance->tmp_dbg_create_infos,
308 &ptr_instance->tmp_callbacks)) {
309 // One or more were found, but allocation failed. Therefore, clean up
310 // and fail this function:
311 loader_heap_free(ptr_instance, ptr_instance);
312 loader_platform_thread_unlock_mutex(&loader_lock);
313 return VK_ERROR_OUT_OF_HOST_MEMORY;
314 } else if (ptr_instance->num_tmp_callbacks > 0) {
315 // Setup the temporary callback(s) here to catch early issues:
Jon Ashburncc407a22016-04-15 09:25:03 -0600316 if (util_CreateDebugReportCallbacks(ptr_instance, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600317 ptr_instance->num_tmp_callbacks,
318 ptr_instance->tmp_dbg_create_infos,
319 ptr_instance->tmp_callbacks)) {
320 // Failure of setting up one or more of the callback. Therefore,
321 // clean up and fail this function:
322 util_FreeDebugReportCreateInfos(pAllocator,
323 ptr_instance->tmp_dbg_create_infos,
324 ptr_instance->tmp_callbacks);
325 loader_heap_free(ptr_instance, ptr_instance);
326 loader_platform_thread_unlock_mutex(&loader_lock);
327 return VK_ERROR_OUT_OF_HOST_MEMORY;
Courtney Goeltzenleuchter82887272015-12-02 15:29:33 -0700328 }
329 }
330
Jon Ashburn3d002332015-08-20 16:35:30 -0600331 /* Due to implicit layers need to get layer list even if
Jon Ashburnf19916e2016-01-11 13:12:43 -0700332 * enabledLayerCount == 0 and VK_INSTANCE_LAYERS is unset. For now always
Jon Ashburn3d002332015-08-20 16:35:30 -0600333 * get layer list (both instance and device) via loader_layer_scan(). */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700334 memset(&ptr_instance->instance_layer_list, 0,
335 sizeof(ptr_instance->instance_layer_list));
336 memset(&ptr_instance->device_layer_list, 0,
337 sizeof(ptr_instance->device_layer_list));
338 loader_layer_scan(ptr_instance, &ptr_instance->instance_layer_list,
Jon Ashburne39a4f82015-08-28 13:38:21 -0600339 &ptr_instance->device_layer_list);
Jon Ashburn3d002332015-08-20 16:35:30 -0600340
341 /* validate the app requested layers to be enabled */
Jon Ashburnf19916e2016-01-11 13:12:43 -0700342 if (pCreateInfo->enabledLayerCount > 0) {
Jon Ashburnf2b4e382016-02-10 20:50:19 -0700343 res =
344 loader_validate_layers(ptr_instance, pCreateInfo->enabledLayerCount,
345 pCreateInfo->ppEnabledLayerNames,
346 &ptr_instance->instance_layer_list);
Jon Ashburn3d002332015-08-20 16:35:30 -0600347 if (res != VK_SUCCESS) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600348 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600349 ptr_instance->num_tmp_callbacks,
350 ptr_instance->tmp_callbacks);
351 util_FreeDebugReportCreateInfos(pAllocator,
352 ptr_instance->tmp_dbg_create_infos,
353 ptr_instance->tmp_callbacks);
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700354 loader_heap_free(ptr_instance, ptr_instance);
Jon Ashburn1ff17592015-10-09 09:40:30 -0600355 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn3d002332015-08-20 16:35:30 -0600356 return res;
357 }
358 }
359
Jon Ashburn86a527a2016-02-10 20:59:26 -0700360 /* convert any meta layers to the actual layers makes a copy of layer name*/
Chris Forbesbd9de052016-04-06 20:49:02 +1200361 VkInstanceCreateInfo ici = *pCreateInfo;
Jon Ashburn86a527a2016-02-10 20:59:26 -0700362 loader_expand_layer_names(
363 ptr_instance, std_validation_str,
364 sizeof(std_validation_names) / sizeof(std_validation_names[0]),
Jon Ashburncc407a22016-04-15 09:25:03 -0600365 std_validation_names, &ici.enabledLayerCount, &ici.ppEnabledLayerNames);
Jon Ashburn86a527a2016-02-10 20:59:26 -0700366
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600367 /* Scan/discover all ICD libraries */
368 memset(&ptr_instance->icd_libs, 0, sizeof(ptr_instance->icd_libs));
Jon Ashburne39a4f82015-08-28 13:38:21 -0600369 loader_icd_scan(ptr_instance, &ptr_instance->icd_libs);
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600370
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600371 /* get extensions from all ICD's, merge so no duplicates, then validate */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700372 loader_get_icd_loader_instance_extensions(
373 ptr_instance, &ptr_instance->icd_libs, &ptr_instance->ext_list);
374 res = loader_validate_instance_extensions(
Jon Ashburnf2b4e382016-02-10 20:50:19 -0700375 ptr_instance, &ptr_instance->ext_list,
Chris Forbesbd9de052016-04-06 20:49:02 +1200376 &ptr_instance->instance_layer_list, &ici);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600377 if (res != VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200378 loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
Jon Ashburne39a4f82015-08-28 13:38:21 -0600379 loader_delete_layer_properties(ptr_instance,
380 &ptr_instance->device_layer_list);
381 loader_delete_layer_properties(ptr_instance,
382 &ptr_instance->instance_layer_list);
383 loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700384 loader_destroy_generic_list(
385 ptr_instance,
386 (struct loader_generic_list *)&ptr_instance->ext_list);
Jon Ashburncc407a22016-04-15 09:25:03 -0600387 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600388 ptr_instance->num_tmp_callbacks,
389 ptr_instance->tmp_callbacks);
390 util_FreeDebugReportCreateInfos(pAllocator,
391 ptr_instance->tmp_dbg_create_infos,
392 ptr_instance->tmp_callbacks);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600393 loader_platform_thread_unlock_mutex(&loader_lock);
394 loader_heap_free(ptr_instance, ptr_instance);
395 return res;
396 }
397
Jon Ashburn23d36b12016-02-02 17:47:28 -0700398 ptr_instance->disp =
399 loader_heap_alloc(ptr_instance, sizeof(VkLayerInstanceDispatchTable),
400 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600401 if (ptr_instance->disp == NULL) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200402 loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
Jon Ashburne39a4f82015-08-28 13:38:21 -0600403 loader_delete_layer_properties(ptr_instance,
404 &ptr_instance->device_layer_list);
405 loader_delete_layer_properties(ptr_instance,
406 &ptr_instance->instance_layer_list);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700407 loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
408 loader_destroy_generic_list(
409 ptr_instance,
410 (struct loader_generic_list *)&ptr_instance->ext_list);
Jon Ashburncc407a22016-04-15 09:25:03 -0600411 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600412 ptr_instance->num_tmp_callbacks,
413 ptr_instance->tmp_callbacks);
414 util_FreeDebugReportCreateInfos(pAllocator,
415 ptr_instance->tmp_dbg_create_infos,
416 ptr_instance->tmp_callbacks);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600417 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600418 loader_heap_free(ptr_instance, ptr_instance);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600419 return VK_ERROR_OUT_OF_HOST_MEMORY;
420 }
421 memcpy(ptr_instance->disp, &instance_disp, sizeof(instance_disp));
422 ptr_instance->next = loader.instances;
423 loader.instances = ptr_instance;
424
Jon Ashburnb82c1852015-08-11 14:49:54 -0600425 /* activate any layers on instance chain */
Chris Forbesbd9de052016-04-06 20:49:02 +1200426 res = loader_enable_instance_layers(ptr_instance, &ici,
Jon Ashburne39a4f82015-08-28 13:38:21 -0600427 &ptr_instance->instance_layer_list);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600428 if (res != VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200429 loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
Jon Ashburne39a4f82015-08-28 13:38:21 -0600430 loader_delete_layer_properties(ptr_instance,
431 &ptr_instance->device_layer_list);
432 loader_delete_layer_properties(ptr_instance,
433 &ptr_instance->instance_layer_list);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700434 loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
435 loader_destroy_generic_list(
436 ptr_instance,
437 (struct loader_generic_list *)&ptr_instance->ext_list);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600438 loader.instances = ptr_instance->next;
Jon Ashburncc407a22016-04-15 09:25:03 -0600439 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600440 ptr_instance->num_tmp_callbacks,
441 ptr_instance->tmp_callbacks);
442 util_FreeDebugReportCreateInfos(pAllocator,
443 ptr_instance->tmp_dbg_create_infos,
444 ptr_instance->tmp_callbacks);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600445 loader_platform_thread_unlock_mutex(&loader_lock);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600446 loader_heap_free(ptr_instance, ptr_instance->disp);
447 loader_heap_free(ptr_instance, ptr_instance);
448 return res;
449 }
Jon Ashburn07daee72015-05-21 18:13:33 -0600450
Jon Ashburn23d36b12016-02-02 17:47:28 -0700451 created_instance = (VkInstance)ptr_instance;
Chris Forbesbd9de052016-04-06 20:49:02 +1200452 res = loader_create_instance_chain(&ici, pAllocator, ptr_instance,
Jon Ashburn6e0a2132016-02-03 12:37:30 -0700453 &created_instance);
Jon Ashburneed0c002015-05-21 17:42:17 -0600454
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700455 if (res == VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200456 wsi_create_instance(ptr_instance, &ici);
457 debug_report_create_instance(ptr_instance, &ici);
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700458
Jon Ashburne5b9bba2016-01-18 12:20:03 -0700459 *pInstance = created_instance;
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700460
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700461 /*
462 * Finally have the layers in place and everyone has seen
463 * the CreateInstance command go by. This allows the layer's
464 * GetInstanceProcAddr functions to return valid extension functions
465 * if enabled.
466 */
467 loader_activate_instance_layer_extensions(ptr_instance, *pInstance);
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700468 } else {
469 // TODO: cleanup here.
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700470 }
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700471
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700472 /* Remove temporary debug_report callback */
Jon Ashburncc407a22016-04-15 09:25:03 -0600473 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600474 ptr_instance->num_tmp_callbacks,
475 ptr_instance->tmp_callbacks);
Chris Forbesbd9de052016-04-06 20:49:02 +1200476 loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600477 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600478 return res;
479}
480
Jon Ashburn23d36b12016-02-02 17:47:28 -0700481LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
482vkDestroyInstance(VkInstance instance,
483 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600484 const VkLayerInstanceDispatchTable *disp;
Jon Ashburne0e64572015-09-30 12:56:42 -0600485 struct loader_instance *ptr_instance = NULL;
Ian Elliott3b354cf2016-03-25 08:43:01 -0600486 bool callback_setup = false;
487
Jeremy Hayesd8726c22016-04-21 13:19:41 -0600488 if (instance == VK_NULL_HANDLE) {
489 return;
490 }
491
Jon Ashburn27cd5842015-05-12 17:26:48 -0600492 disp = loader_get_instance_dispatch(instance);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600493
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600494 loader_platform_thread_lock_mutex(&loader_lock);
495
Jon Ashburne0e64572015-09-30 12:56:42 -0600496 ptr_instance = loader_get_instance(instance);
Ian Elliott3b354cf2016-03-25 08:43:01 -0600497
Ian Elliottad6300f2016-03-31 10:48:19 -0600498 if (ptr_instance->num_tmp_callbacks > 0) {
499 // Setup the temporary callback(s) here to catch cleanup issues:
Jon Ashburncc407a22016-04-15 09:25:03 -0600500 if (!util_CreateDebugReportCallbacks(ptr_instance, pAllocator,
501 ptr_instance->num_tmp_callbacks,
502 ptr_instance->tmp_dbg_create_infos,
503 ptr_instance->tmp_callbacks)) {
Ian Elliott3b354cf2016-03-25 08:43:01 -0600504 callback_setup = true;
505 }
506 }
507
Chia-I Wuf7458c52015-10-26 21:10:41 +0800508 disp->DestroyInstance(instance, pAllocator);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600509
Jon Ashburn4dc1d8a2016-04-20 13:21:17 -0600510 loader_deactivate_layers(ptr_instance, &ptr_instance->activated_layer_list);
Jon Ashburn014438f2016-03-01 19:51:07 -0700511 if (ptr_instance->phys_devs)
512 loader_heap_free(ptr_instance, ptr_instance->phys_devs);
Ian Elliott3b354cf2016-03-25 08:43:01 -0600513 if (callback_setup) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600514 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600515 ptr_instance->num_tmp_callbacks,
516 ptr_instance->tmp_callbacks);
517 util_FreeDebugReportCreateInfos(pAllocator,
518 ptr_instance->tmp_dbg_create_infos,
519 ptr_instance->tmp_callbacks);
Ian Elliott3b354cf2016-03-25 08:43:01 -0600520 }
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600521 loader_heap_free(ptr_instance, ptr_instance->disp);
522 loader_heap_free(ptr_instance, ptr_instance);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600523 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600524}
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600525
Jon Ashburn23d36b12016-02-02 17:47:28 -0700526LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
527vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount,
528 VkPhysicalDevice *pPhysicalDevices) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600529 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600530 VkResult res;
Jon Ashburn014438f2016-03-01 19:51:07 -0700531 uint32_t count, i;
532 struct loader_instance *inst;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600533 disp = loader_get_instance_dispatch(instance);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600534
535 loader_platform_thread_lock_mutex(&loader_lock);
536 res = disp->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount,
Jon Ashburn27cd5842015-05-12 17:26:48 -0600537 pPhysicalDevices);
Jon Ashburn014438f2016-03-01 19:51:07 -0700538
539 if (res != VK_SUCCESS && res != VK_INCOMPLETE) {
540 loader_platform_thread_unlock_mutex(&loader_lock);
541 return res;
542 }
543
544 if (!pPhysicalDevices) {
545 loader_platform_thread_unlock_mutex(&loader_lock);
546 return res;
547 }
548
549 // wrap the PhysDev object for loader usage, return wrapped objects
550 inst = loader_get_instance(instance);
551 if (!inst) {
552 loader_platform_thread_unlock_mutex(&loader_lock);
553 return VK_ERROR_INITIALIZATION_FAILED;
554 }
Jon Ashburncc407a22016-04-15 09:25:03 -0600555 count = (inst->total_gpu_count < *pPhysicalDeviceCount)
556 ? inst->total_gpu_count
557 : *pPhysicalDeviceCount;
Piers Daniell295fe402016-03-29 11:51:11 -0600558 *pPhysicalDeviceCount = count;
Jeannot Breton32ad8d82016-04-12 15:46:20 -0500559 if (!inst->phys_devs) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600560 inst->phys_devs =
561 (struct loader_physical_device_tramp *)loader_heap_alloc(
562 inst, inst->total_gpu_count *
563 sizeof(struct loader_physical_device_tramp),
564 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Jeannot Breton32ad8d82016-04-12 15:46:20 -0500565 }
Jon Ashburn014438f2016-03-01 19:51:07 -0700566 if (!inst->phys_devs) {
567 loader_platform_thread_unlock_mutex(&loader_lock);
568 return VK_ERROR_OUT_OF_HOST_MEMORY;
569 }
570
571 for (i = 0; i < count; i++) {
572
573 // initialize the loader's physicalDevice object
574 loader_set_dispatch((void *)&inst->phys_devs[i], inst->disp);
Piers Daniell295fe402016-03-29 11:51:11 -0600575 inst->phys_devs[i].this_instance = inst;
Jon Ashburn014438f2016-03-01 19:51:07 -0700576 inst->phys_devs[i].phys_dev = pPhysicalDevices[i];
577
578 // copy wrapped object into Application provided array
579 pPhysicalDevices[i] = (VkPhysicalDevice)&inst->phys_devs[i];
580 }
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600581 loader_platform_thread_unlock_mutex(&loader_lock);
582 return res;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600583}
584
Jon Ashburn23d36b12016-02-02 17:47:28 -0700585LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
Jon Ashburn014438f2016-03-01 19:51:07 -0700586vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700587 VkPhysicalDeviceFeatures *pFeatures) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600588 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700589 VkPhysicalDevice unwrapped_phys_dev =
590 loader_unwrap_physical_device(physicalDevice);
591 disp = loader_get_instance_dispatch(physicalDevice);
592 disp->GetPhysicalDeviceFeatures(unwrapped_phys_dev, pFeatures);
Jon Ashburn754864f2015-07-23 18:49:07 -0600593}
594
Jon Ashburn23d36b12016-02-02 17:47:28 -0700595LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
Jon Ashburn014438f2016-03-01 19:51:07 -0700596vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice,
597 VkFormat format,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700598 VkFormatProperties *pFormatInfo) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600599 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700600 VkPhysicalDevice unwrapped_pd =
601 loader_unwrap_physical_device(physicalDevice);
602 disp = loader_get_instance_dispatch(physicalDevice);
603 disp->GetPhysicalDeviceFormatProperties(unwrapped_pd, format, pFormatInfo);
Jon Ashburn754864f2015-07-23 18:49:07 -0600604}
605
Jon Ashburn23d36b12016-02-02 17:47:28 -0700606LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
607vkGetPhysicalDeviceImageFormatProperties(
608 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
609 VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
610 VkImageFormatProperties *pImageFormatProperties) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600611 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700612 VkPhysicalDevice unwrapped_phys_dev =
613 loader_unwrap_physical_device(physicalDevice);
Jon Ashburn754864f2015-07-23 18:49:07 -0600614 disp = loader_get_instance_dispatch(physicalDevice);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700615 return disp->GetPhysicalDeviceImageFormatProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700616 unwrapped_phys_dev, format, type, tiling, usage, flags,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700617 pImageFormatProperties);
Jon Ashburn754864f2015-07-23 18:49:07 -0600618}
619
Jon Ashburn23d36b12016-02-02 17:47:28 -0700620LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
Jon Ashburn014438f2016-03-01 19:51:07 -0700621vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700622 VkPhysicalDeviceProperties *pProperties) {
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600623 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700624 VkPhysicalDevice unwrapped_phys_dev =
625 loader_unwrap_physical_device(physicalDevice);
626 disp = loader_get_instance_dispatch(physicalDevice);
627 disp->GetPhysicalDeviceProperties(unwrapped_phys_dev, pProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600628}
629
Jon Ashburn23d36b12016-02-02 17:47:28 -0700630LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
631vkGetPhysicalDeviceQueueFamilyProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700632 VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700633 VkQueueFamilyProperties *pQueueProperties) {
Tony Barbour59a47322015-06-24 16:06:58 -0600634 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700635 VkPhysicalDevice unwrapped_phys_dev =
636 loader_unwrap_physical_device(physicalDevice);
637 disp = loader_get_instance_dispatch(physicalDevice);
638 disp->GetPhysicalDeviceQueueFamilyProperties(
639 unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600640}
641
Chia-I Wu9ab61502015-11-06 06:42:02 +0800642LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700643 VkPhysicalDevice physicalDevice,
644 VkPhysicalDeviceMemoryProperties *pMemoryProperties) {
Tony Barbour59a47322015-06-24 16:06:58 -0600645 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700646 VkPhysicalDevice unwrapped_phys_dev =
647 loader_unwrap_physical_device(physicalDevice);
648 disp = loader_get_instance_dispatch(physicalDevice);
649 disp->GetPhysicalDeviceMemoryProperties(unwrapped_phys_dev,
650 pMemoryProperties);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600651}
652
Jon Ashburn23d36b12016-02-02 17:47:28 -0700653LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
Jon Ashburn1530c342016-02-26 13:14:27 -0700654vkCreateDevice(VkPhysicalDevice physicalDevice,
655 const VkDeviceCreateInfo *pCreateInfo,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700656 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600657 VkResult res;
Jon Ashburn787eb252016-03-24 15:49:57 -0600658 struct loader_physical_device_tramp *phys_dev;
Jon Ashburn1530c342016-02-26 13:14:27 -0700659 struct loader_device *dev;
660 struct loader_instance *inst;
661 struct loader_layer_list activated_layer_list = {0};
662
663 assert(pCreateInfo->queueCreateInfoCount >= 1);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600664
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600665 loader_platform_thread_lock_mutex(&loader_lock);
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600666
Jon Ashburn787eb252016-03-24 15:49:57 -0600667 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Piers Daniell295fe402016-03-29 11:51:11 -0600668 inst = (struct loader_instance *)phys_dev->this_instance;
Jon Ashburn1530c342016-02-26 13:14:27 -0700669
670 /* validate any app enabled layers are available */
671 if (pCreateInfo->enabledLayerCount > 0) {
672 res = loader_validate_layers(inst, pCreateInfo->enabledLayerCount,
673 pCreateInfo->ppEnabledLayerNames,
674 &inst->device_layer_list);
675 if (res != VK_SUCCESS) {
676 loader_platform_thread_unlock_mutex(&loader_lock);
677 return res;
678 }
679 }
680
Jon Ashburn014438f2016-03-01 19:51:07 -0700681 /* Get the physical device (ICD) extensions */
682 struct loader_extension_list icd_exts;
683 if (!loader_init_generic_list(inst, (struct loader_generic_list *)&icd_exts,
684 sizeof(VkExtensionProperties))) {
685 loader_platform_thread_unlock_mutex(&loader_lock);
686 return VK_ERROR_OUT_OF_HOST_MEMORY;
687 }
Jon Ashburn1530c342016-02-26 13:14:27 -0700688
Jon Ashburn014438f2016-03-01 19:51:07 -0700689 res = loader_add_device_extensions(
Jon Ashburncc407a22016-04-15 09:25:03 -0600690 inst, inst->disp->EnumerateDeviceExtensionProperties,
691 phys_dev->phys_dev, "Unknown", &icd_exts);
Jon Ashburn014438f2016-03-01 19:51:07 -0700692 if (res != VK_SUCCESS) {
693 loader_platform_thread_unlock_mutex(&loader_lock);
694 return res;
Jon Ashburn1530c342016-02-26 13:14:27 -0700695 }
696
697 /* convert any meta layers to the actual layers makes a copy of layer name*/
Chris Forbesbd9de052016-04-06 20:49:02 +1200698 VkDeviceCreateInfo dci = *pCreateInfo;
Jon Ashburn1530c342016-02-26 13:14:27 -0700699 loader_expand_layer_names(
700 inst, std_validation_str,
701 sizeof(std_validation_names) / sizeof(std_validation_names[0]),
Jon Ashburncc407a22016-04-15 09:25:03 -0600702 std_validation_names, &dci.enabledLayerCount, &dci.ppEnabledLayerNames);
Jon Ashburn1530c342016-02-26 13:14:27 -0700703
704 /* fetch a list of all layers activated, explicit and implicit */
Jon Ashburncc407a22016-04-15 09:25:03 -0600705 res = loader_enable_device_layers(inst, &activated_layer_list, &dci,
706 &inst->device_layer_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700707 if (res != VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200708 loader_delete_shadow_dev_layer_names(inst, pCreateInfo, &dci);
Jon Ashburn1530c342016-02-26 13:14:27 -0700709 loader_platform_thread_unlock_mutex(&loader_lock);
710 return res;
711 }
712
713 /* make sure requested extensions to be enabled are supported */
714 res = loader_validate_device_extensions(phys_dev, &activated_layer_list,
Chris Forbesbd9de052016-04-06 20:49:02 +1200715 &icd_exts, &dci);
Jon Ashburn1530c342016-02-26 13:14:27 -0700716 if (res != VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200717 loader_delete_shadow_dev_layer_names(inst, pCreateInfo, &dci);
Jon Ashburn1530c342016-02-26 13:14:27 -0700718 loader_destroy_generic_list(
719 inst, (struct loader_generic_list *)&activated_layer_list);
720 loader_platform_thread_unlock_mutex(&loader_lock);
721 return res;
722 }
723
Piers Daniell295fe402016-03-29 11:51:11 -0600724 dev = loader_create_logical_device(inst);
Jon Ashburn1530c342016-02-26 13:14:27 -0700725 if (dev == NULL) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200726 loader_delete_shadow_dev_layer_names(inst, pCreateInfo, &dci);
Jon Ashburn1530c342016-02-26 13:14:27 -0700727 loader_destroy_generic_list(
728 inst, (struct loader_generic_list *)&activated_layer_list);
729 loader_platform_thread_unlock_mutex(&loader_lock);
730 return VK_ERROR_OUT_OF_HOST_MEMORY;
731 }
732
733 /* move the locally filled layer list into the device, and pass ownership of
734 * the memory */
735 dev->activated_layer_list.capacity = activated_layer_list.capacity;
736 dev->activated_layer_list.count = activated_layer_list.count;
737 dev->activated_layer_list.list = activated_layer_list.list;
738 memset(&activated_layer_list, 0, sizeof(activated_layer_list));
739
740 /* activate any layers on device chain which terminates with device*/
Jon Ashburncc407a22016-04-15 09:25:03 -0600741 res = loader_enable_device_layers(inst, &dev->activated_layer_list, &dci,
742 &inst->device_layer_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700743 if (res != VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200744 loader_delete_shadow_dev_layer_names(inst, pCreateInfo, &dci);
Jon Ashburn1530c342016-02-26 13:14:27 -0700745 loader_platform_thread_unlock_mutex(&loader_lock);
746 return res;
747 }
748
Jon Ashburncc407a22016-04-15 09:25:03 -0600749 res = loader_create_device_chain(phys_dev, &dci, pAllocator, inst, dev);
Jon Ashburn1530c342016-02-26 13:14:27 -0700750 if (res != VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200751 loader_delete_shadow_dev_layer_names(inst, pCreateInfo, &dci);
Jon Ashburn1530c342016-02-26 13:14:27 -0700752 loader_platform_thread_unlock_mutex(&loader_lock);
753 return res;
754 }
755
756 *pDevice = dev->device;
757
758 /* initialize any device extension dispatch entry's from the instance list*/
759 loader_init_dispatch_dev_ext(inst, dev);
760
761 /* initialize WSI device extensions as part of core dispatch since loader
762 * has
763 * dedicated trampoline code for these*/
764 loader_init_device_extension_dispatch_table(
765 &dev->loader_dispatch,
766 dev->loader_dispatch.core_dispatch.GetDeviceProcAddr, *pDevice);
767
Chris Forbesbd9de052016-04-06 20:49:02 +1200768 loader_delete_shadow_dev_layer_names(inst, pCreateInfo, &dci);
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600769
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600770 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600771 return res;
772}
773
Jon Ashburn23d36b12016-02-02 17:47:28 -0700774LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
775vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600776 const VkLayerDispatchTable *disp;
Jon Ashburne39a4f82015-08-28 13:38:21 -0600777 struct loader_device *dev;
Andrzej Kotlowskib168b1a2016-02-03 09:41:53 +0100778
Jeremy Hayesd8726c22016-04-21 13:19:41 -0600779 if (device == VK_NULL_HANDLE) {
780 return;
781 }
782
Andrzej Kotlowskib168b1a2016-02-03 09:41:53 +0100783 loader_platform_thread_lock_mutex(&loader_lock);
784
Jon Ashburne39a4f82015-08-28 13:38:21 -0600785 struct loader_icd *icd = loader_get_icd_and_device(device, &dev);
786 const struct loader_instance *inst = icd->this_instance;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600787 disp = loader_get_dispatch(device);
788
Chia-I Wuf7458c52015-10-26 21:10:41 +0800789 disp->DestroyDevice(device, pAllocator);
Jon Ashburn781a7ae2015-11-19 15:43:26 -0700790 dev->device = NULL;
791 loader_remove_logical_device(inst, icd, dev);
792
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600793 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600794}
795
Jon Ashburn23d36b12016-02-02 17:47:28 -0700796LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
797vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
798 const char *pLayerName,
799 uint32_t *pPropertyCount,
800 VkExtensionProperties *pProperties) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700801 VkResult res = VK_SUCCESS;
Jon Ashburn787eb252016-03-24 15:49:57 -0600802 struct loader_physical_device_tramp *phys_dev;
803 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600804
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600805 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700806
807 /* If pLayerName == NULL, then querying ICD extensions, pass this call
808 down the instance chain which will terminate in the ICD. This allows
809 layers to filter the extensions coming back up the chain.
810 If pLayerName != NULL then get layer extensions from manifest file. */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700811 if (pLayerName == NULL || strlen(pLayerName) == 0) {
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700812 const VkLayerInstanceDispatchTable *disp;
813
814 disp = loader_get_instance_dispatch(physicalDevice);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700815 res = disp->EnumerateDeviceExtensionProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700816 phys_dev->phys_dev, NULL, pPropertyCount, pProperties);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700817 } else {
Jon Ashburn014438f2016-03-01 19:51:07 -0700818
Jon Ashburndc5d9202016-02-29 13:00:51 -0700819 uint32_t count;
820 uint32_t copy_size;
Piers Daniell295fe402016-03-29 11:51:11 -0600821 const struct loader_instance *inst = phys_dev->this_instance;
Jon Ashburnb8726962016-04-08 15:03:35 -0600822 struct loader_device_extension_list *dev_ext_list = NULL;
823 struct loader_device_extension_list local_ext_list;
824 memset(&local_ext_list, 0, sizeof(local_ext_list));
Jon Ashburndc5d9202016-02-29 13:00:51 -0700825 if (vk_string_validate(MaxLoaderStringLength, pLayerName) ==
Jon Ashburn014438f2016-03-01 19:51:07 -0700826 VK_STRING_ERROR_NONE) {
Jon Ashburnb8726962016-04-08 15:03:35 -0600827 if (strcmp(pLayerName, std_validation_str) == 0) {
828 struct loader_layer_list local_list;
829 memset(&local_list, 0, sizeof(local_list));
830 for (uint32_t i = 0; i < sizeof(std_validation_names) /
831 sizeof(std_validation_names[0]);
832 i++) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600833 loader_find_layer_name_add_list(
834 NULL, std_validation_names[i],
835 VK_LAYER_TYPE_DEVICE_EXPLICIT, &inst->device_layer_list,
836 &local_list);
Jon Ashburnb8726962016-04-08 15:03:35 -0600837 }
838 for (uint32_t i = 0; i < local_list.count; i++) {
839 struct loader_device_extension_list *ext_list =
Jon Ashburncc407a22016-04-15 09:25:03 -0600840 &local_list.list[i].device_extension_list;
Jon Ashburnb8726962016-04-08 15:03:35 -0600841 for (uint32_t j = 0; j < ext_list->count; j++) {
842 loader_add_to_dev_ext_list(NULL, &local_ext_list,
843 &ext_list->list[j].props, 0,
844 NULL);
845 }
846 }
847 dev_ext_list = &local_ext_list;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700848
Jon Ashburnb8726962016-04-08 15:03:35 -0600849 } else {
850 for (uint32_t i = 0; i < inst->device_layer_list.count; i++) {
851 struct loader_layer_properties *props =
852 &inst->device_layer_list.list[i];
853 if (strcmp(props->info.layerName, pLayerName) == 0) {
854 dev_ext_list = &props->device_extension_list;
855 }
Jon Ashburndc5d9202016-02-29 13:00:51 -0700856 }
857 }
Jon Ashburnb8726962016-04-08 15:03:35 -0600858
Jon Ashburndc5d9202016-02-29 13:00:51 -0700859 count = (dev_ext_list == NULL) ? 0 : dev_ext_list->count;
860 if (pProperties == NULL) {
861 *pPropertyCount = count;
Jon Ashburncc407a22016-04-15 09:25:03 -0600862 loader_destroy_generic_list(
863 inst, (struct loader_generic_list *)&local_ext_list);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700864 loader_platform_thread_unlock_mutex(&loader_lock);
865 return VK_SUCCESS;
866 }
867
868 copy_size = *pPropertyCount < count ? *pPropertyCount : count;
869 for (uint32_t i = 0; i < copy_size; i++) {
870 memcpy(&pProperties[i], &dev_ext_list->list[i].props,
Jon Ashburn014438f2016-03-01 19:51:07 -0700871 sizeof(VkExtensionProperties));
Jon Ashburndc5d9202016-02-29 13:00:51 -0700872 }
873 *pPropertyCount = copy_size;
874
Jon Ashburncc407a22016-04-15 09:25:03 -0600875 loader_destroy_generic_list(
876 inst, (struct loader_generic_list *)&local_ext_list);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700877 if (copy_size < count) {
878 loader_platform_thread_unlock_mutex(&loader_lock);
879 return VK_INCOMPLETE;
880 }
881 } else {
Jon Ashburn014438f2016-03-01 19:51:07 -0700882 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
883 "vkEnumerateDeviceExtensionProperties: pLayerName "
884 "is too long or is badly formed");
885 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700886 return VK_ERROR_EXTENSION_NOT_PRESENT;
887 }
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700888 }
889
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600890 loader_platform_thread_unlock_mutex(&loader_lock);
Tony Barbour59a47322015-06-24 16:06:58 -0600891 return res;
892}
893
Jon Ashburn23d36b12016-02-02 17:47:28 -0700894LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
895vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
896 uint32_t *pPropertyCount,
897 VkLayerProperties *pProperties) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700898 uint32_t copy_size;
Jon Ashburn787eb252016-03-24 15:49:57 -0600899 struct loader_physical_device_tramp *phys_dev;
Tony Barbour59a47322015-06-24 16:06:58 -0600900
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600901 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700902
903 /* Don't dispatch this call down the instance chain, want all device layers
904 enumerated and instance chain may not contain all device layers */
Jon Ashburndc5d9202016-02-29 13:00:51 -0700905
Jon Ashburn787eb252016-03-24 15:49:57 -0600906 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Piers Daniell295fe402016-03-29 11:51:11 -0600907 const struct loader_instance *inst = phys_dev->this_instance;
Jon Ashburn014438f2016-03-01 19:51:07 -0700908 uint32_t count = inst->device_layer_list.count;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700909
910 if (pProperties == NULL) {
911 *pPropertyCount = count;
912 loader_platform_thread_unlock_mutex(&loader_lock);
913 return VK_SUCCESS;
914 }
915
916 copy_size = (*pPropertyCount < count) ? *pPropertyCount : count;
917 for (uint32_t i = 0; i < copy_size; i++) {
Jon Ashburn014438f2016-03-01 19:51:07 -0700918 memcpy(&pProperties[i], &(inst->device_layer_list.list[i].info),
Jon Ashburndc5d9202016-02-29 13:00:51 -0700919 sizeof(VkLayerProperties));
920 }
921 *pPropertyCount = copy_size;
922
923 if (copy_size < count) {
924 loader_platform_thread_unlock_mutex(&loader_lock);
925 return VK_INCOMPLETE;
926 }
927
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600928 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700929 return VK_SUCCESS;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600930}
931
Jon Ashburn23d36b12016-02-02 17:47:28 -0700932LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
933vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex,
934 VkQueue *pQueue) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600935 const VkLayerDispatchTable *disp;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600936
937 disp = loader_get_dispatch(device);
938
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600939 disp->GetDeviceQueue(device, queueNodeIndex, queueIndex, pQueue);
940 loader_set_dispatch(*pQueue, disp);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600941}
942
Jon Ashburn23d36b12016-02-02 17:47:28 -0700943LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
944vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits,
945 VkFence fence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600946 const VkLayerDispatchTable *disp;
947
948 disp = loader_get_dispatch(queue);
949
Chia-I Wu40cf0ae2015-10-26 17:20:32 +0800950 return disp->QueueSubmit(queue, submitCount, pSubmits, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600951}
952
Jon Ashburn23d36b12016-02-02 17:47:28 -0700953LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600954 const VkLayerDispatchTable *disp;
955
956 disp = loader_get_dispatch(queue);
957
958 return disp->QueueWaitIdle(queue);
959}
960
Jon Ashburn23d36b12016-02-02 17:47:28 -0700961LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600962 const VkLayerDispatchTable *disp;
963
964 disp = loader_get_dispatch(device);
965
966 return disp->DeviceWaitIdle(device);
967}
968
Jon Ashburn23d36b12016-02-02 17:47:28 -0700969LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
970vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
971 const VkAllocationCallbacks *pAllocator,
972 VkDeviceMemory *pMemory) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600973 const VkLayerDispatchTable *disp;
974
975 disp = loader_get_dispatch(device);
976
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800977 return disp->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600978}
979
Jon Ashburn23d36b12016-02-02 17:47:28 -0700980LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
981vkFreeMemory(VkDevice device, VkDeviceMemory mem,
982 const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600983 const VkLayerDispatchTable *disp;
984
985 disp = loader_get_dispatch(device);
986
Chia-I Wuf7458c52015-10-26 21:10:41 +0800987 disp->FreeMemory(device, mem, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600988}
989
Jon Ashburn23d36b12016-02-02 17:47:28 -0700990LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
991vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset,
992 VkDeviceSize size, VkFlags flags, void **ppData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600993 const VkLayerDispatchTable *disp;
994
995 disp = loader_get_dispatch(device);
996
997 return disp->MapMemory(device, mem, offset, size, flags, ppData);
998}
999
Jon Ashburn23d36b12016-02-02 17:47:28 -07001000LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1001vkUnmapMemory(VkDevice device, VkDeviceMemory mem) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001002 const VkLayerDispatchTable *disp;
1003
1004 disp = loader_get_dispatch(device);
1005
Mark Lobodzinski2141f652015-09-07 13:59:43 -06001006 disp->UnmapMemory(device, mem);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001007}
1008
Jon Ashburn23d36b12016-02-02 17:47:28 -07001009LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1010vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
1011 const VkMappedMemoryRange *pMemoryRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001012 const VkLayerDispatchTable *disp;
1013
1014 disp = loader_get_dispatch(device);
1015
Jon Ashburn23d36b12016-02-02 17:47:28 -07001016 return disp->FlushMappedMemoryRanges(device, memoryRangeCount,
1017 pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001018}
1019
Jon Ashburn23d36b12016-02-02 17:47:28 -07001020LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1021vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
1022 const VkMappedMemoryRange *pMemoryRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001023 const VkLayerDispatchTable *disp;
1024
1025 disp = loader_get_dispatch(device);
1026
Jon Ashburn23d36b12016-02-02 17:47:28 -07001027 return disp->InvalidateMappedMemoryRanges(device, memoryRangeCount,
1028 pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001029}
1030
Jon Ashburn23d36b12016-02-02 17:47:28 -07001031LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1032vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory,
1033 VkDeviceSize *pCommittedMemoryInBytes) {
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -06001034 const VkLayerDispatchTable *disp;
1035
1036 disp = loader_get_dispatch(device);
1037
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001038 disp->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes);
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -06001039}
1040
Jon Ashburn23d36b12016-02-02 17:47:28 -07001041LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1042vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem,
1043 VkDeviceSize offset) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001044 const VkLayerDispatchTable *disp;
1045
Mark Lobodzinski942b1722015-05-11 17:21:15 -05001046 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001047
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001048 return disp->BindBufferMemory(device, buffer, mem, offset);
1049}
1050
Jon Ashburn23d36b12016-02-02 17:47:28 -07001051LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1052vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem,
1053 VkDeviceSize offset) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001054 const VkLayerDispatchTable *disp;
1055
1056 disp = loader_get_dispatch(device);
1057
1058 return disp->BindImageMemory(device, image, mem, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001059}
1060
Jon Ashburn23d36b12016-02-02 17:47:28 -07001061LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1062vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer,
1063 VkMemoryRequirements *pMemoryRequirements) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001064 const VkLayerDispatchTable *disp;
1065
1066 disp = loader_get_dispatch(device);
1067
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001068 disp->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -06001069}
1070
Jon Ashburn23d36b12016-02-02 17:47:28 -07001071LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1072vkGetImageMemoryRequirements(VkDevice device, VkImage image,
1073 VkMemoryRequirements *pMemoryRequirements) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001074 const VkLayerDispatchTable *disp;
1075
1076 disp = loader_get_dispatch(device);
1077
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001078 disp->GetImageMemoryRequirements(device, image, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -06001079}
1080
Jon Ashburn23d36b12016-02-02 17:47:28 -07001081LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements(
1082 VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount,
1083 VkSparseImageMemoryRequirements *pSparseMemoryRequirements) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001084 const VkLayerDispatchTable *disp;
1085
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001086 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001087
Jon Ashburn23d36b12016-02-02 17:47:28 -07001088 disp->GetImageSparseMemoryRequirements(device, image,
1089 pSparseMemoryRequirementCount,
1090 pSparseMemoryRequirements);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001091}
1092
Jon Ashburn23d36b12016-02-02 17:47:28 -07001093LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1094vkGetPhysicalDeviceSparseImageFormatProperties(
1095 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
1096 VkSampleCountFlagBits samples, VkImageUsageFlags usage,
1097 VkImageTiling tiling, uint32_t *pPropertyCount,
1098 VkSparseImageFormatProperties *pProperties) {
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001099 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -07001100 VkPhysicalDevice unwrapped_phys_dev =
1101 loader_unwrap_physical_device(physicalDevice);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001102 disp = loader_get_instance_dispatch(physicalDevice);
1103
Jon Ashburn23d36b12016-02-02 17:47:28 -07001104 disp->GetPhysicalDeviceSparseImageFormatProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -07001105 unwrapped_phys_dev, format, type, samples, usage, tiling,
1106 pPropertyCount, pProperties);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001107}
1108
Jon Ashburn23d36b12016-02-02 17:47:28 -07001109LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1110vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount,
1111 const VkBindSparseInfo *pBindInfo, VkFence fence) {
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001112 const VkLayerDispatchTable *disp;
1113
1114 disp = loader_get_dispatch(queue);
1115
Chia-I Wu1ff4c3d2015-10-26 16:55:27 +08001116 return disp->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001117}
1118
Jon Ashburn23d36b12016-02-02 17:47:28 -07001119LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1120vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo,
1121 const VkAllocationCallbacks *pAllocator, VkFence *pFence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001122 const VkLayerDispatchTable *disp;
1123
1124 disp = loader_get_dispatch(device);
1125
Chia-I Wuf7458c52015-10-26 21:10:41 +08001126 return disp->CreateFence(device, pCreateInfo, pAllocator, pFence);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001127}
1128
Jon Ashburn23d36b12016-02-02 17:47:28 -07001129LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1130vkDestroyFence(VkDevice device, VkFence fence,
1131 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001132 const VkLayerDispatchTable *disp;
1133
1134 disp = loader_get_dispatch(device);
1135
Chia-I Wuf7458c52015-10-26 21:10:41 +08001136 disp->DestroyFence(device, fence, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001137}
1138
Jon Ashburn23d36b12016-02-02 17:47:28 -07001139LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1140vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001141 const VkLayerDispatchTable *disp;
1142
1143 disp = loader_get_dispatch(device);
1144
1145 return disp->ResetFences(device, fenceCount, pFences);
1146}
1147
Jon Ashburn23d36b12016-02-02 17:47:28 -07001148LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1149vkGetFenceStatus(VkDevice device, VkFence fence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001150 const VkLayerDispatchTable *disp;
1151
1152 disp = loader_get_dispatch(device);
1153
1154 return disp->GetFenceStatus(device, fence);
1155}
1156
Jon Ashburn23d36b12016-02-02 17:47:28 -07001157LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1158vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences,
1159 VkBool32 waitAll, uint64_t timeout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001160 const VkLayerDispatchTable *disp;
1161
1162 disp = loader_get_dispatch(device);
1163
1164 return disp->WaitForFences(device, fenceCount, pFences, waitAll, timeout);
1165}
1166
Jon Ashburn23d36b12016-02-02 17:47:28 -07001167LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1168vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo,
1169 const VkAllocationCallbacks *pAllocator,
1170 VkSemaphore *pSemaphore) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001171 const VkLayerDispatchTable *disp;
1172
1173 disp = loader_get_dispatch(device);
1174
Chia-I Wuf7458c52015-10-26 21:10:41 +08001175 return disp->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001176}
1177
Jon Ashburn23d36b12016-02-02 17:47:28 -07001178LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1179vkDestroySemaphore(VkDevice device, VkSemaphore semaphore,
1180 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001181 const VkLayerDispatchTable *disp;
1182
1183 disp = loader_get_dispatch(device);
1184
Chia-I Wuf7458c52015-10-26 21:10:41 +08001185 disp->DestroySemaphore(device, semaphore, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001186}
1187
Jon Ashburn23d36b12016-02-02 17:47:28 -07001188LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1189vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo,
1190 const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001191 const VkLayerDispatchTable *disp;
1192
1193 disp = loader_get_dispatch(device);
1194
Chia-I Wuf7458c52015-10-26 21:10:41 +08001195 return disp->CreateEvent(device, pCreateInfo, pAllocator, pEvent);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001196}
1197
Jon Ashburn23d36b12016-02-02 17:47:28 -07001198LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1199vkDestroyEvent(VkDevice device, VkEvent event,
1200 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001201 const VkLayerDispatchTable *disp;
1202
1203 disp = loader_get_dispatch(device);
1204
Chia-I Wuf7458c52015-10-26 21:10:41 +08001205 disp->DestroyEvent(device, event, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001206}
1207
Jon Ashburn23d36b12016-02-02 17:47:28 -07001208LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1209vkGetEventStatus(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001210 const VkLayerDispatchTable *disp;
1211
1212 disp = loader_get_dispatch(device);
1213
1214 return disp->GetEventStatus(device, event);
1215}
1216
Jon Ashburn23d36b12016-02-02 17:47:28 -07001217LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1218vkSetEvent(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001219 const VkLayerDispatchTable *disp;
1220
1221 disp = loader_get_dispatch(device);
1222
1223 return disp->SetEvent(device, event);
1224}
1225
Jon Ashburn23d36b12016-02-02 17:47:28 -07001226LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1227vkResetEvent(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001228 const VkLayerDispatchTable *disp;
1229
1230 disp = loader_get_dispatch(device);
1231
1232 return disp->ResetEvent(device, event);
1233}
1234
Jon Ashburn23d36b12016-02-02 17:47:28 -07001235LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1236vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo,
1237 const VkAllocationCallbacks *pAllocator,
1238 VkQueryPool *pQueryPool) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001239 const VkLayerDispatchTable *disp;
1240
1241 disp = loader_get_dispatch(device);
1242
Chia-I Wuf7458c52015-10-26 21:10:41 +08001243 return disp->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001244}
1245
Jon Ashburn23d36b12016-02-02 17:47:28 -07001246LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1247vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool,
1248 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001249 const VkLayerDispatchTable *disp;
1250
1251 disp = loader_get_dispatch(device);
1252
Chia-I Wuf7458c52015-10-26 21:10:41 +08001253 disp->DestroyQueryPool(device, queryPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001254}
1255
Jon Ashburn23d36b12016-02-02 17:47:28 -07001256LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1257vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool,
1258 uint32_t firstQuery, uint32_t queryCount, size_t dataSize,
1259 void *pData, VkDeviceSize stride,
1260 VkQueryResultFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001261 const VkLayerDispatchTable *disp;
1262
1263 disp = loader_get_dispatch(device);
1264
Jon Ashburn23d36b12016-02-02 17:47:28 -07001265 return disp->GetQueryPoolResults(device, queryPool, firstQuery, queryCount,
1266 dataSize, pData, stride, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001267}
1268
Jon Ashburn23d36b12016-02-02 17:47:28 -07001269LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1270vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo,
1271 const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001272 const VkLayerDispatchTable *disp;
1273
1274 disp = loader_get_dispatch(device);
1275
Chia-I Wuf7458c52015-10-26 21:10:41 +08001276 return disp->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001277}
1278
Jon Ashburn23d36b12016-02-02 17:47:28 -07001279LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1280vkDestroyBuffer(VkDevice device, VkBuffer buffer,
1281 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001282 const VkLayerDispatchTable *disp;
1283
1284 disp = loader_get_dispatch(device);
1285
Chia-I Wuf7458c52015-10-26 21:10:41 +08001286 disp->DestroyBuffer(device, buffer, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001287}
1288
Jon Ashburn23d36b12016-02-02 17:47:28 -07001289LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1290vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo,
1291 const VkAllocationCallbacks *pAllocator,
1292 VkBufferView *pView) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001293 const VkLayerDispatchTable *disp;
1294
1295 disp = loader_get_dispatch(device);
1296
Chia-I Wuf7458c52015-10-26 21:10:41 +08001297 return disp->CreateBufferView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001298}
1299
Jon Ashburn23d36b12016-02-02 17:47:28 -07001300LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1301vkDestroyBufferView(VkDevice device, VkBufferView bufferView,
1302 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001303 const VkLayerDispatchTable *disp;
1304
1305 disp = loader_get_dispatch(device);
1306
Chia-I Wuf7458c52015-10-26 21:10:41 +08001307 disp->DestroyBufferView(device, bufferView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001308}
1309
Jon Ashburn23d36b12016-02-02 17:47:28 -07001310LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1311vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
1312 const VkAllocationCallbacks *pAllocator, VkImage *pImage) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001313 const VkLayerDispatchTable *disp;
1314
1315 disp = loader_get_dispatch(device);
1316
Chia-I Wuf7458c52015-10-26 21:10:41 +08001317 return disp->CreateImage(device, pCreateInfo, pAllocator, pImage);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001318}
1319
Jon Ashburn23d36b12016-02-02 17:47:28 -07001320LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1321vkDestroyImage(VkDevice device, VkImage image,
1322 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001323 const VkLayerDispatchTable *disp;
1324
1325 disp = loader_get_dispatch(device);
1326
Chia-I Wuf7458c52015-10-26 21:10:41 +08001327 disp->DestroyImage(device, image, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001328}
1329
Jon Ashburn23d36b12016-02-02 17:47:28 -07001330LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1331vkGetImageSubresourceLayout(VkDevice device, VkImage image,
1332 const VkImageSubresource *pSubresource,
1333 VkSubresourceLayout *pLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001334 const VkLayerDispatchTable *disp;
1335
1336 disp = loader_get_dispatch(device);
1337
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001338 disp->GetImageSubresourceLayout(device, image, pSubresource, pLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001339}
1340
Jon Ashburn23d36b12016-02-02 17:47:28 -07001341LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1342vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo,
1343 const VkAllocationCallbacks *pAllocator, VkImageView *pView) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001344 const VkLayerDispatchTable *disp;
1345
1346 disp = loader_get_dispatch(device);
1347
Chia-I Wuf7458c52015-10-26 21:10:41 +08001348 return disp->CreateImageView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001349}
1350
Jon Ashburn23d36b12016-02-02 17:47:28 -07001351LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1352vkDestroyImageView(VkDevice device, VkImageView imageView,
1353 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001354 const VkLayerDispatchTable *disp;
1355
1356 disp = loader_get_dispatch(device);
1357
Chia-I Wuf7458c52015-10-26 21:10:41 +08001358 disp->DestroyImageView(device, imageView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001359}
1360
Jon Ashburn23d36b12016-02-02 17:47:28 -07001361LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1362vkCreateShaderModule(VkDevice device,
1363 const VkShaderModuleCreateInfo *pCreateInfo,
1364 const VkAllocationCallbacks *pAllocator,
1365 VkShaderModule *pShader) {
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -06001366 const VkLayerDispatchTable *disp;
1367
1368 disp = loader_get_dispatch(device);
1369
Chia-I Wuf7458c52015-10-26 21:10:41 +08001370 return disp->CreateShaderModule(device, pCreateInfo, pAllocator, pShader);
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -06001371}
1372
Jon Ashburn23d36b12016-02-02 17:47:28 -07001373LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1374vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule,
1375 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001376 const VkLayerDispatchTable *disp;
1377
1378 disp = loader_get_dispatch(device);
1379
Chia-I Wuf7458c52015-10-26 21:10:41 +08001380 disp->DestroyShaderModule(device, shaderModule, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001381}
1382
Jon Ashburn23d36b12016-02-02 17:47:28 -07001383LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1384vkCreatePipelineCache(VkDevice device,
1385 const VkPipelineCacheCreateInfo *pCreateInfo,
1386 const VkAllocationCallbacks *pAllocator,
1387 VkPipelineCache *pPipelineCache) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001388 const VkLayerDispatchTable *disp;
1389
1390 disp = loader_get_dispatch(device);
1391
Jon Ashburn23d36b12016-02-02 17:47:28 -07001392 return disp->CreatePipelineCache(device, pCreateInfo, pAllocator,
1393 pPipelineCache);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001394}
1395
Jon Ashburn23d36b12016-02-02 17:47:28 -07001396LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1397vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache,
1398 const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001399 const VkLayerDispatchTable *disp;
1400
1401 disp = loader_get_dispatch(device);
1402
Chia-I Wuf7458c52015-10-26 21:10:41 +08001403 disp->DestroyPipelineCache(device, pipelineCache, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001404}
1405
Jon Ashburn23d36b12016-02-02 17:47:28 -07001406LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1407vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache,
1408 size_t *pDataSize, void *pData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001409 const VkLayerDispatchTable *disp;
1410
1411 disp = loader_get_dispatch(device);
1412
Chia-I Wub16facd2015-10-26 19:17:06 +08001413 return disp->GetPipelineCacheData(device, pipelineCache, pDataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001414}
1415
Jon Ashburn23d36b12016-02-02 17:47:28 -07001416LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1417vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache,
1418 uint32_t srcCacheCount,
1419 const VkPipelineCache *pSrcCaches) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001420 const VkLayerDispatchTable *disp;
1421
1422 disp = loader_get_dispatch(device);
1423
Jon Ashburn23d36b12016-02-02 17:47:28 -07001424 return disp->MergePipelineCaches(device, dstCache, srcCacheCount,
1425 pSrcCaches);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001426}
1427
Jon Ashburn23d36b12016-02-02 17:47:28 -07001428LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1429vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache,
1430 uint32_t createInfoCount,
1431 const VkGraphicsPipelineCreateInfo *pCreateInfos,
1432 const VkAllocationCallbacks *pAllocator,
1433 VkPipeline *pPipelines) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001434 const VkLayerDispatchTable *disp;
1435
1436 disp = loader_get_dispatch(device);
1437
Jon Ashburn23d36b12016-02-02 17:47:28 -07001438 return disp->CreateGraphicsPipelines(device, pipelineCache, createInfoCount,
1439 pCreateInfos, pAllocator, pPipelines);
Jon Ashburnc669cc62015-07-09 15:02:25 -06001440}
1441
Jon Ashburn23d36b12016-02-02 17:47:28 -07001442LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1443vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache,
1444 uint32_t createInfoCount,
1445 const VkComputePipelineCreateInfo *pCreateInfos,
1446 const VkAllocationCallbacks *pAllocator,
1447 VkPipeline *pPipelines) {
Jon Ashburnc669cc62015-07-09 15:02:25 -06001448 const VkLayerDispatchTable *disp;
1449
1450 disp = loader_get_dispatch(device);
1451
Jon Ashburn23d36b12016-02-02 17:47:28 -07001452 return disp->CreateComputePipelines(device, pipelineCache, createInfoCount,
1453 pCreateInfos, pAllocator, pPipelines);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001454}
1455
Jon Ashburn23d36b12016-02-02 17:47:28 -07001456LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1457vkDestroyPipeline(VkDevice device, VkPipeline pipeline,
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->DestroyPipeline(device, pipeline, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001464}
1465
Jon Ashburn23d36b12016-02-02 17:47:28 -07001466LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1467vkCreatePipelineLayout(VkDevice device,
1468 const VkPipelineLayoutCreateInfo *pCreateInfo,
1469 const VkAllocationCallbacks *pAllocator,
1470 VkPipelineLayout *pPipelineLayout) {
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->CreatePipelineLayout(device, pCreateInfo, pAllocator,
1476 pPipelineLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001477}
1478
Jon Ashburn23d36b12016-02-02 17:47:28 -07001479LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1480vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout,
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->DestroyPipelineLayout(device, pipelineLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001487}
1488
Jon Ashburn23d36b12016-02-02 17:47:28 -07001489LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1490vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo,
1491 const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001492 const VkLayerDispatchTable *disp;
1493
1494 disp = loader_get_dispatch(device);
1495
Chia-I Wuf7458c52015-10-26 21:10:41 +08001496 return disp->CreateSampler(device, pCreateInfo, pAllocator, pSampler);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001497}
1498
Jon Ashburn23d36b12016-02-02 17:47:28 -07001499LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1500vkDestroySampler(VkDevice device, VkSampler sampler,
1501 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001502 const VkLayerDispatchTable *disp;
1503
1504 disp = loader_get_dispatch(device);
1505
Chia-I Wuf7458c52015-10-26 21:10:41 +08001506 disp->DestroySampler(device, sampler, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001507}
1508
Jon Ashburn23d36b12016-02-02 17:47:28 -07001509LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1510vkCreateDescriptorSetLayout(VkDevice device,
1511 const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
1512 const VkAllocationCallbacks *pAllocator,
1513 VkDescriptorSetLayout *pSetLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001514 const VkLayerDispatchTable *disp;
1515
1516 disp = loader_get_dispatch(device);
1517
Jon Ashburn23d36b12016-02-02 17:47:28 -07001518 return disp->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator,
1519 pSetLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001520}
1521
Jon Ashburn23d36b12016-02-02 17:47:28 -07001522LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1523vkDestroyDescriptorSetLayout(VkDevice device,
1524 VkDescriptorSetLayout descriptorSetLayout,
1525 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001526 const VkLayerDispatchTable *disp;
1527
1528 disp = loader_get_dispatch(device);
1529
Chia-I Wuf7458c52015-10-26 21:10:41 +08001530 disp->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001531}
1532
Jon Ashburn23d36b12016-02-02 17:47:28 -07001533LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1534vkCreateDescriptorPool(VkDevice device,
1535 const VkDescriptorPoolCreateInfo *pCreateInfo,
1536 const VkAllocationCallbacks *pAllocator,
1537 VkDescriptorPool *pDescriptorPool) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001538 const VkLayerDispatchTable *disp;
1539
1540 disp = loader_get_dispatch(device);
1541
Jon Ashburn23d36b12016-02-02 17:47:28 -07001542 return disp->CreateDescriptorPool(device, pCreateInfo, pAllocator,
1543 pDescriptorPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001544}
1545
Jon Ashburn23d36b12016-02-02 17:47:28 -07001546LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1547vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
1548 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001549 const VkLayerDispatchTable *disp;
1550
1551 disp = loader_get_dispatch(device);
1552
Chia-I Wuf7458c52015-10-26 21:10:41 +08001553 disp->DestroyDescriptorPool(device, descriptorPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001554}
1555
Jon Ashburn23d36b12016-02-02 17:47:28 -07001556LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1557vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
1558 VkDescriptorPoolResetFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001559 const VkLayerDispatchTable *disp;
1560
1561 disp = loader_get_dispatch(device);
1562
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001563 return disp->ResetDescriptorPool(device, descriptorPool, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001564}
1565
Jon Ashburn23d36b12016-02-02 17:47:28 -07001566LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1567vkAllocateDescriptorSets(VkDevice device,
1568 const VkDescriptorSetAllocateInfo *pAllocateInfo,
1569 VkDescriptorSet *pDescriptorSets) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001570 const VkLayerDispatchTable *disp;
1571
1572 disp = loader_get_dispatch(device);
1573
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001574 return disp->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001575}
1576
Jon Ashburn23d36b12016-02-02 17:47:28 -07001577LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1578vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool,
1579 uint32_t descriptorSetCount,
1580 const VkDescriptorSet *pDescriptorSets) {
Tony Barbour34ec6922015-07-10 10:50:45 -06001581 const VkLayerDispatchTable *disp;
1582
1583 disp = loader_get_dispatch(device);
1584
Jon Ashburn23d36b12016-02-02 17:47:28 -07001585 return disp->FreeDescriptorSets(device, descriptorPool, descriptorSetCount,
1586 pDescriptorSets);
Tony Barbour34ec6922015-07-10 10:50:45 -06001587}
1588
Jon Ashburn23d36b12016-02-02 17:47:28 -07001589LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1590vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount,
1591 const VkWriteDescriptorSet *pDescriptorWrites,
1592 uint32_t descriptorCopyCount,
1593 const VkCopyDescriptorSet *pDescriptorCopies) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001594 const VkLayerDispatchTable *disp;
1595
1596 disp = loader_get_dispatch(device);
1597
Jon Ashburn23d36b12016-02-02 17:47:28 -07001598 disp->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites,
1599 descriptorCopyCount, pDescriptorCopies);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001600}
1601
Jon Ashburn23d36b12016-02-02 17:47:28 -07001602LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1603vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo,
1604 const VkAllocationCallbacks *pAllocator,
1605 VkFramebuffer *pFramebuffer) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001606 const VkLayerDispatchTable *disp;
1607
1608 disp = loader_get_dispatch(device);
1609
Jon Ashburn23d36b12016-02-02 17:47:28 -07001610 return disp->CreateFramebuffer(device, pCreateInfo, pAllocator,
1611 pFramebuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001612}
1613
Jon Ashburn23d36b12016-02-02 17:47:28 -07001614LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1615vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer,
1616 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001617 const VkLayerDispatchTable *disp;
1618
1619 disp = loader_get_dispatch(device);
1620
Chia-I Wuf7458c52015-10-26 21:10:41 +08001621 disp->DestroyFramebuffer(device, framebuffer, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -06001622}
1623
Jon Ashburn23d36b12016-02-02 17:47:28 -07001624LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1625vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
1626 const VkAllocationCallbacks *pAllocator,
1627 VkRenderPass *pRenderPass) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001628 const VkLayerDispatchTable *disp;
1629
1630 disp = loader_get_dispatch(device);
1631
Chia-I Wuf7458c52015-10-26 21:10:41 +08001632 return disp->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
Jon Ashburn754864f2015-07-23 18:49:07 -06001633}
1634
Jon Ashburn23d36b12016-02-02 17:47:28 -07001635LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1636vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass,
1637 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001638 const VkLayerDispatchTable *disp;
1639
1640 disp = loader_get_dispatch(device);
1641
Chia-I Wuf7458c52015-10-26 21:10:41 +08001642 disp->DestroyRenderPass(device, renderPass, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -06001643}
1644
Jon Ashburn23d36b12016-02-02 17:47:28 -07001645LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1646vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass,
1647 VkExtent2D *pGranularity) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001648 const VkLayerDispatchTable *disp;
1649
1650 disp = loader_get_dispatch(device);
1651
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001652 disp->GetRenderAreaGranularity(device, renderPass, pGranularity);
Jon Ashburn754864f2015-07-23 18:49:07 -06001653}
1654
Jon Ashburn23d36b12016-02-02 17:47:28 -07001655LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1656vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo,
1657 const VkAllocationCallbacks *pAllocator,
1658 VkCommandPool *pCommandPool) {
Cody Northrope62183e2015-07-09 18:08:05 -06001659 const VkLayerDispatchTable *disp;
1660
1661 disp = loader_get_dispatch(device);
1662
Jon Ashburn23d36b12016-02-02 17:47:28 -07001663 return disp->CreateCommandPool(device, pCreateInfo, pAllocator,
1664 pCommandPool);
Cody Northrope62183e2015-07-09 18:08:05 -06001665}
1666
Jon Ashburn23d36b12016-02-02 17:47:28 -07001667LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1668vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool,
1669 const VkAllocationCallbacks *pAllocator) {
Cody Northrope62183e2015-07-09 18:08:05 -06001670 const VkLayerDispatchTable *disp;
1671
1672 disp = loader_get_dispatch(device);
1673
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001674 disp->DestroyCommandPool(device, commandPool, pAllocator);
Cody Northrope62183e2015-07-09 18:08:05 -06001675}
1676
Jon Ashburn23d36b12016-02-02 17:47:28 -07001677LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1678vkResetCommandPool(VkDevice device, VkCommandPool commandPool,
1679 VkCommandPoolResetFlags flags) {
Cody Northrope62183e2015-07-09 18:08:05 -06001680 const VkLayerDispatchTable *disp;
1681
1682 disp = loader_get_dispatch(device);
1683
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001684 return disp->ResetCommandPool(device, commandPool, flags);
Cody Northrope62183e2015-07-09 18:08:05 -06001685}
1686
Jon Ashburn23d36b12016-02-02 17:47:28 -07001687LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1688vkAllocateCommandBuffers(VkDevice device,
1689 const VkCommandBufferAllocateInfo *pAllocateInfo,
1690 VkCommandBuffer *pCommandBuffers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001691 const VkLayerDispatchTable *disp;
1692 VkResult res;
1693
1694 disp = loader_get_dispatch(device);
1695
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001696 res = disp->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001697 if (res == VK_SUCCESS) {
Jon Ashburn23d36b12016-02-02 17:47:28 -07001698 for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; i++) {
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001699 if (pCommandBuffers[i]) {
1700 loader_init_dispatch(pCommandBuffers[i], disp);
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001701 }
1702 }
Jon Ashburnd55a3942015-05-06 09:02:10 -06001703 }
1704
1705 return res;
1706}
1707
Jon Ashburn23d36b12016-02-02 17:47:28 -07001708LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1709vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool,
1710 uint32_t commandBufferCount,
1711 const VkCommandBuffer *pCommandBuffers) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001712 const VkLayerDispatchTable *disp;
1713
1714 disp = loader_get_dispatch(device);
1715
Jon Ashburn23d36b12016-02-02 17:47:28 -07001716 disp->FreeCommandBuffers(device, commandPool, commandBufferCount,
1717 pCommandBuffers);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001718}
1719
Jon Ashburn23d36b12016-02-02 17:47:28 -07001720LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1721vkBeginCommandBuffer(VkCommandBuffer commandBuffer,
1722 const VkCommandBufferBeginInfo *pBeginInfo) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001723 const VkLayerDispatchTable *disp;
1724
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001725 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001726
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001727 return disp->BeginCommandBuffer(commandBuffer, pBeginInfo);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001728}
1729
Jon Ashburn23d36b12016-02-02 17:47:28 -07001730LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1731vkEndCommandBuffer(VkCommandBuffer commandBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001732 const VkLayerDispatchTable *disp;
1733
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001734 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001735
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001736 return disp->EndCommandBuffer(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001737}
1738
Jon Ashburn23d36b12016-02-02 17:47:28 -07001739LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1740vkResetCommandBuffer(VkCommandBuffer commandBuffer,
1741 VkCommandBufferResetFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001742 const VkLayerDispatchTable *disp;
1743
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001744 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001745
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001746 return disp->ResetCommandBuffer(commandBuffer, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001747}
1748
Jon Ashburn23d36b12016-02-02 17:47:28 -07001749LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1750vkCmdBindPipeline(VkCommandBuffer commandBuffer,
1751 VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001752 const VkLayerDispatchTable *disp;
1753
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001754 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001755
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001756 disp->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001757}
1758
Jon Ashburn23d36b12016-02-02 17:47:28 -07001759LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1760vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport,
1761 uint32_t viewportCount, const VkViewport *pViewports) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001762 const VkLayerDispatchTable *disp;
1763
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001764 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001765
Jon Ashburn23d36b12016-02-02 17:47:28 -07001766 disp->CmdSetViewport(commandBuffer, firstViewport, viewportCount,
1767 pViewports);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001768}
1769
Jon Ashburn23d36b12016-02-02 17:47:28 -07001770LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1771vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor,
1772 uint32_t scissorCount, const VkRect2D *pScissors) {
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001773 const VkLayerDispatchTable *disp;
1774
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001775 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001776
Jon Ashburn19d3bf12015-12-30 14:06:55 -07001777 disp->CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001778}
1779
Jon Ashburn23d36b12016-02-02 17:47:28 -07001780LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1781vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001782 const VkLayerDispatchTable *disp;
1783
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001784 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001785
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001786 disp->CmdSetLineWidth(commandBuffer, lineWidth);
Cody Northrop12365112015-08-17 11:10:49 -06001787}
1788
Jon Ashburn23d36b12016-02-02 17:47:28 -07001789LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1790vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor,
1791 float depthBiasClamp, float depthBiasSlopeFactor) {
Cody Northrop12365112015-08-17 11:10:49 -06001792 const VkLayerDispatchTable *disp;
1793
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001794 disp = loader_get_dispatch(commandBuffer);
Cody Northrop12365112015-08-17 11:10:49 -06001795
Jon Ashburn23d36b12016-02-02 17:47:28 -07001796 disp->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor,
1797 depthBiasClamp, depthBiasSlopeFactor);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001798}
1799
Jon Ashburn23d36b12016-02-02 17:47:28 -07001800LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1801vkCmdSetBlendConstants(VkCommandBuffer commandBuffer,
1802 const float blendConstants[4]) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001803 const VkLayerDispatchTable *disp;
1804
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001805 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001806
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001807 disp->CmdSetBlendConstants(commandBuffer, blendConstants);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001808}
1809
Jon Ashburn23d36b12016-02-02 17:47:28 -07001810LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1811vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds,
1812 float maxDepthBounds) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001813 const VkLayerDispatchTable *disp;
1814
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001815 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001816
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001817 disp->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
Cody Northrop82485a82015-08-18 15:21:16 -06001818}
1819
Jon Ashburn23d36b12016-02-02 17:47:28 -07001820LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1821vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer,
1822 VkStencilFaceFlags faceMask, uint32_t compareMask) {
Cody Northrop82485a82015-08-18 15:21:16 -06001823 const VkLayerDispatchTable *disp;
1824
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001825 disp = loader_get_dispatch(commandBuffer);
Cody Northrop82485a82015-08-18 15:21:16 -06001826
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001827 disp->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001828}
1829
Jon Ashburn23d36b12016-02-02 17:47:28 -07001830LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1831vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer,
1832 VkStencilFaceFlags faceMask, uint32_t writeMask) {
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001833 const VkLayerDispatchTable *disp;
1834
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001835 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001836
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001837 disp->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001838}
1839
Jon Ashburn23d36b12016-02-02 17:47:28 -07001840LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1841vkCmdSetStencilReference(VkCommandBuffer commandBuffer,
1842 VkStencilFaceFlags faceMask, uint32_t reference) {
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001843 const VkLayerDispatchTable *disp;
1844
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001845 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001846
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001847 disp->CmdSetStencilReference(commandBuffer, faceMask, reference);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001848}
1849
Jon Ashburn23d36b12016-02-02 17:47:28 -07001850LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets(
1851 VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
1852 VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount,
1853 const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount,
1854 const uint32_t *pDynamicOffsets) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001855 const VkLayerDispatchTable *disp;
1856
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001857 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001858
Jon Ashburn23d36b12016-02-02 17:47:28 -07001859 disp->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout,
1860 firstSet, descriptorSetCount, pDescriptorSets,
1861 dynamicOffsetCount, pDynamicOffsets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001862}
1863
Jon Ashburn23d36b12016-02-02 17:47:28 -07001864LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1865vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer,
1866 VkDeviceSize offset, VkIndexType indexType) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001867 const VkLayerDispatchTable *disp;
1868
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001869 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001870
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001871 disp->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001872}
1873
Jon Ashburn23d36b12016-02-02 17:47:28 -07001874LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1875vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding,
1876 uint32_t bindingCount, const VkBuffer *pBuffers,
1877 const VkDeviceSize *pOffsets) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001878 const VkLayerDispatchTable *disp;
1879
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001880 disp = loader_get_dispatch(commandBuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001881
Jon Ashburn23d36b12016-02-02 17:47:28 -07001882 disp->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount,
1883 pBuffers, pOffsets);
Jon Ashburn754864f2015-07-23 18:49:07 -06001884}
1885
Jon Ashburn23d36b12016-02-02 17:47:28 -07001886LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1887vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount,
1888 uint32_t instanceCount, uint32_t firstVertex,
1889 uint32_t firstInstance) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001890 const VkLayerDispatchTable *disp;
1891
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001892 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001893
Jon Ashburn23d36b12016-02-02 17:47:28 -07001894 disp->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex,
1895 firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001896}
1897
Jon Ashburn23d36b12016-02-02 17:47:28 -07001898LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1899vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount,
1900 uint32_t instanceCount, uint32_t firstIndex,
1901 int32_t vertexOffset, uint32_t firstInstance) {
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->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex,
1907 vertexOffset, firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001908}
1909
Jon Ashburn23d36b12016-02-02 17:47:28 -07001910LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1911vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1912 VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001913 const VkLayerDispatchTable *disp;
1914
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001915 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001916
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001917 disp->CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001918}
1919
Jon Ashburn23d36b12016-02-02 17:47:28 -07001920LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1921vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1922 VkDeviceSize offset, uint32_t drawCount,
1923 uint32_t stride) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001924 const VkLayerDispatchTable *disp;
1925
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001926 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001927
Jon Ashburn23d36b12016-02-02 17:47:28 -07001928 disp->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount,
1929 stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001930}
1931
Jon Ashburn23d36b12016-02-02 17:47:28 -07001932LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1933vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y,
1934 uint32_t z) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001935 const VkLayerDispatchTable *disp;
1936
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001937 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001938
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001939 disp->CmdDispatch(commandBuffer, x, y, z);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001940}
1941
Jon Ashburn23d36b12016-02-02 17:47:28 -07001942LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1943vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1944 VkDeviceSize offset) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001945 const VkLayerDispatchTable *disp;
1946
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001947 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001948
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001949 disp->CmdDispatchIndirect(commandBuffer, buffer, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001950}
1951
Jon Ashburn23d36b12016-02-02 17:47:28 -07001952LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1953vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer,
1954 VkBuffer dstBuffer, uint32_t regionCount,
1955 const VkBufferCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001956 const VkLayerDispatchTable *disp;
1957
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001958 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001959
Jon Ashburn23d36b12016-02-02 17:47:28 -07001960 disp->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount,
1961 pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001962}
1963
Jon Ashburn23d36b12016-02-02 17:47:28 -07001964LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1965vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage,
1966 VkImageLayout srcImageLayout, VkImage dstImage,
1967 VkImageLayout dstImageLayout, uint32_t regionCount,
1968 const VkImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001969 const VkLayerDispatchTable *disp;
1970
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001971 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001972
Jon Ashburn23d36b12016-02-02 17:47:28 -07001973 disp->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage,
1974 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001975}
1976
Jon Ashburn23d36b12016-02-02 17:47:28 -07001977LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1978vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage,
1979 VkImageLayout srcImageLayout, VkImage dstImage,
1980 VkImageLayout dstImageLayout, uint32_t regionCount,
1981 const VkImageBlit *pRegions, VkFilter filter) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001982 const VkLayerDispatchTable *disp;
1983
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001984 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001985
Jon Ashburn23d36b12016-02-02 17:47:28 -07001986 disp->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage,
1987 dstImageLayout, regionCount, pRegions, filter);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001988}
1989
Jon Ashburn23d36b12016-02-02 17:47:28 -07001990LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1991vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer,
1992 VkImage dstImage, VkImageLayout dstImageLayout,
1993 uint32_t regionCount,
1994 const VkBufferImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001995 const VkLayerDispatchTable *disp;
1996
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001997 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001998
Jon Ashburn23d36b12016-02-02 17:47:28 -07001999 disp->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage,
2000 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002001}
2002
Jon Ashburn23d36b12016-02-02 17:47:28 -07002003LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2004vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage,
2005 VkImageLayout srcImageLayout, VkBuffer dstBuffer,
2006 uint32_t regionCount,
2007 const VkBufferImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002008 const VkLayerDispatchTable *disp;
2009
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002010 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002011
Jon Ashburn23d36b12016-02-02 17:47:28 -07002012 disp->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout,
2013 dstBuffer, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002014}
2015
Jon Ashburn23d36b12016-02-02 17:47:28 -07002016LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2017vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
2018 VkDeviceSize dstOffset, VkDeviceSize dataSize,
2019 const uint32_t *pData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002020 const VkLayerDispatchTable *disp;
2021
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002022 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002023
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002024 disp->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002025}
2026
Jon Ashburn23d36b12016-02-02 17:47:28 -07002027LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2028vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
2029 VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002030 const VkLayerDispatchTable *disp;
2031
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002032 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002033
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002034 disp->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002035}
2036
Jon Ashburn23d36b12016-02-02 17:47:28 -07002037LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2038vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image,
2039 VkImageLayout imageLayout, const VkClearColorValue *pColor,
2040 uint32_t rangeCount,
2041 const VkImageSubresourceRange *pRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002042 const VkLayerDispatchTable *disp;
2043
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002044 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002045
Jon Ashburn23d36b12016-02-02 17:47:28 -07002046 disp->CmdClearColorImage(commandBuffer, image, imageLayout, pColor,
2047 rangeCount, pRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002048}
2049
Jon Ashburn23d36b12016-02-02 17:47:28 -07002050LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2051vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image,
2052 VkImageLayout imageLayout,
2053 const VkClearDepthStencilValue *pDepthStencil,
2054 uint32_t rangeCount,
2055 const VkImageSubresourceRange *pRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002056 const VkLayerDispatchTable *disp;
2057
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002058 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002059
Jon Ashburn23d36b12016-02-02 17:47:28 -07002060 disp->CmdClearDepthStencilImage(commandBuffer, image, imageLayout,
2061 pDepthStencil, rangeCount, pRanges);
Chris Forbesd9be82b2015-06-22 17:21:59 +12002062}
2063
Jon Ashburn23d36b12016-02-02 17:47:28 -07002064LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2065vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
2066 const VkClearAttachment *pAttachments, uint32_t rectCount,
2067 const VkClearRect *pRects) {
Chris Forbesd9be82b2015-06-22 17:21:59 +12002068 const VkLayerDispatchTable *disp;
2069
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002070 disp = loader_get_dispatch(commandBuffer);
Chris Forbesd9be82b2015-06-22 17:21:59 +12002071
Jon Ashburn23d36b12016-02-02 17:47:28 -07002072 disp->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments,
2073 rectCount, pRects);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002074}
2075
Jon Ashburn23d36b12016-02-02 17:47:28 -07002076LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2077vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage,
2078 VkImageLayout srcImageLayout, VkImage dstImage,
2079 VkImageLayout dstImageLayout, uint32_t regionCount,
2080 const VkImageResolve *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002081 const VkLayerDispatchTable *disp;
2082
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002083 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002084
Jon Ashburn23d36b12016-02-02 17:47:28 -07002085 disp->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage,
2086 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002087}
2088
Jon Ashburn23d36b12016-02-02 17:47:28 -07002089LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2090vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event,
2091 VkPipelineStageFlags stageMask) {
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->CmdSetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002097}
2098
Jon Ashburn23d36b12016-02-02 17:47:28 -07002099LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2100vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event,
2101 VkPipelineStageFlags stageMask) {
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
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002106 disp->CmdResetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002107}
2108
Jon Ashburn23d36b12016-02-02 17:47:28 -07002109LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2110vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount,
2111 const VkEvent *pEvents, VkPipelineStageFlags sourceStageMask,
2112 VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount,
2113 const VkMemoryBarrier *pMemoryBarriers,
2114 uint32_t bufferMemoryBarrierCount,
2115 const VkBufferMemoryBarrier *pBufferMemoryBarriers,
2116 uint32_t imageMemoryBarrierCount,
2117 const VkImageMemoryBarrier *pImageMemoryBarriers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002118 const VkLayerDispatchTable *disp;
2119
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002120 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002121
Jon Ashburnf19916e2016-01-11 13:12:43 -07002122 disp->CmdWaitEvents(commandBuffer, eventCount, pEvents, sourceStageMask,
2123 dstStageMask, memoryBarrierCount, pMemoryBarriers,
2124 bufferMemoryBarrierCount, pBufferMemoryBarriers,
2125 imageMemoryBarrierCount, pImageMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002126}
2127
Jon Ashburnf19916e2016-01-11 13:12:43 -07002128LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier(
Jon Ashburn23d36b12016-02-02 17:47:28 -07002129 VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask,
2130 VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags,
2131 uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers,
2132 uint32_t bufferMemoryBarrierCount,
2133 const VkBufferMemoryBarrier *pBufferMemoryBarriers,
2134 uint32_t imageMemoryBarrierCount,
2135 const VkImageMemoryBarrier *pImageMemoryBarriers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002136 const VkLayerDispatchTable *disp;
2137
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002138 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002139
Jon Ashburn23d36b12016-02-02 17:47:28 -07002140 disp->CmdPipelineBarrier(
2141 commandBuffer, srcStageMask, dstStageMask, dependencyFlags,
2142 memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount,
2143 pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002144}
2145
Jon Ashburn23d36b12016-02-02 17:47:28 -07002146LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2147vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2148 uint32_t slot, VkFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002149 const VkLayerDispatchTable *disp;
2150
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002151 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002152
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002153 disp->CmdBeginQuery(commandBuffer, queryPool, slot, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002154}
2155
Jon Ashburn23d36b12016-02-02 17:47:28 -07002156LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2157vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2158 uint32_t slot) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002159 const VkLayerDispatchTable *disp;
2160
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002161 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002162
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002163 disp->CmdEndQuery(commandBuffer, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002164}
2165
Jon Ashburn23d36b12016-02-02 17:47:28 -07002166LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2167vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2168 uint32_t firstQuery, uint32_t queryCount) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002169 const VkLayerDispatchTable *disp;
2170
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002171 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002172
Jon Ashburn19d3bf12015-12-30 14:06:55 -07002173 disp->CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002174}
2175
Jon Ashburn23d36b12016-02-02 17:47:28 -07002176LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2177vkCmdWriteTimestamp(VkCommandBuffer commandBuffer,
2178 VkPipelineStageFlagBits pipelineStage,
2179 VkQueryPool queryPool, uint32_t slot) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002180 const VkLayerDispatchTable *disp;
2181
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002182 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002183
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002184 disp->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002185}
2186
Jon Ashburn23d36b12016-02-02 17:47:28 -07002187LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2188vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2189 uint32_t firstQuery, uint32_t queryCount,
2190 VkBuffer dstBuffer, VkDeviceSize dstOffset,
2191 VkDeviceSize stride, VkFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002192 const VkLayerDispatchTable *disp;
2193
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002194 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002195
Jon Ashburn23d36b12016-02-02 17:47:28 -07002196 disp->CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery,
2197 queryCount, dstBuffer, dstOffset, stride,
2198 flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002199}
2200
Jon Ashburn23d36b12016-02-02 17:47:28 -07002201LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2202vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout,
2203 VkShaderStageFlags stageFlags, uint32_t offset,
2204 uint32_t size, const void *pValues) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002205 const VkLayerDispatchTable *disp;
2206
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002207 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002208
Jon Ashburn23d36b12016-02-02 17:47:28 -07002209 disp->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size,
2210 pValues);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06002211}
2212
Jon Ashburn23d36b12016-02-02 17:47:28 -07002213LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2214vkCmdBeginRenderPass(VkCommandBuffer commandBuffer,
2215 const VkRenderPassBeginInfo *pRenderPassBegin,
2216 VkSubpassContents contents) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002217 const VkLayerDispatchTable *disp;
2218
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002219 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002220
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002221 disp->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
Chia-I Wu08accc62015-07-07 11:50:03 +08002222}
2223
Jon Ashburn23d36b12016-02-02 17:47:28 -07002224LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2225vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) {
Chia-I Wu08accc62015-07-07 11:50:03 +08002226 const VkLayerDispatchTable *disp;
2227
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002228 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu08accc62015-07-07 11:50:03 +08002229
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002230 disp->CmdNextSubpass(commandBuffer, contents);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002231}
2232
Jon Ashburn23d36b12016-02-02 17:47:28 -07002233LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2234vkCmdEndRenderPass(VkCommandBuffer commandBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002235 const VkLayerDispatchTable *disp;
2236
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002237 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002238
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002239 disp->CmdEndRenderPass(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002240}
2241
Jon Ashburn23d36b12016-02-02 17:47:28 -07002242LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2243vkCmdExecuteCommands(VkCommandBuffer commandBuffer,
2244 uint32_t commandBuffersCount,
2245 const VkCommandBuffer *pCommandBuffers) {
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002246 const VkLayerDispatchTable *disp;
2247
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002248 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002249
Jon Ashburn23d36b12016-02-02 17:47:28 -07002250 disp->CmdExecuteCommands(commandBuffer, commandBuffersCount,
2251 pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002252}