blob: 53ad1cd57faa10b4bb03ddaec320977f575fceff [file] [log] [blame]
Jon Ashburnd55a3942015-05-06 09:02:10 -06001/*
Jon Ashburnd55a3942015-05-06 09:02:10 -06002 *
Jon Ashburn23d36b12016-02-02 17:47:28 -07003 * Copyright (c) 2015-2016 The Khronos Group Inc.
4 * Copyright (c) 2015-2016 Valve Corporation
5 * Copyright (c) 2015-2016 LunarG, Inc.
Courtney Goeltzenleuchterf821dad2015-12-02 14:53:22 -07006 * Copyright (C) 2015 Google Inc.
Jon Ashburnd55a3942015-05-06 09:02:10 -06007 *
Jon Ashburn3ebf1252016-04-19 11:30:31 -06008 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
Jon Ashburnd55a3942015-05-06 09:02:10 -060011 *
Jon Ashburn3ebf1252016-04-19 11:30:31 -060012 * http://www.apache.org/licenses/LICENSE-2.0
Jon Ashburnd55a3942015-05-06 09:02:10 -060013 *
Jon Ashburn3ebf1252016-04-19 11:30:31 -060014 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
Jon Ashburn23d36b12016-02-02 17:47:28 -070019 *
20 * Author: Courtney Goeltzenleuchter <courtney@lunarg.com>
Courtney Goeltzenleuchter05559522015-10-30 11:14:30 -060021 * Author: Jon Ashburn <jon@lunarg.com>
22 * Author: Tony Barbour <tony@LunarG.com>
Jon Ashburn23d36b12016-02-02 17:47:28 -070023 * Author: Chia-I Wu <olv@lunarg.com>
Jon Ashburnd55a3942015-05-06 09:02:10 -060024 */
Courtney Goeltzenleuchter7f5aafc2015-07-05 11:28:29 -060025#define _GNU_SOURCE
Jon Ashburn27cd5842015-05-12 17:26:48 -060026#include <stdlib.h>
27#include <string.h>
Jon Ashburnd55a3942015-05-06 09:02:10 -060028
Tobin Ehlisb835d1b2015-07-03 10:34:49 -060029#include "vk_loader_platform.h"
Jon Ashburnd55a3942015-05-06 09:02:10 -060030#include "loader.h"
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -060031#include "debug_report.h"
Ian Elliott954fa342015-10-30 15:28:23 -060032#include "wsi.h"
Jon Ashburn1530c342016-02-26 13:14:27 -070033#include "gpa_helper.h"
34#include "table_ops.h"
Jon Ashburnd55a3942015-05-06 09:02:10 -060035
Jon Ashburn1530c342016-02-26 13:14:27 -070036/* Trampoline entrypoints are in this file for core Vulkan commands */
37/**
38 * Get an instance level or global level entry point address.
39 * @param instance
40 * @param pName
41 * @return
42 * If instance == NULL returns a global level functions only
43 * If instance is valid returns a trampoline entry point for all dispatchable
44 * Vulkan
45 * functions both core and extensions.
46 */
47LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
48vkGetInstanceProcAddr(VkInstance instance, const char *pName) {
49
50 void *addr;
51
52 addr = globalGetProcAddr(pName);
53 if (instance == VK_NULL_HANDLE) {
54 // get entrypoint addresses that are global (no dispatchable object)
55
56 return addr;
57 } else {
58 // if a global entrypoint return NULL
59 if (addr)
60 return NULL;
61 }
62
63 struct loader_instance *ptr_instance = loader_get_instance(instance);
64 if (ptr_instance == NULL)
65 return NULL;
66 // Return trampoline code for non-global entrypoints including any
67 // extensions.
68 // Device extensions are returned if a layer or ICD supports the extension.
69 // Instance extensions are returned if the extension is enabled and the
70 // loader
71 // or someone else supports the extension
72 return trampolineGetProcAddr(ptr_instance, pName);
73}
74
75/**
76 * Get a device level or global level entry point address.
77 * @param device
78 * @param pName
79 * @return
80 * If device is valid, returns a device relative entry point for device level
81 * entry points both core and extensions.
82 * Device relative means call down the device chain.
83 */
84LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
85vkGetDeviceProcAddr(VkDevice device, const char *pName) {
86 void *addr;
87
88 /* for entrypoints that loader must handle (ie non-dispatchable or create
89 object)
90 make sure the loader entrypoint is returned */
91 addr = loader_non_passthrough_gdpa(pName);
92 if (addr) {
93 return addr;
94 }
95
96 /* Although CreateDevice is on device chain it's dispatchable object isn't
97 * a VkDevice or child of VkDevice so return NULL.
98 */
99 if (!strcmp(pName, "CreateDevice"))
100 return NULL;
101
102 /* return the dispatch table entrypoint for the fastest case */
103 const VkLayerDispatchTable *disp_table = *(VkLayerDispatchTable **)device;
104 if (disp_table == NULL)
105 return NULL;
106
107 addr = loader_lookup_device_dispatch_table(disp_table, pName);
108 if (addr)
109 return addr;
110
111 if (disp_table->GetDeviceProcAddr == NULL)
112 return NULL;
113 return disp_table->GetDeviceProcAddr(device, pName);
114}
115
116LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
117vkEnumerateInstanceExtensionProperties(const char *pLayerName,
118 uint32_t *pPropertyCount,
119 VkExtensionProperties *pProperties) {
120 struct loader_extension_list *global_ext_list = NULL;
121 struct loader_layer_list instance_layers;
Jon Ashburnb8726962016-04-08 15:03:35 -0600122 struct loader_extension_list local_ext_list;
Jon Ashburn1530c342016-02-26 13:14:27 -0700123 struct loader_icd_libs icd_libs;
124 uint32_t copy_size;
125
126 tls_instance = NULL;
Jon Ashburnb8726962016-04-08 15:03:35 -0600127 memset(&local_ext_list, 0, sizeof(local_ext_list));
Jon Ashburn1530c342016-02-26 13:14:27 -0700128 memset(&instance_layers, 0, sizeof(instance_layers));
129 loader_platform_thread_once(&once_init, loader_initialize);
130
131 /* get layer libraries if needed */
132 if (pLayerName && strlen(pLayerName) != 0) {
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600133 if (vk_string_validate(MaxLoaderStringLength, pLayerName) !=
Jon Ashburn1530c342016-02-26 13:14:27 -0700134 VK_STRING_ERROR_NONE) {
Jon Ashburn1530c342016-02-26 13:14:27 -0700135 assert(VK_FALSE && "vkEnumerateInstanceExtensionProperties: "
136 "pLayerName is too long or is badly formed");
137 return VK_ERROR_EXTENSION_NOT_PRESENT;
138 }
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600139
140 loader_layer_scan(NULL, &instance_layers, NULL);
Jon Ashburnb8726962016-04-08 15:03:35 -0600141 if (strcmp(pLayerName, std_validation_str) == 0) {
142 struct loader_layer_list local_list;
143 memset(&local_list, 0, sizeof(local_list));
144 for (uint32_t i = 0; i < sizeof(std_validation_names) /
145 sizeof(std_validation_names[0]);
146 i++) {
147 loader_find_layer_name_add_list(NULL, std_validation_names[i],
148 VK_LAYER_TYPE_INSTANCE_EXPLICIT,
149 &instance_layers, &local_list);
150 }
151 for (uint32_t i = 0; i < local_list.count; i++) {
152 struct loader_extension_list *ext_list =
Jon Ashburncc407a22016-04-15 09:25:03 -0600153 &local_list.list[i].instance_extension_list;
Jon Ashburnb8726962016-04-08 15:03:35 -0600154 loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count,
155 ext_list->list);
156 }
157 loader_destroy_layer_list(NULL, &local_list);
158 global_ext_list = &local_ext_list;
159
160 } else {
161 for (uint32_t i = 0; i < instance_layers.count; i++) {
162 struct loader_layer_properties *props =
163 &instance_layers.list[i];
164 if (strcmp(props->info.layerName, pLayerName) == 0) {
165 global_ext_list = &props->instance_extension_list;
166 break;
167 }
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600168 }
169 }
Jon Ashburn1530c342016-02-26 13:14:27 -0700170 } else {
171 /* Scan/discover all ICD libraries */
172 memset(&icd_libs, 0, sizeof(struct loader_icd_libs));
173 loader_icd_scan(NULL, &icd_libs);
174 /* get extensions from all ICD's, merge so no duplicates */
175 loader_get_icd_loader_instance_extensions(NULL, &icd_libs,
Jon Ashburnb8726962016-04-08 15:03:35 -0600176 &local_ext_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700177 loader_scanned_icd_clear(NULL, &icd_libs);
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600178
179 // Append implicit layers.
180 loader_implicit_layer_scan(NULL, &instance_layers, NULL);
181 for (uint32_t i = 0; i < instance_layers.count; i++) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600182 struct loader_extension_list *ext_list =
183 &instance_layers.list[i].instance_extension_list;
184 loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count,
185 ext_list->list);
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600186 }
187
Jon Ashburnb8726962016-04-08 15:03:35 -0600188 global_ext_list = &local_ext_list;
Jon Ashburn1530c342016-02-26 13:14:27 -0700189 }
190
191 if (global_ext_list == NULL) {
192 loader_destroy_layer_list(NULL, &instance_layers);
193 return VK_ERROR_LAYER_NOT_PRESENT;
194 }
195
196 if (pProperties == NULL) {
197 *pPropertyCount = global_ext_list->count;
198 loader_destroy_layer_list(NULL, &instance_layers);
199 loader_destroy_generic_list(
Jon Ashburnb8726962016-04-08 15:03:35 -0600200 NULL, (struct loader_generic_list *)&local_ext_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700201 return VK_SUCCESS;
202 }
203
204 copy_size = *pPropertyCount < global_ext_list->count
205 ? *pPropertyCount
206 : global_ext_list->count;
207 for (uint32_t i = 0; i < copy_size; i++) {
208 memcpy(&pProperties[i], &global_ext_list->list[i],
209 sizeof(VkExtensionProperties));
210 }
211 *pPropertyCount = copy_size;
212 loader_destroy_generic_list(NULL,
Jon Ashburnb8726962016-04-08 15:03:35 -0600213 (struct loader_generic_list *)&local_ext_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700214
215 if (copy_size < global_ext_list->count) {
216 loader_destroy_layer_list(NULL, &instance_layers);
217 return VK_INCOMPLETE;
218 }
219
220 loader_destroy_layer_list(NULL, &instance_layers);
221 return VK_SUCCESS;
222}
223
224LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
225vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount,
226 VkLayerProperties *pProperties) {
227
228 struct loader_layer_list instance_layer_list;
229 tls_instance = NULL;
230
231 loader_platform_thread_once(&once_init, loader_initialize);
232
233 uint32_t copy_size;
234
235 /* get layer libraries */
236 memset(&instance_layer_list, 0, sizeof(instance_layer_list));
237 loader_layer_scan(NULL, &instance_layer_list, NULL);
238
239 if (pProperties == NULL) {
240 *pPropertyCount = instance_layer_list.count;
241 loader_destroy_layer_list(NULL, &instance_layer_list);
242 return VK_SUCCESS;
243 }
244
245 copy_size = (*pPropertyCount < instance_layer_list.count)
246 ? *pPropertyCount
247 : instance_layer_list.count;
248 for (uint32_t i = 0; i < copy_size; i++) {
249 memcpy(&pProperties[i], &instance_layer_list.list[i].info,
250 sizeof(VkLayerProperties));
251 }
252
253 *pPropertyCount = copy_size;
254 loader_destroy_layer_list(NULL, &instance_layer_list);
255
256 if (copy_size < instance_layer_list.count) {
257 return VK_INCOMPLETE;
258 }
259
260 return VK_SUCCESS;
261}
262
Jon Ashburn23d36b12016-02-02 17:47:28 -0700263LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
264vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
265 const VkAllocationCallbacks *pAllocator,
266 VkInstance *pInstance) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600267 struct loader_instance *ptr_instance = NULL;
Jon Ashburne5b9bba2016-01-18 12:20:03 -0700268 VkInstance created_instance = VK_NULL_HANDLE;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600269 VkResult res = VK_ERROR_INITIALIZATION_FAILED;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600270
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600271 loader_platform_thread_once(&once_init, loader_initialize);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600272
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700273#if 0
274 if (pAllocator) {
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800275 ptr_instance = (struct loader_instance *) pAllocator->pfnAllocation(
Chia-I Wuf7458c52015-10-26 21:10:41 +0800276 pAllocator->pUserData,
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600277 sizeof(struct loader_instance),
Jon Ashburn6a118ae2016-01-07 15:21:14 -0700278 sizeof(int *),
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800279 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600280 } else {
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700281#endif
Jon Ashburn23d36b12016-02-02 17:47:28 -0700282 ptr_instance =
283 (struct loader_instance *)malloc(sizeof(struct loader_instance));
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700284 //}
Jon Ashburn27cd5842015-05-12 17:26:48 -0600285 if (ptr_instance == NULL) {
286 return VK_ERROR_OUT_OF_HOST_MEMORY;
287 }
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600288
Jon Ashburn87d6aa92015-08-28 15:19:27 -0600289 tls_instance = ptr_instance;
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600290 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburnb82c1852015-08-11 14:49:54 -0600291 memset(ptr_instance, 0, sizeof(struct loader_instance));
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700292#if 0
Chia-I Wuf7458c52015-10-26 21:10:41 +0800293 if (pAllocator) {
294 ptr_instance->alloc_callbacks = *pAllocator;
Courtney Goeltzenleuchter7f5aafc2015-07-05 11:28:29 -0600295 }
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700296#endif
Courtney Goeltzenleuchter7f5aafc2015-07-05 11:28:29 -0600297
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700298 /*
Ian Elliottad6300f2016-03-31 10:48:19 -0600299 * Look for one or more debug report create info structures
300 * and setup a callback(s) for each one found.
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700301 */
Ian Elliottad6300f2016-03-31 10:48:19 -0600302 ptr_instance->num_tmp_callbacks = 0;
303 ptr_instance->tmp_dbg_create_infos = NULL;
304 ptr_instance->tmp_callbacks = NULL;
Jon Ashburncc407a22016-04-15 09:25:03 -0600305 if (util_CopyDebugReportCreateInfos(pCreateInfo->pNext, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600306 &ptr_instance->num_tmp_callbacks,
307 &ptr_instance->tmp_dbg_create_infos,
308 &ptr_instance->tmp_callbacks)) {
309 // One or more were found, but allocation failed. Therefore, clean up
310 // and fail this function:
311 loader_heap_free(ptr_instance, ptr_instance);
312 loader_platform_thread_unlock_mutex(&loader_lock);
313 return VK_ERROR_OUT_OF_HOST_MEMORY;
314 } else if (ptr_instance->num_tmp_callbacks > 0) {
315 // Setup the temporary callback(s) here to catch early issues:
Jon Ashburncc407a22016-04-15 09:25:03 -0600316 if (util_CreateDebugReportCallbacks(ptr_instance, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600317 ptr_instance->num_tmp_callbacks,
318 ptr_instance->tmp_dbg_create_infos,
319 ptr_instance->tmp_callbacks)) {
320 // Failure of setting up one or more of the callback. Therefore,
321 // clean up and fail this function:
322 util_FreeDebugReportCreateInfos(pAllocator,
323 ptr_instance->tmp_dbg_create_infos,
324 ptr_instance->tmp_callbacks);
325 loader_heap_free(ptr_instance, ptr_instance);
326 loader_platform_thread_unlock_mutex(&loader_lock);
327 return VK_ERROR_OUT_OF_HOST_MEMORY;
Courtney Goeltzenleuchter82887272015-12-02 15:29:33 -0700328 }
329 }
330
Jon Ashburn3d002332015-08-20 16:35:30 -0600331 /* Due to implicit layers need to get layer list even if
Jon Ashburnf19916e2016-01-11 13:12:43 -0700332 * enabledLayerCount == 0 and VK_INSTANCE_LAYERS is unset. For now always
Jon Ashburn3d002332015-08-20 16:35:30 -0600333 * get layer list (both instance and device) via loader_layer_scan(). */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700334 memset(&ptr_instance->instance_layer_list, 0,
335 sizeof(ptr_instance->instance_layer_list));
336 memset(&ptr_instance->device_layer_list, 0,
337 sizeof(ptr_instance->device_layer_list));
338 loader_layer_scan(ptr_instance, &ptr_instance->instance_layer_list,
Jon Ashburne39a4f82015-08-28 13:38:21 -0600339 &ptr_instance->device_layer_list);
Jon Ashburn3d002332015-08-20 16:35:30 -0600340
341 /* validate the app requested layers to be enabled */
Jon Ashburnf19916e2016-01-11 13:12:43 -0700342 if (pCreateInfo->enabledLayerCount > 0) {
Jon Ashburnf2b4e382016-02-10 20:50:19 -0700343 res =
344 loader_validate_layers(ptr_instance, pCreateInfo->enabledLayerCount,
345 pCreateInfo->ppEnabledLayerNames,
346 &ptr_instance->instance_layer_list);
Jon Ashburn3d002332015-08-20 16:35:30 -0600347 if (res != VK_SUCCESS) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600348 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600349 ptr_instance->num_tmp_callbacks,
350 ptr_instance->tmp_callbacks);
351 util_FreeDebugReportCreateInfos(pAllocator,
352 ptr_instance->tmp_dbg_create_infos,
353 ptr_instance->tmp_callbacks);
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700354 loader_heap_free(ptr_instance, ptr_instance);
Jon Ashburn1ff17592015-10-09 09:40:30 -0600355 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn3d002332015-08-20 16:35:30 -0600356 return res;
357 }
358 }
359
Jon Ashburn86a527a2016-02-10 20:59:26 -0700360 /* convert any meta layers to the actual layers makes a copy of layer name*/
Chris Forbesbd9de052016-04-06 20:49:02 +1200361 VkInstanceCreateInfo ici = *pCreateInfo;
Jon Ashburn86a527a2016-02-10 20:59:26 -0700362 loader_expand_layer_names(
363 ptr_instance, std_validation_str,
364 sizeof(std_validation_names) / sizeof(std_validation_names[0]),
Jon Ashburncc407a22016-04-15 09:25:03 -0600365 std_validation_names, &ici.enabledLayerCount, &ici.ppEnabledLayerNames);
Jon Ashburn86a527a2016-02-10 20:59:26 -0700366
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600367 /* Scan/discover all ICD libraries */
368 memset(&ptr_instance->icd_libs, 0, sizeof(ptr_instance->icd_libs));
Jon Ashburne39a4f82015-08-28 13:38:21 -0600369 loader_icd_scan(ptr_instance, &ptr_instance->icd_libs);
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600370
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600371 /* get extensions from all ICD's, merge so no duplicates, then validate */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700372 loader_get_icd_loader_instance_extensions(
373 ptr_instance, &ptr_instance->icd_libs, &ptr_instance->ext_list);
374 res = loader_validate_instance_extensions(
Jon Ashburnf2b4e382016-02-10 20:50:19 -0700375 ptr_instance, &ptr_instance->ext_list,
Chris Forbesbd9de052016-04-06 20:49:02 +1200376 &ptr_instance->instance_layer_list, &ici);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600377 if (res != VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200378 loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
Jon Ashburne39a4f82015-08-28 13:38:21 -0600379 loader_delete_layer_properties(ptr_instance,
380 &ptr_instance->device_layer_list);
381 loader_delete_layer_properties(ptr_instance,
382 &ptr_instance->instance_layer_list);
383 loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700384 loader_destroy_generic_list(
385 ptr_instance,
386 (struct loader_generic_list *)&ptr_instance->ext_list);
Jon Ashburncc407a22016-04-15 09:25:03 -0600387 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600388 ptr_instance->num_tmp_callbacks,
389 ptr_instance->tmp_callbacks);
390 util_FreeDebugReportCreateInfos(pAllocator,
391 ptr_instance->tmp_dbg_create_infos,
392 ptr_instance->tmp_callbacks);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600393 loader_platform_thread_unlock_mutex(&loader_lock);
394 loader_heap_free(ptr_instance, ptr_instance);
395 return res;
396 }
397
Jon Ashburn23d36b12016-02-02 17:47:28 -0700398 ptr_instance->disp =
399 loader_heap_alloc(ptr_instance, sizeof(VkLayerInstanceDispatchTable),
400 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600401 if (ptr_instance->disp == NULL) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200402 loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
Jon Ashburne39a4f82015-08-28 13:38:21 -0600403 loader_delete_layer_properties(ptr_instance,
404 &ptr_instance->device_layer_list);
405 loader_delete_layer_properties(ptr_instance,
406 &ptr_instance->instance_layer_list);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700407 loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
408 loader_destroy_generic_list(
409 ptr_instance,
410 (struct loader_generic_list *)&ptr_instance->ext_list);
Jon Ashburncc407a22016-04-15 09:25:03 -0600411 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600412 ptr_instance->num_tmp_callbacks,
413 ptr_instance->tmp_callbacks);
414 util_FreeDebugReportCreateInfos(pAllocator,
415 ptr_instance->tmp_dbg_create_infos,
416 ptr_instance->tmp_callbacks);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600417 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600418 loader_heap_free(ptr_instance, ptr_instance);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600419 return VK_ERROR_OUT_OF_HOST_MEMORY;
420 }
421 memcpy(ptr_instance->disp, &instance_disp, sizeof(instance_disp));
422 ptr_instance->next = loader.instances;
423 loader.instances = ptr_instance;
424
Jon Ashburnb82c1852015-08-11 14:49:54 -0600425 /* activate any layers on instance chain */
Chris Forbesbd9de052016-04-06 20:49:02 +1200426 res = loader_enable_instance_layers(ptr_instance, &ici,
Jon Ashburne39a4f82015-08-28 13:38:21 -0600427 &ptr_instance->instance_layer_list);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600428 if (res != VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200429 loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
Jon Ashburne39a4f82015-08-28 13:38:21 -0600430 loader_delete_layer_properties(ptr_instance,
431 &ptr_instance->device_layer_list);
432 loader_delete_layer_properties(ptr_instance,
433 &ptr_instance->instance_layer_list);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700434 loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
435 loader_destroy_generic_list(
436 ptr_instance,
437 (struct loader_generic_list *)&ptr_instance->ext_list);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600438 loader.instances = ptr_instance->next;
Jon Ashburncc407a22016-04-15 09:25:03 -0600439 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600440 ptr_instance->num_tmp_callbacks,
441 ptr_instance->tmp_callbacks);
442 util_FreeDebugReportCreateInfos(pAllocator,
443 ptr_instance->tmp_dbg_create_infos,
444 ptr_instance->tmp_callbacks);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600445 loader_platform_thread_unlock_mutex(&loader_lock);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600446 loader_heap_free(ptr_instance, ptr_instance->disp);
447 loader_heap_free(ptr_instance, ptr_instance);
448 return res;
449 }
Jon Ashburn07daee72015-05-21 18:13:33 -0600450
Jon Ashburn23d36b12016-02-02 17:47:28 -0700451 created_instance = (VkInstance)ptr_instance;
Chris Forbesbd9de052016-04-06 20:49:02 +1200452 res = loader_create_instance_chain(&ici, pAllocator, ptr_instance,
Jon Ashburn6e0a2132016-02-03 12:37:30 -0700453 &created_instance);
Jon Ashburneed0c002015-05-21 17:42:17 -0600454
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700455 if (res == VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200456 wsi_create_instance(ptr_instance, &ici);
457 debug_report_create_instance(ptr_instance, &ici);
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700458
Jon Ashburne5b9bba2016-01-18 12:20:03 -0700459 *pInstance = created_instance;
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700460
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700461 /*
462 * Finally have the layers in place and everyone has seen
463 * the CreateInstance command go by. This allows the layer's
464 * GetInstanceProcAddr functions to return valid extension functions
465 * if enabled.
466 */
467 loader_activate_instance_layer_extensions(ptr_instance, *pInstance);
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700468 } else {
469 // TODO: cleanup here.
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700470 }
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700471
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700472 /* Remove temporary debug_report callback */
Jon Ashburncc407a22016-04-15 09:25:03 -0600473 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600474 ptr_instance->num_tmp_callbacks,
475 ptr_instance->tmp_callbacks);
Chris Forbesbd9de052016-04-06 20:49:02 +1200476 loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600477 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600478 return res;
479}
480
Jon Ashburn23d36b12016-02-02 17:47:28 -0700481LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
482vkDestroyInstance(VkInstance instance,
483 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600484 const VkLayerInstanceDispatchTable *disp;
Jon Ashburne0e64572015-09-30 12:56:42 -0600485 struct loader_instance *ptr_instance = NULL;
Ian Elliott3b354cf2016-03-25 08:43:01 -0600486 bool callback_setup = false;
487
Jon Ashburn27cd5842015-05-12 17:26:48 -0600488 disp = loader_get_instance_dispatch(instance);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600489
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600490 loader_platform_thread_lock_mutex(&loader_lock);
491
Jon Ashburne0e64572015-09-30 12:56:42 -0600492 ptr_instance = loader_get_instance(instance);
Ian Elliott3b354cf2016-03-25 08:43:01 -0600493
Ian Elliottad6300f2016-03-31 10:48:19 -0600494 if (ptr_instance->num_tmp_callbacks > 0) {
495 // Setup the temporary callback(s) here to catch cleanup issues:
Jon Ashburncc407a22016-04-15 09:25:03 -0600496 if (!util_CreateDebugReportCallbacks(ptr_instance, pAllocator,
497 ptr_instance->num_tmp_callbacks,
498 ptr_instance->tmp_dbg_create_infos,
499 ptr_instance->tmp_callbacks)) {
Ian Elliott3b354cf2016-03-25 08:43:01 -0600500 callback_setup = true;
501 }
502 }
503
Chia-I Wuf7458c52015-10-26 21:10:41 +0800504 disp->DestroyInstance(instance, pAllocator);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600505
Courtney Goeltzenleuchter7d0023c2015-06-08 15:09:22 -0600506 loader_deactivate_instance_layers(ptr_instance);
Jon Ashburn014438f2016-03-01 19:51:07 -0700507 if (ptr_instance->phys_devs)
508 loader_heap_free(ptr_instance, ptr_instance->phys_devs);
Ian Elliott3b354cf2016-03-25 08:43:01 -0600509 if (callback_setup) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600510 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600511 ptr_instance->num_tmp_callbacks,
512 ptr_instance->tmp_callbacks);
513 util_FreeDebugReportCreateInfos(pAllocator,
514 ptr_instance->tmp_dbg_create_infos,
515 ptr_instance->tmp_callbacks);
Ian Elliott3b354cf2016-03-25 08:43:01 -0600516 }
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600517 loader_heap_free(ptr_instance, ptr_instance->disp);
518 loader_heap_free(ptr_instance, ptr_instance);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600519 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600520}
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600521
Jon Ashburn23d36b12016-02-02 17:47:28 -0700522LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
523vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount,
524 VkPhysicalDevice *pPhysicalDevices) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600525 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600526 VkResult res;
Jon Ashburn014438f2016-03-01 19:51:07 -0700527 uint32_t count, i;
528 struct loader_instance *inst;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600529 disp = loader_get_instance_dispatch(instance);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600530
531 loader_platform_thread_lock_mutex(&loader_lock);
532 res = disp->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount,
Jon Ashburn27cd5842015-05-12 17:26:48 -0600533 pPhysicalDevices);
Jon Ashburn014438f2016-03-01 19:51:07 -0700534
535 if (res != VK_SUCCESS && res != VK_INCOMPLETE) {
536 loader_platform_thread_unlock_mutex(&loader_lock);
537 return res;
538 }
539
540 if (!pPhysicalDevices) {
541 loader_platform_thread_unlock_mutex(&loader_lock);
542 return res;
543 }
544
545 // wrap the PhysDev object for loader usage, return wrapped objects
546 inst = loader_get_instance(instance);
547 if (!inst) {
548 loader_platform_thread_unlock_mutex(&loader_lock);
549 return VK_ERROR_INITIALIZATION_FAILED;
550 }
Jon Ashburncc407a22016-04-15 09:25:03 -0600551 count = (inst->total_gpu_count < *pPhysicalDeviceCount)
552 ? inst->total_gpu_count
553 : *pPhysicalDeviceCount;
Piers Daniell295fe402016-03-29 11:51:11 -0600554 *pPhysicalDeviceCount = count;
Jeannot Breton32ad8d82016-04-12 15:46:20 -0500555 if (!inst->phys_devs) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600556 inst->phys_devs =
557 (struct loader_physical_device_tramp *)loader_heap_alloc(
558 inst, inst->total_gpu_count *
559 sizeof(struct loader_physical_device_tramp),
560 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Jeannot Breton32ad8d82016-04-12 15:46:20 -0500561 }
Jon Ashburn014438f2016-03-01 19:51:07 -0700562 if (!inst->phys_devs) {
563 loader_platform_thread_unlock_mutex(&loader_lock);
564 return VK_ERROR_OUT_OF_HOST_MEMORY;
565 }
566
567 for (i = 0; i < count; i++) {
568
569 // initialize the loader's physicalDevice object
570 loader_set_dispatch((void *)&inst->phys_devs[i], inst->disp);
Piers Daniell295fe402016-03-29 11:51:11 -0600571 inst->phys_devs[i].this_instance = inst;
Jon Ashburn014438f2016-03-01 19:51:07 -0700572 inst->phys_devs[i].phys_dev = pPhysicalDevices[i];
573
574 // copy wrapped object into Application provided array
575 pPhysicalDevices[i] = (VkPhysicalDevice)&inst->phys_devs[i];
576 }
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600577 loader_platform_thread_unlock_mutex(&loader_lock);
578 return res;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600579}
580
Jon Ashburn23d36b12016-02-02 17:47:28 -0700581LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
Jon Ashburn014438f2016-03-01 19:51:07 -0700582vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700583 VkPhysicalDeviceFeatures *pFeatures) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600584 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700585 VkPhysicalDevice unwrapped_phys_dev =
586 loader_unwrap_physical_device(physicalDevice);
587 disp = loader_get_instance_dispatch(physicalDevice);
588 disp->GetPhysicalDeviceFeatures(unwrapped_phys_dev, pFeatures);
Jon Ashburn754864f2015-07-23 18:49:07 -0600589}
590
Jon Ashburn23d36b12016-02-02 17:47:28 -0700591LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
Jon Ashburn014438f2016-03-01 19:51:07 -0700592vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice,
593 VkFormat format,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700594 VkFormatProperties *pFormatInfo) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600595 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700596 VkPhysicalDevice unwrapped_pd =
597 loader_unwrap_physical_device(physicalDevice);
598 disp = loader_get_instance_dispatch(physicalDevice);
599 disp->GetPhysicalDeviceFormatProperties(unwrapped_pd, format, pFormatInfo);
Jon Ashburn754864f2015-07-23 18:49:07 -0600600}
601
Jon Ashburn23d36b12016-02-02 17:47:28 -0700602LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
603vkGetPhysicalDeviceImageFormatProperties(
604 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
605 VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
606 VkImageFormatProperties *pImageFormatProperties) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600607 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700608 VkPhysicalDevice unwrapped_phys_dev =
609 loader_unwrap_physical_device(physicalDevice);
Jon Ashburn754864f2015-07-23 18:49:07 -0600610 disp = loader_get_instance_dispatch(physicalDevice);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700611 return disp->GetPhysicalDeviceImageFormatProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700612 unwrapped_phys_dev, format, type, tiling, usage, flags,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700613 pImageFormatProperties);
Jon Ashburn754864f2015-07-23 18:49:07 -0600614}
615
Jon Ashburn23d36b12016-02-02 17:47:28 -0700616LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
Jon Ashburn014438f2016-03-01 19:51:07 -0700617vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700618 VkPhysicalDeviceProperties *pProperties) {
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600619 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700620 VkPhysicalDevice unwrapped_phys_dev =
621 loader_unwrap_physical_device(physicalDevice);
622 disp = loader_get_instance_dispatch(physicalDevice);
623 disp->GetPhysicalDeviceProperties(unwrapped_phys_dev, pProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600624}
625
Jon Ashburn23d36b12016-02-02 17:47:28 -0700626LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
627vkGetPhysicalDeviceQueueFamilyProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700628 VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700629 VkQueueFamilyProperties *pQueueProperties) {
Tony Barbour59a47322015-06-24 16:06:58 -0600630 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700631 VkPhysicalDevice unwrapped_phys_dev =
632 loader_unwrap_physical_device(physicalDevice);
633 disp = loader_get_instance_dispatch(physicalDevice);
634 disp->GetPhysicalDeviceQueueFamilyProperties(
635 unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600636}
637
Chia-I Wu9ab61502015-11-06 06:42:02 +0800638LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700639 VkPhysicalDevice physicalDevice,
640 VkPhysicalDeviceMemoryProperties *pMemoryProperties) {
Tony Barbour59a47322015-06-24 16:06:58 -0600641 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700642 VkPhysicalDevice unwrapped_phys_dev =
643 loader_unwrap_physical_device(physicalDevice);
644 disp = loader_get_instance_dispatch(physicalDevice);
645 disp->GetPhysicalDeviceMemoryProperties(unwrapped_phys_dev,
646 pMemoryProperties);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600647}
648
Jon Ashburn23d36b12016-02-02 17:47:28 -0700649LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
Jon Ashburn1530c342016-02-26 13:14:27 -0700650vkCreateDevice(VkPhysicalDevice physicalDevice,
651 const VkDeviceCreateInfo *pCreateInfo,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700652 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600653 VkResult res;
Jon Ashburn787eb252016-03-24 15:49:57 -0600654 struct loader_physical_device_tramp *phys_dev;
Jon Ashburn1530c342016-02-26 13:14:27 -0700655 struct loader_device *dev;
656 struct loader_instance *inst;
657 struct loader_layer_list activated_layer_list = {0};
658
659 assert(pCreateInfo->queueCreateInfoCount >= 1);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600660
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600661 loader_platform_thread_lock_mutex(&loader_lock);
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600662
Jon Ashburn787eb252016-03-24 15:49:57 -0600663 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Piers Daniell295fe402016-03-29 11:51:11 -0600664 inst = (struct loader_instance *)phys_dev->this_instance;
Jon Ashburn1530c342016-02-26 13:14:27 -0700665
666 /* validate any app enabled layers are available */
667 if (pCreateInfo->enabledLayerCount > 0) {
668 res = loader_validate_layers(inst, pCreateInfo->enabledLayerCount,
669 pCreateInfo->ppEnabledLayerNames,
670 &inst->device_layer_list);
671 if (res != VK_SUCCESS) {
672 loader_platform_thread_unlock_mutex(&loader_lock);
673 return res;
674 }
675 }
676
Jon Ashburn014438f2016-03-01 19:51:07 -0700677 /* Get the physical device (ICD) extensions */
678 struct loader_extension_list icd_exts;
679 if (!loader_init_generic_list(inst, (struct loader_generic_list *)&icd_exts,
680 sizeof(VkExtensionProperties))) {
681 loader_platform_thread_unlock_mutex(&loader_lock);
682 return VK_ERROR_OUT_OF_HOST_MEMORY;
683 }
Jon Ashburn1530c342016-02-26 13:14:27 -0700684
Jon Ashburn014438f2016-03-01 19:51:07 -0700685 res = loader_add_device_extensions(
Jon Ashburncc407a22016-04-15 09:25:03 -0600686 inst, inst->disp->EnumerateDeviceExtensionProperties,
687 phys_dev->phys_dev, "Unknown", &icd_exts);
Jon Ashburn014438f2016-03-01 19:51:07 -0700688 if (res != VK_SUCCESS) {
689 loader_platform_thread_unlock_mutex(&loader_lock);
690 return res;
Jon Ashburn1530c342016-02-26 13:14:27 -0700691 }
692
693 /* convert any meta layers to the actual layers makes a copy of layer name*/
Chris Forbesbd9de052016-04-06 20:49:02 +1200694 VkDeviceCreateInfo dci = *pCreateInfo;
Jon Ashburn1530c342016-02-26 13:14:27 -0700695 loader_expand_layer_names(
696 inst, std_validation_str,
697 sizeof(std_validation_names) / sizeof(std_validation_names[0]),
Jon Ashburncc407a22016-04-15 09:25:03 -0600698 std_validation_names, &dci.enabledLayerCount, &dci.ppEnabledLayerNames);
Jon Ashburn1530c342016-02-26 13:14:27 -0700699
700 /* fetch a list of all layers activated, explicit and implicit */
Jon Ashburncc407a22016-04-15 09:25:03 -0600701 res = loader_enable_device_layers(inst, &activated_layer_list, &dci,
702 &inst->device_layer_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700703 if (res != VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200704 loader_delete_shadow_dev_layer_names(inst, pCreateInfo, &dci);
Jon Ashburn1530c342016-02-26 13:14:27 -0700705 loader_platform_thread_unlock_mutex(&loader_lock);
706 return res;
707 }
708
709 /* make sure requested extensions to be enabled are supported */
710 res = loader_validate_device_extensions(phys_dev, &activated_layer_list,
Chris Forbesbd9de052016-04-06 20:49:02 +1200711 &icd_exts, &dci);
Jon Ashburn1530c342016-02-26 13:14:27 -0700712 if (res != VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200713 loader_delete_shadow_dev_layer_names(inst, pCreateInfo, &dci);
Jon Ashburn1530c342016-02-26 13:14:27 -0700714 loader_destroy_generic_list(
715 inst, (struct loader_generic_list *)&activated_layer_list);
716 loader_platform_thread_unlock_mutex(&loader_lock);
717 return res;
718 }
719
Piers Daniell295fe402016-03-29 11:51:11 -0600720 dev = loader_create_logical_device(inst);
Jon Ashburn1530c342016-02-26 13:14:27 -0700721 if (dev == NULL) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200722 loader_delete_shadow_dev_layer_names(inst, pCreateInfo, &dci);
Jon Ashburn1530c342016-02-26 13:14:27 -0700723 loader_destroy_generic_list(
724 inst, (struct loader_generic_list *)&activated_layer_list);
725 loader_platform_thread_unlock_mutex(&loader_lock);
726 return VK_ERROR_OUT_OF_HOST_MEMORY;
727 }
728
729 /* move the locally filled layer list into the device, and pass ownership of
730 * the memory */
731 dev->activated_layer_list.capacity = activated_layer_list.capacity;
732 dev->activated_layer_list.count = activated_layer_list.count;
733 dev->activated_layer_list.list = activated_layer_list.list;
734 memset(&activated_layer_list, 0, sizeof(activated_layer_list));
735
736 /* activate any layers on device chain which terminates with device*/
Jon Ashburncc407a22016-04-15 09:25:03 -0600737 res = loader_enable_device_layers(inst, &dev->activated_layer_list, &dci,
738 &inst->device_layer_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700739 if (res != VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200740 loader_delete_shadow_dev_layer_names(inst, pCreateInfo, &dci);
Jon Ashburn1530c342016-02-26 13:14:27 -0700741 loader_platform_thread_unlock_mutex(&loader_lock);
742 return res;
743 }
744
Jon Ashburncc407a22016-04-15 09:25:03 -0600745 res = loader_create_device_chain(phys_dev, &dci, pAllocator, inst, dev);
Jon Ashburn1530c342016-02-26 13:14:27 -0700746 if (res != VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200747 loader_delete_shadow_dev_layer_names(inst, pCreateInfo, &dci);
Jon Ashburn1530c342016-02-26 13:14:27 -0700748 loader_platform_thread_unlock_mutex(&loader_lock);
749 return res;
750 }
751
752 *pDevice = dev->device;
753
754 /* initialize any device extension dispatch entry's from the instance list*/
755 loader_init_dispatch_dev_ext(inst, dev);
756
757 /* initialize WSI device extensions as part of core dispatch since loader
758 * has
759 * dedicated trampoline code for these*/
760 loader_init_device_extension_dispatch_table(
761 &dev->loader_dispatch,
762 dev->loader_dispatch.core_dispatch.GetDeviceProcAddr, *pDevice);
763
Chris Forbesbd9de052016-04-06 20:49:02 +1200764 loader_delete_shadow_dev_layer_names(inst, pCreateInfo, &dci);
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600765
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600766 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600767 return res;
768}
769
Jon Ashburn23d36b12016-02-02 17:47:28 -0700770LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
771vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600772 const VkLayerDispatchTable *disp;
Jon Ashburne39a4f82015-08-28 13:38:21 -0600773 struct loader_device *dev;
Andrzej Kotlowskib168b1a2016-02-03 09:41:53 +0100774
775 loader_platform_thread_lock_mutex(&loader_lock);
776
Jon Ashburne39a4f82015-08-28 13:38:21 -0600777 struct loader_icd *icd = loader_get_icd_and_device(device, &dev);
778 const struct loader_instance *inst = icd->this_instance;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600779 disp = loader_get_dispatch(device);
780
Chia-I Wuf7458c52015-10-26 21:10:41 +0800781 disp->DestroyDevice(device, pAllocator);
Jon Ashburn781a7ae2015-11-19 15:43:26 -0700782 dev->device = NULL;
783 loader_remove_logical_device(inst, icd, dev);
784
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600785 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600786}
787
Jon Ashburn23d36b12016-02-02 17:47:28 -0700788LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
789vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
790 const char *pLayerName,
791 uint32_t *pPropertyCount,
792 VkExtensionProperties *pProperties) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700793 VkResult res = VK_SUCCESS;
Jon Ashburn787eb252016-03-24 15:49:57 -0600794 struct loader_physical_device_tramp *phys_dev;
795 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600796
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600797 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700798
799 /* If pLayerName == NULL, then querying ICD extensions, pass this call
800 down the instance chain which will terminate in the ICD. This allows
801 layers to filter the extensions coming back up the chain.
802 If pLayerName != NULL then get layer extensions from manifest file. */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700803 if (pLayerName == NULL || strlen(pLayerName) == 0) {
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700804 const VkLayerInstanceDispatchTable *disp;
805
806 disp = loader_get_instance_dispatch(physicalDevice);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700807 res = disp->EnumerateDeviceExtensionProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700808 phys_dev->phys_dev, NULL, pPropertyCount, pProperties);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700809 } else {
Jon Ashburn014438f2016-03-01 19:51:07 -0700810
Jon Ashburndc5d9202016-02-29 13:00:51 -0700811 uint32_t count;
812 uint32_t copy_size;
Piers Daniell295fe402016-03-29 11:51:11 -0600813 const struct loader_instance *inst = phys_dev->this_instance;
Jon Ashburnb8726962016-04-08 15:03:35 -0600814 struct loader_device_extension_list *dev_ext_list = NULL;
815 struct loader_device_extension_list local_ext_list;
816 memset(&local_ext_list, 0, sizeof(local_ext_list));
Jon Ashburndc5d9202016-02-29 13:00:51 -0700817 if (vk_string_validate(MaxLoaderStringLength, pLayerName) ==
Jon Ashburn014438f2016-03-01 19:51:07 -0700818 VK_STRING_ERROR_NONE) {
Jon Ashburnb8726962016-04-08 15:03:35 -0600819 if (strcmp(pLayerName, std_validation_str) == 0) {
820 struct loader_layer_list local_list;
821 memset(&local_list, 0, sizeof(local_list));
822 for (uint32_t i = 0; i < sizeof(std_validation_names) /
823 sizeof(std_validation_names[0]);
824 i++) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600825 loader_find_layer_name_add_list(
826 NULL, std_validation_names[i],
827 VK_LAYER_TYPE_DEVICE_EXPLICIT, &inst->device_layer_list,
828 &local_list);
Jon Ashburnb8726962016-04-08 15:03:35 -0600829 }
830 for (uint32_t i = 0; i < local_list.count; i++) {
831 struct loader_device_extension_list *ext_list =
Jon Ashburncc407a22016-04-15 09:25:03 -0600832 &local_list.list[i].device_extension_list;
Jon Ashburnb8726962016-04-08 15:03:35 -0600833 for (uint32_t j = 0; j < ext_list->count; j++) {
834 loader_add_to_dev_ext_list(NULL, &local_ext_list,
835 &ext_list->list[j].props, 0,
836 NULL);
837 }
838 }
839 dev_ext_list = &local_ext_list;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700840
Jon Ashburnb8726962016-04-08 15:03:35 -0600841 } else {
842 for (uint32_t i = 0; i < inst->device_layer_list.count; i++) {
843 struct loader_layer_properties *props =
844 &inst->device_layer_list.list[i];
845 if (strcmp(props->info.layerName, pLayerName) == 0) {
846 dev_ext_list = &props->device_extension_list;
847 }
Jon Ashburndc5d9202016-02-29 13:00:51 -0700848 }
849 }
Jon Ashburnb8726962016-04-08 15:03:35 -0600850
Jon Ashburndc5d9202016-02-29 13:00:51 -0700851 count = (dev_ext_list == NULL) ? 0 : dev_ext_list->count;
852 if (pProperties == NULL) {
853 *pPropertyCount = count;
Jon Ashburncc407a22016-04-15 09:25:03 -0600854 loader_destroy_generic_list(
855 inst, (struct loader_generic_list *)&local_ext_list);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700856 loader_platform_thread_unlock_mutex(&loader_lock);
857 return VK_SUCCESS;
858 }
859
860 copy_size = *pPropertyCount < count ? *pPropertyCount : count;
861 for (uint32_t i = 0; i < copy_size; i++) {
862 memcpy(&pProperties[i], &dev_ext_list->list[i].props,
Jon Ashburn014438f2016-03-01 19:51:07 -0700863 sizeof(VkExtensionProperties));
Jon Ashburndc5d9202016-02-29 13:00:51 -0700864 }
865 *pPropertyCount = copy_size;
866
Jon Ashburncc407a22016-04-15 09:25:03 -0600867 loader_destroy_generic_list(
868 inst, (struct loader_generic_list *)&local_ext_list);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700869 if (copy_size < count) {
870 loader_platform_thread_unlock_mutex(&loader_lock);
871 return VK_INCOMPLETE;
872 }
873 } else {
Jon Ashburn014438f2016-03-01 19:51:07 -0700874 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
875 "vkEnumerateDeviceExtensionProperties: pLayerName "
876 "is too long or is badly formed");
877 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700878 return VK_ERROR_EXTENSION_NOT_PRESENT;
879 }
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700880 }
881
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600882 loader_platform_thread_unlock_mutex(&loader_lock);
Tony Barbour59a47322015-06-24 16:06:58 -0600883 return res;
884}
885
Jon Ashburn23d36b12016-02-02 17:47:28 -0700886LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
887vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
888 uint32_t *pPropertyCount,
889 VkLayerProperties *pProperties) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700890 uint32_t copy_size;
Jon Ashburn787eb252016-03-24 15:49:57 -0600891 struct loader_physical_device_tramp *phys_dev;
Tony Barbour59a47322015-06-24 16:06:58 -0600892
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600893 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700894
895 /* Don't dispatch this call down the instance chain, want all device layers
896 enumerated and instance chain may not contain all device layers */
Jon Ashburndc5d9202016-02-29 13:00:51 -0700897
Jon Ashburn787eb252016-03-24 15:49:57 -0600898 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Piers Daniell295fe402016-03-29 11:51:11 -0600899 const struct loader_instance *inst = phys_dev->this_instance;
Jon Ashburn014438f2016-03-01 19:51:07 -0700900 uint32_t count = inst->device_layer_list.count;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700901
902 if (pProperties == NULL) {
903 *pPropertyCount = count;
904 loader_platform_thread_unlock_mutex(&loader_lock);
905 return VK_SUCCESS;
906 }
907
908 copy_size = (*pPropertyCount < count) ? *pPropertyCount : count;
909 for (uint32_t i = 0; i < copy_size; i++) {
Jon Ashburn014438f2016-03-01 19:51:07 -0700910 memcpy(&pProperties[i], &(inst->device_layer_list.list[i].info),
Jon Ashburndc5d9202016-02-29 13:00:51 -0700911 sizeof(VkLayerProperties));
912 }
913 *pPropertyCount = copy_size;
914
915 if (copy_size < count) {
916 loader_platform_thread_unlock_mutex(&loader_lock);
917 return VK_INCOMPLETE;
918 }
919
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600920 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700921 return VK_SUCCESS;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600922}
923
Jon Ashburn23d36b12016-02-02 17:47:28 -0700924LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
925vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex,
926 VkQueue *pQueue) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600927 const VkLayerDispatchTable *disp;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600928
929 disp = loader_get_dispatch(device);
930
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600931 disp->GetDeviceQueue(device, queueNodeIndex, queueIndex, pQueue);
932 loader_set_dispatch(*pQueue, disp);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600933}
934
Jon Ashburn23d36b12016-02-02 17:47:28 -0700935LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
936vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits,
937 VkFence fence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600938 const VkLayerDispatchTable *disp;
939
940 disp = loader_get_dispatch(queue);
941
Chia-I Wu40cf0ae2015-10-26 17:20:32 +0800942 return disp->QueueSubmit(queue, submitCount, pSubmits, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600943}
944
Jon Ashburn23d36b12016-02-02 17:47:28 -0700945LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600946 const VkLayerDispatchTable *disp;
947
948 disp = loader_get_dispatch(queue);
949
950 return disp->QueueWaitIdle(queue);
951}
952
Jon Ashburn23d36b12016-02-02 17:47:28 -0700953LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600954 const VkLayerDispatchTable *disp;
955
956 disp = loader_get_dispatch(device);
957
958 return disp->DeviceWaitIdle(device);
959}
960
Jon Ashburn23d36b12016-02-02 17:47:28 -0700961LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
962vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
963 const VkAllocationCallbacks *pAllocator,
964 VkDeviceMemory *pMemory) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600965 const VkLayerDispatchTable *disp;
966
967 disp = loader_get_dispatch(device);
968
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800969 return disp->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600970}
971
Jon Ashburn23d36b12016-02-02 17:47:28 -0700972LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
973vkFreeMemory(VkDevice device, VkDeviceMemory mem,
974 const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600975 const VkLayerDispatchTable *disp;
976
977 disp = loader_get_dispatch(device);
978
Chia-I Wuf7458c52015-10-26 21:10:41 +0800979 disp->FreeMemory(device, mem, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600980}
981
Jon Ashburn23d36b12016-02-02 17:47:28 -0700982LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
983vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset,
984 VkDeviceSize size, VkFlags flags, void **ppData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600985 const VkLayerDispatchTable *disp;
986
987 disp = loader_get_dispatch(device);
988
989 return disp->MapMemory(device, mem, offset, size, flags, ppData);
990}
991
Jon Ashburn23d36b12016-02-02 17:47:28 -0700992LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
993vkUnmapMemory(VkDevice device, VkDeviceMemory mem) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600994 const VkLayerDispatchTable *disp;
995
996 disp = loader_get_dispatch(device);
997
Mark Lobodzinski2141f652015-09-07 13:59:43 -0600998 disp->UnmapMemory(device, mem);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600999}
1000
Jon Ashburn23d36b12016-02-02 17:47:28 -07001001LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1002vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
1003 const VkMappedMemoryRange *pMemoryRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001004 const VkLayerDispatchTable *disp;
1005
1006 disp = loader_get_dispatch(device);
1007
Jon Ashburn23d36b12016-02-02 17:47:28 -07001008 return disp->FlushMappedMemoryRanges(device, memoryRangeCount,
1009 pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001010}
1011
Jon Ashburn23d36b12016-02-02 17:47:28 -07001012LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1013vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
1014 const VkMappedMemoryRange *pMemoryRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001015 const VkLayerDispatchTable *disp;
1016
1017 disp = loader_get_dispatch(device);
1018
Jon Ashburn23d36b12016-02-02 17:47:28 -07001019 return disp->InvalidateMappedMemoryRanges(device, memoryRangeCount,
1020 pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001021}
1022
Jon Ashburn23d36b12016-02-02 17:47:28 -07001023LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1024vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory,
1025 VkDeviceSize *pCommittedMemoryInBytes) {
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -06001026 const VkLayerDispatchTable *disp;
1027
1028 disp = loader_get_dispatch(device);
1029
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001030 disp->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes);
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -06001031}
1032
Jon Ashburn23d36b12016-02-02 17:47:28 -07001033LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1034vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem,
1035 VkDeviceSize offset) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001036 const VkLayerDispatchTable *disp;
1037
Mark Lobodzinski942b1722015-05-11 17:21:15 -05001038 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001039
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001040 return disp->BindBufferMemory(device, buffer, mem, offset);
1041}
1042
Jon Ashburn23d36b12016-02-02 17:47:28 -07001043LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1044vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem,
1045 VkDeviceSize offset) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001046 const VkLayerDispatchTable *disp;
1047
1048 disp = loader_get_dispatch(device);
1049
1050 return disp->BindImageMemory(device, image, mem, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001051}
1052
Jon Ashburn23d36b12016-02-02 17:47:28 -07001053LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1054vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer,
1055 VkMemoryRequirements *pMemoryRequirements) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001056 const VkLayerDispatchTable *disp;
1057
1058 disp = loader_get_dispatch(device);
1059
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001060 disp->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -06001061}
1062
Jon Ashburn23d36b12016-02-02 17:47:28 -07001063LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1064vkGetImageMemoryRequirements(VkDevice device, VkImage image,
1065 VkMemoryRequirements *pMemoryRequirements) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001066 const VkLayerDispatchTable *disp;
1067
1068 disp = loader_get_dispatch(device);
1069
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001070 disp->GetImageMemoryRequirements(device, image, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -06001071}
1072
Jon Ashburn23d36b12016-02-02 17:47:28 -07001073LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements(
1074 VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount,
1075 VkSparseImageMemoryRequirements *pSparseMemoryRequirements) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001076 const VkLayerDispatchTable *disp;
1077
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001078 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001079
Jon Ashburn23d36b12016-02-02 17:47:28 -07001080 disp->GetImageSparseMemoryRequirements(device, image,
1081 pSparseMemoryRequirementCount,
1082 pSparseMemoryRequirements);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001083}
1084
Jon Ashburn23d36b12016-02-02 17:47:28 -07001085LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1086vkGetPhysicalDeviceSparseImageFormatProperties(
1087 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
1088 VkSampleCountFlagBits samples, VkImageUsageFlags usage,
1089 VkImageTiling tiling, uint32_t *pPropertyCount,
1090 VkSparseImageFormatProperties *pProperties) {
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001091 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -07001092 VkPhysicalDevice unwrapped_phys_dev =
1093 loader_unwrap_physical_device(physicalDevice);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001094 disp = loader_get_instance_dispatch(physicalDevice);
1095
Jon Ashburn23d36b12016-02-02 17:47:28 -07001096 disp->GetPhysicalDeviceSparseImageFormatProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -07001097 unwrapped_phys_dev, format, type, samples, usage, tiling,
1098 pPropertyCount, pProperties);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001099}
1100
Jon Ashburn23d36b12016-02-02 17:47:28 -07001101LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1102vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount,
1103 const VkBindSparseInfo *pBindInfo, VkFence fence) {
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001104 const VkLayerDispatchTable *disp;
1105
1106 disp = loader_get_dispatch(queue);
1107
Chia-I Wu1ff4c3d2015-10-26 16:55:27 +08001108 return disp->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001109}
1110
Jon Ashburn23d36b12016-02-02 17:47:28 -07001111LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1112vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo,
1113 const VkAllocationCallbacks *pAllocator, VkFence *pFence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001114 const VkLayerDispatchTable *disp;
1115
1116 disp = loader_get_dispatch(device);
1117
Chia-I Wuf7458c52015-10-26 21:10:41 +08001118 return disp->CreateFence(device, pCreateInfo, pAllocator, pFence);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001119}
1120
Jon Ashburn23d36b12016-02-02 17:47:28 -07001121LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1122vkDestroyFence(VkDevice device, VkFence fence,
1123 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001124 const VkLayerDispatchTable *disp;
1125
1126 disp = loader_get_dispatch(device);
1127
Chia-I Wuf7458c52015-10-26 21:10:41 +08001128 disp->DestroyFence(device, fence, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001129}
1130
Jon Ashburn23d36b12016-02-02 17:47:28 -07001131LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1132vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001133 const VkLayerDispatchTable *disp;
1134
1135 disp = loader_get_dispatch(device);
1136
1137 return disp->ResetFences(device, fenceCount, pFences);
1138}
1139
Jon Ashburn23d36b12016-02-02 17:47:28 -07001140LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1141vkGetFenceStatus(VkDevice device, VkFence fence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001142 const VkLayerDispatchTable *disp;
1143
1144 disp = loader_get_dispatch(device);
1145
1146 return disp->GetFenceStatus(device, fence);
1147}
1148
Jon Ashburn23d36b12016-02-02 17:47:28 -07001149LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1150vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences,
1151 VkBool32 waitAll, uint64_t timeout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001152 const VkLayerDispatchTable *disp;
1153
1154 disp = loader_get_dispatch(device);
1155
1156 return disp->WaitForFences(device, fenceCount, pFences, waitAll, timeout);
1157}
1158
Jon Ashburn23d36b12016-02-02 17:47:28 -07001159LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1160vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo,
1161 const VkAllocationCallbacks *pAllocator,
1162 VkSemaphore *pSemaphore) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001163 const VkLayerDispatchTable *disp;
1164
1165 disp = loader_get_dispatch(device);
1166
Chia-I Wuf7458c52015-10-26 21:10:41 +08001167 return disp->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001168}
1169
Jon Ashburn23d36b12016-02-02 17:47:28 -07001170LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1171vkDestroySemaphore(VkDevice device, VkSemaphore semaphore,
1172 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001173 const VkLayerDispatchTable *disp;
1174
1175 disp = loader_get_dispatch(device);
1176
Chia-I Wuf7458c52015-10-26 21:10:41 +08001177 disp->DestroySemaphore(device, semaphore, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001178}
1179
Jon Ashburn23d36b12016-02-02 17:47:28 -07001180LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1181vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo,
1182 const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001183 const VkLayerDispatchTable *disp;
1184
1185 disp = loader_get_dispatch(device);
1186
Chia-I Wuf7458c52015-10-26 21:10:41 +08001187 return disp->CreateEvent(device, pCreateInfo, pAllocator, pEvent);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001188}
1189
Jon Ashburn23d36b12016-02-02 17:47:28 -07001190LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1191vkDestroyEvent(VkDevice device, VkEvent event,
1192 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001193 const VkLayerDispatchTable *disp;
1194
1195 disp = loader_get_dispatch(device);
1196
Chia-I Wuf7458c52015-10-26 21:10:41 +08001197 disp->DestroyEvent(device, event, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001198}
1199
Jon Ashburn23d36b12016-02-02 17:47:28 -07001200LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1201vkGetEventStatus(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001202 const VkLayerDispatchTable *disp;
1203
1204 disp = loader_get_dispatch(device);
1205
1206 return disp->GetEventStatus(device, event);
1207}
1208
Jon Ashburn23d36b12016-02-02 17:47:28 -07001209LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1210vkSetEvent(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001211 const VkLayerDispatchTable *disp;
1212
1213 disp = loader_get_dispatch(device);
1214
1215 return disp->SetEvent(device, event);
1216}
1217
Jon Ashburn23d36b12016-02-02 17:47:28 -07001218LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1219vkResetEvent(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001220 const VkLayerDispatchTable *disp;
1221
1222 disp = loader_get_dispatch(device);
1223
1224 return disp->ResetEvent(device, event);
1225}
1226
Jon Ashburn23d36b12016-02-02 17:47:28 -07001227LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1228vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo,
1229 const VkAllocationCallbacks *pAllocator,
1230 VkQueryPool *pQueryPool) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001231 const VkLayerDispatchTable *disp;
1232
1233 disp = loader_get_dispatch(device);
1234
Chia-I Wuf7458c52015-10-26 21:10:41 +08001235 return disp->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001236}
1237
Jon Ashburn23d36b12016-02-02 17:47:28 -07001238LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1239vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool,
1240 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001241 const VkLayerDispatchTable *disp;
1242
1243 disp = loader_get_dispatch(device);
1244
Chia-I Wuf7458c52015-10-26 21:10:41 +08001245 disp->DestroyQueryPool(device, queryPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001246}
1247
Jon Ashburn23d36b12016-02-02 17:47:28 -07001248LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1249vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool,
1250 uint32_t firstQuery, uint32_t queryCount, size_t dataSize,
1251 void *pData, VkDeviceSize stride,
1252 VkQueryResultFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001253 const VkLayerDispatchTable *disp;
1254
1255 disp = loader_get_dispatch(device);
1256
Jon Ashburn23d36b12016-02-02 17:47:28 -07001257 return disp->GetQueryPoolResults(device, queryPool, firstQuery, queryCount,
1258 dataSize, pData, stride, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001259}
1260
Jon Ashburn23d36b12016-02-02 17:47:28 -07001261LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1262vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo,
1263 const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001264 const VkLayerDispatchTable *disp;
1265
1266 disp = loader_get_dispatch(device);
1267
Chia-I Wuf7458c52015-10-26 21:10:41 +08001268 return disp->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001269}
1270
Jon Ashburn23d36b12016-02-02 17:47:28 -07001271LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1272vkDestroyBuffer(VkDevice device, VkBuffer buffer,
1273 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001274 const VkLayerDispatchTable *disp;
1275
1276 disp = loader_get_dispatch(device);
1277
Chia-I Wuf7458c52015-10-26 21:10:41 +08001278 disp->DestroyBuffer(device, buffer, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001279}
1280
Jon Ashburn23d36b12016-02-02 17:47:28 -07001281LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1282vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo,
1283 const VkAllocationCallbacks *pAllocator,
1284 VkBufferView *pView) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001285 const VkLayerDispatchTable *disp;
1286
1287 disp = loader_get_dispatch(device);
1288
Chia-I Wuf7458c52015-10-26 21:10:41 +08001289 return disp->CreateBufferView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001290}
1291
Jon Ashburn23d36b12016-02-02 17:47:28 -07001292LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1293vkDestroyBufferView(VkDevice device, VkBufferView bufferView,
1294 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001295 const VkLayerDispatchTable *disp;
1296
1297 disp = loader_get_dispatch(device);
1298
Chia-I Wuf7458c52015-10-26 21:10:41 +08001299 disp->DestroyBufferView(device, bufferView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001300}
1301
Jon Ashburn23d36b12016-02-02 17:47:28 -07001302LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1303vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
1304 const VkAllocationCallbacks *pAllocator, VkImage *pImage) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001305 const VkLayerDispatchTable *disp;
1306
1307 disp = loader_get_dispatch(device);
1308
Chia-I Wuf7458c52015-10-26 21:10:41 +08001309 return disp->CreateImage(device, pCreateInfo, pAllocator, pImage);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001310}
1311
Jon Ashburn23d36b12016-02-02 17:47:28 -07001312LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1313vkDestroyImage(VkDevice device, VkImage image,
1314 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001315 const VkLayerDispatchTable *disp;
1316
1317 disp = loader_get_dispatch(device);
1318
Chia-I Wuf7458c52015-10-26 21:10:41 +08001319 disp->DestroyImage(device, image, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001320}
1321
Jon Ashburn23d36b12016-02-02 17:47:28 -07001322LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1323vkGetImageSubresourceLayout(VkDevice device, VkImage image,
1324 const VkImageSubresource *pSubresource,
1325 VkSubresourceLayout *pLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001326 const VkLayerDispatchTable *disp;
1327
1328 disp = loader_get_dispatch(device);
1329
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001330 disp->GetImageSubresourceLayout(device, image, pSubresource, pLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001331}
1332
Jon Ashburn23d36b12016-02-02 17:47:28 -07001333LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1334vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo,
1335 const VkAllocationCallbacks *pAllocator, VkImageView *pView) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001336 const VkLayerDispatchTable *disp;
1337
1338 disp = loader_get_dispatch(device);
1339
Chia-I Wuf7458c52015-10-26 21:10:41 +08001340 return disp->CreateImageView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001341}
1342
Jon Ashburn23d36b12016-02-02 17:47:28 -07001343LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1344vkDestroyImageView(VkDevice device, VkImageView imageView,
1345 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001346 const VkLayerDispatchTable *disp;
1347
1348 disp = loader_get_dispatch(device);
1349
Chia-I Wuf7458c52015-10-26 21:10:41 +08001350 disp->DestroyImageView(device, imageView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001351}
1352
Jon Ashburn23d36b12016-02-02 17:47:28 -07001353LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1354vkCreateShaderModule(VkDevice device,
1355 const VkShaderModuleCreateInfo *pCreateInfo,
1356 const VkAllocationCallbacks *pAllocator,
1357 VkShaderModule *pShader) {
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -06001358 const VkLayerDispatchTable *disp;
1359
1360 disp = loader_get_dispatch(device);
1361
Chia-I Wuf7458c52015-10-26 21:10:41 +08001362 return disp->CreateShaderModule(device, pCreateInfo, pAllocator, pShader);
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -06001363}
1364
Jon Ashburn23d36b12016-02-02 17:47:28 -07001365LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1366vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule,
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->DestroyShaderModule(device, shaderModule, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001373}
1374
Jon Ashburn23d36b12016-02-02 17:47:28 -07001375LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1376vkCreatePipelineCache(VkDevice device,
1377 const VkPipelineCacheCreateInfo *pCreateInfo,
1378 const VkAllocationCallbacks *pAllocator,
1379 VkPipelineCache *pPipelineCache) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001380 const VkLayerDispatchTable *disp;
1381
1382 disp = loader_get_dispatch(device);
1383
Jon Ashburn23d36b12016-02-02 17:47:28 -07001384 return disp->CreatePipelineCache(device, pCreateInfo, pAllocator,
1385 pPipelineCache);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001386}
1387
Jon Ashburn23d36b12016-02-02 17:47:28 -07001388LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1389vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache,
1390 const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001391 const VkLayerDispatchTable *disp;
1392
1393 disp = loader_get_dispatch(device);
1394
Chia-I Wuf7458c52015-10-26 21:10:41 +08001395 disp->DestroyPipelineCache(device, pipelineCache, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001396}
1397
Jon Ashburn23d36b12016-02-02 17:47:28 -07001398LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1399vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache,
1400 size_t *pDataSize, void *pData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001401 const VkLayerDispatchTable *disp;
1402
1403 disp = loader_get_dispatch(device);
1404
Chia-I Wub16facd2015-10-26 19:17:06 +08001405 return disp->GetPipelineCacheData(device, pipelineCache, pDataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001406}
1407
Jon Ashburn23d36b12016-02-02 17:47:28 -07001408LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1409vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache,
1410 uint32_t srcCacheCount,
1411 const VkPipelineCache *pSrcCaches) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001412 const VkLayerDispatchTable *disp;
1413
1414 disp = loader_get_dispatch(device);
1415
Jon Ashburn23d36b12016-02-02 17:47:28 -07001416 return disp->MergePipelineCaches(device, dstCache, srcCacheCount,
1417 pSrcCaches);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001418}
1419
Jon Ashburn23d36b12016-02-02 17:47:28 -07001420LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1421vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache,
1422 uint32_t createInfoCount,
1423 const VkGraphicsPipelineCreateInfo *pCreateInfos,
1424 const VkAllocationCallbacks *pAllocator,
1425 VkPipeline *pPipelines) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001426 const VkLayerDispatchTable *disp;
1427
1428 disp = loader_get_dispatch(device);
1429
Jon Ashburn23d36b12016-02-02 17:47:28 -07001430 return disp->CreateGraphicsPipelines(device, pipelineCache, createInfoCount,
1431 pCreateInfos, pAllocator, pPipelines);
Jon Ashburnc669cc62015-07-09 15:02:25 -06001432}
1433
Jon Ashburn23d36b12016-02-02 17:47:28 -07001434LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1435vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache,
1436 uint32_t createInfoCount,
1437 const VkComputePipelineCreateInfo *pCreateInfos,
1438 const VkAllocationCallbacks *pAllocator,
1439 VkPipeline *pPipelines) {
Jon Ashburnc669cc62015-07-09 15:02:25 -06001440 const VkLayerDispatchTable *disp;
1441
1442 disp = loader_get_dispatch(device);
1443
Jon Ashburn23d36b12016-02-02 17:47:28 -07001444 return disp->CreateComputePipelines(device, pipelineCache, createInfoCount,
1445 pCreateInfos, pAllocator, pPipelines);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001446}
1447
Jon Ashburn23d36b12016-02-02 17:47:28 -07001448LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1449vkDestroyPipeline(VkDevice device, VkPipeline pipeline,
1450 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001451 const VkLayerDispatchTable *disp;
1452
1453 disp = loader_get_dispatch(device);
1454
Chia-I Wuf7458c52015-10-26 21:10:41 +08001455 disp->DestroyPipeline(device, pipeline, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001456}
1457
Jon Ashburn23d36b12016-02-02 17:47:28 -07001458LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1459vkCreatePipelineLayout(VkDevice device,
1460 const VkPipelineLayoutCreateInfo *pCreateInfo,
1461 const VkAllocationCallbacks *pAllocator,
1462 VkPipelineLayout *pPipelineLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001463 const VkLayerDispatchTable *disp;
1464
1465 disp = loader_get_dispatch(device);
1466
Jon Ashburn23d36b12016-02-02 17:47:28 -07001467 return disp->CreatePipelineLayout(device, pCreateInfo, pAllocator,
1468 pPipelineLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001469}
1470
Jon Ashburn23d36b12016-02-02 17:47:28 -07001471LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1472vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout,
1473 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001474 const VkLayerDispatchTable *disp;
1475
1476 disp = loader_get_dispatch(device);
1477
Chia-I Wuf7458c52015-10-26 21:10:41 +08001478 disp->DestroyPipelineLayout(device, pipelineLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001479}
1480
Jon Ashburn23d36b12016-02-02 17:47:28 -07001481LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1482vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo,
1483 const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001484 const VkLayerDispatchTable *disp;
1485
1486 disp = loader_get_dispatch(device);
1487
Chia-I Wuf7458c52015-10-26 21:10:41 +08001488 return disp->CreateSampler(device, pCreateInfo, pAllocator, pSampler);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001489}
1490
Jon Ashburn23d36b12016-02-02 17:47:28 -07001491LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1492vkDestroySampler(VkDevice device, VkSampler sampler,
1493 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001494 const VkLayerDispatchTable *disp;
1495
1496 disp = loader_get_dispatch(device);
1497
Chia-I Wuf7458c52015-10-26 21:10:41 +08001498 disp->DestroySampler(device, sampler, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001499}
1500
Jon Ashburn23d36b12016-02-02 17:47:28 -07001501LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1502vkCreateDescriptorSetLayout(VkDevice device,
1503 const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
1504 const VkAllocationCallbacks *pAllocator,
1505 VkDescriptorSetLayout *pSetLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001506 const VkLayerDispatchTable *disp;
1507
1508 disp = loader_get_dispatch(device);
1509
Jon Ashburn23d36b12016-02-02 17:47:28 -07001510 return disp->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator,
1511 pSetLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001512}
1513
Jon Ashburn23d36b12016-02-02 17:47:28 -07001514LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1515vkDestroyDescriptorSetLayout(VkDevice device,
1516 VkDescriptorSetLayout descriptorSetLayout,
1517 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001518 const VkLayerDispatchTable *disp;
1519
1520 disp = loader_get_dispatch(device);
1521
Chia-I Wuf7458c52015-10-26 21:10:41 +08001522 disp->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001523}
1524
Jon Ashburn23d36b12016-02-02 17:47:28 -07001525LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1526vkCreateDescriptorPool(VkDevice device,
1527 const VkDescriptorPoolCreateInfo *pCreateInfo,
1528 const VkAllocationCallbacks *pAllocator,
1529 VkDescriptorPool *pDescriptorPool) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001530 const VkLayerDispatchTable *disp;
1531
1532 disp = loader_get_dispatch(device);
1533
Jon Ashburn23d36b12016-02-02 17:47:28 -07001534 return disp->CreateDescriptorPool(device, pCreateInfo, pAllocator,
1535 pDescriptorPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001536}
1537
Jon Ashburn23d36b12016-02-02 17:47:28 -07001538LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1539vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
1540 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001541 const VkLayerDispatchTable *disp;
1542
1543 disp = loader_get_dispatch(device);
1544
Chia-I Wuf7458c52015-10-26 21:10:41 +08001545 disp->DestroyDescriptorPool(device, descriptorPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001546}
1547
Jon Ashburn23d36b12016-02-02 17:47:28 -07001548LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1549vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
1550 VkDescriptorPoolResetFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001551 const VkLayerDispatchTable *disp;
1552
1553 disp = loader_get_dispatch(device);
1554
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001555 return disp->ResetDescriptorPool(device, descriptorPool, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001556}
1557
Jon Ashburn23d36b12016-02-02 17:47:28 -07001558LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1559vkAllocateDescriptorSets(VkDevice device,
1560 const VkDescriptorSetAllocateInfo *pAllocateInfo,
1561 VkDescriptorSet *pDescriptorSets) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001562 const VkLayerDispatchTable *disp;
1563
1564 disp = loader_get_dispatch(device);
1565
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001566 return disp->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001567}
1568
Jon Ashburn23d36b12016-02-02 17:47:28 -07001569LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1570vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool,
1571 uint32_t descriptorSetCount,
1572 const VkDescriptorSet *pDescriptorSets) {
Tony Barbour34ec6922015-07-10 10:50:45 -06001573 const VkLayerDispatchTable *disp;
1574
1575 disp = loader_get_dispatch(device);
1576
Jon Ashburn23d36b12016-02-02 17:47:28 -07001577 return disp->FreeDescriptorSets(device, descriptorPool, descriptorSetCount,
1578 pDescriptorSets);
Tony Barbour34ec6922015-07-10 10:50:45 -06001579}
1580
Jon Ashburn23d36b12016-02-02 17:47:28 -07001581LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1582vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount,
1583 const VkWriteDescriptorSet *pDescriptorWrites,
1584 uint32_t descriptorCopyCount,
1585 const VkCopyDescriptorSet *pDescriptorCopies) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001586 const VkLayerDispatchTable *disp;
1587
1588 disp = loader_get_dispatch(device);
1589
Jon Ashburn23d36b12016-02-02 17:47:28 -07001590 disp->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites,
1591 descriptorCopyCount, pDescriptorCopies);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001592}
1593
Jon Ashburn23d36b12016-02-02 17:47:28 -07001594LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1595vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo,
1596 const VkAllocationCallbacks *pAllocator,
1597 VkFramebuffer *pFramebuffer) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001598 const VkLayerDispatchTable *disp;
1599
1600 disp = loader_get_dispatch(device);
1601
Jon Ashburn23d36b12016-02-02 17:47:28 -07001602 return disp->CreateFramebuffer(device, pCreateInfo, pAllocator,
1603 pFramebuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001604}
1605
Jon Ashburn23d36b12016-02-02 17:47:28 -07001606LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1607vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer,
1608 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001609 const VkLayerDispatchTable *disp;
1610
1611 disp = loader_get_dispatch(device);
1612
Chia-I Wuf7458c52015-10-26 21:10:41 +08001613 disp->DestroyFramebuffer(device, framebuffer, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -06001614}
1615
Jon Ashburn23d36b12016-02-02 17:47:28 -07001616LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1617vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
1618 const VkAllocationCallbacks *pAllocator,
1619 VkRenderPass *pRenderPass) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001620 const VkLayerDispatchTable *disp;
1621
1622 disp = loader_get_dispatch(device);
1623
Chia-I Wuf7458c52015-10-26 21:10:41 +08001624 return disp->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
Jon Ashburn754864f2015-07-23 18:49:07 -06001625}
1626
Jon Ashburn23d36b12016-02-02 17:47:28 -07001627LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1628vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass,
1629 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001630 const VkLayerDispatchTable *disp;
1631
1632 disp = loader_get_dispatch(device);
1633
Chia-I Wuf7458c52015-10-26 21:10:41 +08001634 disp->DestroyRenderPass(device, renderPass, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -06001635}
1636
Jon Ashburn23d36b12016-02-02 17:47:28 -07001637LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1638vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass,
1639 VkExtent2D *pGranularity) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001640 const VkLayerDispatchTable *disp;
1641
1642 disp = loader_get_dispatch(device);
1643
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001644 disp->GetRenderAreaGranularity(device, renderPass, pGranularity);
Jon Ashburn754864f2015-07-23 18:49:07 -06001645}
1646
Jon Ashburn23d36b12016-02-02 17:47:28 -07001647LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1648vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo,
1649 const VkAllocationCallbacks *pAllocator,
1650 VkCommandPool *pCommandPool) {
Cody Northrope62183e2015-07-09 18:08:05 -06001651 const VkLayerDispatchTable *disp;
1652
1653 disp = loader_get_dispatch(device);
1654
Jon Ashburn23d36b12016-02-02 17:47:28 -07001655 return disp->CreateCommandPool(device, pCreateInfo, pAllocator,
1656 pCommandPool);
Cody Northrope62183e2015-07-09 18:08:05 -06001657}
1658
Jon Ashburn23d36b12016-02-02 17:47:28 -07001659LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1660vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool,
1661 const VkAllocationCallbacks *pAllocator) {
Cody Northrope62183e2015-07-09 18:08:05 -06001662 const VkLayerDispatchTable *disp;
1663
1664 disp = loader_get_dispatch(device);
1665
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001666 disp->DestroyCommandPool(device, commandPool, pAllocator);
Cody Northrope62183e2015-07-09 18:08:05 -06001667}
1668
Jon Ashburn23d36b12016-02-02 17:47:28 -07001669LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1670vkResetCommandPool(VkDevice device, VkCommandPool commandPool,
1671 VkCommandPoolResetFlags flags) {
Cody Northrope62183e2015-07-09 18:08:05 -06001672 const VkLayerDispatchTable *disp;
1673
1674 disp = loader_get_dispatch(device);
1675
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001676 return disp->ResetCommandPool(device, commandPool, flags);
Cody Northrope62183e2015-07-09 18:08:05 -06001677}
1678
Jon Ashburn23d36b12016-02-02 17:47:28 -07001679LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1680vkAllocateCommandBuffers(VkDevice device,
1681 const VkCommandBufferAllocateInfo *pAllocateInfo,
1682 VkCommandBuffer *pCommandBuffers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001683 const VkLayerDispatchTable *disp;
1684 VkResult res;
1685
1686 disp = loader_get_dispatch(device);
1687
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001688 res = disp->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001689 if (res == VK_SUCCESS) {
Jon Ashburn23d36b12016-02-02 17:47:28 -07001690 for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; i++) {
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001691 if (pCommandBuffers[i]) {
1692 loader_init_dispatch(pCommandBuffers[i], disp);
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001693 }
1694 }
Jon Ashburnd55a3942015-05-06 09:02:10 -06001695 }
1696
1697 return res;
1698}
1699
Jon Ashburn23d36b12016-02-02 17:47:28 -07001700LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1701vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool,
1702 uint32_t commandBufferCount,
1703 const VkCommandBuffer *pCommandBuffers) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001704 const VkLayerDispatchTable *disp;
1705
1706 disp = loader_get_dispatch(device);
1707
Jon Ashburn23d36b12016-02-02 17:47:28 -07001708 disp->FreeCommandBuffers(device, commandPool, commandBufferCount,
1709 pCommandBuffers);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001710}
1711
Jon Ashburn23d36b12016-02-02 17:47:28 -07001712LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1713vkBeginCommandBuffer(VkCommandBuffer commandBuffer,
1714 const VkCommandBufferBeginInfo *pBeginInfo) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001715 const VkLayerDispatchTable *disp;
1716
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001717 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001718
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001719 return disp->BeginCommandBuffer(commandBuffer, pBeginInfo);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001720}
1721
Jon Ashburn23d36b12016-02-02 17:47:28 -07001722LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1723vkEndCommandBuffer(VkCommandBuffer commandBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001724 const VkLayerDispatchTable *disp;
1725
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001726 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001727
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001728 return disp->EndCommandBuffer(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001729}
1730
Jon Ashburn23d36b12016-02-02 17:47:28 -07001731LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1732vkResetCommandBuffer(VkCommandBuffer commandBuffer,
1733 VkCommandBufferResetFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001734 const VkLayerDispatchTable *disp;
1735
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001736 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001737
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001738 return disp->ResetCommandBuffer(commandBuffer, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001739}
1740
Jon Ashburn23d36b12016-02-02 17:47:28 -07001741LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1742vkCmdBindPipeline(VkCommandBuffer commandBuffer,
1743 VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001744 const VkLayerDispatchTable *disp;
1745
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001746 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001747
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001748 disp->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001749}
1750
Jon Ashburn23d36b12016-02-02 17:47:28 -07001751LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1752vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport,
1753 uint32_t viewportCount, const VkViewport *pViewports) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001754 const VkLayerDispatchTable *disp;
1755
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001756 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001757
Jon Ashburn23d36b12016-02-02 17:47:28 -07001758 disp->CmdSetViewport(commandBuffer, firstViewport, viewportCount,
1759 pViewports);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001760}
1761
Jon Ashburn23d36b12016-02-02 17:47:28 -07001762LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1763vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor,
1764 uint32_t scissorCount, const VkRect2D *pScissors) {
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001765 const VkLayerDispatchTable *disp;
1766
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001767 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001768
Jon Ashburn19d3bf12015-12-30 14:06:55 -07001769 disp->CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001770}
1771
Jon Ashburn23d36b12016-02-02 17:47:28 -07001772LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1773vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001774 const VkLayerDispatchTable *disp;
1775
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001776 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001777
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001778 disp->CmdSetLineWidth(commandBuffer, lineWidth);
Cody Northrop12365112015-08-17 11:10:49 -06001779}
1780
Jon Ashburn23d36b12016-02-02 17:47:28 -07001781LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1782vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor,
1783 float depthBiasClamp, float depthBiasSlopeFactor) {
Cody Northrop12365112015-08-17 11:10:49 -06001784 const VkLayerDispatchTable *disp;
1785
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001786 disp = loader_get_dispatch(commandBuffer);
Cody Northrop12365112015-08-17 11:10:49 -06001787
Jon Ashburn23d36b12016-02-02 17:47:28 -07001788 disp->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor,
1789 depthBiasClamp, depthBiasSlopeFactor);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001790}
1791
Jon Ashburn23d36b12016-02-02 17:47:28 -07001792LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1793vkCmdSetBlendConstants(VkCommandBuffer commandBuffer,
1794 const float blendConstants[4]) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001795 const VkLayerDispatchTable *disp;
1796
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001797 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001798
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001799 disp->CmdSetBlendConstants(commandBuffer, blendConstants);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001800}
1801
Jon Ashburn23d36b12016-02-02 17:47:28 -07001802LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1803vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds,
1804 float maxDepthBounds) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001805 const VkLayerDispatchTable *disp;
1806
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001807 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001808
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001809 disp->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
Cody Northrop82485a82015-08-18 15:21:16 -06001810}
1811
Jon Ashburn23d36b12016-02-02 17:47:28 -07001812LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1813vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer,
1814 VkStencilFaceFlags faceMask, uint32_t compareMask) {
Cody Northrop82485a82015-08-18 15:21:16 -06001815 const VkLayerDispatchTable *disp;
1816
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001817 disp = loader_get_dispatch(commandBuffer);
Cody Northrop82485a82015-08-18 15:21:16 -06001818
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001819 disp->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001820}
1821
Jon Ashburn23d36b12016-02-02 17:47:28 -07001822LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1823vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer,
1824 VkStencilFaceFlags faceMask, uint32_t writeMask) {
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001825 const VkLayerDispatchTable *disp;
1826
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001827 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001828
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001829 disp->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001830}
1831
Jon Ashburn23d36b12016-02-02 17:47:28 -07001832LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1833vkCmdSetStencilReference(VkCommandBuffer commandBuffer,
1834 VkStencilFaceFlags faceMask, uint32_t reference) {
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001835 const VkLayerDispatchTable *disp;
1836
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001837 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001838
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001839 disp->CmdSetStencilReference(commandBuffer, faceMask, reference);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001840}
1841
Jon Ashburn23d36b12016-02-02 17:47:28 -07001842LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets(
1843 VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
1844 VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount,
1845 const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount,
1846 const uint32_t *pDynamicOffsets) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001847 const VkLayerDispatchTable *disp;
1848
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001849 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001850
Jon Ashburn23d36b12016-02-02 17:47:28 -07001851 disp->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout,
1852 firstSet, descriptorSetCount, pDescriptorSets,
1853 dynamicOffsetCount, pDynamicOffsets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001854}
1855
Jon Ashburn23d36b12016-02-02 17:47:28 -07001856LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1857vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer,
1858 VkDeviceSize offset, VkIndexType indexType) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001859 const VkLayerDispatchTable *disp;
1860
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001861 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001862
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001863 disp->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001864}
1865
Jon Ashburn23d36b12016-02-02 17:47:28 -07001866LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1867vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding,
1868 uint32_t bindingCount, const VkBuffer *pBuffers,
1869 const VkDeviceSize *pOffsets) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001870 const VkLayerDispatchTable *disp;
1871
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001872 disp = loader_get_dispatch(commandBuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001873
Jon Ashburn23d36b12016-02-02 17:47:28 -07001874 disp->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount,
1875 pBuffers, pOffsets);
Jon Ashburn754864f2015-07-23 18:49:07 -06001876}
1877
Jon Ashburn23d36b12016-02-02 17:47:28 -07001878LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1879vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount,
1880 uint32_t instanceCount, uint32_t firstVertex,
1881 uint32_t firstInstance) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001882 const VkLayerDispatchTable *disp;
1883
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001884 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001885
Jon Ashburn23d36b12016-02-02 17:47:28 -07001886 disp->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex,
1887 firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001888}
1889
Jon Ashburn23d36b12016-02-02 17:47:28 -07001890LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1891vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount,
1892 uint32_t instanceCount, uint32_t firstIndex,
1893 int32_t vertexOffset, uint32_t firstInstance) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001894 const VkLayerDispatchTable *disp;
1895
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001896 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001897
Jon Ashburn23d36b12016-02-02 17:47:28 -07001898 disp->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex,
1899 vertexOffset, firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001900}
1901
Jon Ashburn23d36b12016-02-02 17:47:28 -07001902LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1903vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1904 VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001905 const VkLayerDispatchTable *disp;
1906
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001907 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001908
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001909 disp->CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001910}
1911
Jon Ashburn23d36b12016-02-02 17:47:28 -07001912LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1913vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1914 VkDeviceSize offset, uint32_t drawCount,
1915 uint32_t stride) {
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->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount,
1921 stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001922}
1923
Jon Ashburn23d36b12016-02-02 17:47:28 -07001924LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1925vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y,
1926 uint32_t z) {
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->CmdDispatch(commandBuffer, x, y, z);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001932}
1933
Jon Ashburn23d36b12016-02-02 17:47:28 -07001934LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1935vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1936 VkDeviceSize offset) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001937 const VkLayerDispatchTable *disp;
1938
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001939 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001940
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001941 disp->CmdDispatchIndirect(commandBuffer, buffer, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001942}
1943
Jon Ashburn23d36b12016-02-02 17:47:28 -07001944LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1945vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer,
1946 VkBuffer dstBuffer, uint32_t regionCount,
1947 const VkBufferCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001948 const VkLayerDispatchTable *disp;
1949
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001950 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001951
Jon Ashburn23d36b12016-02-02 17:47:28 -07001952 disp->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount,
1953 pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001954}
1955
Jon Ashburn23d36b12016-02-02 17:47:28 -07001956LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1957vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage,
1958 VkImageLayout srcImageLayout, VkImage dstImage,
1959 VkImageLayout dstImageLayout, uint32_t regionCount,
1960 const VkImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001961 const VkLayerDispatchTable *disp;
1962
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001963 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001964
Jon Ashburn23d36b12016-02-02 17:47:28 -07001965 disp->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage,
1966 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001967}
1968
Jon Ashburn23d36b12016-02-02 17:47:28 -07001969LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1970vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage,
1971 VkImageLayout srcImageLayout, VkImage dstImage,
1972 VkImageLayout dstImageLayout, uint32_t regionCount,
1973 const VkImageBlit *pRegions, VkFilter filter) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001974 const VkLayerDispatchTable *disp;
1975
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001976 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001977
Jon Ashburn23d36b12016-02-02 17:47:28 -07001978 disp->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage,
1979 dstImageLayout, regionCount, pRegions, filter);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001980}
1981
Jon Ashburn23d36b12016-02-02 17:47:28 -07001982LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1983vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer,
1984 VkImage dstImage, VkImageLayout dstImageLayout,
1985 uint32_t regionCount,
1986 const VkBufferImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001987 const VkLayerDispatchTable *disp;
1988
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001989 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001990
Jon Ashburn23d36b12016-02-02 17:47:28 -07001991 disp->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage,
1992 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001993}
1994
Jon Ashburn23d36b12016-02-02 17:47:28 -07001995LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1996vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage,
1997 VkImageLayout srcImageLayout, VkBuffer dstBuffer,
1998 uint32_t regionCount,
1999 const VkBufferImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002000 const VkLayerDispatchTable *disp;
2001
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002002 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002003
Jon Ashburn23d36b12016-02-02 17:47:28 -07002004 disp->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout,
2005 dstBuffer, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002006}
2007
Jon Ashburn23d36b12016-02-02 17:47:28 -07002008LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2009vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
2010 VkDeviceSize dstOffset, VkDeviceSize dataSize,
2011 const uint32_t *pData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002012 const VkLayerDispatchTable *disp;
2013
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002014 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002015
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002016 disp->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002017}
2018
Jon Ashburn23d36b12016-02-02 17:47:28 -07002019LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2020vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
2021 VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) {
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
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002026 disp->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002027}
2028
Jon Ashburn23d36b12016-02-02 17:47:28 -07002029LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2030vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image,
2031 VkImageLayout imageLayout, const VkClearColorValue *pColor,
2032 uint32_t rangeCount,
2033 const VkImageSubresourceRange *pRanges) {
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
Jon Ashburn23d36b12016-02-02 17:47:28 -07002038 disp->CmdClearColorImage(commandBuffer, image, imageLayout, pColor,
2039 rangeCount, pRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002040}
2041
Jon Ashburn23d36b12016-02-02 17:47:28 -07002042LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2043vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image,
2044 VkImageLayout imageLayout,
2045 const VkClearDepthStencilValue *pDepthStencil,
2046 uint32_t rangeCount,
2047 const VkImageSubresourceRange *pRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002048 const VkLayerDispatchTable *disp;
2049
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002050 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002051
Jon Ashburn23d36b12016-02-02 17:47:28 -07002052 disp->CmdClearDepthStencilImage(commandBuffer, image, imageLayout,
2053 pDepthStencil, rangeCount, pRanges);
Chris Forbesd9be82b2015-06-22 17:21:59 +12002054}
2055
Jon Ashburn23d36b12016-02-02 17:47:28 -07002056LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2057vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
2058 const VkClearAttachment *pAttachments, uint32_t rectCount,
2059 const VkClearRect *pRects) {
Chris Forbesd9be82b2015-06-22 17:21:59 +12002060 const VkLayerDispatchTable *disp;
2061
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002062 disp = loader_get_dispatch(commandBuffer);
Chris Forbesd9be82b2015-06-22 17:21:59 +12002063
Jon Ashburn23d36b12016-02-02 17:47:28 -07002064 disp->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments,
2065 rectCount, pRects);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002066}
2067
Jon Ashburn23d36b12016-02-02 17:47:28 -07002068LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2069vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage,
2070 VkImageLayout srcImageLayout, VkImage dstImage,
2071 VkImageLayout dstImageLayout, uint32_t regionCount,
2072 const VkImageResolve *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002073 const VkLayerDispatchTable *disp;
2074
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002075 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002076
Jon Ashburn23d36b12016-02-02 17:47:28 -07002077 disp->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage,
2078 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002079}
2080
Jon Ashburn23d36b12016-02-02 17:47:28 -07002081LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2082vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event,
2083 VkPipelineStageFlags stageMask) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002084 const VkLayerDispatchTable *disp;
2085
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002086 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002087
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002088 disp->CmdSetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002089}
2090
Jon Ashburn23d36b12016-02-02 17:47:28 -07002091LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2092vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event,
2093 VkPipelineStageFlags stageMask) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002094 const VkLayerDispatchTable *disp;
2095
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002096 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002097
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002098 disp->CmdResetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002099}
2100
Jon Ashburn23d36b12016-02-02 17:47:28 -07002101LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2102vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount,
2103 const VkEvent *pEvents, VkPipelineStageFlags sourceStageMask,
2104 VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount,
2105 const VkMemoryBarrier *pMemoryBarriers,
2106 uint32_t bufferMemoryBarrierCount,
2107 const VkBufferMemoryBarrier *pBufferMemoryBarriers,
2108 uint32_t imageMemoryBarrierCount,
2109 const VkImageMemoryBarrier *pImageMemoryBarriers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002110 const VkLayerDispatchTable *disp;
2111
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002112 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002113
Jon Ashburnf19916e2016-01-11 13:12:43 -07002114 disp->CmdWaitEvents(commandBuffer, eventCount, pEvents, sourceStageMask,
2115 dstStageMask, memoryBarrierCount, pMemoryBarriers,
2116 bufferMemoryBarrierCount, pBufferMemoryBarriers,
2117 imageMemoryBarrierCount, pImageMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002118}
2119
Jon Ashburnf19916e2016-01-11 13:12:43 -07002120LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier(
Jon Ashburn23d36b12016-02-02 17:47:28 -07002121 VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask,
2122 VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags,
2123 uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers,
2124 uint32_t bufferMemoryBarrierCount,
2125 const VkBufferMemoryBarrier *pBufferMemoryBarriers,
2126 uint32_t imageMemoryBarrierCount,
2127 const VkImageMemoryBarrier *pImageMemoryBarriers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002128 const VkLayerDispatchTable *disp;
2129
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002130 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002131
Jon Ashburn23d36b12016-02-02 17:47:28 -07002132 disp->CmdPipelineBarrier(
2133 commandBuffer, srcStageMask, dstStageMask, dependencyFlags,
2134 memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount,
2135 pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002136}
2137
Jon Ashburn23d36b12016-02-02 17:47:28 -07002138LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2139vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2140 uint32_t slot, VkFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002141 const VkLayerDispatchTable *disp;
2142
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002143 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002144
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002145 disp->CmdBeginQuery(commandBuffer, queryPool, slot, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002146}
2147
Jon Ashburn23d36b12016-02-02 17:47:28 -07002148LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2149vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2150 uint32_t slot) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002151 const VkLayerDispatchTable *disp;
2152
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002153 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002154
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002155 disp->CmdEndQuery(commandBuffer, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002156}
2157
Jon Ashburn23d36b12016-02-02 17:47:28 -07002158LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2159vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2160 uint32_t firstQuery, uint32_t queryCount) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002161 const VkLayerDispatchTable *disp;
2162
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002163 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002164
Jon Ashburn19d3bf12015-12-30 14:06:55 -07002165 disp->CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002166}
2167
Jon Ashburn23d36b12016-02-02 17:47:28 -07002168LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2169vkCmdWriteTimestamp(VkCommandBuffer commandBuffer,
2170 VkPipelineStageFlagBits pipelineStage,
2171 VkQueryPool queryPool, uint32_t slot) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002172 const VkLayerDispatchTable *disp;
2173
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002174 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002175
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002176 disp->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002177}
2178
Jon Ashburn23d36b12016-02-02 17:47:28 -07002179LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2180vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2181 uint32_t firstQuery, uint32_t queryCount,
2182 VkBuffer dstBuffer, VkDeviceSize dstOffset,
2183 VkDeviceSize stride, VkFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002184 const VkLayerDispatchTable *disp;
2185
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002186 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002187
Jon Ashburn23d36b12016-02-02 17:47:28 -07002188 disp->CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery,
2189 queryCount, dstBuffer, dstOffset, stride,
2190 flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002191}
2192
Jon Ashburn23d36b12016-02-02 17:47:28 -07002193LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2194vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout,
2195 VkShaderStageFlags stageFlags, uint32_t offset,
2196 uint32_t size, const void *pValues) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002197 const VkLayerDispatchTable *disp;
2198
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002199 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002200
Jon Ashburn23d36b12016-02-02 17:47:28 -07002201 disp->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size,
2202 pValues);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06002203}
2204
Jon Ashburn23d36b12016-02-02 17:47:28 -07002205LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2206vkCmdBeginRenderPass(VkCommandBuffer commandBuffer,
2207 const VkRenderPassBeginInfo *pRenderPassBegin,
2208 VkSubpassContents contents) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002209 const VkLayerDispatchTable *disp;
2210
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002211 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002212
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002213 disp->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
Chia-I Wu08accc62015-07-07 11:50:03 +08002214}
2215
Jon Ashburn23d36b12016-02-02 17:47:28 -07002216LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2217vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) {
Chia-I Wu08accc62015-07-07 11:50:03 +08002218 const VkLayerDispatchTable *disp;
2219
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002220 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu08accc62015-07-07 11:50:03 +08002221
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002222 disp->CmdNextSubpass(commandBuffer, contents);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002223}
2224
Jon Ashburn23d36b12016-02-02 17:47:28 -07002225LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2226vkCmdEndRenderPass(VkCommandBuffer commandBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002227 const VkLayerDispatchTable *disp;
2228
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002229 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002230
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002231 disp->CmdEndRenderPass(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002232}
2233
Jon Ashburn23d36b12016-02-02 17:47:28 -07002234LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2235vkCmdExecuteCommands(VkCommandBuffer commandBuffer,
2236 uint32_t commandBuffersCount,
2237 const VkCommandBuffer *pCommandBuffers) {
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002238 const VkLayerDispatchTable *disp;
2239
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002240 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002241
Jon Ashburn23d36b12016-02-02 17:47:28 -07002242 disp->CmdExecuteCommands(commandBuffer, commandBuffersCount,
2243 pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002244}