blob: 4d14f581b98ab76b8e9439a1abfbd0b140e563c0 [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"
Mark Lobodzinski317574e2016-08-29 14:21:14 -060033#include "extensions.h"
Jon Ashburn1530c342016-02-26 13:14:27 -070034#include "gpa_helper.h"
35#include "table_ops.h"
Jon Ashburnd55a3942015-05-06 09:02:10 -060036
Jon Ashburn1530c342016-02-26 13:14:27 -070037/* Trampoline entrypoints are in this file for core Vulkan commands */
38/**
39 * Get an instance level or global level entry point address.
40 * @param instance
41 * @param pName
42 * @return
43 * If instance == NULL returns a global level functions only
44 * If instance is valid returns a trampoline entry point for all dispatchable
45 * Vulkan
46 * functions both core and extensions.
47 */
48LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
49vkGetInstanceProcAddr(VkInstance instance, const char *pName) {
50
51 void *addr;
52
53 addr = globalGetProcAddr(pName);
54 if (instance == VK_NULL_HANDLE) {
55 // get entrypoint addresses that are global (no dispatchable object)
56
57 return addr;
58 } else {
59 // if a global entrypoint return NULL
60 if (addr)
61 return NULL;
62 }
63
64 struct loader_instance *ptr_instance = loader_get_instance(instance);
65 if (ptr_instance == NULL)
66 return NULL;
67 // Return trampoline code for non-global entrypoints including any
68 // extensions.
69 // Device extensions are returned if a layer or ICD supports the extension.
70 // Instance extensions are returned if the extension is enabled and the
Michael Jurka5c16c002016-12-19 16:31:43 +010071 // loader or someone else supports the extension
Jon Ashburn1530c342016-02-26 13:14:27 -070072 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;
Mark Young0153e0b2016-11-03 14:27:13 -0600123 struct loader_icd_tramp_list icd_tramp_list;
Jon Ashburn1530c342016-02-26 13:14:27 -0700124 uint32_t copy_size;
Mark Young0ad83132016-06-30 13:02:42 -0600125 VkResult res = VK_SUCCESS;
Jon Ashburn1530c342016-02-26 13:14:27 -0700126
127 tls_instance = NULL;
Jon Ashburnb8726962016-04-08 15:03:35 -0600128 memset(&local_ext_list, 0, sizeof(local_ext_list));
Jon Ashburn1530c342016-02-26 13:14:27 -0700129 memset(&instance_layers, 0, sizeof(instance_layers));
130 loader_platform_thread_once(&once_init, loader_initialize);
131
132 /* get layer libraries if needed */
133 if (pLayerName && strlen(pLayerName) != 0) {
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600134 if (vk_string_validate(MaxLoaderStringLength, pLayerName) !=
Jon Ashburn1530c342016-02-26 13:14:27 -0700135 VK_STRING_ERROR_NONE) {
Jon Ashburn1530c342016-02-26 13:14:27 -0700136 assert(VK_FALSE && "vkEnumerateInstanceExtensionProperties: "
137 "pLayerName is too long or is badly formed");
Mark Young0ad83132016-06-30 13:02:42 -0600138 res = VK_ERROR_EXTENSION_NOT_PRESENT;
139 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700140 }
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600141
Jon Ashburn491cd042016-05-16 14:01:18 -0600142 loader_layer_scan(NULL, &instance_layers);
Jon Ashburnb8726962016-04-08 15:03:35 -0600143 if (strcmp(pLayerName, std_validation_str) == 0) {
144 struct loader_layer_list local_list;
145 memset(&local_list, 0, sizeof(local_list));
146 for (uint32_t i = 0; i < sizeof(std_validation_names) /
147 sizeof(std_validation_names[0]);
148 i++) {
149 loader_find_layer_name_add_list(NULL, std_validation_names[i],
150 VK_LAYER_TYPE_INSTANCE_EXPLICIT,
151 &instance_layers, &local_list);
152 }
153 for (uint32_t i = 0; i < local_list.count; i++) {
154 struct loader_extension_list *ext_list =
Jon Ashburncc407a22016-04-15 09:25:03 -0600155 &local_list.list[i].instance_extension_list;
Jon Ashburnb8726962016-04-08 15:03:35 -0600156 loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count,
157 ext_list->list);
158 }
Mark Youngd9ccdd32016-08-01 11:34:36 -0600159 loader_destroy_layer_list(NULL, NULL, &local_list);
Jon Ashburnb8726962016-04-08 15:03:35 -0600160 global_ext_list = &local_ext_list;
161
162 } else {
163 for (uint32_t i = 0; i < instance_layers.count; i++) {
164 struct loader_layer_properties *props =
165 &instance_layers.list[i];
166 if (strcmp(props->info.layerName, pLayerName) == 0) {
167 global_ext_list = &props->instance_extension_list;
168 break;
169 }
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600170 }
171 }
Jon Ashburn1530c342016-02-26 13:14:27 -0700172 } else {
173 /* Scan/discover all ICD libraries */
Mark Young0153e0b2016-11-03 14:27:13 -0600174 memset(&icd_tramp_list, 0, sizeof(struct loader_icd_tramp_list));
175 res = loader_icd_scan(NULL, &icd_tramp_list);
Mark Young0ad83132016-06-30 13:02:42 -0600176 if (VK_SUCCESS != res) {
177 goto out;
178 }
Jon Ashburn1530c342016-02-26 13:14:27 -0700179 /* get extensions from all ICD's, merge so no duplicates */
Mark Young0153e0b2016-11-03 14:27:13 -0600180 res = loader_get_icd_loader_instance_extensions(NULL, &icd_tramp_list,
Mark Young3a587792016-08-19 15:25:08 -0600181 &local_ext_list);
182 if (VK_SUCCESS != res) {
183 goto out;
184 }
Mark Young0153e0b2016-11-03 14:27:13 -0600185 loader_scanned_icd_clear(NULL, &icd_tramp_list);
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600186
187 // Append implicit layers.
Jon Ashburn491cd042016-05-16 14:01:18 -0600188 loader_implicit_layer_scan(NULL, &instance_layers);
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600189 for (uint32_t i = 0; i < instance_layers.count; i++) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600190 struct loader_extension_list *ext_list =
191 &instance_layers.list[i].instance_extension_list;
192 loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count,
193 ext_list->list);
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600194 }
195
Jon Ashburnb8726962016-04-08 15:03:35 -0600196 global_ext_list = &local_ext_list;
Jon Ashburn1530c342016-02-26 13:14:27 -0700197 }
198
199 if (global_ext_list == NULL) {
Mark Young0ad83132016-06-30 13:02:42 -0600200 res = VK_ERROR_LAYER_NOT_PRESENT;
201 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700202 }
203
204 if (pProperties == NULL) {
205 *pPropertyCount = global_ext_list->count;
Mark Young0ad83132016-06-30 13:02:42 -0600206 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700207 }
208
209 copy_size = *pPropertyCount < global_ext_list->count
210 ? *pPropertyCount
211 : global_ext_list->count;
212 for (uint32_t i = 0; i < copy_size; i++) {
213 memcpy(&pProperties[i], &global_ext_list->list[i],
214 sizeof(VkExtensionProperties));
215 }
216 *pPropertyCount = copy_size;
Jon Ashburn1530c342016-02-26 13:14:27 -0700217
218 if (copy_size < global_ext_list->count) {
Mark Young0ad83132016-06-30 13:02:42 -0600219 res = VK_INCOMPLETE;
220 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700221 }
222
Mark Young0ad83132016-06-30 13:02:42 -0600223out:
Mark Young6267ae62017-01-12 12:27:19 -0700224
Mark Young0153e0b2016-11-03 14:27:13 -0600225 loader_destroy_generic_list(NULL,
226 (struct loader_generic_list *)&local_ext_list);
davidhubbard36831082016-07-27 17:59:58 -0700227 loader_delete_layer_properties(NULL, &instance_layers);
Mark Young0ad83132016-06-30 13:02:42 -0600228 return res;
Jon Ashburn1530c342016-02-26 13:14:27 -0700229}
230
Mark Young0153e0b2016-11-03 14:27:13 -0600231LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(
232 uint32_t *pPropertyCount, VkLayerProperties *pProperties) {
Jon Ashburn1530c342016-02-26 13:14:27 -0700233
234 struct loader_layer_list instance_layer_list;
235 tls_instance = NULL;
236
237 loader_platform_thread_once(&once_init, loader_initialize);
238
239 uint32_t copy_size;
240
241 /* get layer libraries */
242 memset(&instance_layer_list, 0, sizeof(instance_layer_list));
Jon Ashburn491cd042016-05-16 14:01:18 -0600243 loader_layer_scan(NULL, &instance_layer_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700244
245 if (pProperties == NULL) {
246 *pPropertyCount = instance_layer_list.count;
Mark Young0ad83132016-06-30 13:02:42 -0600247 loader_destroy_layer_list(NULL, NULL, &instance_layer_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700248 return VK_SUCCESS;
249 }
250
251 copy_size = (*pPropertyCount < instance_layer_list.count)
252 ? *pPropertyCount
253 : instance_layer_list.count;
254 for (uint32_t i = 0; i < copy_size; i++) {
255 memcpy(&pProperties[i], &instance_layer_list.list[i].info,
256 sizeof(VkLayerProperties));
257 }
258
259 *pPropertyCount = copy_size;
Jon Ashburn1530c342016-02-26 13:14:27 -0700260
261 if (copy_size < instance_layer_list.count) {
Jeremy Hayese852f132016-07-06 12:02:03 -0600262 loader_destroy_layer_list(NULL, NULL, &instance_layer_list);
Jon Ashburn1530c342016-02-26 13:14:27 -0700263 return VK_INCOMPLETE;
264 }
265
Jeremy Hayese852f132016-07-06 12:02:03 -0600266 loader_destroy_layer_list(NULL, NULL, &instance_layer_list);
267
Jon Ashburn1530c342016-02-26 13:14:27 -0700268 return VK_SUCCESS;
269}
270
Mark Young0ad83132016-06-30 13:02:42 -0600271LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(
272 const VkInstanceCreateInfo *pCreateInfo,
273 const VkAllocationCallbacks *pAllocator, VkInstance *pInstance) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600274 struct loader_instance *ptr_instance = NULL;
Jon Ashburne5b9bba2016-01-18 12:20:03 -0700275 VkInstance created_instance = VK_NULL_HANDLE;
Mark Young0ad83132016-06-30 13:02:42 -0600276 bool loaderLocked = false;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600277 VkResult res = VK_ERROR_INITIALIZATION_FAILED;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600278
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600279 loader_platform_thread_once(&once_init, loader_initialize);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600280
Mark Young0ad83132016-06-30 13:02:42 -0600281#if (DEBUG_DISABLE_APP_ALLOCATORS == 1)
282 {
283#else
284 if (pAllocator) {
285 ptr_instance = (struct loader_instance *)pAllocator->pfnAllocation(
286 pAllocator->pUserData, sizeof(struct loader_instance),
287 sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600288 } else {
Jon Ashburnf9af1d32016-01-25 14:51:47 -0700289#endif
Mark Young0ad83132016-06-30 13:02:42 -0600290 ptr_instance =
291 (struct loader_instance *)malloc(sizeof(struct loader_instance));
292 }
293
294 VkInstanceCreateInfo ici = *pCreateInfo;
295
Jon Ashburn27cd5842015-05-12 17:26:48 -0600296 if (ptr_instance == NULL) {
Mark Young0ad83132016-06-30 13:02:42 -0600297 res = VK_ERROR_OUT_OF_HOST_MEMORY;
298 goto out;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600299 }
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600300
Jon Ashburn87d6aa92015-08-28 15:19:27 -0600301 tls_instance = ptr_instance;
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600302 loader_platform_thread_lock_mutex(&loader_lock);
Mark Young0ad83132016-06-30 13:02:42 -0600303 loaderLocked = true;
Jon Ashburnb82c1852015-08-11 14:49:54 -0600304 memset(ptr_instance, 0, sizeof(struct loader_instance));
Chia-I Wuf7458c52015-10-26 21:10:41 +0800305 if (pAllocator) {
306 ptr_instance->alloc_callbacks = *pAllocator;
Courtney Goeltzenleuchter7f5aafc2015-07-05 11:28:29 -0600307 }
308
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700309 /*
Ian Elliottad6300f2016-03-31 10:48:19 -0600310 * Look for one or more debug report create info structures
311 * and setup a callback(s) for each one found.
Courtney Goeltzenleuchter45cde5d2015-12-03 13:45:51 -0700312 */
Ian Elliottad6300f2016-03-31 10:48:19 -0600313 ptr_instance->num_tmp_callbacks = 0;
314 ptr_instance->tmp_dbg_create_infos = NULL;
315 ptr_instance->tmp_callbacks = NULL;
Jon Ashburncc407a22016-04-15 09:25:03 -0600316 if (util_CopyDebugReportCreateInfos(pCreateInfo->pNext, 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 // One or more were found, but allocation failed. Therefore, clean up
321 // and fail this function:
Mark Young0ad83132016-06-30 13:02:42 -0600322 res = VK_ERROR_OUT_OF_HOST_MEMORY;
323 goto out;
Ian Elliottad6300f2016-03-31 10:48:19 -0600324 } else if (ptr_instance->num_tmp_callbacks > 0) {
325 // Setup the temporary callback(s) here to catch early issues:
Jon Ashburncc407a22016-04-15 09:25:03 -0600326 if (util_CreateDebugReportCallbacks(ptr_instance, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600327 ptr_instance->num_tmp_callbacks,
328 ptr_instance->tmp_dbg_create_infos,
329 ptr_instance->tmp_callbacks)) {
330 // Failure of setting up one or more of the callback. Therefore,
331 // clean up and fail this function:
Mark Young0ad83132016-06-30 13:02:42 -0600332 res = VK_ERROR_OUT_OF_HOST_MEMORY;
333 goto out;
Courtney Goeltzenleuchter82887272015-12-02 15:29:33 -0700334 }
335 }
336
Jon Ashburn3d002332015-08-20 16:35:30 -0600337 /* Due to implicit layers need to get layer list even if
Jon Ashburnf19916e2016-01-11 13:12:43 -0700338 * enabledLayerCount == 0 and VK_INSTANCE_LAYERS is unset. For now always
Jon Ashburn491cd042016-05-16 14:01:18 -0600339 * get layer list via loader_layer_scan(). */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700340 memset(&ptr_instance->instance_layer_list, 0,
341 sizeof(ptr_instance->instance_layer_list));
Jon Ashburn491cd042016-05-16 14:01:18 -0600342 loader_layer_scan(ptr_instance, &ptr_instance->instance_layer_list);
Jon Ashburn3d002332015-08-20 16:35:30 -0600343
344 /* validate the app requested layers to be enabled */
Jon Ashburnf19916e2016-01-11 13:12:43 -0700345 if (pCreateInfo->enabledLayerCount > 0) {
Jon Ashburnf2b4e382016-02-10 20:50:19 -0700346 res =
347 loader_validate_layers(ptr_instance, pCreateInfo->enabledLayerCount,
348 pCreateInfo->ppEnabledLayerNames,
349 &ptr_instance->instance_layer_list);
Jon Ashburn3d002332015-08-20 16:35:30 -0600350 if (res != VK_SUCCESS) {
Mark Young0ad83132016-06-30 13:02:42 -0600351 goto out;
Jon Ashburn3d002332015-08-20 16:35:30 -0600352 }
353 }
354
Jon Ashburn86a527a2016-02-10 20:59:26 -0700355 /* convert any meta layers to the actual layers makes a copy of layer name*/
Mark Young0ad83132016-06-30 13:02:42 -0600356 VkResult layerErr = loader_expand_layer_names(
Jon Ashburn86a527a2016-02-10 20:59:26 -0700357 ptr_instance, std_validation_str,
358 sizeof(std_validation_names) / sizeof(std_validation_names[0]),
Jon Ashburncc407a22016-04-15 09:25:03 -0600359 std_validation_names, &ici.enabledLayerCount, &ici.ppEnabledLayerNames);
Mark Young0ad83132016-06-30 13:02:42 -0600360 if (VK_SUCCESS != layerErr) {
361 res = layerErr;
362 goto out;
363 }
Jon Ashburn86a527a2016-02-10 20:59:26 -0700364
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600365 /* Scan/discover all ICD libraries */
Mark Young0153e0b2016-11-03 14:27:13 -0600366 memset(&ptr_instance->icd_tramp_list, 0,
367 sizeof(ptr_instance->icd_tramp_list));
368 res = loader_icd_scan(ptr_instance, &ptr_instance->icd_tramp_list);
Mark Young0ad83132016-06-30 13:02:42 -0600369 if (res != VK_SUCCESS) {
370 goto out;
371 }
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600372
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600373 /* get extensions from all ICD's, merge so no duplicates, then validate */
Mark Young3a587792016-08-19 15:25:08 -0600374 res = loader_get_icd_loader_instance_extensions(
Mark Young0153e0b2016-11-03 14:27:13 -0600375 ptr_instance, &ptr_instance->icd_tramp_list, &ptr_instance->ext_list);
Mark Young3a587792016-08-19 15:25:08 -0600376 if (res != VK_SUCCESS) {
377 goto out;
378 }
Jon Ashburn23d36b12016-02-02 17:47:28 -0700379 res = loader_validate_instance_extensions(
Jon Ashburnf2b4e382016-02-10 20:50:19 -0700380 ptr_instance, &ptr_instance->ext_list,
Chris Forbesbd9de052016-04-06 20:49:02 +1200381 &ptr_instance->instance_layer_list, &ici);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600382 if (res != VK_SUCCESS) {
Mark Young0ad83132016-06-30 13:02:42 -0600383 goto out;
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600384 }
385
Mark Young0ad83132016-06-30 13:02:42 -0600386 ptr_instance->disp = loader_instance_heap_alloc(
387 ptr_instance, sizeof(VkLayerInstanceDispatchTable),
388 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600389 if (ptr_instance->disp == NULL) {
Mark Youngb6399312017-01-10 14:22:15 -0700390 loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
391 "vkCreateInstance: Failed to allocate Instance dispatch"
392 " table.");
Mark Young0ad83132016-06-30 13:02:42 -0600393 res = VK_ERROR_OUT_OF_HOST_MEMORY;
394 goto out;
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600395 }
396 memcpy(ptr_instance->disp, &instance_disp, sizeof(instance_disp));
397 ptr_instance->next = loader.instances;
398 loader.instances = ptr_instance;
399
Jon Ashburnb82c1852015-08-11 14:49:54 -0600400 /* activate any layers on instance chain */
Chris Forbesbd9de052016-04-06 20:49:02 +1200401 res = loader_enable_instance_layers(ptr_instance, &ici,
Jon Ashburne39a4f82015-08-28 13:38:21 -0600402 &ptr_instance->instance_layer_list);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600403 if (res != VK_SUCCESS) {
Mark Young0ad83132016-06-30 13:02:42 -0600404 goto out;
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600405 }
Jon Ashburn07daee72015-05-21 18:13:33 -0600406
Jon Ashburn23d36b12016-02-02 17:47:28 -0700407 created_instance = (VkInstance)ptr_instance;
Chris Forbesbd9de052016-04-06 20:49:02 +1200408 res = loader_create_instance_chain(&ici, pAllocator, ptr_instance,
Jon Ashburn6e0a2132016-02-03 12:37:30 -0700409 &created_instance);
Jon Ashburneed0c002015-05-21 17:42:17 -0600410
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700411 if (res == VK_SUCCESS) {
Mark Young39389872017-01-19 21:10:49 -0700412 memset(ptr_instance->enabled_known_extensions.padding, 0, sizeof(uint64_t) * 4);
413
Chris Forbesbd9de052016-04-06 20:49:02 +1200414 wsi_create_instance(ptr_instance, &ici);
415 debug_report_create_instance(ptr_instance, &ici);
Mark Lobodzinski317574e2016-08-29 14:21:14 -0600416 extensions_create_instance(ptr_instance, &ici);
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700417
Jon Ashburne5b9bba2016-01-18 12:20:03 -0700418 *pInstance = created_instance;
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700419
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700420 /*
421 * Finally have the layers in place and everyone has seen
422 * the CreateInstance command go by. This allows the layer's
423 * GetInstanceProcAddr functions to return valid extension functions
424 * if enabled.
425 */
426 loader_activate_instance_layer_extensions(ptr_instance, *pInstance);
427 }
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700428
Mark Young0ad83132016-06-30 13:02:42 -0600429out:
430
431 if (NULL != ptr_instance) {
432 if (res != VK_SUCCESS) {
433 if (NULL != ptr_instance->next) {
434 loader.instances = ptr_instance->next;
435 }
436 if (NULL != ptr_instance->disp) {
437 loader_instance_heap_free(ptr_instance, ptr_instance->disp);
438 }
439 if (ptr_instance->num_tmp_callbacks > 0) {
440 util_DestroyDebugReportCallbacks(
441 ptr_instance, pAllocator, ptr_instance->num_tmp_callbacks,
442 ptr_instance->tmp_callbacks);
443 util_FreeDebugReportCreateInfos(
444 pAllocator, ptr_instance->tmp_dbg_create_infos,
445 ptr_instance->tmp_callbacks);
446 }
447
448 loader_deactivate_layers(ptr_instance, NULL,
449 &ptr_instance->activated_layer_list);
450
451 loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo,
452 &ici);
453 loader_delete_layer_properties(ptr_instance,
454 &ptr_instance->instance_layer_list);
Mark Young0153e0b2016-11-03 14:27:13 -0600455 loader_scanned_icd_clear(ptr_instance,
456 &ptr_instance->icd_tramp_list);
Mark Young0ad83132016-06-30 13:02:42 -0600457 loader_destroy_generic_list(
458 ptr_instance,
459 (struct loader_generic_list *)&ptr_instance->ext_list);
460
461 loader_instance_heap_free(ptr_instance, ptr_instance);
462 } else {
463 /* Remove temporary debug_report callback */
464 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
465 ptr_instance->num_tmp_callbacks,
466 ptr_instance->tmp_callbacks);
467 loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo,
468 &ici);
469 }
470
471 if (loaderLocked) {
472 loader_platform_thread_unlock_mutex(&loader_lock);
473 }
474 }
475
Jon Ashburn27cd5842015-05-12 17:26:48 -0600476 return res;
477}
478
Mark Young0ad83132016-06-30 13:02:42 -0600479LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(
480 VkInstance instance, const VkAllocationCallbacks *pAllocator) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600481 const VkLayerInstanceDispatchTable *disp;
Jon Ashburne0e64572015-09-30 12:56:42 -0600482 struct loader_instance *ptr_instance = NULL;
Ian Elliott3b354cf2016-03-25 08:43:01 -0600483 bool callback_setup = false;
484
Jeremy Hayesd8726c22016-04-21 13:19:41 -0600485 if (instance == VK_NULL_HANDLE) {
486 return;
487 }
488
Mark Young39389872017-01-19 21:10:49 -0700489 disp = loader_get_instance_layer_dispatch(instance);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600490
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600491 loader_platform_thread_lock_mutex(&loader_lock);
492
Jon Ashburne0e64572015-09-30 12:56:42 -0600493 ptr_instance = loader_get_instance(instance);
Ian Elliott3b354cf2016-03-25 08:43:01 -0600494
Mark Young0ad83132016-06-30 13:02:42 -0600495 if (pAllocator) {
496 ptr_instance->alloc_callbacks = *pAllocator;
497 }
498
Ian Elliottad6300f2016-03-31 10:48:19 -0600499 if (ptr_instance->num_tmp_callbacks > 0) {
500 // Setup the temporary callback(s) here to catch cleanup issues:
Jon Ashburncc407a22016-04-15 09:25:03 -0600501 if (!util_CreateDebugReportCallbacks(ptr_instance, pAllocator,
502 ptr_instance->num_tmp_callbacks,
503 ptr_instance->tmp_dbg_create_infos,
504 ptr_instance->tmp_callbacks)) {
Ian Elliott3b354cf2016-03-25 08:43:01 -0600505 callback_setup = true;
506 }
507 }
508
Chia-I Wuf7458c52015-10-26 21:10:41 +0800509 disp->DestroyInstance(instance, pAllocator);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600510
Mark Young0ad83132016-06-30 13:02:42 -0600511 loader_deactivate_layers(ptr_instance, NULL,
512 &ptr_instance->activated_layer_list);
Mark Young39389872017-01-19 21:10:49 -0700513
Mark Young0153e0b2016-11-03 14:27:13 -0600514 if (ptr_instance->phys_devs_tramp) {
Lenny Komowb9f70c32016-12-19 17:11:40 -0700515 for (uint32_t i = 0; i < ptr_instance->phys_dev_count_tramp; i++) {
516 loader_instance_heap_free(ptr_instance,
517 ptr_instance->phys_devs_tramp[i]);
518 }
Mark Young0153e0b2016-11-03 14:27:13 -0600519 loader_instance_heap_free(ptr_instance, ptr_instance->phys_devs_tramp);
Mark Young0ad83132016-06-30 13:02:42 -0600520 }
Mark Young39389872017-01-19 21:10:49 -0700521
Ian Elliott3b354cf2016-03-25 08:43:01 -0600522 if (callback_setup) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600523 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600524 ptr_instance->num_tmp_callbacks,
525 ptr_instance->tmp_callbacks);
526 util_FreeDebugReportCreateInfos(pAllocator,
527 ptr_instance->tmp_dbg_create_infos,
528 ptr_instance->tmp_callbacks);
Ian Elliott3b354cf2016-03-25 08:43:01 -0600529 }
Mark Young0ad83132016-06-30 13:02:42 -0600530 loader_instance_heap_free(ptr_instance, ptr_instance->disp);
531 loader_instance_heap_free(ptr_instance, ptr_instance);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600532 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600533}
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600534
Jon Ashburn23d36b12016-02-02 17:47:28 -0700535LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
536vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount,
537 VkPhysicalDevice *pPhysicalDevices) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600538 const VkLayerInstanceDispatchTable *disp;
Mark Youngd8382d72016-12-23 16:59:58 -0700539 VkResult res = VK_SUCCESS;
Mark Young6267ae62017-01-12 12:27:19 -0700540 uint32_t count, i;
541 struct loader_instance *inst;
Mark Young39389872017-01-19 21:10:49 -0700542 disp = loader_get_instance_layer_dispatch(instance);
Mark Youngd8382d72016-12-23 16:59:58 -0700543
Mark Young6267ae62017-01-12 12:27:19 -0700544 loader_platform_thread_lock_mutex(&loader_lock);
545
546 inst = loader_get_instance(instance);
Mark Youngd8382d72016-12-23 16:59:58 -0700547 if (NULL == inst) {
548 res = VK_ERROR_INITIALIZATION_FAILED;
549 goto out;
550 }
551
Mark Young6267ae62017-01-12 12:27:19 -0700552 if (pPhysicalDevices == NULL) {
553 // Call down. At the lower levels, this will setup the terminator
554 // structures in the loader.
555 res = disp->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount,
556 pPhysicalDevices);
557 if (VK_SUCCESS != res) {
558 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
559 "vkEnumeratePhysicalDevices: Failed in dispatch call"
560 " used to determine number of available GPUs");
Lenny Komowb9f70c32016-12-19 17:11:40 -0700561 }
Jon Ashburn014438f2016-03-01 19:51:07 -0700562
Mark Young6267ae62017-01-12 12:27:19 -0700563 // Goto out, even on success since we don't need to fill in the rest.
564 goto out;
565 }
566
567 VkResult setup_res = setupLoaderTrampPhysDevs(instance);
568 if (setup_res != VK_SUCCESS && setup_res != VK_INCOMPLETE) {
569 res = setup_res;
570 goto out;
571 }
572
573 // Wrap the PhysDev object for loader usage, return wrapped objects
574 if (inst->total_gpu_count > *pPhysicalDeviceCount) {
575 loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0,
576 "vkEnumeratePhysicalDevices: Trimming device count down"
577 " by application request from %d to %d physical devices",
578 inst->total_gpu_count, *pPhysicalDeviceCount);
579 count = *pPhysicalDeviceCount;
580 res = VK_INCOMPLETE;
581 } else {
582 count = inst->total_gpu_count;
583 *pPhysicalDeviceCount = count;
584 }
585
586 for (i = 0; i < count; i++) {
587 pPhysicalDevices[i] = (VkPhysicalDevice)inst->phys_devs_tramp[i];
Jon Ashburn014438f2016-03-01 19:51:07 -0700588 }
Lenny Komowb9f70c32016-12-19 17:11:40 -0700589
Lenny Komowa5e01122016-12-22 15:29:43 -0700590out:
Mark Youngd8382d72016-12-23 16:59:58 -0700591
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600592 loader_platform_thread_unlock_mutex(&loader_lock);
593 return res;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600594}
595
Mark Young0153e0b2016-11-03 14:27:13 -0600596LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures(
597 VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600598 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700599 VkPhysicalDevice unwrapped_phys_dev =
600 loader_unwrap_physical_device(physicalDevice);
Mark Young39389872017-01-19 21:10:49 -0700601 disp = loader_get_instance_layer_dispatch(physicalDevice);
Jon Ashburn014438f2016-03-01 19:51:07 -0700602 disp->GetPhysicalDeviceFeatures(unwrapped_phys_dev, pFeatures);
Jon Ashburn754864f2015-07-23 18:49:07 -0600603}
604
Mark Young0153e0b2016-11-03 14:27:13 -0600605LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(
606 VkPhysicalDevice physicalDevice, VkFormat format,
607 VkFormatProperties *pFormatInfo) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600608 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700609 VkPhysicalDevice unwrapped_pd =
610 loader_unwrap_physical_device(physicalDevice);
Mark Young39389872017-01-19 21:10:49 -0700611 disp = loader_get_instance_layer_dispatch(physicalDevice);
Jon Ashburn014438f2016-03-01 19:51:07 -0700612 disp->GetPhysicalDeviceFormatProperties(unwrapped_pd, format, pFormatInfo);
Jon Ashburn754864f2015-07-23 18:49:07 -0600613}
614
Jon Ashburn23d36b12016-02-02 17:47:28 -0700615LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
616vkGetPhysicalDeviceImageFormatProperties(
617 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
618 VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
619 VkImageFormatProperties *pImageFormatProperties) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600620 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700621 VkPhysicalDevice unwrapped_phys_dev =
622 loader_unwrap_physical_device(physicalDevice);
Mark Young39389872017-01-19 21:10:49 -0700623 disp = loader_get_instance_layer_dispatch(physicalDevice);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700624 return disp->GetPhysicalDeviceImageFormatProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700625 unwrapped_phys_dev, format, type, tiling, usage, flags,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700626 pImageFormatProperties);
Jon Ashburn754864f2015-07-23 18:49:07 -0600627}
628
Mark Young0153e0b2016-11-03 14:27:13 -0600629LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(
630 VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties) {
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600631 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700632 VkPhysicalDevice unwrapped_phys_dev =
633 loader_unwrap_physical_device(physicalDevice);
Mark Young39389872017-01-19 21:10:49 -0700634 disp = loader_get_instance_layer_dispatch(physicalDevice);
Jon Ashburn014438f2016-03-01 19:51:07 -0700635 disp->GetPhysicalDeviceProperties(unwrapped_phys_dev, pProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600636}
637
Jon Ashburn23d36b12016-02-02 17:47:28 -0700638LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
639vkGetPhysicalDeviceQueueFamilyProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700640 VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700641 VkQueueFamilyProperties *pQueueProperties) {
Tony Barbour59a47322015-06-24 16:06:58 -0600642 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700643 VkPhysicalDevice unwrapped_phys_dev =
644 loader_unwrap_physical_device(physicalDevice);
Mark Young39389872017-01-19 21:10:49 -0700645 disp = loader_get_instance_layer_dispatch(physicalDevice);
Jon Ashburn014438f2016-03-01 19:51:07 -0700646 disp->GetPhysicalDeviceQueueFamilyProperties(
647 unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600648}
649
Chia-I Wu9ab61502015-11-06 06:42:02 +0800650LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700651 VkPhysicalDevice physicalDevice,
652 VkPhysicalDeviceMemoryProperties *pMemoryProperties) {
Tony Barbour59a47322015-06-24 16:06:58 -0600653 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700654 VkPhysicalDevice unwrapped_phys_dev =
655 loader_unwrap_physical_device(physicalDevice);
Mark Young39389872017-01-19 21:10:49 -0700656 disp = loader_get_instance_layer_dispatch(physicalDevice);
Jon Ashburn014438f2016-03-01 19:51:07 -0700657 disp->GetPhysicalDeviceMemoryProperties(unwrapped_phys_dev,
658 pMemoryProperties);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600659}
660
Mark Young0ad83132016-06-30 13:02:42 -0600661LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(
662 VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
663 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600664 VkResult res;
Mark Young0ad83132016-06-30 13:02:42 -0600665 struct loader_physical_device_tramp *phys_dev = NULL;
666 struct loader_device *dev = NULL;
667 struct loader_instance *inst = NULL;
Jon Ashburn1530c342016-02-26 13:14:27 -0700668
669 assert(pCreateInfo->queueCreateInfoCount >= 1);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600670
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600671 loader_platform_thread_lock_mutex(&loader_lock);
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600672
Jon Ashburn787eb252016-03-24 15:49:57 -0600673 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Piers Daniell295fe402016-03-29 11:51:11 -0600674 inst = (struct loader_instance *)phys_dev->this_instance;
Jon Ashburn1530c342016-02-26 13:14:27 -0700675
Jon Ashburn014438f2016-03-01 19:51:07 -0700676 /* Get the physical device (ICD) extensions */
677 struct loader_extension_list icd_exts;
Mark Young0ad83132016-06-30 13:02:42 -0600678 icd_exts.list = NULL;
Mark Young3a587792016-08-19 15:25:08 -0600679 res =
680 loader_init_generic_list(inst, (struct loader_generic_list *)&icd_exts,
681 sizeof(VkExtensionProperties));
682 if (VK_SUCCESS != res) {
Mark Youngb6399312017-01-10 14:22:15 -0700683 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
684 "vkCreateDevice: Failed to create ICD extension list");
Mark Young0ad83132016-06-30 13:02:42 -0600685 goto out;
Jon Ashburn014438f2016-03-01 19:51:07 -0700686 }
Jon Ashburn1530c342016-02-26 13:14:27 -0700687
Jon Ashburn014438f2016-03-01 19:51:07 -0700688 res = loader_add_device_extensions(
Mark Young39389872017-01-19 21:10:49 -0700689 inst, inst->disp->layer_inst_disp.EnumerateDeviceExtensionProperties,
Jon Ashburncc407a22016-04-15 09:25:03 -0600690 phys_dev->phys_dev, "Unknown", &icd_exts);
Jon Ashburn014438f2016-03-01 19:51:07 -0700691 if (res != VK_SUCCESS) {
Mark Youngb6399312017-01-10 14:22:15 -0700692 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
693 "vkCreateDevice: Failed to add extensions to list");
Mark Young0ad83132016-06-30 13:02:42 -0600694 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700695 }
696
Jon Ashburn1530c342016-02-26 13:14:27 -0700697 /* make sure requested extensions to be enabled are supported */
Mark Young0ad83132016-06-30 13:02:42 -0600698 res = loader_validate_device_extensions(
699 phys_dev, &inst->activated_layer_list, &icd_exts, pCreateInfo);
Jon Ashburn1530c342016-02-26 13:14:27 -0700700 if (res != VK_SUCCESS) {
Mark Youngb6399312017-01-10 14:22:15 -0700701 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
702 "vkCreateDevice: Failed to validate extensions in list");
Mark Young0ad83132016-06-30 13:02:42 -0600703 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700704 }
705
Mark Young0ad83132016-06-30 13:02:42 -0600706 dev = loader_create_logical_device(inst, pAllocator);
Jon Ashburn1530c342016-02-26 13:14:27 -0700707 if (dev == NULL) {
Mark Young0ad83132016-06-30 13:02:42 -0600708 res = VK_ERROR_OUT_OF_HOST_MEMORY;
709 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700710 }
711
Jon Ashburn491cd042016-05-16 14:01:18 -0600712 /* copy the instance layer list into the device */
713 dev->activated_layer_list.capacity = inst->activated_layer_list.capacity;
714 dev->activated_layer_list.count = inst->activated_layer_list.count;
Mark Young0ad83132016-06-30 13:02:42 -0600715 dev->activated_layer_list.list =
716 loader_device_heap_alloc(dev, inst->activated_layer_list.capacity,
717 VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
Jon Ashburn491cd042016-05-16 14:01:18 -0600718 if (dev->activated_layer_list.list == NULL) {
Mark Youngb6399312017-01-10 14:22:15 -0700719 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
720 "vkCreateDevice: Failed to allocate activated layer"
721 "list of size %d.",
722 inst->activated_layer_list.capacity);
Mark Young0ad83132016-06-30 13:02:42 -0600723 res = VK_ERROR_OUT_OF_HOST_MEMORY;
724 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700725 }
Jon Ashburn491cd042016-05-16 14:01:18 -0600726 memcpy(dev->activated_layer_list.list, inst->activated_layer_list.list,
Mark Young0ad83132016-06-30 13:02:42 -0600727 sizeof(*dev->activated_layer_list.list) *
728 dev->activated_layer_list.count);
Jon Ashburn1530c342016-02-26 13:14:27 -0700729
Mark Young0ad83132016-06-30 13:02:42 -0600730 res = loader_create_device_chain(phys_dev, pCreateInfo, pAllocator, inst,
731 dev);
Jon Ashburn1530c342016-02-26 13:14:27 -0700732 if (res != VK_SUCCESS) {
Mark Youngb6399312017-01-10 14:22:15 -0700733 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
734 "vkCreateDevice: Failed to create device chain.");
Mark Young0ad83132016-06-30 13:02:42 -0600735 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700736 }
737
Mark Young65cb3662016-11-07 13:27:02 -0700738 *pDevice = dev->chain_device;
Jon Ashburn1530c342016-02-26 13:14:27 -0700739
Mark Younga7c51fd2016-09-16 10:18:42 -0600740 // Initialize any device extension dispatch entry's from the instance list
Jon Ashburn1530c342016-02-26 13:14:27 -0700741 loader_init_dispatch_dev_ext(inst, dev);
742
Mark Younga7c51fd2016-09-16 10:18:42 -0600743 // Initialize WSI device extensions as part of core dispatch since loader
744 // has dedicated trampoline code for these*/
Jon Ashburn1530c342016-02-26 13:14:27 -0700745 loader_init_device_extension_dispatch_table(
746 &dev->loader_dispatch,
Mark Younga7c51fd2016-09-16 10:18:42 -0600747 dev->loader_dispatch.core_dispatch.GetDeviceProcAddr, *pDevice);
748
Mark Young0ad83132016-06-30 13:02:42 -0600749out:
750
751 // Failure cleanup
752 if (VK_SUCCESS != res) {
753 if (NULL != dev) {
754 loader_destroy_logical_device(inst, dev, pAllocator);
755 }
756 }
757
758 if (NULL != icd_exts.list) {
759 loader_destroy_generic_list(inst,
760 (struct loader_generic_list *)&icd_exts);
761 }
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600762 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600763 return res;
764}
765
Jon Ashburn23d36b12016-02-02 17:47:28 -0700766LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
767vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600768 const VkLayerDispatchTable *disp;
Jon Ashburne39a4f82015-08-28 13:38:21 -0600769 struct loader_device *dev;
Andrzej Kotlowskib168b1a2016-02-03 09:41:53 +0100770
Jeremy Hayesd8726c22016-04-21 13:19:41 -0600771 if (device == VK_NULL_HANDLE) {
772 return;
773 }
774
Andrzej Kotlowskib168b1a2016-02-03 09:41:53 +0100775 loader_platform_thread_lock_mutex(&loader_lock);
776
Mark Young0153e0b2016-11-03 14:27:13 -0600777 struct loader_icd_term *icd_term =
778 loader_get_icd_and_device(device, &dev, NULL);
779 const struct loader_instance *inst = icd_term->this_instance;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600780 disp = loader_get_dispatch(device);
781
Chia-I Wuf7458c52015-10-26 21:10:41 +0800782 disp->DestroyDevice(device, pAllocator);
Mark Young65cb3662016-11-07 13:27:02 -0700783 dev->chain_device = NULL;
Mark Young65cb3662016-11-07 13:27:02 -0700784 dev->icd_device = NULL;
Mark Young95ed4952016-11-14 15:03:34 -0700785 loader_remove_logical_device(inst, icd_term, dev, pAllocator);
Jon Ashburn781a7ae2015-11-19 15:43:26 -0700786
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600787 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600788}
789
Jon Ashburn23d36b12016-02-02 17:47:28 -0700790LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
791vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
792 const char *pLayerName,
793 uint32_t *pPropertyCount,
794 VkExtensionProperties *pProperties) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700795 VkResult res = VK_SUCCESS;
Jon Ashburn787eb252016-03-24 15:49:57 -0600796 struct loader_physical_device_tramp *phys_dev;
797 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600798
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600799 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700800
801 /* If pLayerName == NULL, then querying ICD extensions, pass this call
802 down the instance chain which will terminate in the ICD. This allows
803 layers to filter the extensions coming back up the chain.
804 If pLayerName != NULL then get layer extensions from manifest file. */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700805 if (pLayerName == NULL || strlen(pLayerName) == 0) {
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700806 const VkLayerInstanceDispatchTable *disp;
807
Mark Young39389872017-01-19 21:10:49 -0700808 disp = loader_get_instance_layer_dispatch(physicalDevice);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700809 res = disp->EnumerateDeviceExtensionProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700810 phys_dev->phys_dev, NULL, pPropertyCount, pProperties);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700811 } else {
Jon Ashburn014438f2016-03-01 19:51:07 -0700812
Jon Ashburndc5d9202016-02-29 13:00:51 -0700813 uint32_t count;
814 uint32_t copy_size;
Piers Daniell295fe402016-03-29 11:51:11 -0600815 const struct loader_instance *inst = phys_dev->this_instance;
Jon Ashburnb8726962016-04-08 15:03:35 -0600816 struct loader_device_extension_list *dev_ext_list = NULL;
817 struct loader_device_extension_list local_ext_list;
818 memset(&local_ext_list, 0, sizeof(local_ext_list));
Jon Ashburndc5d9202016-02-29 13:00:51 -0700819 if (vk_string_validate(MaxLoaderStringLength, pLayerName) ==
Jon Ashburn014438f2016-03-01 19:51:07 -0700820 VK_STRING_ERROR_NONE) {
Jon Ashburnb8726962016-04-08 15:03:35 -0600821 if (strcmp(pLayerName, std_validation_str) == 0) {
822 struct loader_layer_list local_list;
823 memset(&local_list, 0, sizeof(local_list));
824 for (uint32_t i = 0; i < sizeof(std_validation_names) /
825 sizeof(std_validation_names[0]);
826 i++) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600827 loader_find_layer_name_add_list(
828 NULL, std_validation_names[i],
Mark Young0153e0b2016-11-03 14:27:13 -0600829 VK_LAYER_TYPE_INSTANCE_EXPLICIT,
830 &inst->instance_layer_list, &local_list);
Jon Ashburnb8726962016-04-08 15:03:35 -0600831 }
832 for (uint32_t i = 0; i < local_list.count; i++) {
833 struct loader_device_extension_list *ext_list =
Jon Ashburncc407a22016-04-15 09:25:03 -0600834 &local_list.list[i].device_extension_list;
Jon Ashburnb8726962016-04-08 15:03:35 -0600835 for (uint32_t j = 0; j < ext_list->count; j++) {
836 loader_add_to_dev_ext_list(NULL, &local_ext_list,
837 &ext_list->list[j].props, 0,
838 NULL);
839 }
840 }
841 dev_ext_list = &local_ext_list;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700842
Jon Ashburnb8726962016-04-08 15:03:35 -0600843 } else {
Jon Ashburn491cd042016-05-16 14:01:18 -0600844 for (uint32_t i = 0; i < inst->instance_layer_list.count; i++) {
Jon Ashburnb8726962016-04-08 15:03:35 -0600845 struct loader_layer_properties *props =
Jon Ashburn491cd042016-05-16 14:01:18 -0600846 &inst->instance_layer_list.list[i];
Jon Ashburnb8726962016-04-08 15:03:35 -0600847 if (strcmp(props->info.layerName, pLayerName) == 0) {
848 dev_ext_list = &props->device_extension_list;
849 }
Jon Ashburndc5d9202016-02-29 13:00:51 -0700850 }
851 }
Jon Ashburnb8726962016-04-08 15:03:35 -0600852
Jon Ashburndc5d9202016-02-29 13:00:51 -0700853 count = (dev_ext_list == NULL) ? 0 : dev_ext_list->count;
854 if (pProperties == NULL) {
855 *pPropertyCount = count;
Jon Ashburncc407a22016-04-15 09:25:03 -0600856 loader_destroy_generic_list(
857 inst, (struct loader_generic_list *)&local_ext_list);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700858 loader_platform_thread_unlock_mutex(&loader_lock);
859 return VK_SUCCESS;
860 }
861
862 copy_size = *pPropertyCount < count ? *pPropertyCount : count;
863 for (uint32_t i = 0; i < copy_size; i++) {
864 memcpy(&pProperties[i], &dev_ext_list->list[i].props,
Jon Ashburn014438f2016-03-01 19:51:07 -0700865 sizeof(VkExtensionProperties));
Jon Ashburndc5d9202016-02-29 13:00:51 -0700866 }
867 *pPropertyCount = copy_size;
868
Jon Ashburncc407a22016-04-15 09:25:03 -0600869 loader_destroy_generic_list(
870 inst, (struct loader_generic_list *)&local_ext_list);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700871 if (copy_size < count) {
872 loader_platform_thread_unlock_mutex(&loader_lock);
873 return VK_INCOMPLETE;
874 }
875 } else {
Jon Ashburn014438f2016-03-01 19:51:07 -0700876 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
877 "vkEnumerateDeviceExtensionProperties: pLayerName "
878 "is too long or is badly formed");
879 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700880 return VK_ERROR_EXTENSION_NOT_PRESENT;
881 }
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700882 }
883
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600884 loader_platform_thread_unlock_mutex(&loader_lock);
Tony Barbour59a47322015-06-24 16:06:58 -0600885 return res;
886}
887
Jon Ashburn23d36b12016-02-02 17:47:28 -0700888LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
889vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
890 uint32_t *pPropertyCount,
891 VkLayerProperties *pProperties) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700892 uint32_t copy_size;
Jon Ashburn787eb252016-03-24 15:49:57 -0600893 struct loader_physical_device_tramp *phys_dev;
Jon Ashburn491cd042016-05-16 14:01:18 -0600894 struct loader_layer_list *enabled_layers, layers_list;
895 uint32_t std_val_count = sizeof(std_validation_names) /
896 sizeof(std_validation_names[0]);
897 memset(&layers_list, 0, sizeof(layers_list));
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600898 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700899
900 /* Don't dispatch this call down the instance chain, want all device layers
901 enumerated and instance chain may not contain all device layers */
Jon Ashburn491cd042016-05-16 14:01:18 -0600902 // TODO re-evaluate the above statement we maybe able to start calling
903 // down the chain
Jon Ashburndc5d9202016-02-29 13:00:51 -0700904
Jon Ashburn787eb252016-03-24 15:49:57 -0600905 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Piers Daniell295fe402016-03-29 11:51:11 -0600906 const struct loader_instance *inst = phys_dev->this_instance;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700907
Jon Ashburn491cd042016-05-16 14:01:18 -0600908 uint32_t count = inst->activated_layer_list.count;
909 if (inst->activated_layers_are_std_val)
910 count = count - std_val_count + 1;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700911 if (pProperties == NULL) {
912 *pPropertyCount = count;
913 loader_platform_thread_unlock_mutex(&loader_lock);
914 return VK_SUCCESS;
915 }
Jon Ashburn491cd042016-05-16 14:01:18 -0600916 /* make sure to enumerate standard_validation if that is what was used
917 at the instance layer enablement */
918 if (inst->activated_layers_are_std_val) {
919 enabled_layers = &layers_list;
920 enabled_layers->count = count;
921 enabled_layers->capacity = enabled_layers->count *
922 sizeof(struct loader_layer_properties);
Mark Young0ad83132016-06-30 13:02:42 -0600923 enabled_layers->list = loader_instance_heap_alloc(inst, enabled_layers->capacity,
Jon Ashburn491cd042016-05-16 14:01:18 -0600924 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Mark Youngb6399312017-01-10 14:22:15 -0700925 if (!enabled_layers->list) {
926 loader_log(
927 inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
928 "vkEnumerateDeviceLayerProperties: Failed to allocate enabled"
929 "layer list of size %d",
930 enabled_layers->capacity);
Jon Ashburn491cd042016-05-16 14:01:18 -0600931 return VK_ERROR_OUT_OF_HOST_MEMORY;
Mark Youngb6399312017-01-10 14:22:15 -0700932 }
Jon Ashburn491cd042016-05-16 14:01:18 -0600933
934 uint32_t j = 0;
935 for (uint32_t i = 0; i < inst->activated_layer_list.count; j++) {
936
937 if (loader_find_layer_name_array(
938 inst->activated_layer_list.list[i].info.layerName,
939 std_val_count, std_validation_names)) {
940 struct loader_layer_properties props;
941 loader_init_std_validation_props(&props);
Mark Young0ad83132016-06-30 13:02:42 -0600942 VkResult err = loader_copy_layer_properties(inst,
943 &enabled_layers->list[j],
944 &props);
945 if (err != VK_SUCCESS) {
946 return err;
947 }
Jon Ashburn491cd042016-05-16 14:01:18 -0600948 i += std_val_count;
949 }
950 else {
Mark Young0ad83132016-06-30 13:02:42 -0600951 VkResult err = loader_copy_layer_properties(inst,
952 &enabled_layers->list[j],
953 &inst->activated_layer_list.list[i++]);
954 if (err != VK_SUCCESS) {
955 return err;
956 }
Jon Ashburn491cd042016-05-16 14:01:18 -0600957 }
958 }
959 }
960 else {
961 enabled_layers = (struct loader_layer_list *) &inst->activated_layer_list;
962 }
963
Jon Ashburndc5d9202016-02-29 13:00:51 -0700964
965 copy_size = (*pPropertyCount < count) ? *pPropertyCount : count;
966 for (uint32_t i = 0; i < copy_size; i++) {
Jon Ashburn491cd042016-05-16 14:01:18 -0600967 memcpy(&pProperties[i], &(enabled_layers->list[i].info),
Jon Ashburndc5d9202016-02-29 13:00:51 -0700968 sizeof(VkLayerProperties));
969 }
970 *pPropertyCount = copy_size;
971
Mark Young0ad83132016-06-30 13:02:42 -0600972 if (inst->activated_layers_are_std_val) {
Jon Ashburn491cd042016-05-16 14:01:18 -0600973 loader_delete_layer_properties(inst, enabled_layers);
Mark Young0ad83132016-06-30 13:02:42 -0600974 }
Jon Ashburndc5d9202016-02-29 13:00:51 -0700975 if (copy_size < count) {
976 loader_platform_thread_unlock_mutex(&loader_lock);
977 return VK_INCOMPLETE;
978 }
979
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600980 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700981 return VK_SUCCESS;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600982}
983
Jon Ashburn23d36b12016-02-02 17:47:28 -0700984LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
985vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex,
986 VkQueue *pQueue) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600987 const VkLayerDispatchTable *disp;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600988
989 disp = loader_get_dispatch(device);
990
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600991 disp->GetDeviceQueue(device, queueNodeIndex, queueIndex, pQueue);
992 loader_set_dispatch(*pQueue, disp);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600993}
994
Jon Ashburn23d36b12016-02-02 17:47:28 -0700995LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
996vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits,
997 VkFence fence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600998 const VkLayerDispatchTable *disp;
999
1000 disp = loader_get_dispatch(queue);
1001
Chia-I Wu40cf0ae2015-10-26 17:20:32 +08001002 return disp->QueueSubmit(queue, submitCount, pSubmits, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001003}
1004
Jon Ashburn23d36b12016-02-02 17:47:28 -07001005LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001006 const VkLayerDispatchTable *disp;
1007
1008 disp = loader_get_dispatch(queue);
1009
1010 return disp->QueueWaitIdle(queue);
1011}
1012
Jon Ashburn23d36b12016-02-02 17:47:28 -07001013LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001014 const VkLayerDispatchTable *disp;
1015
1016 disp = loader_get_dispatch(device);
1017
1018 return disp->DeviceWaitIdle(device);
1019}
1020
Jon Ashburn23d36b12016-02-02 17:47:28 -07001021LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1022vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
1023 const VkAllocationCallbacks *pAllocator,
1024 VkDeviceMemory *pMemory) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001025 const VkLayerDispatchTable *disp;
1026
1027 disp = loader_get_dispatch(device);
1028
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001029 return disp->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001030}
1031
Jon Ashburn23d36b12016-02-02 17:47:28 -07001032LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1033vkFreeMemory(VkDevice device, VkDeviceMemory mem,
1034 const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001035 const VkLayerDispatchTable *disp;
1036
1037 disp = loader_get_dispatch(device);
1038
Chia-I Wuf7458c52015-10-26 21:10:41 +08001039 disp->FreeMemory(device, mem, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001040}
1041
Jon Ashburn23d36b12016-02-02 17:47:28 -07001042LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1043vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset,
1044 VkDeviceSize size, VkFlags flags, void **ppData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001045 const VkLayerDispatchTable *disp;
1046
1047 disp = loader_get_dispatch(device);
1048
1049 return disp->MapMemory(device, mem, offset, size, flags, ppData);
1050}
1051
Jon Ashburn23d36b12016-02-02 17:47:28 -07001052LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1053vkUnmapMemory(VkDevice device, VkDeviceMemory mem) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001054 const VkLayerDispatchTable *disp;
1055
1056 disp = loader_get_dispatch(device);
1057
Mark Lobodzinski2141f652015-09-07 13:59:43 -06001058 disp->UnmapMemory(device, mem);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001059}
1060
Jon Ashburn23d36b12016-02-02 17:47:28 -07001061LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1062vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
1063 const VkMappedMemoryRange *pMemoryRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001064 const VkLayerDispatchTable *disp;
1065
1066 disp = loader_get_dispatch(device);
1067
Jon Ashburn23d36b12016-02-02 17:47:28 -07001068 return disp->FlushMappedMemoryRanges(device, memoryRangeCount,
1069 pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001070}
1071
Jon Ashburn23d36b12016-02-02 17:47:28 -07001072LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1073vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
1074 const VkMappedMemoryRange *pMemoryRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001075 const VkLayerDispatchTable *disp;
1076
1077 disp = loader_get_dispatch(device);
1078
Jon Ashburn23d36b12016-02-02 17:47:28 -07001079 return disp->InvalidateMappedMemoryRanges(device, memoryRangeCount,
1080 pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001081}
1082
Jon Ashburn23d36b12016-02-02 17:47:28 -07001083LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1084vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory,
1085 VkDeviceSize *pCommittedMemoryInBytes) {
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -06001086 const VkLayerDispatchTable *disp;
1087
1088 disp = loader_get_dispatch(device);
1089
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001090 disp->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes);
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -06001091}
1092
Jon Ashburn23d36b12016-02-02 17:47:28 -07001093LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1094vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem,
1095 VkDeviceSize offset) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001096 const VkLayerDispatchTable *disp;
1097
Mark Lobodzinski942b1722015-05-11 17:21:15 -05001098 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001099
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001100 return disp->BindBufferMemory(device, buffer, mem, offset);
1101}
1102
Jon Ashburn23d36b12016-02-02 17:47:28 -07001103LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1104vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem,
1105 VkDeviceSize offset) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001106 const VkLayerDispatchTable *disp;
1107
1108 disp = loader_get_dispatch(device);
1109
1110 return disp->BindImageMemory(device, image, mem, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001111}
1112
Jon Ashburn23d36b12016-02-02 17:47:28 -07001113LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1114vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer,
1115 VkMemoryRequirements *pMemoryRequirements) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001116 const VkLayerDispatchTable *disp;
1117
1118 disp = loader_get_dispatch(device);
1119
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001120 disp->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -06001121}
1122
Jon Ashburn23d36b12016-02-02 17:47:28 -07001123LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1124vkGetImageMemoryRequirements(VkDevice device, VkImage image,
1125 VkMemoryRequirements *pMemoryRequirements) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001126 const VkLayerDispatchTable *disp;
1127
1128 disp = loader_get_dispatch(device);
1129
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001130 disp->GetImageMemoryRequirements(device, image, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -06001131}
1132
Jon Ashburn23d36b12016-02-02 17:47:28 -07001133LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements(
1134 VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount,
1135 VkSparseImageMemoryRequirements *pSparseMemoryRequirements) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001136 const VkLayerDispatchTable *disp;
1137
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001138 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001139
Jon Ashburn23d36b12016-02-02 17:47:28 -07001140 disp->GetImageSparseMemoryRequirements(device, image,
1141 pSparseMemoryRequirementCount,
1142 pSparseMemoryRequirements);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001143}
1144
Jon Ashburn23d36b12016-02-02 17:47:28 -07001145LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1146vkGetPhysicalDeviceSparseImageFormatProperties(
1147 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
1148 VkSampleCountFlagBits samples, VkImageUsageFlags usage,
1149 VkImageTiling tiling, uint32_t *pPropertyCount,
1150 VkSparseImageFormatProperties *pProperties) {
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001151 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -07001152 VkPhysicalDevice unwrapped_phys_dev =
1153 loader_unwrap_physical_device(physicalDevice);
Mark Young39389872017-01-19 21:10:49 -07001154 disp = loader_get_instance_layer_dispatch(physicalDevice);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001155
Jon Ashburn23d36b12016-02-02 17:47:28 -07001156 disp->GetPhysicalDeviceSparseImageFormatProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -07001157 unwrapped_phys_dev, format, type, samples, usage, tiling,
1158 pPropertyCount, pProperties);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001159}
1160
Jon Ashburn23d36b12016-02-02 17:47:28 -07001161LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1162vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount,
1163 const VkBindSparseInfo *pBindInfo, VkFence fence) {
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001164 const VkLayerDispatchTable *disp;
1165
1166 disp = loader_get_dispatch(queue);
1167
Chia-I Wu1ff4c3d2015-10-26 16:55:27 +08001168 return disp->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001169}
1170
Jon Ashburn23d36b12016-02-02 17:47:28 -07001171LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1172vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo,
1173 const VkAllocationCallbacks *pAllocator, VkFence *pFence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001174 const VkLayerDispatchTable *disp;
1175
1176 disp = loader_get_dispatch(device);
1177
Chia-I Wuf7458c52015-10-26 21:10:41 +08001178 return disp->CreateFence(device, pCreateInfo, pAllocator, pFence);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001179}
1180
Jon Ashburn23d36b12016-02-02 17:47:28 -07001181LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1182vkDestroyFence(VkDevice device, VkFence fence,
1183 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001184 const VkLayerDispatchTable *disp;
1185
1186 disp = loader_get_dispatch(device);
1187
Chia-I Wuf7458c52015-10-26 21:10:41 +08001188 disp->DestroyFence(device, fence, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001189}
1190
Jon Ashburn23d36b12016-02-02 17:47:28 -07001191LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1192vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001193 const VkLayerDispatchTable *disp;
1194
1195 disp = loader_get_dispatch(device);
1196
1197 return disp->ResetFences(device, fenceCount, pFences);
1198}
1199
Jon Ashburn23d36b12016-02-02 17:47:28 -07001200LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1201vkGetFenceStatus(VkDevice device, VkFence fence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001202 const VkLayerDispatchTable *disp;
1203
1204 disp = loader_get_dispatch(device);
1205
1206 return disp->GetFenceStatus(device, fence);
1207}
1208
Jon Ashburn23d36b12016-02-02 17:47:28 -07001209LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1210vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences,
1211 VkBool32 waitAll, uint64_t timeout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001212 const VkLayerDispatchTable *disp;
1213
1214 disp = loader_get_dispatch(device);
1215
1216 return disp->WaitForFences(device, fenceCount, pFences, waitAll, timeout);
1217}
1218
Jon Ashburn23d36b12016-02-02 17:47:28 -07001219LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1220vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo,
1221 const VkAllocationCallbacks *pAllocator,
1222 VkSemaphore *pSemaphore) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001223 const VkLayerDispatchTable *disp;
1224
1225 disp = loader_get_dispatch(device);
1226
Chia-I Wuf7458c52015-10-26 21:10:41 +08001227 return disp->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001228}
1229
Jon Ashburn23d36b12016-02-02 17:47:28 -07001230LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1231vkDestroySemaphore(VkDevice device, VkSemaphore semaphore,
1232 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001233 const VkLayerDispatchTable *disp;
1234
1235 disp = loader_get_dispatch(device);
1236
Chia-I Wuf7458c52015-10-26 21:10:41 +08001237 disp->DestroySemaphore(device, semaphore, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001238}
1239
Jon Ashburn23d36b12016-02-02 17:47:28 -07001240LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1241vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo,
1242 const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001243 const VkLayerDispatchTable *disp;
1244
1245 disp = loader_get_dispatch(device);
1246
Chia-I Wuf7458c52015-10-26 21:10:41 +08001247 return disp->CreateEvent(device, pCreateInfo, pAllocator, pEvent);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001248}
1249
Jon Ashburn23d36b12016-02-02 17:47:28 -07001250LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1251vkDestroyEvent(VkDevice device, VkEvent event,
1252 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001253 const VkLayerDispatchTable *disp;
1254
1255 disp = loader_get_dispatch(device);
1256
Chia-I Wuf7458c52015-10-26 21:10:41 +08001257 disp->DestroyEvent(device, event, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001258}
1259
Jon Ashburn23d36b12016-02-02 17:47:28 -07001260LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1261vkGetEventStatus(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001262 const VkLayerDispatchTable *disp;
1263
1264 disp = loader_get_dispatch(device);
1265
1266 return disp->GetEventStatus(device, event);
1267}
1268
Jon Ashburn23d36b12016-02-02 17:47:28 -07001269LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1270vkSetEvent(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001271 const VkLayerDispatchTable *disp;
1272
1273 disp = loader_get_dispatch(device);
1274
1275 return disp->SetEvent(device, event);
1276}
1277
Jon Ashburn23d36b12016-02-02 17:47:28 -07001278LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1279vkResetEvent(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001280 const VkLayerDispatchTable *disp;
1281
1282 disp = loader_get_dispatch(device);
1283
1284 return disp->ResetEvent(device, event);
1285}
1286
Jon Ashburn23d36b12016-02-02 17:47:28 -07001287LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1288vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo,
1289 const VkAllocationCallbacks *pAllocator,
1290 VkQueryPool *pQueryPool) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001291 const VkLayerDispatchTable *disp;
1292
1293 disp = loader_get_dispatch(device);
1294
Chia-I Wuf7458c52015-10-26 21:10:41 +08001295 return disp->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001296}
1297
Jon Ashburn23d36b12016-02-02 17:47:28 -07001298LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1299vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool,
1300 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001301 const VkLayerDispatchTable *disp;
1302
1303 disp = loader_get_dispatch(device);
1304
Chia-I Wuf7458c52015-10-26 21:10:41 +08001305 disp->DestroyQueryPool(device, queryPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001306}
1307
Jon Ashburn23d36b12016-02-02 17:47:28 -07001308LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1309vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool,
1310 uint32_t firstQuery, uint32_t queryCount, size_t dataSize,
1311 void *pData, VkDeviceSize stride,
1312 VkQueryResultFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001313 const VkLayerDispatchTable *disp;
1314
1315 disp = loader_get_dispatch(device);
1316
Jon Ashburn23d36b12016-02-02 17:47:28 -07001317 return disp->GetQueryPoolResults(device, queryPool, firstQuery, queryCount,
1318 dataSize, pData, stride, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001319}
1320
Jon Ashburn23d36b12016-02-02 17:47:28 -07001321LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1322vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo,
1323 const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001324 const VkLayerDispatchTable *disp;
1325
1326 disp = loader_get_dispatch(device);
1327
Chia-I Wuf7458c52015-10-26 21:10:41 +08001328 return disp->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001329}
1330
Jon Ashburn23d36b12016-02-02 17:47:28 -07001331LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1332vkDestroyBuffer(VkDevice device, VkBuffer buffer,
1333 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001334 const VkLayerDispatchTable *disp;
1335
1336 disp = loader_get_dispatch(device);
1337
Chia-I Wuf7458c52015-10-26 21:10:41 +08001338 disp->DestroyBuffer(device, buffer, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001339}
1340
Jon Ashburn23d36b12016-02-02 17:47:28 -07001341LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1342vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo,
1343 const VkAllocationCallbacks *pAllocator,
1344 VkBufferView *pView) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001345 const VkLayerDispatchTable *disp;
1346
1347 disp = loader_get_dispatch(device);
1348
Chia-I Wuf7458c52015-10-26 21:10:41 +08001349 return disp->CreateBufferView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001350}
1351
Jon Ashburn23d36b12016-02-02 17:47:28 -07001352LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1353vkDestroyBufferView(VkDevice device, VkBufferView bufferView,
1354 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001355 const VkLayerDispatchTable *disp;
1356
1357 disp = loader_get_dispatch(device);
1358
Chia-I Wuf7458c52015-10-26 21:10:41 +08001359 disp->DestroyBufferView(device, bufferView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001360}
1361
Jon Ashburn23d36b12016-02-02 17:47:28 -07001362LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1363vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
1364 const VkAllocationCallbacks *pAllocator, VkImage *pImage) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001365 const VkLayerDispatchTable *disp;
1366
1367 disp = loader_get_dispatch(device);
1368
Chia-I Wuf7458c52015-10-26 21:10:41 +08001369 return disp->CreateImage(device, pCreateInfo, pAllocator, pImage);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001370}
1371
Jon Ashburn23d36b12016-02-02 17:47:28 -07001372LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1373vkDestroyImage(VkDevice device, VkImage image,
1374 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001375 const VkLayerDispatchTable *disp;
1376
1377 disp = loader_get_dispatch(device);
1378
Chia-I Wuf7458c52015-10-26 21:10:41 +08001379 disp->DestroyImage(device, image, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001380}
1381
Jon Ashburn23d36b12016-02-02 17:47:28 -07001382LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1383vkGetImageSubresourceLayout(VkDevice device, VkImage image,
1384 const VkImageSubresource *pSubresource,
1385 VkSubresourceLayout *pLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001386 const VkLayerDispatchTable *disp;
1387
1388 disp = loader_get_dispatch(device);
1389
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001390 disp->GetImageSubresourceLayout(device, image, pSubresource, pLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001391}
1392
Jon Ashburn23d36b12016-02-02 17:47:28 -07001393LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1394vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo,
1395 const VkAllocationCallbacks *pAllocator, VkImageView *pView) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001396 const VkLayerDispatchTable *disp;
1397
1398 disp = loader_get_dispatch(device);
1399
Chia-I Wuf7458c52015-10-26 21:10:41 +08001400 return disp->CreateImageView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001401}
1402
Jon Ashburn23d36b12016-02-02 17:47:28 -07001403LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1404vkDestroyImageView(VkDevice device, VkImageView imageView,
1405 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001406 const VkLayerDispatchTable *disp;
1407
1408 disp = loader_get_dispatch(device);
1409
Chia-I Wuf7458c52015-10-26 21:10:41 +08001410 disp->DestroyImageView(device, imageView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001411}
1412
Jon Ashburn23d36b12016-02-02 17:47:28 -07001413LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1414vkCreateShaderModule(VkDevice device,
1415 const VkShaderModuleCreateInfo *pCreateInfo,
1416 const VkAllocationCallbacks *pAllocator,
1417 VkShaderModule *pShader) {
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -06001418 const VkLayerDispatchTable *disp;
1419
1420 disp = loader_get_dispatch(device);
1421
Chia-I Wuf7458c52015-10-26 21:10:41 +08001422 return disp->CreateShaderModule(device, pCreateInfo, pAllocator, pShader);
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -06001423}
1424
Jon Ashburn23d36b12016-02-02 17:47:28 -07001425LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1426vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule,
1427 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001428 const VkLayerDispatchTable *disp;
1429
1430 disp = loader_get_dispatch(device);
1431
Chia-I Wuf7458c52015-10-26 21:10:41 +08001432 disp->DestroyShaderModule(device, shaderModule, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001433}
1434
Jon Ashburn23d36b12016-02-02 17:47:28 -07001435LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1436vkCreatePipelineCache(VkDevice device,
1437 const VkPipelineCacheCreateInfo *pCreateInfo,
1438 const VkAllocationCallbacks *pAllocator,
1439 VkPipelineCache *pPipelineCache) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001440 const VkLayerDispatchTable *disp;
1441
1442 disp = loader_get_dispatch(device);
1443
Jon Ashburn23d36b12016-02-02 17:47:28 -07001444 return disp->CreatePipelineCache(device, pCreateInfo, pAllocator,
1445 pPipelineCache);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001446}
1447
Jon Ashburn23d36b12016-02-02 17:47:28 -07001448LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1449vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache,
1450 const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001451 const VkLayerDispatchTable *disp;
1452
1453 disp = loader_get_dispatch(device);
1454
Chia-I Wuf7458c52015-10-26 21:10:41 +08001455 disp->DestroyPipelineCache(device, pipelineCache, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001456}
1457
Jon Ashburn23d36b12016-02-02 17:47:28 -07001458LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1459vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache,
1460 size_t *pDataSize, void *pData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001461 const VkLayerDispatchTable *disp;
1462
1463 disp = loader_get_dispatch(device);
1464
Chia-I Wub16facd2015-10-26 19:17:06 +08001465 return disp->GetPipelineCacheData(device, pipelineCache, pDataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001466}
1467
Jon Ashburn23d36b12016-02-02 17:47:28 -07001468LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1469vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache,
1470 uint32_t srcCacheCount,
1471 const VkPipelineCache *pSrcCaches) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001472 const VkLayerDispatchTable *disp;
1473
1474 disp = loader_get_dispatch(device);
1475
Jon Ashburn23d36b12016-02-02 17:47:28 -07001476 return disp->MergePipelineCaches(device, dstCache, srcCacheCount,
1477 pSrcCaches);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001478}
1479
Jon Ashburn23d36b12016-02-02 17:47:28 -07001480LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1481vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache,
1482 uint32_t createInfoCount,
1483 const VkGraphicsPipelineCreateInfo *pCreateInfos,
1484 const VkAllocationCallbacks *pAllocator,
1485 VkPipeline *pPipelines) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001486 const VkLayerDispatchTable *disp;
1487
1488 disp = loader_get_dispatch(device);
1489
Jon Ashburn23d36b12016-02-02 17:47:28 -07001490 return disp->CreateGraphicsPipelines(device, pipelineCache, createInfoCount,
1491 pCreateInfos, pAllocator, pPipelines);
Jon Ashburnc669cc62015-07-09 15:02:25 -06001492}
1493
Jon Ashburn23d36b12016-02-02 17:47:28 -07001494LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1495vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache,
1496 uint32_t createInfoCount,
1497 const VkComputePipelineCreateInfo *pCreateInfos,
1498 const VkAllocationCallbacks *pAllocator,
1499 VkPipeline *pPipelines) {
Jon Ashburnc669cc62015-07-09 15:02:25 -06001500 const VkLayerDispatchTable *disp;
1501
1502 disp = loader_get_dispatch(device);
1503
Jon Ashburn23d36b12016-02-02 17:47:28 -07001504 return disp->CreateComputePipelines(device, pipelineCache, createInfoCount,
1505 pCreateInfos, pAllocator, pPipelines);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001506}
1507
Jon Ashburn23d36b12016-02-02 17:47:28 -07001508LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1509vkDestroyPipeline(VkDevice device, VkPipeline pipeline,
1510 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001511 const VkLayerDispatchTable *disp;
1512
1513 disp = loader_get_dispatch(device);
1514
Chia-I Wuf7458c52015-10-26 21:10:41 +08001515 disp->DestroyPipeline(device, pipeline, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001516}
1517
Jon Ashburn23d36b12016-02-02 17:47:28 -07001518LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1519vkCreatePipelineLayout(VkDevice device,
1520 const VkPipelineLayoutCreateInfo *pCreateInfo,
1521 const VkAllocationCallbacks *pAllocator,
1522 VkPipelineLayout *pPipelineLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001523 const VkLayerDispatchTable *disp;
1524
1525 disp = loader_get_dispatch(device);
1526
Jon Ashburn23d36b12016-02-02 17:47:28 -07001527 return disp->CreatePipelineLayout(device, pCreateInfo, pAllocator,
1528 pPipelineLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001529}
1530
Jon Ashburn23d36b12016-02-02 17:47:28 -07001531LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1532vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout,
1533 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001534 const VkLayerDispatchTable *disp;
1535
1536 disp = loader_get_dispatch(device);
1537
Chia-I Wuf7458c52015-10-26 21:10:41 +08001538 disp->DestroyPipelineLayout(device, pipelineLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001539}
1540
Jon Ashburn23d36b12016-02-02 17:47:28 -07001541LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1542vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo,
1543 const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001544 const VkLayerDispatchTable *disp;
1545
1546 disp = loader_get_dispatch(device);
1547
Chia-I Wuf7458c52015-10-26 21:10:41 +08001548 return disp->CreateSampler(device, pCreateInfo, pAllocator, pSampler);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001549}
1550
Jon Ashburn23d36b12016-02-02 17:47:28 -07001551LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1552vkDestroySampler(VkDevice device, VkSampler sampler,
1553 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001554 const VkLayerDispatchTable *disp;
1555
1556 disp = loader_get_dispatch(device);
1557
Chia-I Wuf7458c52015-10-26 21:10:41 +08001558 disp->DestroySampler(device, sampler, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001559}
1560
Jon Ashburn23d36b12016-02-02 17:47:28 -07001561LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1562vkCreateDescriptorSetLayout(VkDevice device,
1563 const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
1564 const VkAllocationCallbacks *pAllocator,
1565 VkDescriptorSetLayout *pSetLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001566 const VkLayerDispatchTable *disp;
1567
1568 disp = loader_get_dispatch(device);
1569
Jon Ashburn23d36b12016-02-02 17:47:28 -07001570 return disp->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator,
1571 pSetLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001572}
1573
Jon Ashburn23d36b12016-02-02 17:47:28 -07001574LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1575vkDestroyDescriptorSetLayout(VkDevice device,
1576 VkDescriptorSetLayout descriptorSetLayout,
1577 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001578 const VkLayerDispatchTable *disp;
1579
1580 disp = loader_get_dispatch(device);
1581
Chia-I Wuf7458c52015-10-26 21:10:41 +08001582 disp->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001583}
1584
Jon Ashburn23d36b12016-02-02 17:47:28 -07001585LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1586vkCreateDescriptorPool(VkDevice device,
1587 const VkDescriptorPoolCreateInfo *pCreateInfo,
1588 const VkAllocationCallbacks *pAllocator,
1589 VkDescriptorPool *pDescriptorPool) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001590 const VkLayerDispatchTable *disp;
1591
1592 disp = loader_get_dispatch(device);
1593
Jon Ashburn23d36b12016-02-02 17:47:28 -07001594 return disp->CreateDescriptorPool(device, pCreateInfo, pAllocator,
1595 pDescriptorPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001596}
1597
Jon Ashburn23d36b12016-02-02 17:47:28 -07001598LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1599vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
1600 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001601 const VkLayerDispatchTable *disp;
1602
1603 disp = loader_get_dispatch(device);
1604
Chia-I Wuf7458c52015-10-26 21:10:41 +08001605 disp->DestroyDescriptorPool(device, descriptorPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001606}
1607
Jon Ashburn23d36b12016-02-02 17:47:28 -07001608LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1609vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
1610 VkDescriptorPoolResetFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001611 const VkLayerDispatchTable *disp;
1612
1613 disp = loader_get_dispatch(device);
1614
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001615 return disp->ResetDescriptorPool(device, descriptorPool, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001616}
1617
Jon Ashburn23d36b12016-02-02 17:47:28 -07001618LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1619vkAllocateDescriptorSets(VkDevice device,
1620 const VkDescriptorSetAllocateInfo *pAllocateInfo,
1621 VkDescriptorSet *pDescriptorSets) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001622 const VkLayerDispatchTable *disp;
1623
1624 disp = loader_get_dispatch(device);
1625
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001626 return disp->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001627}
1628
Jon Ashburn23d36b12016-02-02 17:47:28 -07001629LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1630vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool,
1631 uint32_t descriptorSetCount,
1632 const VkDescriptorSet *pDescriptorSets) {
Tony Barbour34ec6922015-07-10 10:50:45 -06001633 const VkLayerDispatchTable *disp;
1634
1635 disp = loader_get_dispatch(device);
1636
Jon Ashburn23d36b12016-02-02 17:47:28 -07001637 return disp->FreeDescriptorSets(device, descriptorPool, descriptorSetCount,
1638 pDescriptorSets);
Tony Barbour34ec6922015-07-10 10:50:45 -06001639}
1640
Jon Ashburn23d36b12016-02-02 17:47:28 -07001641LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1642vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount,
1643 const VkWriteDescriptorSet *pDescriptorWrites,
1644 uint32_t descriptorCopyCount,
1645 const VkCopyDescriptorSet *pDescriptorCopies) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001646 const VkLayerDispatchTable *disp;
1647
1648 disp = loader_get_dispatch(device);
1649
Jon Ashburn23d36b12016-02-02 17:47:28 -07001650 disp->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites,
1651 descriptorCopyCount, pDescriptorCopies);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001652}
1653
Jon Ashburn23d36b12016-02-02 17:47:28 -07001654LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1655vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo,
1656 const VkAllocationCallbacks *pAllocator,
1657 VkFramebuffer *pFramebuffer) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001658 const VkLayerDispatchTable *disp;
1659
1660 disp = loader_get_dispatch(device);
1661
Jon Ashburn23d36b12016-02-02 17:47:28 -07001662 return disp->CreateFramebuffer(device, pCreateInfo, pAllocator,
1663 pFramebuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001664}
1665
Jon Ashburn23d36b12016-02-02 17:47:28 -07001666LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1667vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer,
1668 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001669 const VkLayerDispatchTable *disp;
1670
1671 disp = loader_get_dispatch(device);
1672
Chia-I Wuf7458c52015-10-26 21:10:41 +08001673 disp->DestroyFramebuffer(device, framebuffer, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -06001674}
1675
Jon Ashburn23d36b12016-02-02 17:47:28 -07001676LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1677vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
1678 const VkAllocationCallbacks *pAllocator,
1679 VkRenderPass *pRenderPass) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001680 const VkLayerDispatchTable *disp;
1681
1682 disp = loader_get_dispatch(device);
1683
Chia-I Wuf7458c52015-10-26 21:10:41 +08001684 return disp->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
Jon Ashburn754864f2015-07-23 18:49:07 -06001685}
1686
Jon Ashburn23d36b12016-02-02 17:47:28 -07001687LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1688vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass,
1689 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001690 const VkLayerDispatchTable *disp;
1691
1692 disp = loader_get_dispatch(device);
1693
Chia-I Wuf7458c52015-10-26 21:10:41 +08001694 disp->DestroyRenderPass(device, renderPass, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -06001695}
1696
Jon Ashburn23d36b12016-02-02 17:47:28 -07001697LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1698vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass,
1699 VkExtent2D *pGranularity) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001700 const VkLayerDispatchTable *disp;
1701
1702 disp = loader_get_dispatch(device);
1703
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001704 disp->GetRenderAreaGranularity(device, renderPass, pGranularity);
Jon Ashburn754864f2015-07-23 18:49:07 -06001705}
1706
Jon Ashburn23d36b12016-02-02 17:47:28 -07001707LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1708vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo,
1709 const VkAllocationCallbacks *pAllocator,
1710 VkCommandPool *pCommandPool) {
Cody Northrope62183e2015-07-09 18:08:05 -06001711 const VkLayerDispatchTable *disp;
1712
1713 disp = loader_get_dispatch(device);
1714
Jon Ashburn23d36b12016-02-02 17:47:28 -07001715 return disp->CreateCommandPool(device, pCreateInfo, pAllocator,
1716 pCommandPool);
Cody Northrope62183e2015-07-09 18:08:05 -06001717}
1718
Jon Ashburn23d36b12016-02-02 17:47:28 -07001719LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1720vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool,
1721 const VkAllocationCallbacks *pAllocator) {
Cody Northrope62183e2015-07-09 18:08:05 -06001722 const VkLayerDispatchTable *disp;
1723
1724 disp = loader_get_dispatch(device);
1725
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001726 disp->DestroyCommandPool(device, commandPool, pAllocator);
Cody Northrope62183e2015-07-09 18:08:05 -06001727}
1728
Jon Ashburn23d36b12016-02-02 17:47:28 -07001729LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1730vkResetCommandPool(VkDevice device, VkCommandPool commandPool,
1731 VkCommandPoolResetFlags flags) {
Cody Northrope62183e2015-07-09 18:08:05 -06001732 const VkLayerDispatchTable *disp;
1733
1734 disp = loader_get_dispatch(device);
1735
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001736 return disp->ResetCommandPool(device, commandPool, flags);
Cody Northrope62183e2015-07-09 18:08:05 -06001737}
1738
Jon Ashburn23d36b12016-02-02 17:47:28 -07001739LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1740vkAllocateCommandBuffers(VkDevice device,
1741 const VkCommandBufferAllocateInfo *pAllocateInfo,
1742 VkCommandBuffer *pCommandBuffers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001743 const VkLayerDispatchTable *disp;
1744 VkResult res;
1745
1746 disp = loader_get_dispatch(device);
1747
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001748 res = disp->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001749 if (res == VK_SUCCESS) {
Jon Ashburn23d36b12016-02-02 17:47:28 -07001750 for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; i++) {
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001751 if (pCommandBuffers[i]) {
1752 loader_init_dispatch(pCommandBuffers[i], disp);
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001753 }
1754 }
Jon Ashburnd55a3942015-05-06 09:02:10 -06001755 }
1756
1757 return res;
1758}
1759
Jon Ashburn23d36b12016-02-02 17:47:28 -07001760LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1761vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool,
1762 uint32_t commandBufferCount,
1763 const VkCommandBuffer *pCommandBuffers) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001764 const VkLayerDispatchTable *disp;
1765
1766 disp = loader_get_dispatch(device);
1767
Jon Ashburn23d36b12016-02-02 17:47:28 -07001768 disp->FreeCommandBuffers(device, commandPool, commandBufferCount,
1769 pCommandBuffers);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001770}
1771
Jon Ashburn23d36b12016-02-02 17:47:28 -07001772LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1773vkBeginCommandBuffer(VkCommandBuffer commandBuffer,
1774 const VkCommandBufferBeginInfo *pBeginInfo) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001775 const VkLayerDispatchTable *disp;
1776
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001777 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001778
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001779 return disp->BeginCommandBuffer(commandBuffer, pBeginInfo);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001780}
1781
Jon Ashburn23d36b12016-02-02 17:47:28 -07001782LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1783vkEndCommandBuffer(VkCommandBuffer commandBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001784 const VkLayerDispatchTable *disp;
1785
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001786 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001787
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001788 return disp->EndCommandBuffer(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001789}
1790
Jon Ashburn23d36b12016-02-02 17:47:28 -07001791LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1792vkResetCommandBuffer(VkCommandBuffer commandBuffer,
1793 VkCommandBufferResetFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001794 const VkLayerDispatchTable *disp;
1795
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001796 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001797
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001798 return disp->ResetCommandBuffer(commandBuffer, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001799}
1800
Jon Ashburn23d36b12016-02-02 17:47:28 -07001801LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1802vkCmdBindPipeline(VkCommandBuffer commandBuffer,
1803 VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001804 const VkLayerDispatchTable *disp;
1805
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001806 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001807
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001808 disp->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001809}
1810
Jon Ashburn23d36b12016-02-02 17:47:28 -07001811LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1812vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport,
1813 uint32_t viewportCount, const VkViewport *pViewports) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001814 const VkLayerDispatchTable *disp;
1815
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001816 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001817
Jon Ashburn23d36b12016-02-02 17:47:28 -07001818 disp->CmdSetViewport(commandBuffer, firstViewport, viewportCount,
1819 pViewports);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001820}
1821
Jon Ashburn23d36b12016-02-02 17:47:28 -07001822LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1823vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor,
1824 uint32_t scissorCount, const VkRect2D *pScissors) {
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001825 const VkLayerDispatchTable *disp;
1826
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001827 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001828
Jon Ashburn19d3bf12015-12-30 14:06:55 -07001829 disp->CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001830}
1831
Jon Ashburn23d36b12016-02-02 17:47:28 -07001832LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1833vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001834 const VkLayerDispatchTable *disp;
1835
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001836 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001837
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001838 disp->CmdSetLineWidth(commandBuffer, lineWidth);
Cody Northrop12365112015-08-17 11:10:49 -06001839}
1840
Jon Ashburn23d36b12016-02-02 17:47:28 -07001841LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1842vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor,
1843 float depthBiasClamp, float depthBiasSlopeFactor) {
Cody Northrop12365112015-08-17 11:10:49 -06001844 const VkLayerDispatchTable *disp;
1845
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001846 disp = loader_get_dispatch(commandBuffer);
Cody Northrop12365112015-08-17 11:10:49 -06001847
Jon Ashburn23d36b12016-02-02 17:47:28 -07001848 disp->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor,
1849 depthBiasClamp, depthBiasSlopeFactor);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001850}
1851
Jon Ashburn23d36b12016-02-02 17:47:28 -07001852LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1853vkCmdSetBlendConstants(VkCommandBuffer commandBuffer,
1854 const float blendConstants[4]) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001855 const VkLayerDispatchTable *disp;
1856
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001857 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001858
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001859 disp->CmdSetBlendConstants(commandBuffer, blendConstants);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001860}
1861
Jon Ashburn23d36b12016-02-02 17:47:28 -07001862LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1863vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds,
1864 float maxDepthBounds) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001865 const VkLayerDispatchTable *disp;
1866
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001867 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001868
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001869 disp->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
Cody Northrop82485a82015-08-18 15:21:16 -06001870}
1871
Jon Ashburn23d36b12016-02-02 17:47:28 -07001872LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1873vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer,
1874 VkStencilFaceFlags faceMask, uint32_t compareMask) {
Cody Northrop82485a82015-08-18 15:21:16 -06001875 const VkLayerDispatchTable *disp;
1876
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001877 disp = loader_get_dispatch(commandBuffer);
Cody Northrop82485a82015-08-18 15:21:16 -06001878
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001879 disp->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001880}
1881
Jon Ashburn23d36b12016-02-02 17:47:28 -07001882LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1883vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer,
1884 VkStencilFaceFlags faceMask, uint32_t writeMask) {
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001885 const VkLayerDispatchTable *disp;
1886
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001887 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001888
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001889 disp->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001890}
1891
Jon Ashburn23d36b12016-02-02 17:47:28 -07001892LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1893vkCmdSetStencilReference(VkCommandBuffer commandBuffer,
1894 VkStencilFaceFlags faceMask, uint32_t reference) {
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001895 const VkLayerDispatchTable *disp;
1896
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001897 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001898
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001899 disp->CmdSetStencilReference(commandBuffer, faceMask, reference);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001900}
1901
Jon Ashburn23d36b12016-02-02 17:47:28 -07001902LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets(
1903 VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
1904 VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount,
1905 const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount,
1906 const uint32_t *pDynamicOffsets) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001907 const VkLayerDispatchTable *disp;
1908
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001909 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001910
Jon Ashburn23d36b12016-02-02 17:47:28 -07001911 disp->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout,
1912 firstSet, descriptorSetCount, pDescriptorSets,
1913 dynamicOffsetCount, pDynamicOffsets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001914}
1915
Jon Ashburn23d36b12016-02-02 17:47:28 -07001916LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1917vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer,
1918 VkDeviceSize offset, VkIndexType indexType) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001919 const VkLayerDispatchTable *disp;
1920
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001921 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001922
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001923 disp->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001924}
1925
Jon Ashburn23d36b12016-02-02 17:47:28 -07001926LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1927vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding,
1928 uint32_t bindingCount, const VkBuffer *pBuffers,
1929 const VkDeviceSize *pOffsets) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001930 const VkLayerDispatchTable *disp;
1931
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001932 disp = loader_get_dispatch(commandBuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001933
Jon Ashburn23d36b12016-02-02 17:47:28 -07001934 disp->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount,
1935 pBuffers, pOffsets);
Jon Ashburn754864f2015-07-23 18:49:07 -06001936}
1937
Jon Ashburn23d36b12016-02-02 17:47:28 -07001938LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1939vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount,
1940 uint32_t instanceCount, uint32_t firstVertex,
1941 uint32_t firstInstance) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001942 const VkLayerDispatchTable *disp;
1943
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001944 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001945
Jon Ashburn23d36b12016-02-02 17:47:28 -07001946 disp->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex,
1947 firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001948}
1949
Jon Ashburn23d36b12016-02-02 17:47:28 -07001950LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1951vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount,
1952 uint32_t instanceCount, uint32_t firstIndex,
1953 int32_t vertexOffset, uint32_t firstInstance) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001954 const VkLayerDispatchTable *disp;
1955
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001956 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001957
Jon Ashburn23d36b12016-02-02 17:47:28 -07001958 disp->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex,
1959 vertexOffset, firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001960}
1961
Jon Ashburn23d36b12016-02-02 17:47:28 -07001962LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1963vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1964 VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001965 const VkLayerDispatchTable *disp;
1966
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001967 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001968
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001969 disp->CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001970}
1971
Jon Ashburn23d36b12016-02-02 17:47:28 -07001972LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1973vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1974 VkDeviceSize offset, uint32_t drawCount,
1975 uint32_t stride) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001976 const VkLayerDispatchTable *disp;
1977
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001978 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001979
Jon Ashburn23d36b12016-02-02 17:47:28 -07001980 disp->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount,
1981 stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001982}
1983
Jon Ashburn23d36b12016-02-02 17:47:28 -07001984LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1985vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y,
1986 uint32_t z) {
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
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001991 disp->CmdDispatch(commandBuffer, x, y, z);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001992}
1993
Jon Ashburn23d36b12016-02-02 17:47:28 -07001994LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1995vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1996 VkDeviceSize offset) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001997 const VkLayerDispatchTable *disp;
1998
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001999 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002000
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002001 disp->CmdDispatchIndirect(commandBuffer, buffer, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002002}
2003
Jon Ashburn23d36b12016-02-02 17:47:28 -07002004LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2005vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer,
2006 VkBuffer dstBuffer, uint32_t regionCount,
2007 const VkBufferCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002008 const VkLayerDispatchTable *disp;
2009
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002010 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002011
Jon Ashburn23d36b12016-02-02 17:47:28 -07002012 disp->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount,
2013 pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002014}
2015
Jon Ashburn23d36b12016-02-02 17:47:28 -07002016LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2017vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage,
2018 VkImageLayout srcImageLayout, VkImage dstImage,
2019 VkImageLayout dstImageLayout, uint32_t regionCount,
2020 const VkImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002021 const VkLayerDispatchTable *disp;
2022
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002023 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002024
Jon Ashburn23d36b12016-02-02 17:47:28 -07002025 disp->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage,
2026 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002027}
2028
Jon Ashburn23d36b12016-02-02 17:47:28 -07002029LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2030vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage,
2031 VkImageLayout srcImageLayout, VkImage dstImage,
2032 VkImageLayout dstImageLayout, uint32_t regionCount,
2033 const VkImageBlit *pRegions, VkFilter filter) {
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->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage,
2039 dstImageLayout, regionCount, pRegions, filter);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002040}
2041
Jon Ashburn23d36b12016-02-02 17:47:28 -07002042LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2043vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer,
2044 VkImage dstImage, VkImageLayout dstImageLayout,
2045 uint32_t regionCount,
2046 const VkBufferImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002047 const VkLayerDispatchTable *disp;
2048
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002049 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002050
Jon Ashburn23d36b12016-02-02 17:47:28 -07002051 disp->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage,
2052 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002053}
2054
Jon Ashburn23d36b12016-02-02 17:47:28 -07002055LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2056vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage,
2057 VkImageLayout srcImageLayout, VkBuffer dstBuffer,
2058 uint32_t regionCount,
2059 const VkBufferImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002060 const VkLayerDispatchTable *disp;
2061
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002062 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002063
Jon Ashburn23d36b12016-02-02 17:47:28 -07002064 disp->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout,
2065 dstBuffer, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002066}
2067
Jon Ashburn23d36b12016-02-02 17:47:28 -07002068LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2069vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
2070 VkDeviceSize dstOffset, VkDeviceSize dataSize,
Karl Schultzee344492016-07-11 15:09:57 -06002071 const void *pData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002072 const VkLayerDispatchTable *disp;
2073
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002074 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002075
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002076 disp->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002077}
2078
Jon Ashburn23d36b12016-02-02 17:47:28 -07002079LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2080vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
2081 VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002082 const VkLayerDispatchTable *disp;
2083
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002084 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002085
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002086 disp->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002087}
2088
Jon Ashburn23d36b12016-02-02 17:47:28 -07002089LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2090vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image,
2091 VkImageLayout imageLayout, const VkClearColorValue *pColor,
2092 uint32_t rangeCount,
2093 const VkImageSubresourceRange *pRanges) {
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
Jon Ashburn23d36b12016-02-02 17:47:28 -07002098 disp->CmdClearColorImage(commandBuffer, image, imageLayout, pColor,
2099 rangeCount, pRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002100}
2101
Jon Ashburn23d36b12016-02-02 17:47:28 -07002102LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2103vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image,
2104 VkImageLayout imageLayout,
2105 const VkClearDepthStencilValue *pDepthStencil,
2106 uint32_t rangeCount,
2107 const VkImageSubresourceRange *pRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002108 const VkLayerDispatchTable *disp;
2109
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002110 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002111
Jon Ashburn23d36b12016-02-02 17:47:28 -07002112 disp->CmdClearDepthStencilImage(commandBuffer, image, imageLayout,
2113 pDepthStencil, rangeCount, pRanges);
Chris Forbesd9be82b2015-06-22 17:21:59 +12002114}
2115
Jon Ashburn23d36b12016-02-02 17:47:28 -07002116LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2117vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
2118 const VkClearAttachment *pAttachments, uint32_t rectCount,
2119 const VkClearRect *pRects) {
Chris Forbesd9be82b2015-06-22 17:21:59 +12002120 const VkLayerDispatchTable *disp;
2121
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002122 disp = loader_get_dispatch(commandBuffer);
Chris Forbesd9be82b2015-06-22 17:21:59 +12002123
Jon Ashburn23d36b12016-02-02 17:47:28 -07002124 disp->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments,
2125 rectCount, pRects);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002126}
2127
Jon Ashburn23d36b12016-02-02 17:47:28 -07002128LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2129vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage,
2130 VkImageLayout srcImageLayout, VkImage dstImage,
2131 VkImageLayout dstImageLayout, uint32_t regionCount,
2132 const VkImageResolve *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002133 const VkLayerDispatchTable *disp;
2134
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002135 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002136
Jon Ashburn23d36b12016-02-02 17:47:28 -07002137 disp->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage,
2138 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002139}
2140
Jon Ashburn23d36b12016-02-02 17:47:28 -07002141LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2142vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event,
2143 VkPipelineStageFlags stageMask) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002144 const VkLayerDispatchTable *disp;
2145
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002146 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002147
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002148 disp->CmdSetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002149}
2150
Jon Ashburn23d36b12016-02-02 17:47:28 -07002151LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2152vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event,
2153 VkPipelineStageFlags stageMask) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002154 const VkLayerDispatchTable *disp;
2155
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002156 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002157
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002158 disp->CmdResetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002159}
2160
Jon Ashburn23d36b12016-02-02 17:47:28 -07002161LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2162vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount,
2163 const VkEvent *pEvents, VkPipelineStageFlags sourceStageMask,
2164 VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount,
2165 const VkMemoryBarrier *pMemoryBarriers,
2166 uint32_t bufferMemoryBarrierCount,
2167 const VkBufferMemoryBarrier *pBufferMemoryBarriers,
2168 uint32_t imageMemoryBarrierCount,
2169 const VkImageMemoryBarrier *pImageMemoryBarriers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002170 const VkLayerDispatchTable *disp;
2171
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002172 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002173
Jon Ashburnf19916e2016-01-11 13:12:43 -07002174 disp->CmdWaitEvents(commandBuffer, eventCount, pEvents, sourceStageMask,
2175 dstStageMask, memoryBarrierCount, pMemoryBarriers,
2176 bufferMemoryBarrierCount, pBufferMemoryBarriers,
2177 imageMemoryBarrierCount, pImageMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002178}
2179
Jon Ashburnf19916e2016-01-11 13:12:43 -07002180LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier(
Jon Ashburn23d36b12016-02-02 17:47:28 -07002181 VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask,
2182 VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags,
2183 uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers,
2184 uint32_t bufferMemoryBarrierCount,
2185 const VkBufferMemoryBarrier *pBufferMemoryBarriers,
2186 uint32_t imageMemoryBarrierCount,
2187 const VkImageMemoryBarrier *pImageMemoryBarriers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002188 const VkLayerDispatchTable *disp;
2189
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002190 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002191
Jon Ashburn23d36b12016-02-02 17:47:28 -07002192 disp->CmdPipelineBarrier(
2193 commandBuffer, srcStageMask, dstStageMask, dependencyFlags,
2194 memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount,
2195 pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002196}
2197
Jon Ashburn23d36b12016-02-02 17:47:28 -07002198LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2199vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2200 uint32_t slot, VkFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002201 const VkLayerDispatchTable *disp;
2202
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002203 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002204
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002205 disp->CmdBeginQuery(commandBuffer, queryPool, slot, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002206}
2207
Jon Ashburn23d36b12016-02-02 17:47:28 -07002208LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2209vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2210 uint32_t slot) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002211 const VkLayerDispatchTable *disp;
2212
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002213 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002214
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002215 disp->CmdEndQuery(commandBuffer, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002216}
2217
Jon Ashburn23d36b12016-02-02 17:47:28 -07002218LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2219vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2220 uint32_t firstQuery, uint32_t queryCount) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002221 const VkLayerDispatchTable *disp;
2222
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002223 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002224
Jon Ashburn19d3bf12015-12-30 14:06:55 -07002225 disp->CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002226}
2227
Jon Ashburn23d36b12016-02-02 17:47:28 -07002228LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2229vkCmdWriteTimestamp(VkCommandBuffer commandBuffer,
2230 VkPipelineStageFlagBits pipelineStage,
2231 VkQueryPool queryPool, uint32_t slot) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002232 const VkLayerDispatchTable *disp;
2233
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002234 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002235
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002236 disp->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002237}
2238
Jon Ashburn23d36b12016-02-02 17:47:28 -07002239LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2240vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2241 uint32_t firstQuery, uint32_t queryCount,
2242 VkBuffer dstBuffer, VkDeviceSize dstOffset,
2243 VkDeviceSize stride, VkFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002244 const VkLayerDispatchTable *disp;
2245
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002246 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002247
Jon Ashburn23d36b12016-02-02 17:47:28 -07002248 disp->CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery,
2249 queryCount, dstBuffer, dstOffset, stride,
2250 flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002251}
2252
Jon Ashburn23d36b12016-02-02 17:47:28 -07002253LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2254vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout,
2255 VkShaderStageFlags stageFlags, uint32_t offset,
2256 uint32_t size, const void *pValues) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002257 const VkLayerDispatchTable *disp;
2258
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002259 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002260
Jon Ashburn23d36b12016-02-02 17:47:28 -07002261 disp->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size,
2262 pValues);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06002263}
2264
Jon Ashburn23d36b12016-02-02 17:47:28 -07002265LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2266vkCmdBeginRenderPass(VkCommandBuffer commandBuffer,
2267 const VkRenderPassBeginInfo *pRenderPassBegin,
2268 VkSubpassContents contents) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002269 const VkLayerDispatchTable *disp;
2270
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002271 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002272
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002273 disp->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
Chia-I Wu08accc62015-07-07 11:50:03 +08002274}
2275
Jon Ashburn23d36b12016-02-02 17:47:28 -07002276LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2277vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) {
Chia-I Wu08accc62015-07-07 11:50:03 +08002278 const VkLayerDispatchTable *disp;
2279
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002280 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu08accc62015-07-07 11:50:03 +08002281
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002282 disp->CmdNextSubpass(commandBuffer, contents);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002283}
2284
Jon Ashburn23d36b12016-02-02 17:47:28 -07002285LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2286vkCmdEndRenderPass(VkCommandBuffer commandBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002287 const VkLayerDispatchTable *disp;
2288
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002289 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002290
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002291 disp->CmdEndRenderPass(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002292}
2293
Jon Ashburn23d36b12016-02-02 17:47:28 -07002294LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2295vkCmdExecuteCommands(VkCommandBuffer commandBuffer,
2296 uint32_t commandBuffersCount,
2297 const VkCommandBuffer *pCommandBuffers) {
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002298 const VkLayerDispatchTable *disp;
2299
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002300 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002301
Jon Ashburn23d36b12016-02-02 17:47:28 -07002302 disp->CmdExecuteCommands(commandBuffer, commandBuffersCount,
2303 pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002304}