blob: e2c3205873b1441b5200786dd37ec19b7db6c12a [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;
Mark Young0ad83132016-06-30 13:02:42 -0600125 VkResult res = VK_SUCCESS;
Jon Ashburn1530c342016-02-26 13:14:27 -0700126
127 tls_instance = NULL;
Jon Ashburnb8726962016-04-08 15:03:35 -0600128 memset(&local_ext_list, 0, sizeof(local_ext_list));
Jon Ashburn1530c342016-02-26 13:14:27 -0700129 memset(&instance_layers, 0, sizeof(instance_layers));
130 loader_platform_thread_once(&once_init, loader_initialize);
131
132 /* get layer libraries if needed */
133 if (pLayerName && strlen(pLayerName) != 0) {
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600134 if (vk_string_validate(MaxLoaderStringLength, pLayerName) !=
Jon Ashburn1530c342016-02-26 13:14:27 -0700135 VK_STRING_ERROR_NONE) {
Jon Ashburn1530c342016-02-26 13:14:27 -0700136 assert(VK_FALSE && "vkEnumerateInstanceExtensionProperties: "
137 "pLayerName is too long or is badly formed");
Mark Young0ad83132016-06-30 13:02:42 -0600138 res = VK_ERROR_EXTENSION_NOT_PRESENT;
139 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700140 }
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600141
Jon Ashburn491cd042016-05-16 14:01:18 -0600142 loader_layer_scan(NULL, &instance_layers);
Jon Ashburnb8726962016-04-08 15:03:35 -0600143 if (strcmp(pLayerName, std_validation_str) == 0) {
144 struct loader_layer_list local_list;
145 memset(&local_list, 0, sizeof(local_list));
146 for (uint32_t i = 0; i < sizeof(std_validation_names) /
147 sizeof(std_validation_names[0]);
148 i++) {
149 loader_find_layer_name_add_list(NULL, std_validation_names[i],
150 VK_LAYER_TYPE_INSTANCE_EXPLICIT,
151 &instance_layers, &local_list);
152 }
153 for (uint32_t i = 0; i < local_list.count; i++) {
154 struct loader_extension_list *ext_list =
Jon Ashburncc407a22016-04-15 09:25:03 -0600155 &local_list.list[i].instance_extension_list;
Jon Ashburnb8726962016-04-08 15:03:35 -0600156 loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count,
157 ext_list->list);
158 }
Mark Youngd9ccdd32016-08-01 11:34:36 -0600159 loader_destroy_layer_list(NULL, NULL, &local_list);
Jon Ashburnb8726962016-04-08 15:03:35 -0600160 global_ext_list = &local_ext_list;
161
162 } else {
163 for (uint32_t i = 0; i < instance_layers.count; i++) {
164 struct loader_layer_properties *props =
165 &instance_layers.list[i];
166 if (strcmp(props->info.layerName, pLayerName) == 0) {
167 global_ext_list = &props->instance_extension_list;
168 break;
169 }
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600170 }
171 }
Jon Ashburn1530c342016-02-26 13:14:27 -0700172 } else {
173 /* Scan/discover all ICD libraries */
174 memset(&icd_libs, 0, sizeof(struct loader_icd_libs));
Mark Young0ad83132016-06-30 13:02:42 -0600175 res = loader_icd_scan(NULL, &icd_libs);
176 if (VK_SUCCESS != res) {
177 goto out;
178 }
Jon Ashburn1530c342016-02-26 13:14:27 -0700179 /* get extensions from all ICD's, merge so no duplicates */
180 loader_get_icd_loader_instance_extensions(NULL, &icd_libs,
Jon Ashburnb8726962016-04-08 15:03:35 -0600181 &local_ext_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700182 loader_scanned_icd_clear(NULL, &icd_libs);
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600183
184 // Append implicit layers.
Jon Ashburn491cd042016-05-16 14:01:18 -0600185 loader_implicit_layer_scan(NULL, &instance_layers);
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600186 for (uint32_t i = 0; i < instance_layers.count; i++) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600187 struct loader_extension_list *ext_list =
188 &instance_layers.list[i].instance_extension_list;
189 loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count,
190 ext_list->list);
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600191 }
192
Jon Ashburnb8726962016-04-08 15:03:35 -0600193 global_ext_list = &local_ext_list;
Jon Ashburn1530c342016-02-26 13:14:27 -0700194 }
195
196 if (global_ext_list == NULL) {
Mark Young0ad83132016-06-30 13:02:42 -0600197 res = VK_ERROR_LAYER_NOT_PRESENT;
198 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700199 }
200
201 if (pProperties == NULL) {
202 *pPropertyCount = global_ext_list->count;
Mark Young0ad83132016-06-30 13:02:42 -0600203 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700204 }
205
206 copy_size = *pPropertyCount < global_ext_list->count
207 ? *pPropertyCount
208 : global_ext_list->count;
209 for (uint32_t i = 0; i < copy_size; i++) {
210 memcpy(&pProperties[i], &global_ext_list->list[i],
211 sizeof(VkExtensionProperties));
212 }
213 *pPropertyCount = copy_size;
Jon Ashburn1530c342016-02-26 13:14:27 -0700214
215 if (copy_size < global_ext_list->count) {
Mark Young0ad83132016-06-30 13:02:42 -0600216 res = VK_INCOMPLETE;
217 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700218 }
219
Mark Young0ad83132016-06-30 13:02:42 -0600220out:
221 loader_destroy_generic_list(NULL, (struct loader_generic_list *)&local_ext_list);
davidhubbard36831082016-07-27 17:59:58 -0700222 loader_delete_layer_properties(NULL, &instance_layers);
Mark Young0ad83132016-06-30 13:02:42 -0600223 return res;
Jon Ashburn1530c342016-02-26 13:14:27 -0700224}
225
226LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
227vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount,
228 VkLayerProperties *pProperties) {
229
230 struct loader_layer_list instance_layer_list;
231 tls_instance = NULL;
232
233 loader_platform_thread_once(&once_init, loader_initialize);
234
235 uint32_t copy_size;
236
237 /* get layer libraries */
238 memset(&instance_layer_list, 0, sizeof(instance_layer_list));
Jon Ashburn491cd042016-05-16 14:01:18 -0600239 loader_layer_scan(NULL, &instance_layer_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700240
241 if (pProperties == NULL) {
242 *pPropertyCount = instance_layer_list.count;
Mark Young0ad83132016-06-30 13:02:42 -0600243 loader_destroy_layer_list(NULL, NULL, &instance_layer_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700244 return VK_SUCCESS;
245 }
246
247 copy_size = (*pPropertyCount < instance_layer_list.count)
248 ? *pPropertyCount
249 : instance_layer_list.count;
250 for (uint32_t i = 0; i < copy_size; i++) {
251 memcpy(&pProperties[i], &instance_layer_list.list[i].info,
252 sizeof(VkLayerProperties));
253 }
254
255 *pPropertyCount = copy_size;
Jon Ashburn1530c342016-02-26 13:14:27 -0700256
257 if (copy_size < instance_layer_list.count) {
Jeremy Hayese852f132016-07-06 12:02:03 -0600258 loader_destroy_layer_list(NULL, NULL, &instance_layer_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700259 return VK_INCOMPLETE;
260 }
261
Jeremy Hayese852f132016-07-06 12:02:03 -0600262 loader_destroy_layer_list(NULL, NULL, &instance_layer_list);
263
Jon Ashburn1530c342016-02-26 13:14:27 -0700264 return VK_SUCCESS;
265}
266
Mark Young0ad83132016-06-30 13:02:42 -0600267LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(
268 const VkInstanceCreateInfo *pCreateInfo,
269 const VkAllocationCallbacks *pAllocator, VkInstance *pInstance) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600270 struct loader_instance *ptr_instance = NULL;
Jon Ashburne5b9bba2016-01-18 12:20:03 -0700271 VkInstance created_instance = VK_NULL_HANDLE;
Mark Young0ad83132016-06-30 13:02:42 -0600272 bool loaderLocked = false;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600273 VkResult res = VK_ERROR_INITIALIZATION_FAILED;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600274
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600275 loader_platform_thread_once(&once_init, loader_initialize);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600276
Mark Young0ad83132016-06-30 13:02:42 -0600277#if (DEBUG_DISABLE_APP_ALLOCATORS == 1)
278 {
279#else
280 if (pAllocator) {
281 ptr_instance = (struct loader_instance *)pAllocator->pfnAllocation(
282 pAllocator->pUserData, sizeof(struct loader_instance),
283 sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600284 } else {
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700285#endif
Mark Young0ad83132016-06-30 13:02:42 -0600286 ptr_instance =
287 (struct loader_instance *)malloc(sizeof(struct loader_instance));
288 }
289
290 VkInstanceCreateInfo ici = *pCreateInfo;
291
Jon Ashburn27cd5842015-05-12 17:26:48 -0600292 if (ptr_instance == NULL) {
Mark Young0ad83132016-06-30 13:02:42 -0600293 res = VK_ERROR_OUT_OF_HOST_MEMORY;
294 goto out;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600295 }
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600296
Jon Ashburn87d6aa92015-08-28 15:19:27 -0600297 tls_instance = ptr_instance;
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600298 loader_platform_thread_lock_mutex(&loader_lock);
Mark Young0ad83132016-06-30 13:02:42 -0600299 loaderLocked = true;
Jon Ashburnb82c1852015-08-11 14:49:54 -0600300 memset(ptr_instance, 0, sizeof(struct loader_instance));
Chia-I Wuf7458c52015-10-26 21:10:41 +0800301 if (pAllocator) {
302 ptr_instance->alloc_callbacks = *pAllocator;
Courtney Goeltzenleuchter7f5aafc2015-07-05 11:28:29 -0600303 }
304
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700305 /*
Ian Elliottad6300f2016-03-31 10:48:19 -0600306 * Look for one or more debug report create info structures
307 * and setup a callback(s) for each one found.
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700308 */
Ian Elliottad6300f2016-03-31 10:48:19 -0600309 ptr_instance->num_tmp_callbacks = 0;
310 ptr_instance->tmp_dbg_create_infos = NULL;
311 ptr_instance->tmp_callbacks = NULL;
Jon Ashburncc407a22016-04-15 09:25:03 -0600312 if (util_CopyDebugReportCreateInfos(pCreateInfo->pNext, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600313 &ptr_instance->num_tmp_callbacks,
314 &ptr_instance->tmp_dbg_create_infos,
315 &ptr_instance->tmp_callbacks)) {
316 // One or more were found, but allocation failed. Therefore, clean up
317 // and fail this function:
Mark Young0ad83132016-06-30 13:02:42 -0600318 res = VK_ERROR_OUT_OF_HOST_MEMORY;
319 goto out;
Ian Elliottad6300f2016-03-31 10:48:19 -0600320 } else if (ptr_instance->num_tmp_callbacks > 0) {
321 // Setup the temporary callback(s) here to catch early issues:
Jon Ashburncc407a22016-04-15 09:25:03 -0600322 if (util_CreateDebugReportCallbacks(ptr_instance, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600323 ptr_instance->num_tmp_callbacks,
324 ptr_instance->tmp_dbg_create_infos,
325 ptr_instance->tmp_callbacks)) {
326 // Failure of setting up one or more of the callback. Therefore,
327 // clean up and fail this function:
Mark Young0ad83132016-06-30 13:02:42 -0600328 res = VK_ERROR_OUT_OF_HOST_MEMORY;
329 goto out;
Courtney Goeltzenleuchter82887272015-12-02 15:29:33 -0700330 }
331 }
332
Jon Ashburn3d002332015-08-20 16:35:30 -0600333 /* Due to implicit layers need to get layer list even if
Jon Ashburnf19916e2016-01-11 13:12:43 -0700334 * enabledLayerCount == 0 and VK_INSTANCE_LAYERS is unset. For now always
Jon Ashburn491cd042016-05-16 14:01:18 -0600335 * get layer list via loader_layer_scan(). */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700336 memset(&ptr_instance->instance_layer_list, 0,
337 sizeof(ptr_instance->instance_layer_list));
Jon Ashburn491cd042016-05-16 14:01:18 -0600338 loader_layer_scan(ptr_instance, &ptr_instance->instance_layer_list);
Jon Ashburn3d002332015-08-20 16:35:30 -0600339
340 /* validate the app requested layers to be enabled */
Jon Ashburnf19916e2016-01-11 13:12:43 -0700341 if (pCreateInfo->enabledLayerCount > 0) {
Jon Ashburnf2b4e382016-02-10 20:50:19 -0700342 res =
343 loader_validate_layers(ptr_instance, pCreateInfo->enabledLayerCount,
344 pCreateInfo->ppEnabledLayerNames,
345 &ptr_instance->instance_layer_list);
Jon Ashburn3d002332015-08-20 16:35:30 -0600346 if (res != VK_SUCCESS) {
Mark Young0ad83132016-06-30 13:02:42 -0600347 goto out;
Jon Ashburn3d002332015-08-20 16:35:30 -0600348 }
349 }
350
Jon Ashburn86a527a2016-02-10 20:59:26 -0700351 /* convert any meta layers to the actual layers makes a copy of layer name*/
Mark Young0ad83132016-06-30 13:02:42 -0600352 VkResult layerErr = loader_expand_layer_names(
Jon Ashburn86a527a2016-02-10 20:59:26 -0700353 ptr_instance, std_validation_str,
354 sizeof(std_validation_names) / sizeof(std_validation_names[0]),
Jon Ashburncc407a22016-04-15 09:25:03 -0600355 std_validation_names, &ici.enabledLayerCount, &ici.ppEnabledLayerNames);
Mark Young0ad83132016-06-30 13:02:42 -0600356 if (VK_SUCCESS != layerErr) {
357 res = layerErr;
358 goto out;
359 }
Jon Ashburn86a527a2016-02-10 20:59:26 -0700360
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600361 /* Scan/discover all ICD libraries */
362 memset(&ptr_instance->icd_libs, 0, sizeof(ptr_instance->icd_libs));
Mark Young0ad83132016-06-30 13:02:42 -0600363 res = loader_icd_scan(ptr_instance, &ptr_instance->icd_libs);
364 if (res != VK_SUCCESS) {
365 goto out;
366 }
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600367
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600368 /* get extensions from all ICD's, merge so no duplicates, then validate */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700369 loader_get_icd_loader_instance_extensions(
370 ptr_instance, &ptr_instance->icd_libs, &ptr_instance->ext_list);
371 res = loader_validate_instance_extensions(
Jon Ashburnf2b4e382016-02-10 20:50:19 -0700372 ptr_instance, &ptr_instance->ext_list,
Chris Forbesbd9de052016-04-06 20:49:02 +1200373 &ptr_instance->instance_layer_list, &ici);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600374 if (res != VK_SUCCESS) {
Mark Young0ad83132016-06-30 13:02:42 -0600375 goto out;
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600376 }
377
Mark Young0ad83132016-06-30 13:02:42 -0600378 ptr_instance->disp = loader_instance_heap_alloc(
379 ptr_instance, sizeof(VkLayerInstanceDispatchTable),
380 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600381 if (ptr_instance->disp == NULL) {
Mark Young0ad83132016-06-30 13:02:42 -0600382 res = VK_ERROR_OUT_OF_HOST_MEMORY;
383 goto out;
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600384 }
385 memcpy(ptr_instance->disp, &instance_disp, sizeof(instance_disp));
386 ptr_instance->next = loader.instances;
387 loader.instances = ptr_instance;
388
Jon Ashburnb82c1852015-08-11 14:49:54 -0600389 /* activate any layers on instance chain */
Chris Forbesbd9de052016-04-06 20:49:02 +1200390 res = loader_enable_instance_layers(ptr_instance, &ici,
Jon Ashburne39a4f82015-08-28 13:38:21 -0600391 &ptr_instance->instance_layer_list);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600392 if (res != VK_SUCCESS) {
Mark Young0ad83132016-06-30 13:02:42 -0600393 goto out;
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600394 }
Jon Ashburn07daee72015-05-21 18:13:33 -0600395
Jon Ashburn23d36b12016-02-02 17:47:28 -0700396 created_instance = (VkInstance)ptr_instance;
Chris Forbesbd9de052016-04-06 20:49:02 +1200397 res = loader_create_instance_chain(&ici, pAllocator, ptr_instance,
Jon Ashburn6e0a2132016-02-03 12:37:30 -0700398 &created_instance);
Jon Ashburneed0c002015-05-21 17:42:17 -0600399
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700400 if (res == VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200401 wsi_create_instance(ptr_instance, &ici);
402 debug_report_create_instance(ptr_instance, &ici);
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700403
Jon Ashburne5b9bba2016-01-18 12:20:03 -0700404 *pInstance = created_instance;
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700405
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700406 /*
407 * Finally have the layers in place and everyone has seen
408 * the CreateInstance command go by. This allows the layer's
409 * GetInstanceProcAddr functions to return valid extension functions
410 * if enabled.
411 */
412 loader_activate_instance_layer_extensions(ptr_instance, *pInstance);
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700413 } else {
414 // TODO: cleanup here.
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700415 }
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700416
Mark Young0ad83132016-06-30 13:02:42 -0600417out:
418
419 if (NULL != ptr_instance) {
420 if (res != VK_SUCCESS) {
421 if (NULL != ptr_instance->next) {
422 loader.instances = ptr_instance->next;
423 }
424 if (NULL != ptr_instance->disp) {
425 loader_instance_heap_free(ptr_instance, ptr_instance->disp);
426 }
427 if (ptr_instance->num_tmp_callbacks > 0) {
428 util_DestroyDebugReportCallbacks(
429 ptr_instance, pAllocator, ptr_instance->num_tmp_callbacks,
430 ptr_instance->tmp_callbacks);
431 util_FreeDebugReportCreateInfos(
432 pAllocator, ptr_instance->tmp_dbg_create_infos,
433 ptr_instance->tmp_callbacks);
434 }
435
436 loader_deactivate_layers(ptr_instance, NULL,
437 &ptr_instance->activated_layer_list);
438
439 loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo,
440 &ici);
441 loader_delete_layer_properties(ptr_instance,
442 &ptr_instance->instance_layer_list);
443 loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
444 loader_destroy_generic_list(
445 ptr_instance,
446 (struct loader_generic_list *)&ptr_instance->ext_list);
447
448 loader_instance_heap_free(ptr_instance, ptr_instance);
449 } else {
450 /* Remove temporary debug_report callback */
451 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
452 ptr_instance->num_tmp_callbacks,
453 ptr_instance->tmp_callbacks);
454 loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo,
455 &ici);
456 }
457
458 if (loaderLocked) {
459 loader_platform_thread_unlock_mutex(&loader_lock);
460 }
461 }
462
Jon Ashburn27cd5842015-05-12 17:26:48 -0600463 return res;
464}
465
Mark Young0ad83132016-06-30 13:02:42 -0600466LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(
467 VkInstance instance, const VkAllocationCallbacks *pAllocator) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600468 const VkLayerInstanceDispatchTable *disp;
Jon Ashburne0e64572015-09-30 12:56:42 -0600469 struct loader_instance *ptr_instance = NULL;
Ian Elliott3b354cf2016-03-25 08:43:01 -0600470 bool callback_setup = false;
471
Jeremy Hayesd8726c22016-04-21 13:19:41 -0600472 if (instance == VK_NULL_HANDLE) {
473 return;
474 }
475
Jon Ashburn27cd5842015-05-12 17:26:48 -0600476 disp = loader_get_instance_dispatch(instance);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600477
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600478 loader_platform_thread_lock_mutex(&loader_lock);
479
Jon Ashburne0e64572015-09-30 12:56:42 -0600480 ptr_instance = loader_get_instance(instance);
Ian Elliott3b354cf2016-03-25 08:43:01 -0600481
Mark Young0ad83132016-06-30 13:02:42 -0600482 if (pAllocator) {
483 ptr_instance->alloc_callbacks = *pAllocator;
484 }
485
Ian Elliottad6300f2016-03-31 10:48:19 -0600486 if (ptr_instance->num_tmp_callbacks > 0) {
487 // Setup the temporary callback(s) here to catch cleanup issues:
Jon Ashburncc407a22016-04-15 09:25:03 -0600488 if (!util_CreateDebugReportCallbacks(ptr_instance, pAllocator,
489 ptr_instance->num_tmp_callbacks,
490 ptr_instance->tmp_dbg_create_infos,
491 ptr_instance->tmp_callbacks)) {
Ian Elliott3b354cf2016-03-25 08:43:01 -0600492 callback_setup = true;
493 }
494 }
495
Chia-I Wuf7458c52015-10-26 21:10:41 +0800496 disp->DestroyInstance(instance, pAllocator);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600497
Mark Young0ad83132016-06-30 13:02:42 -0600498 loader_deactivate_layers(ptr_instance, NULL,
499 &ptr_instance->activated_layer_list);
500 if (ptr_instance->phys_devs) {
501 loader_instance_heap_free(ptr_instance, ptr_instance->phys_devs);
502 }
Ian Elliott3b354cf2016-03-25 08:43:01 -0600503 if (callback_setup) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600504 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600505 ptr_instance->num_tmp_callbacks,
506 ptr_instance->tmp_callbacks);
507 util_FreeDebugReportCreateInfos(pAllocator,
508 ptr_instance->tmp_dbg_create_infos,
509 ptr_instance->tmp_callbacks);
Ian Elliott3b354cf2016-03-25 08:43:01 -0600510 }
Mark Young0ad83132016-06-30 13:02:42 -0600511 loader_instance_heap_free(ptr_instance, ptr_instance->disp);
512 loader_instance_heap_free(ptr_instance, ptr_instance);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600513 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600514}
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600515
Jon Ashburn23d36b12016-02-02 17:47:28 -0700516LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
517vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount,
518 VkPhysicalDevice *pPhysicalDevices) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600519 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600520 VkResult res;
Jon Ashburn014438f2016-03-01 19:51:07 -0700521 uint32_t count, i;
522 struct loader_instance *inst;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600523 disp = loader_get_instance_dispatch(instance);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600524
525 loader_platform_thread_lock_mutex(&loader_lock);
526 res = disp->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount,
Jon Ashburn27cd5842015-05-12 17:26:48 -0600527 pPhysicalDevices);
Jon Ashburn014438f2016-03-01 19:51:07 -0700528
529 if (res != VK_SUCCESS && res != VK_INCOMPLETE) {
530 loader_platform_thread_unlock_mutex(&loader_lock);
531 return res;
532 }
533
534 if (!pPhysicalDevices) {
535 loader_platform_thread_unlock_mutex(&loader_lock);
536 return res;
537 }
538
539 // wrap the PhysDev object for loader usage, return wrapped objects
540 inst = loader_get_instance(instance);
541 if (!inst) {
542 loader_platform_thread_unlock_mutex(&loader_lock);
543 return VK_ERROR_INITIALIZATION_FAILED;
544 }
Jon Ashburncc407a22016-04-15 09:25:03 -0600545 count = (inst->total_gpu_count < *pPhysicalDeviceCount)
546 ? inst->total_gpu_count
547 : *pPhysicalDeviceCount;
Piers Daniell295fe402016-03-29 11:51:11 -0600548 *pPhysicalDeviceCount = count;
Jeannot Breton32ad8d82016-04-12 15:46:20 -0500549 if (!inst->phys_devs) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600550 inst->phys_devs =
Mark Young0ad83132016-06-30 13:02:42 -0600551 (struct loader_physical_device_tramp *)loader_instance_heap_alloc(
Jon Ashburncc407a22016-04-15 09:25:03 -0600552 inst, inst->total_gpu_count *
553 sizeof(struct loader_physical_device_tramp),
554 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Jeannot Breton32ad8d82016-04-12 15:46:20 -0500555 }
Jon Ashburn014438f2016-03-01 19:51:07 -0700556 if (!inst->phys_devs) {
557 loader_platform_thread_unlock_mutex(&loader_lock);
558 return VK_ERROR_OUT_OF_HOST_MEMORY;
559 }
560
561 for (i = 0; i < count; i++) {
562
563 // initialize the loader's physicalDevice object
564 loader_set_dispatch((void *)&inst->phys_devs[i], inst->disp);
Piers Daniell295fe402016-03-29 11:51:11 -0600565 inst->phys_devs[i].this_instance = inst;
Jon Ashburn014438f2016-03-01 19:51:07 -0700566 inst->phys_devs[i].phys_dev = pPhysicalDevices[i];
567
568 // copy wrapped object into Application provided array
569 pPhysicalDevices[i] = (VkPhysicalDevice)&inst->phys_devs[i];
570 }
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600571 loader_platform_thread_unlock_mutex(&loader_lock);
572 return res;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600573}
574
Jon Ashburn23d36b12016-02-02 17:47:28 -0700575LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
Jon Ashburn014438f2016-03-01 19:51:07 -0700576vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700577 VkPhysicalDeviceFeatures *pFeatures) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600578 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700579 VkPhysicalDevice unwrapped_phys_dev =
580 loader_unwrap_physical_device(physicalDevice);
581 disp = loader_get_instance_dispatch(physicalDevice);
582 disp->GetPhysicalDeviceFeatures(unwrapped_phys_dev, pFeatures);
Jon Ashburn754864f2015-07-23 18:49:07 -0600583}
584
Jon Ashburn23d36b12016-02-02 17:47:28 -0700585LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
Jon Ashburn014438f2016-03-01 19:51:07 -0700586vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice,
587 VkFormat format,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700588 VkFormatProperties *pFormatInfo) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600589 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700590 VkPhysicalDevice unwrapped_pd =
591 loader_unwrap_physical_device(physicalDevice);
592 disp = loader_get_instance_dispatch(physicalDevice);
593 disp->GetPhysicalDeviceFormatProperties(unwrapped_pd, format, pFormatInfo);
Jon Ashburn754864f2015-07-23 18:49:07 -0600594}
595
Jon Ashburn23d36b12016-02-02 17:47:28 -0700596LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
597vkGetPhysicalDeviceImageFormatProperties(
598 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
599 VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
600 VkImageFormatProperties *pImageFormatProperties) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600601 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700602 VkPhysicalDevice unwrapped_phys_dev =
603 loader_unwrap_physical_device(physicalDevice);
Jon Ashburn754864f2015-07-23 18:49:07 -0600604 disp = loader_get_instance_dispatch(physicalDevice);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700605 return disp->GetPhysicalDeviceImageFormatProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700606 unwrapped_phys_dev, format, type, tiling, usage, flags,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700607 pImageFormatProperties);
Jon Ashburn754864f2015-07-23 18:49:07 -0600608}
609
Jon Ashburn23d36b12016-02-02 17:47:28 -0700610LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
Jon Ashburn014438f2016-03-01 19:51:07 -0700611vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700612 VkPhysicalDeviceProperties *pProperties) {
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600613 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700614 VkPhysicalDevice unwrapped_phys_dev =
615 loader_unwrap_physical_device(physicalDevice);
616 disp = loader_get_instance_dispatch(physicalDevice);
617 disp->GetPhysicalDeviceProperties(unwrapped_phys_dev, pProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600618}
619
Jon Ashburn23d36b12016-02-02 17:47:28 -0700620LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
621vkGetPhysicalDeviceQueueFamilyProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700622 VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700623 VkQueueFamilyProperties *pQueueProperties) {
Tony Barbour59a47322015-06-24 16:06:58 -0600624 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700625 VkPhysicalDevice unwrapped_phys_dev =
626 loader_unwrap_physical_device(physicalDevice);
627 disp = loader_get_instance_dispatch(physicalDevice);
628 disp->GetPhysicalDeviceQueueFamilyProperties(
629 unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600630}
631
Chia-I Wu9ab61502015-11-06 06:42:02 +0800632LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700633 VkPhysicalDevice physicalDevice,
634 VkPhysicalDeviceMemoryProperties *pMemoryProperties) {
Tony Barbour59a47322015-06-24 16:06:58 -0600635 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700636 VkPhysicalDevice unwrapped_phys_dev =
637 loader_unwrap_physical_device(physicalDevice);
638 disp = loader_get_instance_dispatch(physicalDevice);
639 disp->GetPhysicalDeviceMemoryProperties(unwrapped_phys_dev,
640 pMemoryProperties);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600641}
642
Mark Young0ad83132016-06-30 13:02:42 -0600643LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(
644 VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
645 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600646 VkResult res;
Mark Young0ad83132016-06-30 13:02:42 -0600647 struct loader_physical_device_tramp *phys_dev = NULL;
648 struct loader_device *dev = NULL;
649 struct loader_instance *inst = NULL;
Jon Ashburn1530c342016-02-26 13:14:27 -0700650
651 assert(pCreateInfo->queueCreateInfoCount >= 1);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600652
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600653 loader_platform_thread_lock_mutex(&loader_lock);
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600654
Jon Ashburn787eb252016-03-24 15:49:57 -0600655 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Piers Daniell295fe402016-03-29 11:51:11 -0600656 inst = (struct loader_instance *)phys_dev->this_instance;
Jon Ashburn1530c342016-02-26 13:14:27 -0700657
Jon Ashburn014438f2016-03-01 19:51:07 -0700658 /* Get the physical device (ICD) extensions */
659 struct loader_extension_list icd_exts;
Mark Young0ad83132016-06-30 13:02:42 -0600660 icd_exts.list = NULL;
Jon Ashburn014438f2016-03-01 19:51:07 -0700661 if (!loader_init_generic_list(inst, (struct loader_generic_list *)&icd_exts,
662 sizeof(VkExtensionProperties))) {
Mark Young0ad83132016-06-30 13:02:42 -0600663 res = VK_ERROR_OUT_OF_HOST_MEMORY;
664 goto out;
Jon Ashburn014438f2016-03-01 19:51:07 -0700665 }
Jon Ashburn1530c342016-02-26 13:14:27 -0700666
Jon Ashburn014438f2016-03-01 19:51:07 -0700667 res = loader_add_device_extensions(
Jon Ashburncc407a22016-04-15 09:25:03 -0600668 inst, inst->disp->EnumerateDeviceExtensionProperties,
669 phys_dev->phys_dev, "Unknown", &icd_exts);
Jon Ashburn014438f2016-03-01 19:51:07 -0700670 if (res != VK_SUCCESS) {
Mark Young0ad83132016-06-30 13:02:42 -0600671 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700672 }
673
Jon Ashburn1530c342016-02-26 13:14:27 -0700674 /* make sure requested extensions to be enabled are supported */
Mark Young0ad83132016-06-30 13:02:42 -0600675 res = loader_validate_device_extensions(
676 phys_dev, &inst->activated_layer_list, &icd_exts, pCreateInfo);
Jon Ashburn1530c342016-02-26 13:14:27 -0700677 if (res != VK_SUCCESS) {
Mark Young0ad83132016-06-30 13:02:42 -0600678 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700679 }
680
Mark Young0ad83132016-06-30 13:02:42 -0600681 dev = loader_create_logical_device(inst, pAllocator);
Jon Ashburn1530c342016-02-26 13:14:27 -0700682 if (dev == NULL) {
Mark Young0ad83132016-06-30 13:02:42 -0600683 res = VK_ERROR_OUT_OF_HOST_MEMORY;
684 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700685 }
686
Jon Ashburn491cd042016-05-16 14:01:18 -0600687 /* copy the instance layer list into the device */
688 dev->activated_layer_list.capacity = inst->activated_layer_list.capacity;
689 dev->activated_layer_list.count = inst->activated_layer_list.count;
Mark Young0ad83132016-06-30 13:02:42 -0600690 dev->activated_layer_list.list =
691 loader_device_heap_alloc(dev, inst->activated_layer_list.capacity,
692 VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
Jon Ashburn491cd042016-05-16 14:01:18 -0600693 if (dev->activated_layer_list.list == NULL) {
Mark Young0ad83132016-06-30 13:02:42 -0600694 res = VK_ERROR_OUT_OF_HOST_MEMORY;
695 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700696 }
Jon Ashburn491cd042016-05-16 14:01:18 -0600697 memcpy(dev->activated_layer_list.list, inst->activated_layer_list.list,
Mark Young0ad83132016-06-30 13:02:42 -0600698 sizeof(*dev->activated_layer_list.list) *
699 dev->activated_layer_list.count);
Jon Ashburn1530c342016-02-26 13:14:27 -0700700
Mark Young0ad83132016-06-30 13:02:42 -0600701 res = loader_create_device_chain(phys_dev, pCreateInfo, pAllocator, inst,
702 dev);
Jon Ashburn1530c342016-02-26 13:14:27 -0700703 if (res != VK_SUCCESS) {
Mark Young0ad83132016-06-30 13:02:42 -0600704 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700705 }
706
707 *pDevice = dev->device;
708
709 /* initialize any device extension dispatch entry's from the instance list*/
710 loader_init_dispatch_dev_ext(inst, dev);
711
712 /* initialize WSI device extensions as part of core dispatch since loader
713 * has
714 * dedicated trampoline code for these*/
715 loader_init_device_extension_dispatch_table(
716 &dev->loader_dispatch,
717 dev->loader_dispatch.core_dispatch.GetDeviceProcAddr, *pDevice);
718
Mark Young0ad83132016-06-30 13:02:42 -0600719out:
720
721 // Failure cleanup
722 if (VK_SUCCESS != res) {
723 if (NULL != dev) {
724 loader_destroy_logical_device(inst, dev, pAllocator);
725 }
726 }
727
728 if (NULL != icd_exts.list) {
729 loader_destroy_generic_list(inst,
730 (struct loader_generic_list *)&icd_exts);
731 }
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600732 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600733 return res;
734}
735
Jon Ashburn23d36b12016-02-02 17:47:28 -0700736LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
737vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600738 const VkLayerDispatchTable *disp;
Jon Ashburne39a4f82015-08-28 13:38:21 -0600739 struct loader_device *dev;
Andrzej Kotlowskib168b1a2016-02-03 09:41:53 +0100740
Jeremy Hayesd8726c22016-04-21 13:19:41 -0600741 if (device == VK_NULL_HANDLE) {
742 return;
743 }
744
Andrzej Kotlowskib168b1a2016-02-03 09:41:53 +0100745 loader_platform_thread_lock_mutex(&loader_lock);
746
Jon Ashburne39a4f82015-08-28 13:38:21 -0600747 struct loader_icd *icd = loader_get_icd_and_device(device, &dev);
748 const struct loader_instance *inst = icd->this_instance;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600749 disp = loader_get_dispatch(device);
750
Chia-I Wuf7458c52015-10-26 21:10:41 +0800751 disp->DestroyDevice(device, pAllocator);
Jon Ashburn781a7ae2015-11-19 15:43:26 -0700752 dev->device = NULL;
Mark Young0ad83132016-06-30 13:02:42 -0600753 loader_remove_logical_device(inst, icd, dev, pAllocator);
Jon Ashburn781a7ae2015-11-19 15:43:26 -0700754
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600755 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600756}
757
Jon Ashburn23d36b12016-02-02 17:47:28 -0700758LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
759vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
760 const char *pLayerName,
761 uint32_t *pPropertyCount,
762 VkExtensionProperties *pProperties) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700763 VkResult res = VK_SUCCESS;
Jon Ashburn787eb252016-03-24 15:49:57 -0600764 struct loader_physical_device_tramp *phys_dev;
765 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600766
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600767 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700768
769 /* If pLayerName == NULL, then querying ICD extensions, pass this call
770 down the instance chain which will terminate in the ICD. This allows
771 layers to filter the extensions coming back up the chain.
772 If pLayerName != NULL then get layer extensions from manifest file. */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700773 if (pLayerName == NULL || strlen(pLayerName) == 0) {
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700774 const VkLayerInstanceDispatchTable *disp;
775
776 disp = loader_get_instance_dispatch(physicalDevice);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700777 res = disp->EnumerateDeviceExtensionProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700778 phys_dev->phys_dev, NULL, pPropertyCount, pProperties);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700779 } else {
Jon Ashburn014438f2016-03-01 19:51:07 -0700780
Jon Ashburndc5d9202016-02-29 13:00:51 -0700781 uint32_t count;
782 uint32_t copy_size;
Piers Daniell295fe402016-03-29 11:51:11 -0600783 const struct loader_instance *inst = phys_dev->this_instance;
Jon Ashburnb8726962016-04-08 15:03:35 -0600784 struct loader_device_extension_list *dev_ext_list = NULL;
785 struct loader_device_extension_list local_ext_list;
786 memset(&local_ext_list, 0, sizeof(local_ext_list));
Jon Ashburndc5d9202016-02-29 13:00:51 -0700787 if (vk_string_validate(MaxLoaderStringLength, pLayerName) ==
Jon Ashburn014438f2016-03-01 19:51:07 -0700788 VK_STRING_ERROR_NONE) {
Jon Ashburnb8726962016-04-08 15:03:35 -0600789 if (strcmp(pLayerName, std_validation_str) == 0) {
790 struct loader_layer_list local_list;
791 memset(&local_list, 0, sizeof(local_list));
792 for (uint32_t i = 0; i < sizeof(std_validation_names) /
793 sizeof(std_validation_names[0]);
794 i++) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600795 loader_find_layer_name_add_list(
796 NULL, std_validation_names[i],
Jon Ashburn491cd042016-05-16 14:01:18 -0600797 VK_LAYER_TYPE_INSTANCE_EXPLICIT, &inst->instance_layer_list,
Jon Ashburncc407a22016-04-15 09:25:03 -0600798 &local_list);
Jon Ashburnb8726962016-04-08 15:03:35 -0600799 }
800 for (uint32_t i = 0; i < local_list.count; i++) {
801 struct loader_device_extension_list *ext_list =
Jon Ashburncc407a22016-04-15 09:25:03 -0600802 &local_list.list[i].device_extension_list;
Jon Ashburnb8726962016-04-08 15:03:35 -0600803 for (uint32_t j = 0; j < ext_list->count; j++) {
804 loader_add_to_dev_ext_list(NULL, &local_ext_list,
805 &ext_list->list[j].props, 0,
806 NULL);
807 }
808 }
809 dev_ext_list = &local_ext_list;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700810
Jon Ashburnb8726962016-04-08 15:03:35 -0600811 } else {
Jon Ashburn491cd042016-05-16 14:01:18 -0600812 for (uint32_t i = 0; i < inst->instance_layer_list.count; i++) {
Jon Ashburnb8726962016-04-08 15:03:35 -0600813 struct loader_layer_properties *props =
Jon Ashburn491cd042016-05-16 14:01:18 -0600814 &inst->instance_layer_list.list[i];
Jon Ashburnb8726962016-04-08 15:03:35 -0600815 if (strcmp(props->info.layerName, pLayerName) == 0) {
816 dev_ext_list = &props->device_extension_list;
817 }
Jon Ashburndc5d9202016-02-29 13:00:51 -0700818 }
819 }
Jon Ashburnb8726962016-04-08 15:03:35 -0600820
Jon Ashburndc5d9202016-02-29 13:00:51 -0700821 count = (dev_ext_list == NULL) ? 0 : dev_ext_list->count;
822 if (pProperties == NULL) {
823 *pPropertyCount = count;
Jon Ashburncc407a22016-04-15 09:25:03 -0600824 loader_destroy_generic_list(
825 inst, (struct loader_generic_list *)&local_ext_list);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700826 loader_platform_thread_unlock_mutex(&loader_lock);
827 return VK_SUCCESS;
828 }
829
830 copy_size = *pPropertyCount < count ? *pPropertyCount : count;
831 for (uint32_t i = 0; i < copy_size; i++) {
832 memcpy(&pProperties[i], &dev_ext_list->list[i].props,
Jon Ashburn014438f2016-03-01 19:51:07 -0700833 sizeof(VkExtensionProperties));
Jon Ashburndc5d9202016-02-29 13:00:51 -0700834 }
835 *pPropertyCount = copy_size;
836
Jon Ashburncc407a22016-04-15 09:25:03 -0600837 loader_destroy_generic_list(
838 inst, (struct loader_generic_list *)&local_ext_list);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700839 if (copy_size < count) {
840 loader_platform_thread_unlock_mutex(&loader_lock);
841 return VK_INCOMPLETE;
842 }
843 } else {
Jon Ashburn014438f2016-03-01 19:51:07 -0700844 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
845 "vkEnumerateDeviceExtensionProperties: pLayerName "
846 "is too long or is badly formed");
847 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700848 return VK_ERROR_EXTENSION_NOT_PRESENT;
849 }
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700850 }
851
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600852 loader_platform_thread_unlock_mutex(&loader_lock);
Tony Barbour59a47322015-06-24 16:06:58 -0600853 return res;
854}
855
Jon Ashburn23d36b12016-02-02 17:47:28 -0700856LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
857vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
858 uint32_t *pPropertyCount,
859 VkLayerProperties *pProperties) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700860 uint32_t copy_size;
Jon Ashburn787eb252016-03-24 15:49:57 -0600861 struct loader_physical_device_tramp *phys_dev;
Jon Ashburn491cd042016-05-16 14:01:18 -0600862 struct loader_layer_list *enabled_layers, layers_list;
863 uint32_t std_val_count = sizeof(std_validation_names) /
864 sizeof(std_validation_names[0]);
865 memset(&layers_list, 0, sizeof(layers_list));
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600866 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700867
868 /* Don't dispatch this call down the instance chain, want all device layers
869 enumerated and instance chain may not contain all device layers */
Jon Ashburn491cd042016-05-16 14:01:18 -0600870 // TODO re-evaluate the above statement we maybe able to start calling
871 // down the chain
Jon Ashburndc5d9202016-02-29 13:00:51 -0700872
Jon Ashburn787eb252016-03-24 15:49:57 -0600873 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Piers Daniell295fe402016-03-29 11:51:11 -0600874 const struct loader_instance *inst = phys_dev->this_instance;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700875
Jon Ashburn491cd042016-05-16 14:01:18 -0600876 uint32_t count = inst->activated_layer_list.count;
877 if (inst->activated_layers_are_std_val)
878 count = count - std_val_count + 1;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700879 if (pProperties == NULL) {
880 *pPropertyCount = count;
881 loader_platform_thread_unlock_mutex(&loader_lock);
882 return VK_SUCCESS;
883 }
Jon Ashburn491cd042016-05-16 14:01:18 -0600884 /* make sure to enumerate standard_validation if that is what was used
885 at the instance layer enablement */
886 if (inst->activated_layers_are_std_val) {
887 enabled_layers = &layers_list;
888 enabled_layers->count = count;
889 enabled_layers->capacity = enabled_layers->count *
890 sizeof(struct loader_layer_properties);
Mark Young0ad83132016-06-30 13:02:42 -0600891 enabled_layers->list = loader_instance_heap_alloc(inst, enabled_layers->capacity,
Jon Ashburn491cd042016-05-16 14:01:18 -0600892 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
893 if (!enabled_layers->list)
894 return VK_ERROR_OUT_OF_HOST_MEMORY;
895
896 uint32_t j = 0;
897 for (uint32_t i = 0; i < inst->activated_layer_list.count; j++) {
898
899 if (loader_find_layer_name_array(
900 inst->activated_layer_list.list[i].info.layerName,
901 std_val_count, std_validation_names)) {
902 struct loader_layer_properties props;
903 loader_init_std_validation_props(&props);
Mark Young0ad83132016-06-30 13:02:42 -0600904 VkResult err = loader_copy_layer_properties(inst,
905 &enabled_layers->list[j],
906 &props);
907 if (err != VK_SUCCESS) {
908 return err;
909 }
Jon Ashburn491cd042016-05-16 14:01:18 -0600910 i += std_val_count;
911 }
912 else {
Mark Young0ad83132016-06-30 13:02:42 -0600913 VkResult err = loader_copy_layer_properties(inst,
914 &enabled_layers->list[j],
915 &inst->activated_layer_list.list[i++]);
916 if (err != VK_SUCCESS) {
917 return err;
918 }
Jon Ashburn491cd042016-05-16 14:01:18 -0600919 }
920 }
921 }
922 else {
923 enabled_layers = (struct loader_layer_list *) &inst->activated_layer_list;
924 }
925
Jon Ashburndc5d9202016-02-29 13:00:51 -0700926
927 copy_size = (*pPropertyCount < count) ? *pPropertyCount : count;
928 for (uint32_t i = 0; i < copy_size; i++) {
Jon Ashburn491cd042016-05-16 14:01:18 -0600929 memcpy(&pProperties[i], &(enabled_layers->list[i].info),
Jon Ashburndc5d9202016-02-29 13:00:51 -0700930 sizeof(VkLayerProperties));
931 }
932 *pPropertyCount = copy_size;
933
Mark Young0ad83132016-06-30 13:02:42 -0600934 if (inst->activated_layers_are_std_val) {
Jon Ashburn491cd042016-05-16 14:01:18 -0600935 loader_delete_layer_properties(inst, enabled_layers);
Mark Young0ad83132016-06-30 13:02:42 -0600936 }
Jon Ashburndc5d9202016-02-29 13:00:51 -0700937 if (copy_size < count) {
938 loader_platform_thread_unlock_mutex(&loader_lock);
939 return VK_INCOMPLETE;
940 }
941
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600942 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700943 return VK_SUCCESS;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600944}
945
Jon Ashburn23d36b12016-02-02 17:47:28 -0700946LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
947vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex,
948 VkQueue *pQueue) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600949 const VkLayerDispatchTable *disp;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600950
951 disp = loader_get_dispatch(device);
952
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600953 disp->GetDeviceQueue(device, queueNodeIndex, queueIndex, pQueue);
954 loader_set_dispatch(*pQueue, disp);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600955}
956
Jon Ashburn23d36b12016-02-02 17:47:28 -0700957LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
958vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits,
959 VkFence fence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600960 const VkLayerDispatchTable *disp;
961
962 disp = loader_get_dispatch(queue);
963
Chia-I Wu40cf0ae2015-10-26 17:20:32 +0800964 return disp->QueueSubmit(queue, submitCount, pSubmits, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600965}
966
Jon Ashburn23d36b12016-02-02 17:47:28 -0700967LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600968 const VkLayerDispatchTable *disp;
969
970 disp = loader_get_dispatch(queue);
971
972 return disp->QueueWaitIdle(queue);
973}
974
Jon Ashburn23d36b12016-02-02 17:47:28 -0700975LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600976 const VkLayerDispatchTable *disp;
977
978 disp = loader_get_dispatch(device);
979
980 return disp->DeviceWaitIdle(device);
981}
982
Jon Ashburn23d36b12016-02-02 17:47:28 -0700983LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
984vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
985 const VkAllocationCallbacks *pAllocator,
986 VkDeviceMemory *pMemory) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600987 const VkLayerDispatchTable *disp;
988
989 disp = loader_get_dispatch(device);
990
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800991 return disp->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600992}
993
Jon Ashburn23d36b12016-02-02 17:47:28 -0700994LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
995vkFreeMemory(VkDevice device, VkDeviceMemory mem,
996 const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600997 const VkLayerDispatchTable *disp;
998
999 disp = loader_get_dispatch(device);
1000
Chia-I Wuf7458c52015-10-26 21:10:41 +08001001 disp->FreeMemory(device, mem, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001002}
1003
Jon Ashburn23d36b12016-02-02 17:47:28 -07001004LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1005vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset,
1006 VkDeviceSize size, VkFlags flags, void **ppData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001007 const VkLayerDispatchTable *disp;
1008
1009 disp = loader_get_dispatch(device);
1010
1011 return disp->MapMemory(device, mem, offset, size, flags, ppData);
1012}
1013
Jon Ashburn23d36b12016-02-02 17:47:28 -07001014LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1015vkUnmapMemory(VkDevice device, VkDeviceMemory mem) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001016 const VkLayerDispatchTable *disp;
1017
1018 disp = loader_get_dispatch(device);
1019
Mark Lobodzinski2141f652015-09-07 13:59:43 -06001020 disp->UnmapMemory(device, mem);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001021}
1022
Jon Ashburn23d36b12016-02-02 17:47:28 -07001023LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1024vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
1025 const VkMappedMemoryRange *pMemoryRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001026 const VkLayerDispatchTable *disp;
1027
1028 disp = loader_get_dispatch(device);
1029
Jon Ashburn23d36b12016-02-02 17:47:28 -07001030 return disp->FlushMappedMemoryRanges(device, memoryRangeCount,
1031 pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001032}
1033
Jon Ashburn23d36b12016-02-02 17:47:28 -07001034LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1035vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
1036 const VkMappedMemoryRange *pMemoryRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001037 const VkLayerDispatchTable *disp;
1038
1039 disp = loader_get_dispatch(device);
1040
Jon Ashburn23d36b12016-02-02 17:47:28 -07001041 return disp->InvalidateMappedMemoryRanges(device, memoryRangeCount,
1042 pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001043}
1044
Jon Ashburn23d36b12016-02-02 17:47:28 -07001045LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1046vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory,
1047 VkDeviceSize *pCommittedMemoryInBytes) {
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -06001048 const VkLayerDispatchTable *disp;
1049
1050 disp = loader_get_dispatch(device);
1051
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001052 disp->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes);
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -06001053}
1054
Jon Ashburn23d36b12016-02-02 17:47:28 -07001055LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1056vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem,
1057 VkDeviceSize offset) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001058 const VkLayerDispatchTable *disp;
1059
Mark Lobodzinski942b1722015-05-11 17:21:15 -05001060 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001061
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001062 return disp->BindBufferMemory(device, buffer, mem, offset);
1063}
1064
Jon Ashburn23d36b12016-02-02 17:47:28 -07001065LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1066vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem,
1067 VkDeviceSize offset) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001068 const VkLayerDispatchTable *disp;
1069
1070 disp = loader_get_dispatch(device);
1071
1072 return disp->BindImageMemory(device, image, mem, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001073}
1074
Jon Ashburn23d36b12016-02-02 17:47:28 -07001075LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1076vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer,
1077 VkMemoryRequirements *pMemoryRequirements) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001078 const VkLayerDispatchTable *disp;
1079
1080 disp = loader_get_dispatch(device);
1081
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001082 disp->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -06001083}
1084
Jon Ashburn23d36b12016-02-02 17:47:28 -07001085LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1086vkGetImageMemoryRequirements(VkDevice device, VkImage image,
1087 VkMemoryRequirements *pMemoryRequirements) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001088 const VkLayerDispatchTable *disp;
1089
1090 disp = loader_get_dispatch(device);
1091
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001092 disp->GetImageMemoryRequirements(device, image, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -06001093}
1094
Jon Ashburn23d36b12016-02-02 17:47:28 -07001095LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements(
1096 VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount,
1097 VkSparseImageMemoryRequirements *pSparseMemoryRequirements) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001098 const VkLayerDispatchTable *disp;
1099
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001100 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001101
Jon Ashburn23d36b12016-02-02 17:47:28 -07001102 disp->GetImageSparseMemoryRequirements(device, image,
1103 pSparseMemoryRequirementCount,
1104 pSparseMemoryRequirements);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001105}
1106
Jon Ashburn23d36b12016-02-02 17:47:28 -07001107LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1108vkGetPhysicalDeviceSparseImageFormatProperties(
1109 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
1110 VkSampleCountFlagBits samples, VkImageUsageFlags usage,
1111 VkImageTiling tiling, uint32_t *pPropertyCount,
1112 VkSparseImageFormatProperties *pProperties) {
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001113 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -07001114 VkPhysicalDevice unwrapped_phys_dev =
1115 loader_unwrap_physical_device(physicalDevice);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001116 disp = loader_get_instance_dispatch(physicalDevice);
1117
Jon Ashburn23d36b12016-02-02 17:47:28 -07001118 disp->GetPhysicalDeviceSparseImageFormatProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -07001119 unwrapped_phys_dev, format, type, samples, usage, tiling,
1120 pPropertyCount, pProperties);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001121}
1122
Jon Ashburn23d36b12016-02-02 17:47:28 -07001123LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1124vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount,
1125 const VkBindSparseInfo *pBindInfo, VkFence fence) {
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001126 const VkLayerDispatchTable *disp;
1127
1128 disp = loader_get_dispatch(queue);
1129
Chia-I Wu1ff4c3d2015-10-26 16:55:27 +08001130 return disp->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001131}
1132
Jon Ashburn23d36b12016-02-02 17:47:28 -07001133LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1134vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo,
1135 const VkAllocationCallbacks *pAllocator, VkFence *pFence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001136 const VkLayerDispatchTable *disp;
1137
1138 disp = loader_get_dispatch(device);
1139
Chia-I Wuf7458c52015-10-26 21:10:41 +08001140 return disp->CreateFence(device, pCreateInfo, pAllocator, pFence);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001141}
1142
Jon Ashburn23d36b12016-02-02 17:47:28 -07001143LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1144vkDestroyFence(VkDevice device, VkFence fence,
1145 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001146 const VkLayerDispatchTable *disp;
1147
1148 disp = loader_get_dispatch(device);
1149
Chia-I Wuf7458c52015-10-26 21:10:41 +08001150 disp->DestroyFence(device, fence, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001151}
1152
Jon Ashburn23d36b12016-02-02 17:47:28 -07001153LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1154vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001155 const VkLayerDispatchTable *disp;
1156
1157 disp = loader_get_dispatch(device);
1158
1159 return disp->ResetFences(device, fenceCount, pFences);
1160}
1161
Jon Ashburn23d36b12016-02-02 17:47:28 -07001162LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1163vkGetFenceStatus(VkDevice device, VkFence fence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001164 const VkLayerDispatchTable *disp;
1165
1166 disp = loader_get_dispatch(device);
1167
1168 return disp->GetFenceStatus(device, fence);
1169}
1170
Jon Ashburn23d36b12016-02-02 17:47:28 -07001171LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1172vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences,
1173 VkBool32 waitAll, uint64_t timeout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001174 const VkLayerDispatchTable *disp;
1175
1176 disp = loader_get_dispatch(device);
1177
1178 return disp->WaitForFences(device, fenceCount, pFences, waitAll, timeout);
1179}
1180
Jon Ashburn23d36b12016-02-02 17:47:28 -07001181LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1182vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo,
1183 const VkAllocationCallbacks *pAllocator,
1184 VkSemaphore *pSemaphore) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001185 const VkLayerDispatchTable *disp;
1186
1187 disp = loader_get_dispatch(device);
1188
Chia-I Wuf7458c52015-10-26 21:10:41 +08001189 return disp->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001190}
1191
Jon Ashburn23d36b12016-02-02 17:47:28 -07001192LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1193vkDestroySemaphore(VkDevice device, VkSemaphore semaphore,
1194 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001195 const VkLayerDispatchTable *disp;
1196
1197 disp = loader_get_dispatch(device);
1198
Chia-I Wuf7458c52015-10-26 21:10:41 +08001199 disp->DestroySemaphore(device, semaphore, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001200}
1201
Jon Ashburn23d36b12016-02-02 17:47:28 -07001202LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1203vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo,
1204 const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001205 const VkLayerDispatchTable *disp;
1206
1207 disp = loader_get_dispatch(device);
1208
Chia-I Wuf7458c52015-10-26 21:10:41 +08001209 return disp->CreateEvent(device, pCreateInfo, pAllocator, pEvent);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001210}
1211
Jon Ashburn23d36b12016-02-02 17:47:28 -07001212LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1213vkDestroyEvent(VkDevice device, VkEvent event,
1214 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001215 const VkLayerDispatchTable *disp;
1216
1217 disp = loader_get_dispatch(device);
1218
Chia-I Wuf7458c52015-10-26 21:10:41 +08001219 disp->DestroyEvent(device, event, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001220}
1221
Jon Ashburn23d36b12016-02-02 17:47:28 -07001222LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1223vkGetEventStatus(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001224 const VkLayerDispatchTable *disp;
1225
1226 disp = loader_get_dispatch(device);
1227
1228 return disp->GetEventStatus(device, event);
1229}
1230
Jon Ashburn23d36b12016-02-02 17:47:28 -07001231LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1232vkSetEvent(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001233 const VkLayerDispatchTable *disp;
1234
1235 disp = loader_get_dispatch(device);
1236
1237 return disp->SetEvent(device, event);
1238}
1239
Jon Ashburn23d36b12016-02-02 17:47:28 -07001240LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1241vkResetEvent(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001242 const VkLayerDispatchTable *disp;
1243
1244 disp = loader_get_dispatch(device);
1245
1246 return disp->ResetEvent(device, event);
1247}
1248
Jon Ashburn23d36b12016-02-02 17:47:28 -07001249LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1250vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo,
1251 const VkAllocationCallbacks *pAllocator,
1252 VkQueryPool *pQueryPool) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001253 const VkLayerDispatchTable *disp;
1254
1255 disp = loader_get_dispatch(device);
1256
Chia-I Wuf7458c52015-10-26 21:10:41 +08001257 return disp->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001258}
1259
Jon Ashburn23d36b12016-02-02 17:47:28 -07001260LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1261vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool,
1262 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001263 const VkLayerDispatchTable *disp;
1264
1265 disp = loader_get_dispatch(device);
1266
Chia-I Wuf7458c52015-10-26 21:10:41 +08001267 disp->DestroyQueryPool(device, queryPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001268}
1269
Jon Ashburn23d36b12016-02-02 17:47:28 -07001270LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1271vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool,
1272 uint32_t firstQuery, uint32_t queryCount, size_t dataSize,
1273 void *pData, VkDeviceSize stride,
1274 VkQueryResultFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001275 const VkLayerDispatchTable *disp;
1276
1277 disp = loader_get_dispatch(device);
1278
Jon Ashburn23d36b12016-02-02 17:47:28 -07001279 return disp->GetQueryPoolResults(device, queryPool, firstQuery, queryCount,
1280 dataSize, pData, stride, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001281}
1282
Jon Ashburn23d36b12016-02-02 17:47:28 -07001283LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1284vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo,
1285 const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001286 const VkLayerDispatchTable *disp;
1287
1288 disp = loader_get_dispatch(device);
1289
Chia-I Wuf7458c52015-10-26 21:10:41 +08001290 return disp->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001291}
1292
Jon Ashburn23d36b12016-02-02 17:47:28 -07001293LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1294vkDestroyBuffer(VkDevice device, VkBuffer buffer,
1295 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001296 const VkLayerDispatchTable *disp;
1297
1298 disp = loader_get_dispatch(device);
1299
Chia-I Wuf7458c52015-10-26 21:10:41 +08001300 disp->DestroyBuffer(device, buffer, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001301}
1302
Jon Ashburn23d36b12016-02-02 17:47:28 -07001303LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1304vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo,
1305 const VkAllocationCallbacks *pAllocator,
1306 VkBufferView *pView) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001307 const VkLayerDispatchTable *disp;
1308
1309 disp = loader_get_dispatch(device);
1310
Chia-I Wuf7458c52015-10-26 21:10:41 +08001311 return disp->CreateBufferView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001312}
1313
Jon Ashburn23d36b12016-02-02 17:47:28 -07001314LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1315vkDestroyBufferView(VkDevice device, VkBufferView bufferView,
1316 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001317 const VkLayerDispatchTable *disp;
1318
1319 disp = loader_get_dispatch(device);
1320
Chia-I Wuf7458c52015-10-26 21:10:41 +08001321 disp->DestroyBufferView(device, bufferView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001322}
1323
Jon Ashburn23d36b12016-02-02 17:47:28 -07001324LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1325vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
1326 const VkAllocationCallbacks *pAllocator, VkImage *pImage) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001327 const VkLayerDispatchTable *disp;
1328
1329 disp = loader_get_dispatch(device);
1330
Chia-I Wuf7458c52015-10-26 21:10:41 +08001331 return disp->CreateImage(device, pCreateInfo, pAllocator, pImage);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001332}
1333
Jon Ashburn23d36b12016-02-02 17:47:28 -07001334LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1335vkDestroyImage(VkDevice device, VkImage image,
1336 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001337 const VkLayerDispatchTable *disp;
1338
1339 disp = loader_get_dispatch(device);
1340
Chia-I Wuf7458c52015-10-26 21:10:41 +08001341 disp->DestroyImage(device, image, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001342}
1343
Jon Ashburn23d36b12016-02-02 17:47:28 -07001344LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1345vkGetImageSubresourceLayout(VkDevice device, VkImage image,
1346 const VkImageSubresource *pSubresource,
1347 VkSubresourceLayout *pLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001348 const VkLayerDispatchTable *disp;
1349
1350 disp = loader_get_dispatch(device);
1351
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001352 disp->GetImageSubresourceLayout(device, image, pSubresource, pLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001353}
1354
Jon Ashburn23d36b12016-02-02 17:47:28 -07001355LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1356vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo,
1357 const VkAllocationCallbacks *pAllocator, VkImageView *pView) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001358 const VkLayerDispatchTable *disp;
1359
1360 disp = loader_get_dispatch(device);
1361
Chia-I Wuf7458c52015-10-26 21:10:41 +08001362 return disp->CreateImageView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001363}
1364
Jon Ashburn23d36b12016-02-02 17:47:28 -07001365LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1366vkDestroyImageView(VkDevice device, VkImageView imageView,
1367 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001368 const VkLayerDispatchTable *disp;
1369
1370 disp = loader_get_dispatch(device);
1371
Chia-I Wuf7458c52015-10-26 21:10:41 +08001372 disp->DestroyImageView(device, imageView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001373}
1374
Jon Ashburn23d36b12016-02-02 17:47:28 -07001375LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1376vkCreateShaderModule(VkDevice device,
1377 const VkShaderModuleCreateInfo *pCreateInfo,
1378 const VkAllocationCallbacks *pAllocator,
1379 VkShaderModule *pShader) {
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -06001380 const VkLayerDispatchTable *disp;
1381
1382 disp = loader_get_dispatch(device);
1383
Chia-I Wuf7458c52015-10-26 21:10:41 +08001384 return disp->CreateShaderModule(device, pCreateInfo, pAllocator, pShader);
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -06001385}
1386
Jon Ashburn23d36b12016-02-02 17:47:28 -07001387LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1388vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule,
1389 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001390 const VkLayerDispatchTable *disp;
1391
1392 disp = loader_get_dispatch(device);
1393
Chia-I Wuf7458c52015-10-26 21:10:41 +08001394 disp->DestroyShaderModule(device, shaderModule, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001395}
1396
Jon Ashburn23d36b12016-02-02 17:47:28 -07001397LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1398vkCreatePipelineCache(VkDevice device,
1399 const VkPipelineCacheCreateInfo *pCreateInfo,
1400 const VkAllocationCallbacks *pAllocator,
1401 VkPipelineCache *pPipelineCache) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001402 const VkLayerDispatchTable *disp;
1403
1404 disp = loader_get_dispatch(device);
1405
Jon Ashburn23d36b12016-02-02 17:47:28 -07001406 return disp->CreatePipelineCache(device, pCreateInfo, pAllocator,
1407 pPipelineCache);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001408}
1409
Jon Ashburn23d36b12016-02-02 17:47:28 -07001410LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1411vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache,
1412 const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001413 const VkLayerDispatchTable *disp;
1414
1415 disp = loader_get_dispatch(device);
1416
Chia-I Wuf7458c52015-10-26 21:10:41 +08001417 disp->DestroyPipelineCache(device, pipelineCache, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001418}
1419
Jon Ashburn23d36b12016-02-02 17:47:28 -07001420LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1421vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache,
1422 size_t *pDataSize, void *pData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001423 const VkLayerDispatchTable *disp;
1424
1425 disp = loader_get_dispatch(device);
1426
Chia-I Wub16facd2015-10-26 19:17:06 +08001427 return disp->GetPipelineCacheData(device, pipelineCache, pDataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001428}
1429
Jon Ashburn23d36b12016-02-02 17:47:28 -07001430LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1431vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache,
1432 uint32_t srcCacheCount,
1433 const VkPipelineCache *pSrcCaches) {
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->MergePipelineCaches(device, dstCache, srcCacheCount,
1439 pSrcCaches);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001440}
1441
Jon Ashburn23d36b12016-02-02 17:47:28 -07001442LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1443vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache,
1444 uint32_t createInfoCount,
1445 const VkGraphicsPipelineCreateInfo *pCreateInfos,
1446 const VkAllocationCallbacks *pAllocator,
1447 VkPipeline *pPipelines) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001448 const VkLayerDispatchTable *disp;
1449
1450 disp = loader_get_dispatch(device);
1451
Jon Ashburn23d36b12016-02-02 17:47:28 -07001452 return disp->CreateGraphicsPipelines(device, pipelineCache, createInfoCount,
1453 pCreateInfos, pAllocator, pPipelines);
Jon Ashburnc669cc62015-07-09 15:02:25 -06001454}
1455
Jon Ashburn23d36b12016-02-02 17:47:28 -07001456LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1457vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache,
1458 uint32_t createInfoCount,
1459 const VkComputePipelineCreateInfo *pCreateInfos,
1460 const VkAllocationCallbacks *pAllocator,
1461 VkPipeline *pPipelines) {
Jon Ashburnc669cc62015-07-09 15:02:25 -06001462 const VkLayerDispatchTable *disp;
1463
1464 disp = loader_get_dispatch(device);
1465
Jon Ashburn23d36b12016-02-02 17:47:28 -07001466 return disp->CreateComputePipelines(device, pipelineCache, createInfoCount,
1467 pCreateInfos, pAllocator, pPipelines);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001468}
1469
Jon Ashburn23d36b12016-02-02 17:47:28 -07001470LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1471vkDestroyPipeline(VkDevice device, VkPipeline pipeline,
1472 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001473 const VkLayerDispatchTable *disp;
1474
1475 disp = loader_get_dispatch(device);
1476
Chia-I Wuf7458c52015-10-26 21:10:41 +08001477 disp->DestroyPipeline(device, pipeline, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001478}
1479
Jon Ashburn23d36b12016-02-02 17:47:28 -07001480LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1481vkCreatePipelineLayout(VkDevice device,
1482 const VkPipelineLayoutCreateInfo *pCreateInfo,
1483 const VkAllocationCallbacks *pAllocator,
1484 VkPipelineLayout *pPipelineLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001485 const VkLayerDispatchTable *disp;
1486
1487 disp = loader_get_dispatch(device);
1488
Jon Ashburn23d36b12016-02-02 17:47:28 -07001489 return disp->CreatePipelineLayout(device, pCreateInfo, pAllocator,
1490 pPipelineLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001491}
1492
Jon Ashburn23d36b12016-02-02 17:47:28 -07001493LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1494vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout,
1495 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001496 const VkLayerDispatchTable *disp;
1497
1498 disp = loader_get_dispatch(device);
1499
Chia-I Wuf7458c52015-10-26 21:10:41 +08001500 disp->DestroyPipelineLayout(device, pipelineLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001501}
1502
Jon Ashburn23d36b12016-02-02 17:47:28 -07001503LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1504vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo,
1505 const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001506 const VkLayerDispatchTable *disp;
1507
1508 disp = loader_get_dispatch(device);
1509
Chia-I Wuf7458c52015-10-26 21:10:41 +08001510 return disp->CreateSampler(device, pCreateInfo, pAllocator, pSampler);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001511}
1512
Jon Ashburn23d36b12016-02-02 17:47:28 -07001513LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1514vkDestroySampler(VkDevice device, VkSampler sampler,
1515 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001516 const VkLayerDispatchTable *disp;
1517
1518 disp = loader_get_dispatch(device);
1519
Chia-I Wuf7458c52015-10-26 21:10:41 +08001520 disp->DestroySampler(device, sampler, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001521}
1522
Jon Ashburn23d36b12016-02-02 17:47:28 -07001523LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1524vkCreateDescriptorSetLayout(VkDevice device,
1525 const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
1526 const VkAllocationCallbacks *pAllocator,
1527 VkDescriptorSetLayout *pSetLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001528 const VkLayerDispatchTable *disp;
1529
1530 disp = loader_get_dispatch(device);
1531
Jon Ashburn23d36b12016-02-02 17:47:28 -07001532 return disp->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator,
1533 pSetLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001534}
1535
Jon Ashburn23d36b12016-02-02 17:47:28 -07001536LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1537vkDestroyDescriptorSetLayout(VkDevice device,
1538 VkDescriptorSetLayout descriptorSetLayout,
1539 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001540 const VkLayerDispatchTable *disp;
1541
1542 disp = loader_get_dispatch(device);
1543
Chia-I Wuf7458c52015-10-26 21:10:41 +08001544 disp->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001545}
1546
Jon Ashburn23d36b12016-02-02 17:47:28 -07001547LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1548vkCreateDescriptorPool(VkDevice device,
1549 const VkDescriptorPoolCreateInfo *pCreateInfo,
1550 const VkAllocationCallbacks *pAllocator,
1551 VkDescriptorPool *pDescriptorPool) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001552 const VkLayerDispatchTable *disp;
1553
1554 disp = loader_get_dispatch(device);
1555
Jon Ashburn23d36b12016-02-02 17:47:28 -07001556 return disp->CreateDescriptorPool(device, pCreateInfo, pAllocator,
1557 pDescriptorPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001558}
1559
Jon Ashburn23d36b12016-02-02 17:47:28 -07001560LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1561vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
1562 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001563 const VkLayerDispatchTable *disp;
1564
1565 disp = loader_get_dispatch(device);
1566
Chia-I Wuf7458c52015-10-26 21:10:41 +08001567 disp->DestroyDescriptorPool(device, descriptorPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001568}
1569
Jon Ashburn23d36b12016-02-02 17:47:28 -07001570LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1571vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
1572 VkDescriptorPoolResetFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001573 const VkLayerDispatchTable *disp;
1574
1575 disp = loader_get_dispatch(device);
1576
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001577 return disp->ResetDescriptorPool(device, descriptorPool, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001578}
1579
Jon Ashburn23d36b12016-02-02 17:47:28 -07001580LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1581vkAllocateDescriptorSets(VkDevice device,
1582 const VkDescriptorSetAllocateInfo *pAllocateInfo,
1583 VkDescriptorSet *pDescriptorSets) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001584 const VkLayerDispatchTable *disp;
1585
1586 disp = loader_get_dispatch(device);
1587
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001588 return disp->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001589}
1590
Jon Ashburn23d36b12016-02-02 17:47:28 -07001591LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1592vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool,
1593 uint32_t descriptorSetCount,
1594 const VkDescriptorSet *pDescriptorSets) {
Tony Barbour34ec6922015-07-10 10:50:45 -06001595 const VkLayerDispatchTable *disp;
1596
1597 disp = loader_get_dispatch(device);
1598
Jon Ashburn23d36b12016-02-02 17:47:28 -07001599 return disp->FreeDescriptorSets(device, descriptorPool, descriptorSetCount,
1600 pDescriptorSets);
Tony Barbour34ec6922015-07-10 10:50:45 -06001601}
1602
Jon Ashburn23d36b12016-02-02 17:47:28 -07001603LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1604vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount,
1605 const VkWriteDescriptorSet *pDescriptorWrites,
1606 uint32_t descriptorCopyCount,
1607 const VkCopyDescriptorSet *pDescriptorCopies) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001608 const VkLayerDispatchTable *disp;
1609
1610 disp = loader_get_dispatch(device);
1611
Jon Ashburn23d36b12016-02-02 17:47:28 -07001612 disp->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites,
1613 descriptorCopyCount, pDescriptorCopies);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001614}
1615
Jon Ashburn23d36b12016-02-02 17:47:28 -07001616LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1617vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo,
1618 const VkAllocationCallbacks *pAllocator,
1619 VkFramebuffer *pFramebuffer) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001620 const VkLayerDispatchTable *disp;
1621
1622 disp = loader_get_dispatch(device);
1623
Jon Ashburn23d36b12016-02-02 17:47:28 -07001624 return disp->CreateFramebuffer(device, pCreateInfo, pAllocator,
1625 pFramebuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001626}
1627
Jon Ashburn23d36b12016-02-02 17:47:28 -07001628LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1629vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer,
1630 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001631 const VkLayerDispatchTable *disp;
1632
1633 disp = loader_get_dispatch(device);
1634
Chia-I Wuf7458c52015-10-26 21:10:41 +08001635 disp->DestroyFramebuffer(device, framebuffer, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -06001636}
1637
Jon Ashburn23d36b12016-02-02 17:47:28 -07001638LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1639vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
1640 const VkAllocationCallbacks *pAllocator,
1641 VkRenderPass *pRenderPass) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001642 const VkLayerDispatchTable *disp;
1643
1644 disp = loader_get_dispatch(device);
1645
Chia-I Wuf7458c52015-10-26 21:10:41 +08001646 return disp->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
Jon Ashburn754864f2015-07-23 18:49:07 -06001647}
1648
Jon Ashburn23d36b12016-02-02 17:47:28 -07001649LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1650vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass,
1651 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001652 const VkLayerDispatchTable *disp;
1653
1654 disp = loader_get_dispatch(device);
1655
Chia-I Wuf7458c52015-10-26 21:10:41 +08001656 disp->DestroyRenderPass(device, renderPass, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -06001657}
1658
Jon Ashburn23d36b12016-02-02 17:47:28 -07001659LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1660vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass,
1661 VkExtent2D *pGranularity) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001662 const VkLayerDispatchTable *disp;
1663
1664 disp = loader_get_dispatch(device);
1665
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001666 disp->GetRenderAreaGranularity(device, renderPass, pGranularity);
Jon Ashburn754864f2015-07-23 18:49:07 -06001667}
1668
Jon Ashburn23d36b12016-02-02 17:47:28 -07001669LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1670vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo,
1671 const VkAllocationCallbacks *pAllocator,
1672 VkCommandPool *pCommandPool) {
Cody Northrope62183e2015-07-09 18:08:05 -06001673 const VkLayerDispatchTable *disp;
1674
1675 disp = loader_get_dispatch(device);
1676
Jon Ashburn23d36b12016-02-02 17:47:28 -07001677 return disp->CreateCommandPool(device, pCreateInfo, pAllocator,
1678 pCommandPool);
Cody Northrope62183e2015-07-09 18:08:05 -06001679}
1680
Jon Ashburn23d36b12016-02-02 17:47:28 -07001681LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1682vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool,
1683 const VkAllocationCallbacks *pAllocator) {
Cody Northrope62183e2015-07-09 18:08:05 -06001684 const VkLayerDispatchTable *disp;
1685
1686 disp = loader_get_dispatch(device);
1687
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001688 disp->DestroyCommandPool(device, commandPool, pAllocator);
Cody Northrope62183e2015-07-09 18:08:05 -06001689}
1690
Jon Ashburn23d36b12016-02-02 17:47:28 -07001691LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1692vkResetCommandPool(VkDevice device, VkCommandPool commandPool,
1693 VkCommandPoolResetFlags flags) {
Cody Northrope62183e2015-07-09 18:08:05 -06001694 const VkLayerDispatchTable *disp;
1695
1696 disp = loader_get_dispatch(device);
1697
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001698 return disp->ResetCommandPool(device, commandPool, flags);
Cody Northrope62183e2015-07-09 18:08:05 -06001699}
1700
Jon Ashburn23d36b12016-02-02 17:47:28 -07001701LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1702vkAllocateCommandBuffers(VkDevice device,
1703 const VkCommandBufferAllocateInfo *pAllocateInfo,
1704 VkCommandBuffer *pCommandBuffers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001705 const VkLayerDispatchTable *disp;
1706 VkResult res;
1707
1708 disp = loader_get_dispatch(device);
1709
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001710 res = disp->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001711 if (res == VK_SUCCESS) {
Jon Ashburn23d36b12016-02-02 17:47:28 -07001712 for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; i++) {
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001713 if (pCommandBuffers[i]) {
1714 loader_init_dispatch(pCommandBuffers[i], disp);
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001715 }
1716 }
Jon Ashburnd55a3942015-05-06 09:02:10 -06001717 }
1718
1719 return res;
1720}
1721
Jon Ashburn23d36b12016-02-02 17:47:28 -07001722LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1723vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool,
1724 uint32_t commandBufferCount,
1725 const VkCommandBuffer *pCommandBuffers) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001726 const VkLayerDispatchTable *disp;
1727
1728 disp = loader_get_dispatch(device);
1729
Jon Ashburn23d36b12016-02-02 17:47:28 -07001730 disp->FreeCommandBuffers(device, commandPool, commandBufferCount,
1731 pCommandBuffers);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001732}
1733
Jon Ashburn23d36b12016-02-02 17:47:28 -07001734LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1735vkBeginCommandBuffer(VkCommandBuffer commandBuffer,
1736 const VkCommandBufferBeginInfo *pBeginInfo) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001737 const VkLayerDispatchTable *disp;
1738
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001739 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001740
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001741 return disp->BeginCommandBuffer(commandBuffer, pBeginInfo);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001742}
1743
Jon Ashburn23d36b12016-02-02 17:47:28 -07001744LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1745vkEndCommandBuffer(VkCommandBuffer commandBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001746 const VkLayerDispatchTable *disp;
1747
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001748 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001749
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001750 return disp->EndCommandBuffer(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001751}
1752
Jon Ashburn23d36b12016-02-02 17:47:28 -07001753LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1754vkResetCommandBuffer(VkCommandBuffer commandBuffer,
1755 VkCommandBufferResetFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001756 const VkLayerDispatchTable *disp;
1757
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001758 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001759
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001760 return disp->ResetCommandBuffer(commandBuffer, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001761}
1762
Jon Ashburn23d36b12016-02-02 17:47:28 -07001763LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1764vkCmdBindPipeline(VkCommandBuffer commandBuffer,
1765 VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001766 const VkLayerDispatchTable *disp;
1767
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001768 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001769
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001770 disp->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001771}
1772
Jon Ashburn23d36b12016-02-02 17:47:28 -07001773LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1774vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport,
1775 uint32_t viewportCount, const VkViewport *pViewports) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001776 const VkLayerDispatchTable *disp;
1777
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001778 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001779
Jon Ashburn23d36b12016-02-02 17:47:28 -07001780 disp->CmdSetViewport(commandBuffer, firstViewport, viewportCount,
1781 pViewports);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001782}
1783
Jon Ashburn23d36b12016-02-02 17:47:28 -07001784LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1785vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor,
1786 uint32_t scissorCount, const VkRect2D *pScissors) {
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001787 const VkLayerDispatchTable *disp;
1788
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001789 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001790
Jon Ashburn19d3bf12015-12-30 14:06:55 -07001791 disp->CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001792}
1793
Jon Ashburn23d36b12016-02-02 17:47:28 -07001794LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1795vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001796 const VkLayerDispatchTable *disp;
1797
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001798 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001799
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001800 disp->CmdSetLineWidth(commandBuffer, lineWidth);
Cody Northrop12365112015-08-17 11:10:49 -06001801}
1802
Jon Ashburn23d36b12016-02-02 17:47:28 -07001803LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1804vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor,
1805 float depthBiasClamp, float depthBiasSlopeFactor) {
Cody Northrop12365112015-08-17 11:10:49 -06001806 const VkLayerDispatchTable *disp;
1807
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001808 disp = loader_get_dispatch(commandBuffer);
Cody Northrop12365112015-08-17 11:10:49 -06001809
Jon Ashburn23d36b12016-02-02 17:47:28 -07001810 disp->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor,
1811 depthBiasClamp, depthBiasSlopeFactor);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001812}
1813
Jon Ashburn23d36b12016-02-02 17:47:28 -07001814LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1815vkCmdSetBlendConstants(VkCommandBuffer commandBuffer,
1816 const float blendConstants[4]) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001817 const VkLayerDispatchTable *disp;
1818
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001819 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001820
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001821 disp->CmdSetBlendConstants(commandBuffer, blendConstants);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001822}
1823
Jon Ashburn23d36b12016-02-02 17:47:28 -07001824LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1825vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds,
1826 float maxDepthBounds) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001827 const VkLayerDispatchTable *disp;
1828
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001829 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001830
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001831 disp->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
Cody Northrop82485a82015-08-18 15:21:16 -06001832}
1833
Jon Ashburn23d36b12016-02-02 17:47:28 -07001834LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1835vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer,
1836 VkStencilFaceFlags faceMask, uint32_t compareMask) {
Cody Northrop82485a82015-08-18 15:21:16 -06001837 const VkLayerDispatchTable *disp;
1838
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001839 disp = loader_get_dispatch(commandBuffer);
Cody Northrop82485a82015-08-18 15:21:16 -06001840
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001841 disp->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001842}
1843
Jon Ashburn23d36b12016-02-02 17:47:28 -07001844LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1845vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer,
1846 VkStencilFaceFlags faceMask, uint32_t writeMask) {
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001847 const VkLayerDispatchTable *disp;
1848
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001849 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001850
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001851 disp->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001852}
1853
Jon Ashburn23d36b12016-02-02 17:47:28 -07001854LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1855vkCmdSetStencilReference(VkCommandBuffer commandBuffer,
1856 VkStencilFaceFlags faceMask, uint32_t reference) {
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001857 const VkLayerDispatchTable *disp;
1858
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001859 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001860
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001861 disp->CmdSetStencilReference(commandBuffer, faceMask, reference);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001862}
1863
Jon Ashburn23d36b12016-02-02 17:47:28 -07001864LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets(
1865 VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
1866 VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount,
1867 const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount,
1868 const uint32_t *pDynamicOffsets) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001869 const VkLayerDispatchTable *disp;
1870
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001871 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001872
Jon Ashburn23d36b12016-02-02 17:47:28 -07001873 disp->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout,
1874 firstSet, descriptorSetCount, pDescriptorSets,
1875 dynamicOffsetCount, pDynamicOffsets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001876}
1877
Jon Ashburn23d36b12016-02-02 17:47:28 -07001878LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1879vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer,
1880 VkDeviceSize offset, VkIndexType indexType) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001881 const VkLayerDispatchTable *disp;
1882
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001883 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001884
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001885 disp->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001886}
1887
Jon Ashburn23d36b12016-02-02 17:47:28 -07001888LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1889vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding,
1890 uint32_t bindingCount, const VkBuffer *pBuffers,
1891 const VkDeviceSize *pOffsets) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001892 const VkLayerDispatchTable *disp;
1893
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001894 disp = loader_get_dispatch(commandBuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001895
Jon Ashburn23d36b12016-02-02 17:47:28 -07001896 disp->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount,
1897 pBuffers, pOffsets);
Jon Ashburn754864f2015-07-23 18:49:07 -06001898}
1899
Jon Ashburn23d36b12016-02-02 17:47:28 -07001900LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1901vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount,
1902 uint32_t instanceCount, uint32_t firstVertex,
1903 uint32_t firstInstance) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001904 const VkLayerDispatchTable *disp;
1905
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001906 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001907
Jon Ashburn23d36b12016-02-02 17:47:28 -07001908 disp->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex,
1909 firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001910}
1911
Jon Ashburn23d36b12016-02-02 17:47:28 -07001912LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1913vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount,
1914 uint32_t instanceCount, uint32_t firstIndex,
1915 int32_t vertexOffset, uint32_t firstInstance) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001916 const VkLayerDispatchTable *disp;
1917
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001918 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001919
Jon Ashburn23d36b12016-02-02 17:47:28 -07001920 disp->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex,
1921 vertexOffset, firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001922}
1923
Jon Ashburn23d36b12016-02-02 17:47:28 -07001924LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1925vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1926 VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001927 const VkLayerDispatchTable *disp;
1928
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001929 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001930
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001931 disp->CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001932}
1933
Jon Ashburn23d36b12016-02-02 17:47:28 -07001934LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1935vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1936 VkDeviceSize offset, uint32_t drawCount,
1937 uint32_t stride) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001938 const VkLayerDispatchTable *disp;
1939
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001940 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001941
Jon Ashburn23d36b12016-02-02 17:47:28 -07001942 disp->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount,
1943 stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001944}
1945
Jon Ashburn23d36b12016-02-02 17:47:28 -07001946LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1947vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y,
1948 uint32_t z) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001949 const VkLayerDispatchTable *disp;
1950
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001951 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001952
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001953 disp->CmdDispatch(commandBuffer, x, y, z);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001954}
1955
Jon Ashburn23d36b12016-02-02 17:47:28 -07001956LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1957vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1958 VkDeviceSize offset) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001959 const VkLayerDispatchTable *disp;
1960
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001961 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001962
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001963 disp->CmdDispatchIndirect(commandBuffer, buffer, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001964}
1965
Jon Ashburn23d36b12016-02-02 17:47:28 -07001966LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1967vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer,
1968 VkBuffer dstBuffer, uint32_t regionCount,
1969 const VkBufferCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001970 const VkLayerDispatchTable *disp;
1971
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001972 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001973
Jon Ashburn23d36b12016-02-02 17:47:28 -07001974 disp->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount,
1975 pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001976}
1977
Jon Ashburn23d36b12016-02-02 17:47:28 -07001978LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1979vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage,
1980 VkImageLayout srcImageLayout, VkImage dstImage,
1981 VkImageLayout dstImageLayout, uint32_t regionCount,
1982 const VkImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001983 const VkLayerDispatchTable *disp;
1984
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001985 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001986
Jon Ashburn23d36b12016-02-02 17:47:28 -07001987 disp->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage,
1988 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001989}
1990
Jon Ashburn23d36b12016-02-02 17:47:28 -07001991LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1992vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage,
1993 VkImageLayout srcImageLayout, VkImage dstImage,
1994 VkImageLayout dstImageLayout, uint32_t regionCount,
1995 const VkImageBlit *pRegions, VkFilter filter) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001996 const VkLayerDispatchTable *disp;
1997
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001998 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001999
Jon Ashburn23d36b12016-02-02 17:47:28 -07002000 disp->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage,
2001 dstImageLayout, regionCount, pRegions, filter);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002002}
2003
Jon Ashburn23d36b12016-02-02 17:47:28 -07002004LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2005vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer,
2006 VkImage dstImage, VkImageLayout dstImageLayout,
2007 uint32_t regionCount,
2008 const VkBufferImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002009 const VkLayerDispatchTable *disp;
2010
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002011 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002012
Jon Ashburn23d36b12016-02-02 17:47:28 -07002013 disp->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage,
2014 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002015}
2016
Jon Ashburn23d36b12016-02-02 17:47:28 -07002017LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2018vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage,
2019 VkImageLayout srcImageLayout, VkBuffer dstBuffer,
2020 uint32_t regionCount,
2021 const VkBufferImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002022 const VkLayerDispatchTable *disp;
2023
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002024 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002025
Jon Ashburn23d36b12016-02-02 17:47:28 -07002026 disp->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout,
2027 dstBuffer, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002028}
2029
Jon Ashburn23d36b12016-02-02 17:47:28 -07002030LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2031vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
2032 VkDeviceSize dstOffset, VkDeviceSize dataSize,
Karl Schultzee344492016-07-11 15:09:57 -06002033 const void *pData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002034 const VkLayerDispatchTable *disp;
2035
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002036 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002037
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002038 disp->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002039}
2040
Jon Ashburn23d36b12016-02-02 17:47:28 -07002041LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2042vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
2043 VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002044 const VkLayerDispatchTable *disp;
2045
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002046 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002047
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002048 disp->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002049}
2050
Jon Ashburn23d36b12016-02-02 17:47:28 -07002051LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2052vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image,
2053 VkImageLayout imageLayout, const VkClearColorValue *pColor,
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->CmdClearColorImage(commandBuffer, image, imageLayout, pColor,
2061 rangeCount, pRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002062}
2063
Jon Ashburn23d36b12016-02-02 17:47:28 -07002064LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2065vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image,
2066 VkImageLayout imageLayout,
2067 const VkClearDepthStencilValue *pDepthStencil,
2068 uint32_t rangeCount,
2069 const VkImageSubresourceRange *pRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002070 const VkLayerDispatchTable *disp;
2071
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002072 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002073
Jon Ashburn23d36b12016-02-02 17:47:28 -07002074 disp->CmdClearDepthStencilImage(commandBuffer, image, imageLayout,
2075 pDepthStencil, rangeCount, pRanges);
Chris Forbesd9be82b2015-06-22 17:21:59 +12002076}
2077
Jon Ashburn23d36b12016-02-02 17:47:28 -07002078LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2079vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
2080 const VkClearAttachment *pAttachments, uint32_t rectCount,
2081 const VkClearRect *pRects) {
Chris Forbesd9be82b2015-06-22 17:21:59 +12002082 const VkLayerDispatchTable *disp;
2083
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002084 disp = loader_get_dispatch(commandBuffer);
Chris Forbesd9be82b2015-06-22 17:21:59 +12002085
Jon Ashburn23d36b12016-02-02 17:47:28 -07002086 disp->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments,
2087 rectCount, pRects);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002088}
2089
Jon Ashburn23d36b12016-02-02 17:47:28 -07002090LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2091vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage,
2092 VkImageLayout srcImageLayout, VkImage dstImage,
2093 VkImageLayout dstImageLayout, uint32_t regionCount,
2094 const VkImageResolve *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002095 const VkLayerDispatchTable *disp;
2096
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002097 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002098
Jon Ashburn23d36b12016-02-02 17:47:28 -07002099 disp->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage,
2100 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002101}
2102
Jon Ashburn23d36b12016-02-02 17:47:28 -07002103LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2104vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event,
2105 VkPipelineStageFlags stageMask) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002106 const VkLayerDispatchTable *disp;
2107
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002108 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002109
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002110 disp->CmdSetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002111}
2112
Jon Ashburn23d36b12016-02-02 17:47:28 -07002113LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2114vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event,
2115 VkPipelineStageFlags stageMask) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002116 const VkLayerDispatchTable *disp;
2117
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002118 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002119
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002120 disp->CmdResetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002121}
2122
Jon Ashburn23d36b12016-02-02 17:47:28 -07002123LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2124vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount,
2125 const VkEvent *pEvents, VkPipelineStageFlags sourceStageMask,
2126 VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount,
2127 const VkMemoryBarrier *pMemoryBarriers,
2128 uint32_t bufferMemoryBarrierCount,
2129 const VkBufferMemoryBarrier *pBufferMemoryBarriers,
2130 uint32_t imageMemoryBarrierCount,
2131 const VkImageMemoryBarrier *pImageMemoryBarriers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002132 const VkLayerDispatchTable *disp;
2133
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002134 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002135
Jon Ashburnf19916e2016-01-11 13:12:43 -07002136 disp->CmdWaitEvents(commandBuffer, eventCount, pEvents, sourceStageMask,
2137 dstStageMask, memoryBarrierCount, pMemoryBarriers,
2138 bufferMemoryBarrierCount, pBufferMemoryBarriers,
2139 imageMemoryBarrierCount, pImageMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002140}
2141
Jon Ashburnf19916e2016-01-11 13:12:43 -07002142LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier(
Jon Ashburn23d36b12016-02-02 17:47:28 -07002143 VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask,
2144 VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags,
2145 uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers,
2146 uint32_t bufferMemoryBarrierCount,
2147 const VkBufferMemoryBarrier *pBufferMemoryBarriers,
2148 uint32_t imageMemoryBarrierCount,
2149 const VkImageMemoryBarrier *pImageMemoryBarriers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002150 const VkLayerDispatchTable *disp;
2151
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002152 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002153
Jon Ashburn23d36b12016-02-02 17:47:28 -07002154 disp->CmdPipelineBarrier(
2155 commandBuffer, srcStageMask, dstStageMask, dependencyFlags,
2156 memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount,
2157 pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002158}
2159
Jon Ashburn23d36b12016-02-02 17:47:28 -07002160LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2161vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2162 uint32_t slot, VkFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002163 const VkLayerDispatchTable *disp;
2164
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002165 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002166
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002167 disp->CmdBeginQuery(commandBuffer, queryPool, slot, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002168}
2169
Jon Ashburn23d36b12016-02-02 17:47:28 -07002170LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2171vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2172 uint32_t slot) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002173 const VkLayerDispatchTable *disp;
2174
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002175 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002176
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002177 disp->CmdEndQuery(commandBuffer, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002178}
2179
Jon Ashburn23d36b12016-02-02 17:47:28 -07002180LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2181vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2182 uint32_t firstQuery, uint32_t queryCount) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002183 const VkLayerDispatchTable *disp;
2184
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002185 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002186
Jon Ashburn19d3bf12015-12-30 14:06:55 -07002187 disp->CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002188}
2189
Jon Ashburn23d36b12016-02-02 17:47:28 -07002190LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2191vkCmdWriteTimestamp(VkCommandBuffer commandBuffer,
2192 VkPipelineStageFlagBits pipelineStage,
2193 VkQueryPool queryPool, uint32_t slot) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002194 const VkLayerDispatchTable *disp;
2195
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002196 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002197
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002198 disp->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002199}
2200
Jon Ashburn23d36b12016-02-02 17:47:28 -07002201LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2202vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2203 uint32_t firstQuery, uint32_t queryCount,
2204 VkBuffer dstBuffer, VkDeviceSize dstOffset,
2205 VkDeviceSize stride, VkFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002206 const VkLayerDispatchTable *disp;
2207
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002208 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002209
Jon Ashburn23d36b12016-02-02 17:47:28 -07002210 disp->CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery,
2211 queryCount, dstBuffer, dstOffset, stride,
2212 flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002213}
2214
Jon Ashburn23d36b12016-02-02 17:47:28 -07002215LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2216vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout,
2217 VkShaderStageFlags stageFlags, uint32_t offset,
2218 uint32_t size, const void *pValues) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002219 const VkLayerDispatchTable *disp;
2220
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002221 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002222
Jon Ashburn23d36b12016-02-02 17:47:28 -07002223 disp->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size,
2224 pValues);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06002225}
2226
Jon Ashburn23d36b12016-02-02 17:47:28 -07002227LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2228vkCmdBeginRenderPass(VkCommandBuffer commandBuffer,
2229 const VkRenderPassBeginInfo *pRenderPassBegin,
2230 VkSubpassContents contents) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002231 const VkLayerDispatchTable *disp;
2232
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002233 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002234
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002235 disp->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
Chia-I Wu08accc62015-07-07 11:50:03 +08002236}
2237
Jon Ashburn23d36b12016-02-02 17:47:28 -07002238LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2239vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) {
Chia-I Wu08accc62015-07-07 11:50:03 +08002240 const VkLayerDispatchTable *disp;
2241
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002242 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu08accc62015-07-07 11:50:03 +08002243
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002244 disp->CmdNextSubpass(commandBuffer, contents);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002245}
2246
Jon Ashburn23d36b12016-02-02 17:47:28 -07002247LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2248vkCmdEndRenderPass(VkCommandBuffer commandBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002249 const VkLayerDispatchTable *disp;
2250
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002251 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002252
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002253 disp->CmdEndRenderPass(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002254}
2255
Jon Ashburn23d36b12016-02-02 17:47:28 -07002256LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2257vkCmdExecuteCommands(VkCommandBuffer commandBuffer,
2258 uint32_t commandBuffersCount,
2259 const VkCommandBuffer *pCommandBuffers) {
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002260 const VkLayerDispatchTable *disp;
2261
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002262 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002263
Jon Ashburn23d36b12016-02-02 17:47:28 -07002264 disp->CmdExecuteCommands(commandBuffer, commandBuffersCount,
2265 pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002266}