blob: 7ed168f53f159553c5864bc316039355cc79813c [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
71 // loader
72 // or someone else supports the extension
73 return trampolineGetProcAddr(ptr_instance, pName);
74}
75
76/**
77 * Get a device level or global level entry point address.
78 * @param device
79 * @param pName
80 * @return
81 * If device is valid, returns a device relative entry point for device level
82 * entry points both core and extensions.
83 * Device relative means call down the device chain.
84 */
85LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
86vkGetDeviceProcAddr(VkDevice device, const char *pName) {
87 void *addr;
88
89 /* for entrypoints that loader must handle (ie non-dispatchable or create
90 object)
91 make sure the loader entrypoint is returned */
92 addr = loader_non_passthrough_gdpa(pName);
93 if (addr) {
94 return addr;
95 }
96
97 /* Although CreateDevice is on device chain it's dispatchable object isn't
98 * a VkDevice or child of VkDevice so return NULL.
99 */
100 if (!strcmp(pName, "CreateDevice"))
101 return NULL;
102
103 /* return the dispatch table entrypoint for the fastest case */
104 const VkLayerDispatchTable *disp_table = *(VkLayerDispatchTable **)device;
105 if (disp_table == NULL)
106 return NULL;
107
108 addr = loader_lookup_device_dispatch_table(disp_table, pName);
109 if (addr)
110 return addr;
111
112 if (disp_table->GetDeviceProcAddr == NULL)
113 return NULL;
114 return disp_table->GetDeviceProcAddr(device, pName);
115}
116
117LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
118vkEnumerateInstanceExtensionProperties(const char *pLayerName,
119 uint32_t *pPropertyCount,
120 VkExtensionProperties *pProperties) {
121 struct loader_extension_list *global_ext_list = NULL;
122 struct loader_layer_list instance_layers;
Jon Ashburnb8726962016-04-08 15:03:35 -0600123 struct loader_extension_list local_ext_list;
Jon Ashburn1530c342016-02-26 13:14:27 -0700124 struct loader_icd_libs icd_libs;
125 uint32_t copy_size;
Mark Young0ad83132016-06-30 13:02:42 -0600126 VkResult res = VK_SUCCESS;
Jon Ashburn1530c342016-02-26 13:14:27 -0700127
128 tls_instance = NULL;
Jon Ashburnb8726962016-04-08 15:03:35 -0600129 memset(&local_ext_list, 0, sizeof(local_ext_list));
Jon Ashburn1530c342016-02-26 13:14:27 -0700130 memset(&instance_layers, 0, sizeof(instance_layers));
131 loader_platform_thread_once(&once_init, loader_initialize);
132
133 /* get layer libraries if needed */
134 if (pLayerName && strlen(pLayerName) != 0) {
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600135 if (vk_string_validate(MaxLoaderStringLength, pLayerName) !=
Jon Ashburn1530c342016-02-26 13:14:27 -0700136 VK_STRING_ERROR_NONE) {
Jon Ashburn1530c342016-02-26 13:14:27 -0700137 assert(VK_FALSE && "vkEnumerateInstanceExtensionProperties: "
138 "pLayerName is too long or is badly formed");
Mark Young0ad83132016-06-30 13:02:42 -0600139 res = VK_ERROR_EXTENSION_NOT_PRESENT;
140 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700141 }
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600142
Jon Ashburn491cd042016-05-16 14:01:18 -0600143 loader_layer_scan(NULL, &instance_layers);
Jon Ashburnb8726962016-04-08 15:03:35 -0600144 if (strcmp(pLayerName, std_validation_str) == 0) {
145 struct loader_layer_list local_list;
146 memset(&local_list, 0, sizeof(local_list));
147 for (uint32_t i = 0; i < sizeof(std_validation_names) /
148 sizeof(std_validation_names[0]);
149 i++) {
150 loader_find_layer_name_add_list(NULL, std_validation_names[i],
151 VK_LAYER_TYPE_INSTANCE_EXPLICIT,
152 &instance_layers, &local_list);
153 }
154 for (uint32_t i = 0; i < local_list.count; i++) {
155 struct loader_extension_list *ext_list =
Jon Ashburncc407a22016-04-15 09:25:03 -0600156 &local_list.list[i].instance_extension_list;
Jon Ashburnb8726962016-04-08 15:03:35 -0600157 loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count,
158 ext_list->list);
159 }
Mark Youngd9ccdd32016-08-01 11:34:36 -0600160 loader_destroy_layer_list(NULL, NULL, &local_list);
Jon Ashburnb8726962016-04-08 15:03:35 -0600161 global_ext_list = &local_ext_list;
162
163 } else {
164 for (uint32_t i = 0; i < instance_layers.count; i++) {
165 struct loader_layer_properties *props =
166 &instance_layers.list[i];
167 if (strcmp(props->info.layerName, pLayerName) == 0) {
168 global_ext_list = &props->instance_extension_list;
169 break;
170 }
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600171 }
172 }
Jon Ashburn1530c342016-02-26 13:14:27 -0700173 } else {
174 /* Scan/discover all ICD libraries */
175 memset(&icd_libs, 0, sizeof(struct loader_icd_libs));
Mark Young0ad83132016-06-30 13:02:42 -0600176 res = loader_icd_scan(NULL, &icd_libs);
177 if (VK_SUCCESS != res) {
178 goto out;
179 }
Jon Ashburn1530c342016-02-26 13:14:27 -0700180 /* get extensions from all ICD's, merge so no duplicates */
Mark Young3a587792016-08-19 15:25:08 -0600181 res = loader_get_icd_loader_instance_extensions(NULL, &icd_libs,
182 &local_ext_list);
183 if (VK_SUCCESS != res) {
184 goto out;
185 }
Jon Ashburn1530c342016-02-26 13:14:27 -0700186 loader_scanned_icd_clear(NULL, &icd_libs);
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600187
188 // Append implicit layers.
Jon Ashburn491cd042016-05-16 14:01:18 -0600189 loader_implicit_layer_scan(NULL, &instance_layers);
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600190 for (uint32_t i = 0; i < instance_layers.count; i++) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600191 struct loader_extension_list *ext_list =
192 &instance_layers.list[i].instance_extension_list;
193 loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count,
194 ext_list->list);
Jeremy Hayes3e2bd5a2016-04-01 11:40:26 -0600195 }
196
Jon Ashburnb8726962016-04-08 15:03:35 -0600197 global_ext_list = &local_ext_list;
Jon Ashburn1530c342016-02-26 13:14:27 -0700198 }
199
200 if (global_ext_list == NULL) {
Mark Young0ad83132016-06-30 13:02:42 -0600201 res = VK_ERROR_LAYER_NOT_PRESENT;
202 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700203 }
204
205 if (pProperties == NULL) {
206 *pPropertyCount = global_ext_list->count;
Mark Young0ad83132016-06-30 13:02:42 -0600207 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700208 }
209
210 copy_size = *pPropertyCount < global_ext_list->count
211 ? *pPropertyCount
212 : global_ext_list->count;
213 for (uint32_t i = 0; i < copy_size; i++) {
214 memcpy(&pProperties[i], &global_ext_list->list[i],
215 sizeof(VkExtensionProperties));
216 }
217 *pPropertyCount = copy_size;
Jon Ashburn1530c342016-02-26 13:14:27 -0700218
219 if (copy_size < global_ext_list->count) {
Mark Young0ad83132016-06-30 13:02:42 -0600220 res = VK_INCOMPLETE;
221 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700222 }
223
Mark Young0ad83132016-06-30 13:02:42 -0600224out:
225 loader_destroy_generic_list(NULL, (struct loader_generic_list *)&local_ext_list);
davidhubbard36831082016-07-27 17:59:58 -0700226 loader_delete_layer_properties(NULL, &instance_layers);
Mark Young0ad83132016-06-30 13:02:42 -0600227 return res;
Jon Ashburn1530c342016-02-26 13:14:27 -0700228}
229
230LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
231vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount,
232 VkLayerProperties *pProperties) {
233
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 */
366 memset(&ptr_instance->icd_libs, 0, sizeof(ptr_instance->icd_libs));
Mark Young0ad83132016-06-30 13:02:42 -0600367 res = loader_icd_scan(ptr_instance, &ptr_instance->icd_libs);
368 if (res != VK_SUCCESS) {
369 goto out;
370 }
Jon Ashburn8810c5f2015-08-18 18:04:47 -0600371
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600372 /* get extensions from all ICD's, merge so no duplicates, then validate */
Mark Young3a587792016-08-19 15:25:08 -0600373 res = loader_get_icd_loader_instance_extensions(
Jon Ashburn23d36b12016-02-02 17:47:28 -0700374 ptr_instance, &ptr_instance->icd_libs, &ptr_instance->ext_list);
Mark Young3a587792016-08-19 15:25:08 -0600375 if (res != VK_SUCCESS) {
376 goto out;
377 }
Jon Ashburn23d36b12016-02-02 17:47:28 -0700378 res = loader_validate_instance_extensions(
Jon Ashburnf2b4e382016-02-10 20:50:19 -0700379 ptr_instance, &ptr_instance->ext_list,
Chris Forbesbd9de052016-04-06 20:49:02 +1200380 &ptr_instance->instance_layer_list, &ici);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600381 if (res != VK_SUCCESS) {
Mark Young0ad83132016-06-30 13:02:42 -0600382 goto out;
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600383 }
384
Mark Young0ad83132016-06-30 13:02:42 -0600385 ptr_instance->disp = loader_instance_heap_alloc(
386 ptr_instance, sizeof(VkLayerInstanceDispatchTable),
387 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600388 if (ptr_instance->disp == NULL) {
Mark Young0ad83132016-06-30 13:02:42 -0600389 res = VK_ERROR_OUT_OF_HOST_MEMORY;
390 goto out;
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600391 }
392 memcpy(ptr_instance->disp, &instance_disp, sizeof(instance_disp));
393 ptr_instance->next = loader.instances;
394 loader.instances = ptr_instance;
395
Jon Ashburnb82c1852015-08-11 14:49:54 -0600396 /* activate any layers on instance chain */
Chris Forbesbd9de052016-04-06 20:49:02 +1200397 res = loader_enable_instance_layers(ptr_instance, &ici,
Jon Ashburne39a4f82015-08-28 13:38:21 -0600398 &ptr_instance->instance_layer_list);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600399 if (res != VK_SUCCESS) {
Mark Young0ad83132016-06-30 13:02:42 -0600400 goto out;
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600401 }
Jon Ashburn07daee72015-05-21 18:13:33 -0600402
Jon Ashburn23d36b12016-02-02 17:47:28 -0700403 created_instance = (VkInstance)ptr_instance;
Chris Forbesbd9de052016-04-06 20:49:02 +1200404 res = loader_create_instance_chain(&ici, pAllocator, ptr_instance,
Jon Ashburn6e0a2132016-02-03 12:37:30 -0700405 &created_instance);
Jon Ashburneed0c002015-05-21 17:42:17 -0600406
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700407 if (res == VK_SUCCESS) {
Chris Forbesbd9de052016-04-06 20:49:02 +1200408 wsi_create_instance(ptr_instance, &ici);
409 debug_report_create_instance(ptr_instance, &ici);
Mark Lobodzinski317574e2016-08-29 14:21:14 -0600410 extensions_create_instance(ptr_instance, &ici);
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700411
Jon Ashburne5b9bba2016-01-18 12:20:03 -0700412 *pInstance = created_instance;
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700413
Jon Ashburne46cf7c2016-01-14 13:51:55 -0700414 /*
415 * Finally have the layers in place and everyone has seen
416 * the CreateInstance command go by. This allows the layer's
417 * GetInstanceProcAddr functions to return valid extension functions
418 * if enabled.
419 */
420 loader_activate_instance_layer_extensions(ptr_instance, *pInstance);
421 }
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700422
Mark Young0ad83132016-06-30 13:02:42 -0600423out:
424
425 if (NULL != ptr_instance) {
426 if (res != VK_SUCCESS) {
427 if (NULL != ptr_instance->next) {
428 loader.instances = ptr_instance->next;
429 }
430 if (NULL != ptr_instance->disp) {
431 loader_instance_heap_free(ptr_instance, ptr_instance->disp);
432 }
433 if (ptr_instance->num_tmp_callbacks > 0) {
434 util_DestroyDebugReportCallbacks(
435 ptr_instance, pAllocator, ptr_instance->num_tmp_callbacks,
436 ptr_instance->tmp_callbacks);
437 util_FreeDebugReportCreateInfos(
438 pAllocator, ptr_instance->tmp_dbg_create_infos,
439 ptr_instance->tmp_callbacks);
440 }
441
442 loader_deactivate_layers(ptr_instance, NULL,
443 &ptr_instance->activated_layer_list);
444
445 loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo,
446 &ici);
447 loader_delete_layer_properties(ptr_instance,
448 &ptr_instance->instance_layer_list);
449 loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
450 loader_destroy_generic_list(
451 ptr_instance,
452 (struct loader_generic_list *)&ptr_instance->ext_list);
453
454 loader_instance_heap_free(ptr_instance, ptr_instance);
455 } else {
456 /* Remove temporary debug_report callback */
457 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
458 ptr_instance->num_tmp_callbacks,
459 ptr_instance->tmp_callbacks);
460 loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo,
461 &ici);
462 }
463
464 if (loaderLocked) {
465 loader_platform_thread_unlock_mutex(&loader_lock);
466 }
467 }
468
Jon Ashburn27cd5842015-05-12 17:26:48 -0600469 return res;
470}
471
Mark Young0ad83132016-06-30 13:02:42 -0600472LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(
473 VkInstance instance, const VkAllocationCallbacks *pAllocator) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600474 const VkLayerInstanceDispatchTable *disp;
Jon Ashburne0e64572015-09-30 12:56:42 -0600475 struct loader_instance *ptr_instance = NULL;
Ian Elliott3b354cf2016-03-25 08:43:01 -0600476 bool callback_setup = false;
477
Jeremy Hayesd8726c22016-04-21 13:19:41 -0600478 if (instance == VK_NULL_HANDLE) {
479 return;
480 }
481
Jon Ashburn27cd5842015-05-12 17:26:48 -0600482 disp = loader_get_instance_dispatch(instance);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600483
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600484 loader_platform_thread_lock_mutex(&loader_lock);
485
Jon Ashburne0e64572015-09-30 12:56:42 -0600486 ptr_instance = loader_get_instance(instance);
Ian Elliott3b354cf2016-03-25 08:43:01 -0600487
Mark Young0ad83132016-06-30 13:02:42 -0600488 if (pAllocator) {
489 ptr_instance->alloc_callbacks = *pAllocator;
490 }
491
Ian Elliottad6300f2016-03-31 10:48:19 -0600492 if (ptr_instance->num_tmp_callbacks > 0) {
493 // Setup the temporary callback(s) here to catch cleanup issues:
Jon Ashburncc407a22016-04-15 09:25:03 -0600494 if (!util_CreateDebugReportCallbacks(ptr_instance, pAllocator,
495 ptr_instance->num_tmp_callbacks,
496 ptr_instance->tmp_dbg_create_infos,
497 ptr_instance->tmp_callbacks)) {
Ian Elliott3b354cf2016-03-25 08:43:01 -0600498 callback_setup = true;
499 }
500 }
501
Chia-I Wuf7458c52015-10-26 21:10:41 +0800502 disp->DestroyInstance(instance, pAllocator);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600503
Mark Young0ad83132016-06-30 13:02:42 -0600504 loader_deactivate_layers(ptr_instance, NULL,
505 &ptr_instance->activated_layer_list);
506 if (ptr_instance->phys_devs) {
507 loader_instance_heap_free(ptr_instance, ptr_instance->phys_devs);
508 }
Ian Elliott3b354cf2016-03-25 08:43:01 -0600509 if (callback_setup) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600510 util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
Ian Elliottad6300f2016-03-31 10:48:19 -0600511 ptr_instance->num_tmp_callbacks,
512 ptr_instance->tmp_callbacks);
513 util_FreeDebugReportCreateInfos(pAllocator,
514 ptr_instance->tmp_dbg_create_infos,
515 ptr_instance->tmp_callbacks);
Ian Elliott3b354cf2016-03-25 08:43:01 -0600516 }
Mark Young0ad83132016-06-30 13:02:42 -0600517 loader_instance_heap_free(ptr_instance, ptr_instance->disp);
518 loader_instance_heap_free(ptr_instance, ptr_instance);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600519 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600520}
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600521
Jon Ashburn23d36b12016-02-02 17:47:28 -0700522LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
523vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount,
524 VkPhysicalDevice *pPhysicalDevices) {
Jon Ashburn27cd5842015-05-12 17:26:48 -0600525 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600526 VkResult res;
Jon Ashburn014438f2016-03-01 19:51:07 -0700527 uint32_t count, i;
528 struct loader_instance *inst;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600529 disp = loader_get_instance_dispatch(instance);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600530
531 loader_platform_thread_lock_mutex(&loader_lock);
532 res = disp->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount,
Jon Ashburn27cd5842015-05-12 17:26:48 -0600533 pPhysicalDevices);
Jon Ashburn014438f2016-03-01 19:51:07 -0700534
535 if (res != VK_SUCCESS && res != VK_INCOMPLETE) {
536 loader_platform_thread_unlock_mutex(&loader_lock);
537 return res;
538 }
539
540 if (!pPhysicalDevices) {
541 loader_platform_thread_unlock_mutex(&loader_lock);
542 return res;
543 }
544
545 // wrap the PhysDev object for loader usage, return wrapped objects
546 inst = loader_get_instance(instance);
547 if (!inst) {
548 loader_platform_thread_unlock_mutex(&loader_lock);
549 return VK_ERROR_INITIALIZATION_FAILED;
550 }
Jon Ashburncc407a22016-04-15 09:25:03 -0600551 count = (inst->total_gpu_count < *pPhysicalDeviceCount)
552 ? inst->total_gpu_count
553 : *pPhysicalDeviceCount;
Piers Daniell295fe402016-03-29 11:51:11 -0600554 *pPhysicalDeviceCount = count;
Jeannot Breton32ad8d82016-04-12 15:46:20 -0500555 if (!inst->phys_devs) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600556 inst->phys_devs =
Mark Young0ad83132016-06-30 13:02:42 -0600557 (struct loader_physical_device_tramp *)loader_instance_heap_alloc(
Jon Ashburncc407a22016-04-15 09:25:03 -0600558 inst, inst->total_gpu_count *
559 sizeof(struct loader_physical_device_tramp),
560 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Jeannot Breton32ad8d82016-04-12 15:46:20 -0500561 }
Jon Ashburn014438f2016-03-01 19:51:07 -0700562 if (!inst->phys_devs) {
563 loader_platform_thread_unlock_mutex(&loader_lock);
564 return VK_ERROR_OUT_OF_HOST_MEMORY;
565 }
566
567 for (i = 0; i < count; i++) {
568
569 // initialize the loader's physicalDevice object
570 loader_set_dispatch((void *)&inst->phys_devs[i], inst->disp);
Piers Daniell295fe402016-03-29 11:51:11 -0600571 inst->phys_devs[i].this_instance = inst;
Jon Ashburn014438f2016-03-01 19:51:07 -0700572 inst->phys_devs[i].phys_dev = pPhysicalDevices[i];
573
574 // copy wrapped object into Application provided array
575 pPhysicalDevices[i] = (VkPhysicalDevice)&inst->phys_devs[i];
576 }
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600577 loader_platform_thread_unlock_mutex(&loader_lock);
578 return res;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600579}
580
Jon Ashburn23d36b12016-02-02 17:47:28 -0700581LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
Jon Ashburn014438f2016-03-01 19:51:07 -0700582vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700583 VkPhysicalDeviceFeatures *pFeatures) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600584 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700585 VkPhysicalDevice unwrapped_phys_dev =
586 loader_unwrap_physical_device(physicalDevice);
587 disp = loader_get_instance_dispatch(physicalDevice);
588 disp->GetPhysicalDeviceFeatures(unwrapped_phys_dev, pFeatures);
Jon Ashburn754864f2015-07-23 18:49:07 -0600589}
590
Jon Ashburn23d36b12016-02-02 17:47:28 -0700591LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
Jon Ashburn014438f2016-03-01 19:51:07 -0700592vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice,
593 VkFormat format,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700594 VkFormatProperties *pFormatInfo) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600595 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700596 VkPhysicalDevice unwrapped_pd =
597 loader_unwrap_physical_device(physicalDevice);
598 disp = loader_get_instance_dispatch(physicalDevice);
599 disp->GetPhysicalDeviceFormatProperties(unwrapped_pd, format, pFormatInfo);
Jon Ashburn754864f2015-07-23 18:49:07 -0600600}
601
Jon Ashburn23d36b12016-02-02 17:47:28 -0700602LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
603vkGetPhysicalDeviceImageFormatProperties(
604 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
605 VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
606 VkImageFormatProperties *pImageFormatProperties) {
Jon Ashburn754864f2015-07-23 18:49:07 -0600607 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700608 VkPhysicalDevice unwrapped_phys_dev =
609 loader_unwrap_physical_device(physicalDevice);
Jon Ashburn754864f2015-07-23 18:49:07 -0600610 disp = loader_get_instance_dispatch(physicalDevice);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700611 return disp->GetPhysicalDeviceImageFormatProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700612 unwrapped_phys_dev, format, type, tiling, usage, flags,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700613 pImageFormatProperties);
Jon Ashburn754864f2015-07-23 18:49:07 -0600614}
615
Jon Ashburn23d36b12016-02-02 17:47:28 -0700616LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
Jon Ashburn014438f2016-03-01 19:51:07 -0700617vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700618 VkPhysicalDeviceProperties *pProperties) {
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600619 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700620 VkPhysicalDevice unwrapped_phys_dev =
621 loader_unwrap_physical_device(physicalDevice);
622 disp = loader_get_instance_dispatch(physicalDevice);
623 disp->GetPhysicalDeviceProperties(unwrapped_phys_dev, pProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600624}
625
Jon Ashburn23d36b12016-02-02 17:47:28 -0700626LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
627vkGetPhysicalDeviceQueueFamilyProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700628 VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount,
Jon Ashburn23d36b12016-02-02 17:47:28 -0700629 VkQueueFamilyProperties *pQueueProperties) {
Tony Barbour59a47322015-06-24 16:06:58 -0600630 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700631 VkPhysicalDevice unwrapped_phys_dev =
632 loader_unwrap_physical_device(physicalDevice);
633 disp = loader_get_instance_dispatch(physicalDevice);
634 disp->GetPhysicalDeviceQueueFamilyProperties(
635 unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600636}
637
Chia-I Wu9ab61502015-11-06 06:42:02 +0800638LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700639 VkPhysicalDevice physicalDevice,
640 VkPhysicalDeviceMemoryProperties *pMemoryProperties) {
Tony Barbour59a47322015-06-24 16:06:58 -0600641 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -0700642 VkPhysicalDevice unwrapped_phys_dev =
643 loader_unwrap_physical_device(physicalDevice);
644 disp = loader_get_instance_dispatch(physicalDevice);
645 disp->GetPhysicalDeviceMemoryProperties(unwrapped_phys_dev,
646 pMemoryProperties);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600647}
648
Mark Young0ad83132016-06-30 13:02:42 -0600649LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(
650 VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
651 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600652 VkResult res;
Mark Young0ad83132016-06-30 13:02:42 -0600653 struct loader_physical_device_tramp *phys_dev = NULL;
654 struct loader_device *dev = NULL;
655 struct loader_instance *inst = NULL;
Jon Ashburn1530c342016-02-26 13:14:27 -0700656
657 assert(pCreateInfo->queueCreateInfoCount >= 1);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600658
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600659 loader_platform_thread_lock_mutex(&loader_lock);
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600660
Jon Ashburn787eb252016-03-24 15:49:57 -0600661 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Piers Daniell295fe402016-03-29 11:51:11 -0600662 inst = (struct loader_instance *)phys_dev->this_instance;
Jon Ashburn1530c342016-02-26 13:14:27 -0700663
Jon Ashburn014438f2016-03-01 19:51:07 -0700664 /* Get the physical device (ICD) extensions */
665 struct loader_extension_list icd_exts;
Mark Young0ad83132016-06-30 13:02:42 -0600666 icd_exts.list = NULL;
Mark Young3a587792016-08-19 15:25:08 -0600667 res =
668 loader_init_generic_list(inst, (struct loader_generic_list *)&icd_exts,
669 sizeof(VkExtensionProperties));
670 if (VK_SUCCESS != res) {
Mark Young0ad83132016-06-30 13:02:42 -0600671 goto out;
Jon Ashburn014438f2016-03-01 19:51:07 -0700672 }
Jon Ashburn1530c342016-02-26 13:14:27 -0700673
Jon Ashburn014438f2016-03-01 19:51:07 -0700674 res = loader_add_device_extensions(
Jon Ashburncc407a22016-04-15 09:25:03 -0600675 inst, inst->disp->EnumerateDeviceExtensionProperties,
676 phys_dev->phys_dev, "Unknown", &icd_exts);
Jon Ashburn014438f2016-03-01 19:51:07 -0700677 if (res != VK_SUCCESS) {
Mark Young0ad83132016-06-30 13:02:42 -0600678 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700679 }
680
Jon Ashburn1530c342016-02-26 13:14:27 -0700681 /* make sure requested extensions to be enabled are supported */
Mark Young0ad83132016-06-30 13:02:42 -0600682 res = loader_validate_device_extensions(
683 phys_dev, &inst->activated_layer_list, &icd_exts, pCreateInfo);
Jon Ashburn1530c342016-02-26 13:14:27 -0700684 if (res != VK_SUCCESS) {
Mark Young0ad83132016-06-30 13:02:42 -0600685 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700686 }
687
Mark Young0ad83132016-06-30 13:02:42 -0600688 dev = loader_create_logical_device(inst, pAllocator);
Jon Ashburn1530c342016-02-26 13:14:27 -0700689 if (dev == NULL) {
Mark Young0ad83132016-06-30 13:02:42 -0600690 res = VK_ERROR_OUT_OF_HOST_MEMORY;
691 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700692 }
693
Jon Ashburn491cd042016-05-16 14:01:18 -0600694 /* copy the instance layer list into the device */
695 dev->activated_layer_list.capacity = inst->activated_layer_list.capacity;
696 dev->activated_layer_list.count = inst->activated_layer_list.count;
Mark Young0ad83132016-06-30 13:02:42 -0600697 dev->activated_layer_list.list =
698 loader_device_heap_alloc(dev, inst->activated_layer_list.capacity,
699 VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
Jon Ashburn491cd042016-05-16 14:01:18 -0600700 if (dev->activated_layer_list.list == NULL) {
Mark Young0ad83132016-06-30 13:02:42 -0600701 res = VK_ERROR_OUT_OF_HOST_MEMORY;
702 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700703 }
Jon Ashburn491cd042016-05-16 14:01:18 -0600704 memcpy(dev->activated_layer_list.list, inst->activated_layer_list.list,
Mark Young0ad83132016-06-30 13:02:42 -0600705 sizeof(*dev->activated_layer_list.list) *
706 dev->activated_layer_list.count);
Jon Ashburn1530c342016-02-26 13:14:27 -0700707
Mark Young0ad83132016-06-30 13:02:42 -0600708 res = loader_create_device_chain(phys_dev, pCreateInfo, pAllocator, inst,
709 dev);
Jon Ashburn1530c342016-02-26 13:14:27 -0700710 if (res != VK_SUCCESS) {
Mark Young0ad83132016-06-30 13:02:42 -0600711 goto out;
Jon Ashburn1530c342016-02-26 13:14:27 -0700712 }
713
714 *pDevice = dev->device;
715
716 /* initialize any device extension dispatch entry's from the instance list*/
717 loader_init_dispatch_dev_ext(inst, dev);
718
719 /* initialize WSI device extensions as part of core dispatch since loader
720 * has
721 * dedicated trampoline code for these*/
722 loader_init_device_extension_dispatch_table(
723 &dev->loader_dispatch,
724 dev->loader_dispatch.core_dispatch.GetDeviceProcAddr, *pDevice);
725
Mark Young0ad83132016-06-30 13:02:42 -0600726out:
727
728 // Failure cleanup
729 if (VK_SUCCESS != res) {
730 if (NULL != dev) {
731 loader_destroy_logical_device(inst, dev, pAllocator);
732 }
733 }
734
735 if (NULL != icd_exts.list) {
736 loader_destroy_generic_list(inst,
737 (struct loader_generic_list *)&icd_exts);
738 }
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600739 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600740 return res;
741}
742
Jon Ashburn23d36b12016-02-02 17:47:28 -0700743LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
744vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600745 const VkLayerDispatchTable *disp;
Jon Ashburne39a4f82015-08-28 13:38:21 -0600746 struct loader_device *dev;
Andrzej Kotlowskib168b1a2016-02-03 09:41:53 +0100747
Jeremy Hayesd8726c22016-04-21 13:19:41 -0600748 if (device == VK_NULL_HANDLE) {
749 return;
750 }
751
Andrzej Kotlowskib168b1a2016-02-03 09:41:53 +0100752 loader_platform_thread_lock_mutex(&loader_lock);
753
Jon Ashburne39a4f82015-08-28 13:38:21 -0600754 struct loader_icd *icd = loader_get_icd_and_device(device, &dev);
755 const struct loader_instance *inst = icd->this_instance;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600756 disp = loader_get_dispatch(device);
757
Chia-I Wuf7458c52015-10-26 21:10:41 +0800758 disp->DestroyDevice(device, pAllocator);
Jon Ashburn781a7ae2015-11-19 15:43:26 -0700759 dev->device = NULL;
Mark Young0ad83132016-06-30 13:02:42 -0600760 loader_remove_logical_device(inst, icd, dev, pAllocator);
Jon Ashburn781a7ae2015-11-19 15:43:26 -0700761
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600762 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600763}
764
Jon Ashburn23d36b12016-02-02 17:47:28 -0700765LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
766vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
767 const char *pLayerName,
768 uint32_t *pPropertyCount,
769 VkExtensionProperties *pProperties) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700770 VkResult res = VK_SUCCESS;
Jon Ashburn787eb252016-03-24 15:49:57 -0600771 struct loader_physical_device_tramp *phys_dev;
772 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600773
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600774 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700775
776 /* If pLayerName == NULL, then querying ICD extensions, pass this call
777 down the instance chain which will terminate in the ICD. This allows
778 layers to filter the extensions coming back up the chain.
779 If pLayerName != NULL then get layer extensions from manifest file. */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700780 if (pLayerName == NULL || strlen(pLayerName) == 0) {
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700781 const VkLayerInstanceDispatchTable *disp;
782
783 disp = loader_get_instance_dispatch(physicalDevice);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700784 res = disp->EnumerateDeviceExtensionProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700785 phys_dev->phys_dev, NULL, pPropertyCount, pProperties);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700786 } else {
Jon Ashburn014438f2016-03-01 19:51:07 -0700787
Jon Ashburndc5d9202016-02-29 13:00:51 -0700788 uint32_t count;
789 uint32_t copy_size;
Piers Daniell295fe402016-03-29 11:51:11 -0600790 const struct loader_instance *inst = phys_dev->this_instance;
Jon Ashburnb8726962016-04-08 15:03:35 -0600791 struct loader_device_extension_list *dev_ext_list = NULL;
792 struct loader_device_extension_list local_ext_list;
793 memset(&local_ext_list, 0, sizeof(local_ext_list));
Jon Ashburndc5d9202016-02-29 13:00:51 -0700794 if (vk_string_validate(MaxLoaderStringLength, pLayerName) ==
Jon Ashburn014438f2016-03-01 19:51:07 -0700795 VK_STRING_ERROR_NONE) {
Jon Ashburnb8726962016-04-08 15:03:35 -0600796 if (strcmp(pLayerName, std_validation_str) == 0) {
797 struct loader_layer_list local_list;
798 memset(&local_list, 0, sizeof(local_list));
799 for (uint32_t i = 0; i < sizeof(std_validation_names) /
800 sizeof(std_validation_names[0]);
801 i++) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600802 loader_find_layer_name_add_list(
803 NULL, std_validation_names[i],
Jon Ashburn491cd042016-05-16 14:01:18 -0600804 VK_LAYER_TYPE_INSTANCE_EXPLICIT, &inst->instance_layer_list,
Jon Ashburncc407a22016-04-15 09:25:03 -0600805 &local_list);
Jon Ashburnb8726962016-04-08 15:03:35 -0600806 }
807 for (uint32_t i = 0; i < local_list.count; i++) {
808 struct loader_device_extension_list *ext_list =
Jon Ashburncc407a22016-04-15 09:25:03 -0600809 &local_list.list[i].device_extension_list;
Jon Ashburnb8726962016-04-08 15:03:35 -0600810 for (uint32_t j = 0; j < ext_list->count; j++) {
811 loader_add_to_dev_ext_list(NULL, &local_ext_list,
812 &ext_list->list[j].props, 0,
813 NULL);
814 }
815 }
816 dev_ext_list = &local_ext_list;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700817
Jon Ashburnb8726962016-04-08 15:03:35 -0600818 } else {
Jon Ashburn491cd042016-05-16 14:01:18 -0600819 for (uint32_t i = 0; i < inst->instance_layer_list.count; i++) {
Jon Ashburnb8726962016-04-08 15:03:35 -0600820 struct loader_layer_properties *props =
Jon Ashburn491cd042016-05-16 14:01:18 -0600821 &inst->instance_layer_list.list[i];
Jon Ashburnb8726962016-04-08 15:03:35 -0600822 if (strcmp(props->info.layerName, pLayerName) == 0) {
823 dev_ext_list = &props->device_extension_list;
824 }
Jon Ashburndc5d9202016-02-29 13:00:51 -0700825 }
826 }
Jon Ashburnb8726962016-04-08 15:03:35 -0600827
Jon Ashburndc5d9202016-02-29 13:00:51 -0700828 count = (dev_ext_list == NULL) ? 0 : dev_ext_list->count;
829 if (pProperties == NULL) {
830 *pPropertyCount = count;
Jon Ashburncc407a22016-04-15 09:25:03 -0600831 loader_destroy_generic_list(
832 inst, (struct loader_generic_list *)&local_ext_list);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700833 loader_platform_thread_unlock_mutex(&loader_lock);
834 return VK_SUCCESS;
835 }
836
837 copy_size = *pPropertyCount < count ? *pPropertyCount : count;
838 for (uint32_t i = 0; i < copy_size; i++) {
839 memcpy(&pProperties[i], &dev_ext_list->list[i].props,
Jon Ashburn014438f2016-03-01 19:51:07 -0700840 sizeof(VkExtensionProperties));
Jon Ashburndc5d9202016-02-29 13:00:51 -0700841 }
842 *pPropertyCount = copy_size;
843
Jon Ashburncc407a22016-04-15 09:25:03 -0600844 loader_destroy_generic_list(
845 inst, (struct loader_generic_list *)&local_ext_list);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700846 if (copy_size < count) {
847 loader_platform_thread_unlock_mutex(&loader_lock);
848 return VK_INCOMPLETE;
849 }
850 } else {
Jon Ashburn014438f2016-03-01 19:51:07 -0700851 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
852 "vkEnumerateDeviceExtensionProperties: pLayerName "
853 "is too long or is badly formed");
854 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700855 return VK_ERROR_EXTENSION_NOT_PRESENT;
856 }
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700857 }
858
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600859 loader_platform_thread_unlock_mutex(&loader_lock);
Tony Barbour59a47322015-06-24 16:06:58 -0600860 return res;
861}
862
Jon Ashburn23d36b12016-02-02 17:47:28 -0700863LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
864vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
865 uint32_t *pPropertyCount,
866 VkLayerProperties *pProperties) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700867 uint32_t copy_size;
Jon Ashburn787eb252016-03-24 15:49:57 -0600868 struct loader_physical_device_tramp *phys_dev;
Jon Ashburn491cd042016-05-16 14:01:18 -0600869 struct loader_layer_list *enabled_layers, layers_list;
870 uint32_t std_val_count = sizeof(std_validation_names) /
871 sizeof(std_validation_names[0]);
872 memset(&layers_list, 0, sizeof(layers_list));
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600873 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700874
875 /* Don't dispatch this call down the instance chain, want all device layers
876 enumerated and instance chain may not contain all device layers */
Jon Ashburn491cd042016-05-16 14:01:18 -0600877 // TODO re-evaluate the above statement we maybe able to start calling
878 // down the chain
Jon Ashburndc5d9202016-02-29 13:00:51 -0700879
Jon Ashburn787eb252016-03-24 15:49:57 -0600880 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Piers Daniell295fe402016-03-29 11:51:11 -0600881 const struct loader_instance *inst = phys_dev->this_instance;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700882
Jon Ashburn491cd042016-05-16 14:01:18 -0600883 uint32_t count = inst->activated_layer_list.count;
884 if (inst->activated_layers_are_std_val)
885 count = count - std_val_count + 1;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700886 if (pProperties == NULL) {
887 *pPropertyCount = count;
888 loader_platform_thread_unlock_mutex(&loader_lock);
889 return VK_SUCCESS;
890 }
Jon Ashburn491cd042016-05-16 14:01:18 -0600891 /* make sure to enumerate standard_validation if that is what was used
892 at the instance layer enablement */
893 if (inst->activated_layers_are_std_val) {
894 enabled_layers = &layers_list;
895 enabled_layers->count = count;
896 enabled_layers->capacity = enabled_layers->count *
897 sizeof(struct loader_layer_properties);
Mark Young0ad83132016-06-30 13:02:42 -0600898 enabled_layers->list = loader_instance_heap_alloc(inst, enabled_layers->capacity,
Jon Ashburn491cd042016-05-16 14:01:18 -0600899 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
900 if (!enabled_layers->list)
901 return VK_ERROR_OUT_OF_HOST_MEMORY;
902
903 uint32_t j = 0;
904 for (uint32_t i = 0; i < inst->activated_layer_list.count; j++) {
905
906 if (loader_find_layer_name_array(
907 inst->activated_layer_list.list[i].info.layerName,
908 std_val_count, std_validation_names)) {
909 struct loader_layer_properties props;
910 loader_init_std_validation_props(&props);
Mark Young0ad83132016-06-30 13:02:42 -0600911 VkResult err = loader_copy_layer_properties(inst,
912 &enabled_layers->list[j],
913 &props);
914 if (err != VK_SUCCESS) {
915 return err;
916 }
Jon Ashburn491cd042016-05-16 14:01:18 -0600917 i += std_val_count;
918 }
919 else {
Mark Young0ad83132016-06-30 13:02:42 -0600920 VkResult err = loader_copy_layer_properties(inst,
921 &enabled_layers->list[j],
922 &inst->activated_layer_list.list[i++]);
923 if (err != VK_SUCCESS) {
924 return err;
925 }
Jon Ashburn491cd042016-05-16 14:01:18 -0600926 }
927 }
928 }
929 else {
930 enabled_layers = (struct loader_layer_list *) &inst->activated_layer_list;
931 }
932
Jon Ashburndc5d9202016-02-29 13:00:51 -0700933
934 copy_size = (*pPropertyCount < count) ? *pPropertyCount : count;
935 for (uint32_t i = 0; i < copy_size; i++) {
Jon Ashburn491cd042016-05-16 14:01:18 -0600936 memcpy(&pProperties[i], &(enabled_layers->list[i].info),
Jon Ashburndc5d9202016-02-29 13:00:51 -0700937 sizeof(VkLayerProperties));
938 }
939 *pPropertyCount = copy_size;
940
Mark Young0ad83132016-06-30 13:02:42 -0600941 if (inst->activated_layers_are_std_val) {
Jon Ashburn491cd042016-05-16 14:01:18 -0600942 loader_delete_layer_properties(inst, enabled_layers);
Mark Young0ad83132016-06-30 13:02:42 -0600943 }
Jon Ashburndc5d9202016-02-29 13:00:51 -0700944 if (copy_size < count) {
945 loader_platform_thread_unlock_mutex(&loader_lock);
946 return VK_INCOMPLETE;
947 }
948
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600949 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700950 return VK_SUCCESS;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600951}
952
Jon Ashburn23d36b12016-02-02 17:47:28 -0700953LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
954vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex,
955 VkQueue *pQueue) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600956 const VkLayerDispatchTable *disp;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600957
958 disp = loader_get_dispatch(device);
959
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600960 disp->GetDeviceQueue(device, queueNodeIndex, queueIndex, pQueue);
961 loader_set_dispatch(*pQueue, disp);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600962}
963
Jon Ashburn23d36b12016-02-02 17:47:28 -0700964LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
965vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits,
966 VkFence fence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600967 const VkLayerDispatchTable *disp;
968
969 disp = loader_get_dispatch(queue);
970
Chia-I Wu40cf0ae2015-10-26 17:20:32 +0800971 return disp->QueueSubmit(queue, submitCount, pSubmits, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600972}
973
Jon Ashburn23d36b12016-02-02 17:47:28 -0700974LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600975 const VkLayerDispatchTable *disp;
976
977 disp = loader_get_dispatch(queue);
978
979 return disp->QueueWaitIdle(queue);
980}
981
Jon Ashburn23d36b12016-02-02 17:47:28 -0700982LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600983 const VkLayerDispatchTable *disp;
984
985 disp = loader_get_dispatch(device);
986
987 return disp->DeviceWaitIdle(device);
988}
989
Jon Ashburn23d36b12016-02-02 17:47:28 -0700990LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
991vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
992 const VkAllocationCallbacks *pAllocator,
993 VkDeviceMemory *pMemory) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600994 const VkLayerDispatchTable *disp;
995
996 disp = loader_get_dispatch(device);
997
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800998 return disp->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600999}
1000
Jon Ashburn23d36b12016-02-02 17:47:28 -07001001LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1002vkFreeMemory(VkDevice device, VkDeviceMemory mem,
1003 const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001004 const VkLayerDispatchTable *disp;
1005
1006 disp = loader_get_dispatch(device);
1007
Chia-I Wuf7458c52015-10-26 21:10:41 +08001008 disp->FreeMemory(device, mem, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001009}
1010
Jon Ashburn23d36b12016-02-02 17:47:28 -07001011LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1012vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset,
1013 VkDeviceSize size, VkFlags flags, void **ppData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001014 const VkLayerDispatchTable *disp;
1015
1016 disp = loader_get_dispatch(device);
1017
1018 return disp->MapMemory(device, mem, offset, size, flags, ppData);
1019}
1020
Jon Ashburn23d36b12016-02-02 17:47:28 -07001021LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1022vkUnmapMemory(VkDevice device, VkDeviceMemory mem) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001023 const VkLayerDispatchTable *disp;
1024
1025 disp = loader_get_dispatch(device);
1026
Mark Lobodzinski2141f652015-09-07 13:59:43 -06001027 disp->UnmapMemory(device, mem);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001028}
1029
Jon Ashburn23d36b12016-02-02 17:47:28 -07001030LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1031vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
1032 const VkMappedMemoryRange *pMemoryRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001033 const VkLayerDispatchTable *disp;
1034
1035 disp = loader_get_dispatch(device);
1036
Jon Ashburn23d36b12016-02-02 17:47:28 -07001037 return disp->FlushMappedMemoryRanges(device, memoryRangeCount,
1038 pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001039}
1040
Jon Ashburn23d36b12016-02-02 17:47:28 -07001041LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1042vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
1043 const VkMappedMemoryRange *pMemoryRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001044 const VkLayerDispatchTable *disp;
1045
1046 disp = loader_get_dispatch(device);
1047
Jon Ashburn23d36b12016-02-02 17:47:28 -07001048 return disp->InvalidateMappedMemoryRanges(device, memoryRangeCount,
1049 pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001050}
1051
Jon Ashburn23d36b12016-02-02 17:47:28 -07001052LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1053vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory,
1054 VkDeviceSize *pCommittedMemoryInBytes) {
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -06001055 const VkLayerDispatchTable *disp;
1056
1057 disp = loader_get_dispatch(device);
1058
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001059 disp->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes);
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -06001060}
1061
Jon Ashburn23d36b12016-02-02 17:47:28 -07001062LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1063vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem,
1064 VkDeviceSize offset) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001065 const VkLayerDispatchTable *disp;
1066
Mark Lobodzinski942b1722015-05-11 17:21:15 -05001067 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001068
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001069 return disp->BindBufferMemory(device, buffer, mem, offset);
1070}
1071
Jon Ashburn23d36b12016-02-02 17:47:28 -07001072LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1073vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem,
1074 VkDeviceSize offset) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001075 const VkLayerDispatchTable *disp;
1076
1077 disp = loader_get_dispatch(device);
1078
1079 return disp->BindImageMemory(device, image, mem, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001080}
1081
Jon Ashburn23d36b12016-02-02 17:47:28 -07001082LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1083vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer,
1084 VkMemoryRequirements *pMemoryRequirements) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001085 const VkLayerDispatchTable *disp;
1086
1087 disp = loader_get_dispatch(device);
1088
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001089 disp->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -06001090}
1091
Jon Ashburn23d36b12016-02-02 17:47:28 -07001092LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1093vkGetImageMemoryRequirements(VkDevice device, VkImage image,
1094 VkMemoryRequirements *pMemoryRequirements) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001095 const VkLayerDispatchTable *disp;
1096
1097 disp = loader_get_dispatch(device);
1098
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001099 disp->GetImageMemoryRequirements(device, image, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -06001100}
1101
Jon Ashburn23d36b12016-02-02 17:47:28 -07001102LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements(
1103 VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount,
1104 VkSparseImageMemoryRequirements *pSparseMemoryRequirements) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001105 const VkLayerDispatchTable *disp;
1106
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001107 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001108
Jon Ashburn23d36b12016-02-02 17:47:28 -07001109 disp->GetImageSparseMemoryRequirements(device, image,
1110 pSparseMemoryRequirementCount,
1111 pSparseMemoryRequirements);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001112}
1113
Jon Ashburn23d36b12016-02-02 17:47:28 -07001114LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1115vkGetPhysicalDeviceSparseImageFormatProperties(
1116 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
1117 VkSampleCountFlagBits samples, VkImageUsageFlags usage,
1118 VkImageTiling tiling, uint32_t *pPropertyCount,
1119 VkSparseImageFormatProperties *pProperties) {
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001120 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -07001121 VkPhysicalDevice unwrapped_phys_dev =
1122 loader_unwrap_physical_device(physicalDevice);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001123 disp = loader_get_instance_dispatch(physicalDevice);
1124
Jon Ashburn23d36b12016-02-02 17:47:28 -07001125 disp->GetPhysicalDeviceSparseImageFormatProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -07001126 unwrapped_phys_dev, format, type, samples, usage, tiling,
1127 pPropertyCount, pProperties);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001128}
1129
Jon Ashburn23d36b12016-02-02 17:47:28 -07001130LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1131vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount,
1132 const VkBindSparseInfo *pBindInfo, VkFence fence) {
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001133 const VkLayerDispatchTable *disp;
1134
1135 disp = loader_get_dispatch(queue);
1136
Chia-I Wu1ff4c3d2015-10-26 16:55:27 +08001137 return disp->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001138}
1139
Jon Ashburn23d36b12016-02-02 17:47:28 -07001140LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1141vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo,
1142 const VkAllocationCallbacks *pAllocator, VkFence *pFence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001143 const VkLayerDispatchTable *disp;
1144
1145 disp = loader_get_dispatch(device);
1146
Chia-I Wuf7458c52015-10-26 21:10:41 +08001147 return disp->CreateFence(device, pCreateInfo, pAllocator, pFence);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001148}
1149
Jon Ashburn23d36b12016-02-02 17:47:28 -07001150LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1151vkDestroyFence(VkDevice device, VkFence fence,
1152 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001153 const VkLayerDispatchTable *disp;
1154
1155 disp = loader_get_dispatch(device);
1156
Chia-I Wuf7458c52015-10-26 21:10:41 +08001157 disp->DestroyFence(device, fence, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001158}
1159
Jon Ashburn23d36b12016-02-02 17:47:28 -07001160LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1161vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001162 const VkLayerDispatchTable *disp;
1163
1164 disp = loader_get_dispatch(device);
1165
1166 return disp->ResetFences(device, fenceCount, pFences);
1167}
1168
Jon Ashburn23d36b12016-02-02 17:47:28 -07001169LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1170vkGetFenceStatus(VkDevice device, VkFence fence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001171 const VkLayerDispatchTable *disp;
1172
1173 disp = loader_get_dispatch(device);
1174
1175 return disp->GetFenceStatus(device, fence);
1176}
1177
Jon Ashburn23d36b12016-02-02 17:47:28 -07001178LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1179vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences,
1180 VkBool32 waitAll, uint64_t timeout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001181 const VkLayerDispatchTable *disp;
1182
1183 disp = loader_get_dispatch(device);
1184
1185 return disp->WaitForFences(device, fenceCount, pFences, waitAll, timeout);
1186}
1187
Jon Ashburn23d36b12016-02-02 17:47:28 -07001188LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1189vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo,
1190 const VkAllocationCallbacks *pAllocator,
1191 VkSemaphore *pSemaphore) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001192 const VkLayerDispatchTable *disp;
1193
1194 disp = loader_get_dispatch(device);
1195
Chia-I Wuf7458c52015-10-26 21:10:41 +08001196 return disp->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001197}
1198
Jon Ashburn23d36b12016-02-02 17:47:28 -07001199LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1200vkDestroySemaphore(VkDevice device, VkSemaphore semaphore,
1201 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001202 const VkLayerDispatchTable *disp;
1203
1204 disp = loader_get_dispatch(device);
1205
Chia-I Wuf7458c52015-10-26 21:10:41 +08001206 disp->DestroySemaphore(device, semaphore, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001207}
1208
Jon Ashburn23d36b12016-02-02 17:47:28 -07001209LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1210vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo,
1211 const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001212 const VkLayerDispatchTable *disp;
1213
1214 disp = loader_get_dispatch(device);
1215
Chia-I Wuf7458c52015-10-26 21:10:41 +08001216 return disp->CreateEvent(device, pCreateInfo, pAllocator, pEvent);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001217}
1218
Jon Ashburn23d36b12016-02-02 17:47:28 -07001219LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1220vkDestroyEvent(VkDevice device, VkEvent event,
1221 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001222 const VkLayerDispatchTable *disp;
1223
1224 disp = loader_get_dispatch(device);
1225
Chia-I Wuf7458c52015-10-26 21:10:41 +08001226 disp->DestroyEvent(device, event, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001227}
1228
Jon Ashburn23d36b12016-02-02 17:47:28 -07001229LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1230vkGetEventStatus(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001231 const VkLayerDispatchTable *disp;
1232
1233 disp = loader_get_dispatch(device);
1234
1235 return disp->GetEventStatus(device, event);
1236}
1237
Jon Ashburn23d36b12016-02-02 17:47:28 -07001238LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1239vkSetEvent(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001240 const VkLayerDispatchTable *disp;
1241
1242 disp = loader_get_dispatch(device);
1243
1244 return disp->SetEvent(device, event);
1245}
1246
Jon Ashburn23d36b12016-02-02 17:47:28 -07001247LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1248vkResetEvent(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001249 const VkLayerDispatchTable *disp;
1250
1251 disp = loader_get_dispatch(device);
1252
1253 return disp->ResetEvent(device, event);
1254}
1255
Jon Ashburn23d36b12016-02-02 17:47:28 -07001256LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1257vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo,
1258 const VkAllocationCallbacks *pAllocator,
1259 VkQueryPool *pQueryPool) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001260 const VkLayerDispatchTable *disp;
1261
1262 disp = loader_get_dispatch(device);
1263
Chia-I Wuf7458c52015-10-26 21:10:41 +08001264 return disp->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001265}
1266
Jon Ashburn23d36b12016-02-02 17:47:28 -07001267LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1268vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool,
1269 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001270 const VkLayerDispatchTable *disp;
1271
1272 disp = loader_get_dispatch(device);
1273
Chia-I Wuf7458c52015-10-26 21:10:41 +08001274 disp->DestroyQueryPool(device, queryPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001275}
1276
Jon Ashburn23d36b12016-02-02 17:47:28 -07001277LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1278vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool,
1279 uint32_t firstQuery, uint32_t queryCount, size_t dataSize,
1280 void *pData, VkDeviceSize stride,
1281 VkQueryResultFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001282 const VkLayerDispatchTable *disp;
1283
1284 disp = loader_get_dispatch(device);
1285
Jon Ashburn23d36b12016-02-02 17:47:28 -07001286 return disp->GetQueryPoolResults(device, queryPool, firstQuery, queryCount,
1287 dataSize, pData, stride, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001288}
1289
Jon Ashburn23d36b12016-02-02 17:47:28 -07001290LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1291vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo,
1292 const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001293 const VkLayerDispatchTable *disp;
1294
1295 disp = loader_get_dispatch(device);
1296
Chia-I Wuf7458c52015-10-26 21:10:41 +08001297 return disp->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001298}
1299
Jon Ashburn23d36b12016-02-02 17:47:28 -07001300LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1301vkDestroyBuffer(VkDevice device, VkBuffer buffer,
1302 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001303 const VkLayerDispatchTable *disp;
1304
1305 disp = loader_get_dispatch(device);
1306
Chia-I Wuf7458c52015-10-26 21:10:41 +08001307 disp->DestroyBuffer(device, buffer, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001308}
1309
Jon Ashburn23d36b12016-02-02 17:47:28 -07001310LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1311vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo,
1312 const VkAllocationCallbacks *pAllocator,
1313 VkBufferView *pView) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001314 const VkLayerDispatchTable *disp;
1315
1316 disp = loader_get_dispatch(device);
1317
Chia-I Wuf7458c52015-10-26 21:10:41 +08001318 return disp->CreateBufferView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001319}
1320
Jon Ashburn23d36b12016-02-02 17:47:28 -07001321LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1322vkDestroyBufferView(VkDevice device, VkBufferView bufferView,
1323 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001324 const VkLayerDispatchTable *disp;
1325
1326 disp = loader_get_dispatch(device);
1327
Chia-I Wuf7458c52015-10-26 21:10:41 +08001328 disp->DestroyBufferView(device, bufferView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001329}
1330
Jon Ashburn23d36b12016-02-02 17:47:28 -07001331LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1332vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
1333 const VkAllocationCallbacks *pAllocator, VkImage *pImage) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001334 const VkLayerDispatchTable *disp;
1335
1336 disp = loader_get_dispatch(device);
1337
Chia-I Wuf7458c52015-10-26 21:10:41 +08001338 return disp->CreateImage(device, pCreateInfo, pAllocator, pImage);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001339}
1340
Jon Ashburn23d36b12016-02-02 17:47:28 -07001341LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1342vkDestroyImage(VkDevice device, VkImage image,
1343 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001344 const VkLayerDispatchTable *disp;
1345
1346 disp = loader_get_dispatch(device);
1347
Chia-I Wuf7458c52015-10-26 21:10:41 +08001348 disp->DestroyImage(device, image, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001349}
1350
Jon Ashburn23d36b12016-02-02 17:47:28 -07001351LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1352vkGetImageSubresourceLayout(VkDevice device, VkImage image,
1353 const VkImageSubresource *pSubresource,
1354 VkSubresourceLayout *pLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001355 const VkLayerDispatchTable *disp;
1356
1357 disp = loader_get_dispatch(device);
1358
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001359 disp->GetImageSubresourceLayout(device, image, pSubresource, pLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001360}
1361
Jon Ashburn23d36b12016-02-02 17:47:28 -07001362LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1363vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo,
1364 const VkAllocationCallbacks *pAllocator, VkImageView *pView) {
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->CreateImageView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001370}
1371
Jon Ashburn23d36b12016-02-02 17:47:28 -07001372LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1373vkDestroyImageView(VkDevice device, VkImageView imageView,
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->DestroyImageView(device, imageView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001380}
1381
Jon Ashburn23d36b12016-02-02 17:47:28 -07001382LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1383vkCreateShaderModule(VkDevice device,
1384 const VkShaderModuleCreateInfo *pCreateInfo,
1385 const VkAllocationCallbacks *pAllocator,
1386 VkShaderModule *pShader) {
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -06001387 const VkLayerDispatchTable *disp;
1388
1389 disp = loader_get_dispatch(device);
1390
Chia-I Wuf7458c52015-10-26 21:10:41 +08001391 return disp->CreateShaderModule(device, pCreateInfo, pAllocator, pShader);
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -06001392}
1393
Jon Ashburn23d36b12016-02-02 17:47:28 -07001394LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1395vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule,
1396 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001397 const VkLayerDispatchTable *disp;
1398
1399 disp = loader_get_dispatch(device);
1400
Chia-I Wuf7458c52015-10-26 21:10:41 +08001401 disp->DestroyShaderModule(device, shaderModule, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001402}
1403
Jon Ashburn23d36b12016-02-02 17:47:28 -07001404LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1405vkCreatePipelineCache(VkDevice device,
1406 const VkPipelineCacheCreateInfo *pCreateInfo,
1407 const VkAllocationCallbacks *pAllocator,
1408 VkPipelineCache *pPipelineCache) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001409 const VkLayerDispatchTable *disp;
1410
1411 disp = loader_get_dispatch(device);
1412
Jon Ashburn23d36b12016-02-02 17:47:28 -07001413 return disp->CreatePipelineCache(device, pCreateInfo, pAllocator,
1414 pPipelineCache);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001415}
1416
Jon Ashburn23d36b12016-02-02 17:47:28 -07001417LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1418vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache,
1419 const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001420 const VkLayerDispatchTable *disp;
1421
1422 disp = loader_get_dispatch(device);
1423
Chia-I Wuf7458c52015-10-26 21:10:41 +08001424 disp->DestroyPipelineCache(device, pipelineCache, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001425}
1426
Jon Ashburn23d36b12016-02-02 17:47:28 -07001427LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1428vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache,
1429 size_t *pDataSize, void *pData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001430 const VkLayerDispatchTable *disp;
1431
1432 disp = loader_get_dispatch(device);
1433
Chia-I Wub16facd2015-10-26 19:17:06 +08001434 return disp->GetPipelineCacheData(device, pipelineCache, pDataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001435}
1436
Jon Ashburn23d36b12016-02-02 17:47:28 -07001437LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1438vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache,
1439 uint32_t srcCacheCount,
1440 const VkPipelineCache *pSrcCaches) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001441 const VkLayerDispatchTable *disp;
1442
1443 disp = loader_get_dispatch(device);
1444
Jon Ashburn23d36b12016-02-02 17:47:28 -07001445 return disp->MergePipelineCaches(device, dstCache, srcCacheCount,
1446 pSrcCaches);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001447}
1448
Jon Ashburn23d36b12016-02-02 17:47:28 -07001449LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1450vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache,
1451 uint32_t createInfoCount,
1452 const VkGraphicsPipelineCreateInfo *pCreateInfos,
1453 const VkAllocationCallbacks *pAllocator,
1454 VkPipeline *pPipelines) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001455 const VkLayerDispatchTable *disp;
1456
1457 disp = loader_get_dispatch(device);
1458
Jon Ashburn23d36b12016-02-02 17:47:28 -07001459 return disp->CreateGraphicsPipelines(device, pipelineCache, createInfoCount,
1460 pCreateInfos, pAllocator, pPipelines);
Jon Ashburnc669cc62015-07-09 15:02:25 -06001461}
1462
Jon Ashburn23d36b12016-02-02 17:47:28 -07001463LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1464vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache,
1465 uint32_t createInfoCount,
1466 const VkComputePipelineCreateInfo *pCreateInfos,
1467 const VkAllocationCallbacks *pAllocator,
1468 VkPipeline *pPipelines) {
Jon Ashburnc669cc62015-07-09 15:02:25 -06001469 const VkLayerDispatchTable *disp;
1470
1471 disp = loader_get_dispatch(device);
1472
Jon Ashburn23d36b12016-02-02 17:47:28 -07001473 return disp->CreateComputePipelines(device, pipelineCache, createInfoCount,
1474 pCreateInfos, pAllocator, pPipelines);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001475}
1476
Jon Ashburn23d36b12016-02-02 17:47:28 -07001477LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1478vkDestroyPipeline(VkDevice device, VkPipeline pipeline,
1479 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001480 const VkLayerDispatchTable *disp;
1481
1482 disp = loader_get_dispatch(device);
1483
Chia-I Wuf7458c52015-10-26 21:10:41 +08001484 disp->DestroyPipeline(device, pipeline, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001485}
1486
Jon Ashburn23d36b12016-02-02 17:47:28 -07001487LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1488vkCreatePipelineLayout(VkDevice device,
1489 const VkPipelineLayoutCreateInfo *pCreateInfo,
1490 const VkAllocationCallbacks *pAllocator,
1491 VkPipelineLayout *pPipelineLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001492 const VkLayerDispatchTable *disp;
1493
1494 disp = loader_get_dispatch(device);
1495
Jon Ashburn23d36b12016-02-02 17:47:28 -07001496 return disp->CreatePipelineLayout(device, pCreateInfo, pAllocator,
1497 pPipelineLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001498}
1499
Jon Ashburn23d36b12016-02-02 17:47:28 -07001500LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1501vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout,
1502 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001503 const VkLayerDispatchTable *disp;
1504
1505 disp = loader_get_dispatch(device);
1506
Chia-I Wuf7458c52015-10-26 21:10:41 +08001507 disp->DestroyPipelineLayout(device, pipelineLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001508}
1509
Jon Ashburn23d36b12016-02-02 17:47:28 -07001510LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1511vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo,
1512 const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001513 const VkLayerDispatchTable *disp;
1514
1515 disp = loader_get_dispatch(device);
1516
Chia-I Wuf7458c52015-10-26 21:10:41 +08001517 return disp->CreateSampler(device, pCreateInfo, pAllocator, pSampler);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001518}
1519
Jon Ashburn23d36b12016-02-02 17:47:28 -07001520LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1521vkDestroySampler(VkDevice device, VkSampler sampler,
1522 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001523 const VkLayerDispatchTable *disp;
1524
1525 disp = loader_get_dispatch(device);
1526
Chia-I Wuf7458c52015-10-26 21:10:41 +08001527 disp->DestroySampler(device, sampler, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001528}
1529
Jon Ashburn23d36b12016-02-02 17:47:28 -07001530LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1531vkCreateDescriptorSetLayout(VkDevice device,
1532 const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
1533 const VkAllocationCallbacks *pAllocator,
1534 VkDescriptorSetLayout *pSetLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001535 const VkLayerDispatchTable *disp;
1536
1537 disp = loader_get_dispatch(device);
1538
Jon Ashburn23d36b12016-02-02 17:47:28 -07001539 return disp->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator,
1540 pSetLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001541}
1542
Jon Ashburn23d36b12016-02-02 17:47:28 -07001543LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1544vkDestroyDescriptorSetLayout(VkDevice device,
1545 VkDescriptorSetLayout descriptorSetLayout,
1546 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001547 const VkLayerDispatchTable *disp;
1548
1549 disp = loader_get_dispatch(device);
1550
Chia-I Wuf7458c52015-10-26 21:10:41 +08001551 disp->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001552}
1553
Jon Ashburn23d36b12016-02-02 17:47:28 -07001554LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1555vkCreateDescriptorPool(VkDevice device,
1556 const VkDescriptorPoolCreateInfo *pCreateInfo,
1557 const VkAllocationCallbacks *pAllocator,
1558 VkDescriptorPool *pDescriptorPool) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001559 const VkLayerDispatchTable *disp;
1560
1561 disp = loader_get_dispatch(device);
1562
Jon Ashburn23d36b12016-02-02 17:47:28 -07001563 return disp->CreateDescriptorPool(device, pCreateInfo, pAllocator,
1564 pDescriptorPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001565}
1566
Jon Ashburn23d36b12016-02-02 17:47:28 -07001567LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1568vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
1569 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001570 const VkLayerDispatchTable *disp;
1571
1572 disp = loader_get_dispatch(device);
1573
Chia-I Wuf7458c52015-10-26 21:10:41 +08001574 disp->DestroyDescriptorPool(device, descriptorPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001575}
1576
Jon Ashburn23d36b12016-02-02 17:47:28 -07001577LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1578vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
1579 VkDescriptorPoolResetFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001580 const VkLayerDispatchTable *disp;
1581
1582 disp = loader_get_dispatch(device);
1583
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001584 return disp->ResetDescriptorPool(device, descriptorPool, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001585}
1586
Jon Ashburn23d36b12016-02-02 17:47:28 -07001587LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1588vkAllocateDescriptorSets(VkDevice device,
1589 const VkDescriptorSetAllocateInfo *pAllocateInfo,
1590 VkDescriptorSet *pDescriptorSets) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001591 const VkLayerDispatchTable *disp;
1592
1593 disp = loader_get_dispatch(device);
1594
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001595 return disp->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001596}
1597
Jon Ashburn23d36b12016-02-02 17:47:28 -07001598LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1599vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool,
1600 uint32_t descriptorSetCount,
1601 const VkDescriptorSet *pDescriptorSets) {
Tony Barbour34ec6922015-07-10 10:50:45 -06001602 const VkLayerDispatchTable *disp;
1603
1604 disp = loader_get_dispatch(device);
1605
Jon Ashburn23d36b12016-02-02 17:47:28 -07001606 return disp->FreeDescriptorSets(device, descriptorPool, descriptorSetCount,
1607 pDescriptorSets);
Tony Barbour34ec6922015-07-10 10:50:45 -06001608}
1609
Jon Ashburn23d36b12016-02-02 17:47:28 -07001610LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1611vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount,
1612 const VkWriteDescriptorSet *pDescriptorWrites,
1613 uint32_t descriptorCopyCount,
1614 const VkCopyDescriptorSet *pDescriptorCopies) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001615 const VkLayerDispatchTable *disp;
1616
1617 disp = loader_get_dispatch(device);
1618
Jon Ashburn23d36b12016-02-02 17:47:28 -07001619 disp->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites,
1620 descriptorCopyCount, pDescriptorCopies);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001621}
1622
Jon Ashburn23d36b12016-02-02 17:47:28 -07001623LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1624vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo,
1625 const VkAllocationCallbacks *pAllocator,
1626 VkFramebuffer *pFramebuffer) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001627 const VkLayerDispatchTable *disp;
1628
1629 disp = loader_get_dispatch(device);
1630
Jon Ashburn23d36b12016-02-02 17:47:28 -07001631 return disp->CreateFramebuffer(device, pCreateInfo, pAllocator,
1632 pFramebuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001633}
1634
Jon Ashburn23d36b12016-02-02 17:47:28 -07001635LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1636vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer,
1637 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001638 const VkLayerDispatchTable *disp;
1639
1640 disp = loader_get_dispatch(device);
1641
Chia-I Wuf7458c52015-10-26 21:10:41 +08001642 disp->DestroyFramebuffer(device, framebuffer, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -06001643}
1644
Jon Ashburn23d36b12016-02-02 17:47:28 -07001645LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1646vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
1647 const VkAllocationCallbacks *pAllocator,
1648 VkRenderPass *pRenderPass) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001649 const VkLayerDispatchTable *disp;
1650
1651 disp = loader_get_dispatch(device);
1652
Chia-I Wuf7458c52015-10-26 21:10:41 +08001653 return disp->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
Jon Ashburn754864f2015-07-23 18:49:07 -06001654}
1655
Jon Ashburn23d36b12016-02-02 17:47:28 -07001656LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1657vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass,
1658 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001659 const VkLayerDispatchTable *disp;
1660
1661 disp = loader_get_dispatch(device);
1662
Chia-I Wuf7458c52015-10-26 21:10:41 +08001663 disp->DestroyRenderPass(device, renderPass, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -06001664}
1665
Jon Ashburn23d36b12016-02-02 17:47:28 -07001666LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1667vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass,
1668 VkExtent2D *pGranularity) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001669 const VkLayerDispatchTable *disp;
1670
1671 disp = loader_get_dispatch(device);
1672
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001673 disp->GetRenderAreaGranularity(device, renderPass, pGranularity);
Jon Ashburn754864f2015-07-23 18:49:07 -06001674}
1675
Jon Ashburn23d36b12016-02-02 17:47:28 -07001676LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1677vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo,
1678 const VkAllocationCallbacks *pAllocator,
1679 VkCommandPool *pCommandPool) {
Cody Northrope62183e2015-07-09 18:08:05 -06001680 const VkLayerDispatchTable *disp;
1681
1682 disp = loader_get_dispatch(device);
1683
Jon Ashburn23d36b12016-02-02 17:47:28 -07001684 return disp->CreateCommandPool(device, pCreateInfo, pAllocator,
1685 pCommandPool);
Cody Northrope62183e2015-07-09 18:08:05 -06001686}
1687
Jon Ashburn23d36b12016-02-02 17:47:28 -07001688LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1689vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool,
1690 const VkAllocationCallbacks *pAllocator) {
Cody Northrope62183e2015-07-09 18:08:05 -06001691 const VkLayerDispatchTable *disp;
1692
1693 disp = loader_get_dispatch(device);
1694
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001695 disp->DestroyCommandPool(device, commandPool, pAllocator);
Cody Northrope62183e2015-07-09 18:08:05 -06001696}
1697
Jon Ashburn23d36b12016-02-02 17:47:28 -07001698LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1699vkResetCommandPool(VkDevice device, VkCommandPool commandPool,
1700 VkCommandPoolResetFlags flags) {
Cody Northrope62183e2015-07-09 18:08:05 -06001701 const VkLayerDispatchTable *disp;
1702
1703 disp = loader_get_dispatch(device);
1704
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001705 return disp->ResetCommandPool(device, commandPool, flags);
Cody Northrope62183e2015-07-09 18:08:05 -06001706}
1707
Jon Ashburn23d36b12016-02-02 17:47:28 -07001708LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1709vkAllocateCommandBuffers(VkDevice device,
1710 const VkCommandBufferAllocateInfo *pAllocateInfo,
1711 VkCommandBuffer *pCommandBuffers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001712 const VkLayerDispatchTable *disp;
1713 VkResult res;
1714
1715 disp = loader_get_dispatch(device);
1716
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001717 res = disp->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001718 if (res == VK_SUCCESS) {
Jon Ashburn23d36b12016-02-02 17:47:28 -07001719 for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; i++) {
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001720 if (pCommandBuffers[i]) {
1721 loader_init_dispatch(pCommandBuffers[i], disp);
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001722 }
1723 }
Jon Ashburnd55a3942015-05-06 09:02:10 -06001724 }
1725
1726 return res;
1727}
1728
Jon Ashburn23d36b12016-02-02 17:47:28 -07001729LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1730vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool,
1731 uint32_t commandBufferCount,
1732 const VkCommandBuffer *pCommandBuffers) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001733 const VkLayerDispatchTable *disp;
1734
1735 disp = loader_get_dispatch(device);
1736
Jon Ashburn23d36b12016-02-02 17:47:28 -07001737 disp->FreeCommandBuffers(device, commandPool, commandBufferCount,
1738 pCommandBuffers);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001739}
1740
Jon Ashburn23d36b12016-02-02 17:47:28 -07001741LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1742vkBeginCommandBuffer(VkCommandBuffer commandBuffer,
1743 const VkCommandBufferBeginInfo *pBeginInfo) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001744 const VkLayerDispatchTable *disp;
1745
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001746 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001747
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001748 return disp->BeginCommandBuffer(commandBuffer, pBeginInfo);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001749}
1750
Jon Ashburn23d36b12016-02-02 17:47:28 -07001751LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1752vkEndCommandBuffer(VkCommandBuffer commandBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001753 const VkLayerDispatchTable *disp;
1754
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001755 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001756
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001757 return disp->EndCommandBuffer(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001758}
1759
Jon Ashburn23d36b12016-02-02 17:47:28 -07001760LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1761vkResetCommandBuffer(VkCommandBuffer commandBuffer,
1762 VkCommandBufferResetFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001763 const VkLayerDispatchTable *disp;
1764
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001765 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001766
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001767 return disp->ResetCommandBuffer(commandBuffer, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001768}
1769
Jon Ashburn23d36b12016-02-02 17:47:28 -07001770LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1771vkCmdBindPipeline(VkCommandBuffer commandBuffer,
1772 VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001773 const VkLayerDispatchTable *disp;
1774
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001775 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001776
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001777 disp->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001778}
1779
Jon Ashburn23d36b12016-02-02 17:47:28 -07001780LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1781vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport,
1782 uint32_t viewportCount, const VkViewport *pViewports) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001783 const VkLayerDispatchTable *disp;
1784
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001785 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001786
Jon Ashburn23d36b12016-02-02 17:47:28 -07001787 disp->CmdSetViewport(commandBuffer, firstViewport, viewportCount,
1788 pViewports);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001789}
1790
Jon Ashburn23d36b12016-02-02 17:47:28 -07001791LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1792vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor,
1793 uint32_t scissorCount, const VkRect2D *pScissors) {
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001794 const VkLayerDispatchTable *disp;
1795
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001796 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001797
Jon Ashburn19d3bf12015-12-30 14:06:55 -07001798 disp->CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001799}
1800
Jon Ashburn23d36b12016-02-02 17:47:28 -07001801LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1802vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001803 const VkLayerDispatchTable *disp;
1804
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001805 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001806
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001807 disp->CmdSetLineWidth(commandBuffer, lineWidth);
Cody Northrop12365112015-08-17 11:10:49 -06001808}
1809
Jon Ashburn23d36b12016-02-02 17:47:28 -07001810LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1811vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor,
1812 float depthBiasClamp, float depthBiasSlopeFactor) {
Cody Northrop12365112015-08-17 11:10:49 -06001813 const VkLayerDispatchTable *disp;
1814
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001815 disp = loader_get_dispatch(commandBuffer);
Cody Northrop12365112015-08-17 11:10:49 -06001816
Jon Ashburn23d36b12016-02-02 17:47:28 -07001817 disp->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor,
1818 depthBiasClamp, depthBiasSlopeFactor);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001819}
1820
Jon Ashburn23d36b12016-02-02 17:47:28 -07001821LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1822vkCmdSetBlendConstants(VkCommandBuffer commandBuffer,
1823 const float blendConstants[4]) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001824 const VkLayerDispatchTable *disp;
1825
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001826 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001827
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001828 disp->CmdSetBlendConstants(commandBuffer, blendConstants);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001829}
1830
Jon Ashburn23d36b12016-02-02 17:47:28 -07001831LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1832vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds,
1833 float maxDepthBounds) {
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->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
Cody Northrop82485a82015-08-18 15:21:16 -06001839}
1840
Jon Ashburn23d36b12016-02-02 17:47:28 -07001841LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1842vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer,
1843 VkStencilFaceFlags faceMask, uint32_t compareMask) {
Cody Northrop82485a82015-08-18 15:21:16 -06001844 const VkLayerDispatchTable *disp;
1845
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001846 disp = loader_get_dispatch(commandBuffer);
Cody Northrop82485a82015-08-18 15:21:16 -06001847
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001848 disp->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001849}
1850
Jon Ashburn23d36b12016-02-02 17:47:28 -07001851LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1852vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer,
1853 VkStencilFaceFlags faceMask, uint32_t writeMask) {
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001854 const VkLayerDispatchTable *disp;
1855
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001856 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001857
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001858 disp->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001859}
1860
Jon Ashburn23d36b12016-02-02 17:47:28 -07001861LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1862vkCmdSetStencilReference(VkCommandBuffer commandBuffer,
1863 VkStencilFaceFlags faceMask, uint32_t reference) {
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001864 const VkLayerDispatchTable *disp;
1865
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001866 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001867
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001868 disp->CmdSetStencilReference(commandBuffer, faceMask, reference);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001869}
1870
Jon Ashburn23d36b12016-02-02 17:47:28 -07001871LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets(
1872 VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
1873 VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount,
1874 const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount,
1875 const uint32_t *pDynamicOffsets) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001876 const VkLayerDispatchTable *disp;
1877
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001878 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001879
Jon Ashburn23d36b12016-02-02 17:47:28 -07001880 disp->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout,
1881 firstSet, descriptorSetCount, pDescriptorSets,
1882 dynamicOffsetCount, pDynamicOffsets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001883}
1884
Jon Ashburn23d36b12016-02-02 17:47:28 -07001885LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1886vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer,
1887 VkDeviceSize offset, VkIndexType indexType) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001888 const VkLayerDispatchTable *disp;
1889
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001890 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001891
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001892 disp->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001893}
1894
Jon Ashburn23d36b12016-02-02 17:47:28 -07001895LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1896vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding,
1897 uint32_t bindingCount, const VkBuffer *pBuffers,
1898 const VkDeviceSize *pOffsets) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001899 const VkLayerDispatchTable *disp;
1900
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001901 disp = loader_get_dispatch(commandBuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001902
Jon Ashburn23d36b12016-02-02 17:47:28 -07001903 disp->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount,
1904 pBuffers, pOffsets);
Jon Ashburn754864f2015-07-23 18:49:07 -06001905}
1906
Jon Ashburn23d36b12016-02-02 17:47:28 -07001907LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1908vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount,
1909 uint32_t instanceCount, uint32_t firstVertex,
1910 uint32_t firstInstance) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001911 const VkLayerDispatchTable *disp;
1912
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001913 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001914
Jon Ashburn23d36b12016-02-02 17:47:28 -07001915 disp->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex,
1916 firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001917}
1918
Jon Ashburn23d36b12016-02-02 17:47:28 -07001919LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1920vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount,
1921 uint32_t instanceCount, uint32_t firstIndex,
1922 int32_t vertexOffset, uint32_t firstInstance) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001923 const VkLayerDispatchTable *disp;
1924
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001925 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001926
Jon Ashburn23d36b12016-02-02 17:47:28 -07001927 disp->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex,
1928 vertexOffset, firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001929}
1930
Jon Ashburn23d36b12016-02-02 17:47:28 -07001931LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1932vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1933 VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001934 const VkLayerDispatchTable *disp;
1935
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001936 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001937
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001938 disp->CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001939}
1940
Jon Ashburn23d36b12016-02-02 17:47:28 -07001941LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1942vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1943 VkDeviceSize offset, uint32_t drawCount,
1944 uint32_t stride) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001945 const VkLayerDispatchTable *disp;
1946
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001947 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001948
Jon Ashburn23d36b12016-02-02 17:47:28 -07001949 disp->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount,
1950 stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001951}
1952
Jon Ashburn23d36b12016-02-02 17:47:28 -07001953LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1954vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y,
1955 uint32_t z) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001956 const VkLayerDispatchTable *disp;
1957
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001958 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001959
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001960 disp->CmdDispatch(commandBuffer, x, y, z);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001961}
1962
Jon Ashburn23d36b12016-02-02 17:47:28 -07001963LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1964vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1965 VkDeviceSize offset) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001966 const VkLayerDispatchTable *disp;
1967
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001968 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001969
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001970 disp->CmdDispatchIndirect(commandBuffer, buffer, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001971}
1972
Jon Ashburn23d36b12016-02-02 17:47:28 -07001973LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1974vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer,
1975 VkBuffer dstBuffer, uint32_t regionCount,
1976 const VkBufferCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001977 const VkLayerDispatchTable *disp;
1978
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001979 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001980
Jon Ashburn23d36b12016-02-02 17:47:28 -07001981 disp->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount,
1982 pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001983}
1984
Jon Ashburn23d36b12016-02-02 17:47:28 -07001985LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1986vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage,
1987 VkImageLayout srcImageLayout, VkImage dstImage,
1988 VkImageLayout dstImageLayout, uint32_t regionCount,
1989 const VkImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001990 const VkLayerDispatchTable *disp;
1991
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001992 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001993
Jon Ashburn23d36b12016-02-02 17:47:28 -07001994 disp->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage,
1995 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001996}
1997
Jon Ashburn23d36b12016-02-02 17:47:28 -07001998LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1999vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage,
2000 VkImageLayout srcImageLayout, VkImage dstImage,
2001 VkImageLayout dstImageLayout, uint32_t regionCount,
2002 const VkImageBlit *pRegions, VkFilter filter) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002003 const VkLayerDispatchTable *disp;
2004
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002005 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002006
Jon Ashburn23d36b12016-02-02 17:47:28 -07002007 disp->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage,
2008 dstImageLayout, regionCount, pRegions, filter);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002009}
2010
Jon Ashburn23d36b12016-02-02 17:47:28 -07002011LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2012vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer,
2013 VkImage dstImage, VkImageLayout dstImageLayout,
2014 uint32_t regionCount,
2015 const VkBufferImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002016 const VkLayerDispatchTable *disp;
2017
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002018 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002019
Jon Ashburn23d36b12016-02-02 17:47:28 -07002020 disp->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage,
2021 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002022}
2023
Jon Ashburn23d36b12016-02-02 17:47:28 -07002024LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2025vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage,
2026 VkImageLayout srcImageLayout, VkBuffer dstBuffer,
2027 uint32_t regionCount,
2028 const VkBufferImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002029 const VkLayerDispatchTable *disp;
2030
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002031 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002032
Jon Ashburn23d36b12016-02-02 17:47:28 -07002033 disp->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout,
2034 dstBuffer, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002035}
2036
Jon Ashburn23d36b12016-02-02 17:47:28 -07002037LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2038vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
2039 VkDeviceSize dstOffset, VkDeviceSize dataSize,
Karl Schultzee344492016-07-11 15:09:57 -06002040 const void *pData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002041 const VkLayerDispatchTable *disp;
2042
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002043 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002044
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002045 disp->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002046}
2047
Jon Ashburn23d36b12016-02-02 17:47:28 -07002048LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2049vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
2050 VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002051 const VkLayerDispatchTable *disp;
2052
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002053 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002054
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002055 disp->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002056}
2057
Jon Ashburn23d36b12016-02-02 17:47:28 -07002058LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2059vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image,
2060 VkImageLayout imageLayout, const VkClearColorValue *pColor,
2061 uint32_t rangeCount,
2062 const VkImageSubresourceRange *pRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002063 const VkLayerDispatchTable *disp;
2064
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002065 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002066
Jon Ashburn23d36b12016-02-02 17:47:28 -07002067 disp->CmdClearColorImage(commandBuffer, image, imageLayout, pColor,
2068 rangeCount, pRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002069}
2070
Jon Ashburn23d36b12016-02-02 17:47:28 -07002071LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2072vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image,
2073 VkImageLayout imageLayout,
2074 const VkClearDepthStencilValue *pDepthStencil,
2075 uint32_t rangeCount,
2076 const VkImageSubresourceRange *pRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002077 const VkLayerDispatchTable *disp;
2078
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002079 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002080
Jon Ashburn23d36b12016-02-02 17:47:28 -07002081 disp->CmdClearDepthStencilImage(commandBuffer, image, imageLayout,
2082 pDepthStencil, rangeCount, pRanges);
Chris Forbesd9be82b2015-06-22 17:21:59 +12002083}
2084
Jon Ashburn23d36b12016-02-02 17:47:28 -07002085LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2086vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
2087 const VkClearAttachment *pAttachments, uint32_t rectCount,
2088 const VkClearRect *pRects) {
Chris Forbesd9be82b2015-06-22 17:21:59 +12002089 const VkLayerDispatchTable *disp;
2090
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002091 disp = loader_get_dispatch(commandBuffer);
Chris Forbesd9be82b2015-06-22 17:21:59 +12002092
Jon Ashburn23d36b12016-02-02 17:47:28 -07002093 disp->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments,
2094 rectCount, pRects);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002095}
2096
Jon Ashburn23d36b12016-02-02 17:47:28 -07002097LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2098vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage,
2099 VkImageLayout srcImageLayout, VkImage dstImage,
2100 VkImageLayout dstImageLayout, uint32_t regionCount,
2101 const VkImageResolve *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002102 const VkLayerDispatchTable *disp;
2103
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002104 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002105
Jon Ashburn23d36b12016-02-02 17:47:28 -07002106 disp->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage,
2107 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002108}
2109
Jon Ashburn23d36b12016-02-02 17:47:28 -07002110LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2111vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event,
2112 VkPipelineStageFlags stageMask) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002113 const VkLayerDispatchTable *disp;
2114
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002115 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002116
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002117 disp->CmdSetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002118}
2119
Jon Ashburn23d36b12016-02-02 17:47:28 -07002120LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2121vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event,
2122 VkPipelineStageFlags stageMask) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002123 const VkLayerDispatchTable *disp;
2124
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002125 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002126
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002127 disp->CmdResetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002128}
2129
Jon Ashburn23d36b12016-02-02 17:47:28 -07002130LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2131vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount,
2132 const VkEvent *pEvents, VkPipelineStageFlags sourceStageMask,
2133 VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount,
2134 const VkMemoryBarrier *pMemoryBarriers,
2135 uint32_t bufferMemoryBarrierCount,
2136 const VkBufferMemoryBarrier *pBufferMemoryBarriers,
2137 uint32_t imageMemoryBarrierCount,
2138 const VkImageMemoryBarrier *pImageMemoryBarriers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002139 const VkLayerDispatchTable *disp;
2140
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002141 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002142
Jon Ashburnf19916e2016-01-11 13:12:43 -07002143 disp->CmdWaitEvents(commandBuffer, eventCount, pEvents, sourceStageMask,
2144 dstStageMask, memoryBarrierCount, pMemoryBarriers,
2145 bufferMemoryBarrierCount, pBufferMemoryBarriers,
2146 imageMemoryBarrierCount, pImageMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002147}
2148
Jon Ashburnf19916e2016-01-11 13:12:43 -07002149LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier(
Jon Ashburn23d36b12016-02-02 17:47:28 -07002150 VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask,
2151 VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags,
2152 uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers,
2153 uint32_t bufferMemoryBarrierCount,
2154 const VkBufferMemoryBarrier *pBufferMemoryBarriers,
2155 uint32_t imageMemoryBarrierCount,
2156 const VkImageMemoryBarrier *pImageMemoryBarriers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002157 const VkLayerDispatchTable *disp;
2158
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002159 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002160
Jon Ashburn23d36b12016-02-02 17:47:28 -07002161 disp->CmdPipelineBarrier(
2162 commandBuffer, srcStageMask, dstStageMask, dependencyFlags,
2163 memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount,
2164 pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002165}
2166
Jon Ashburn23d36b12016-02-02 17:47:28 -07002167LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2168vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2169 uint32_t slot, VkFlags flags) {
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
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002174 disp->CmdBeginQuery(commandBuffer, queryPool, slot, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002175}
2176
Jon Ashburn23d36b12016-02-02 17:47:28 -07002177LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2178vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2179 uint32_t slot) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002180 const VkLayerDispatchTable *disp;
2181
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002182 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002183
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002184 disp->CmdEndQuery(commandBuffer, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002185}
2186
Jon Ashburn23d36b12016-02-02 17:47:28 -07002187LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2188vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2189 uint32_t firstQuery, uint32_t queryCount) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002190 const VkLayerDispatchTable *disp;
2191
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002192 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002193
Jon Ashburn19d3bf12015-12-30 14:06:55 -07002194 disp->CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002195}
2196
Jon Ashburn23d36b12016-02-02 17:47:28 -07002197LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2198vkCmdWriteTimestamp(VkCommandBuffer commandBuffer,
2199 VkPipelineStageFlagBits pipelineStage,
2200 VkQueryPool queryPool, uint32_t slot) {
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->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002206}
2207
Jon Ashburn23d36b12016-02-02 17:47:28 -07002208LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2209vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2210 uint32_t firstQuery, uint32_t queryCount,
2211 VkBuffer dstBuffer, VkDeviceSize dstOffset,
2212 VkDeviceSize stride, VkFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002213 const VkLayerDispatchTable *disp;
2214
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002215 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002216
Jon Ashburn23d36b12016-02-02 17:47:28 -07002217 disp->CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery,
2218 queryCount, dstBuffer, dstOffset, stride,
2219 flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002220}
2221
Jon Ashburn23d36b12016-02-02 17:47:28 -07002222LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2223vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout,
2224 VkShaderStageFlags stageFlags, uint32_t offset,
2225 uint32_t size, const void *pValues) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002226 const VkLayerDispatchTable *disp;
2227
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002228 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002229
Jon Ashburn23d36b12016-02-02 17:47:28 -07002230 disp->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size,
2231 pValues);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06002232}
2233
Jon Ashburn23d36b12016-02-02 17:47:28 -07002234LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2235vkCmdBeginRenderPass(VkCommandBuffer commandBuffer,
2236 const VkRenderPassBeginInfo *pRenderPassBegin,
2237 VkSubpassContents contents) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002238 const VkLayerDispatchTable *disp;
2239
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002240 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002241
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002242 disp->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
Chia-I Wu08accc62015-07-07 11:50:03 +08002243}
2244
Jon Ashburn23d36b12016-02-02 17:47:28 -07002245LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2246vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) {
Chia-I Wu08accc62015-07-07 11:50:03 +08002247 const VkLayerDispatchTable *disp;
2248
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002249 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu08accc62015-07-07 11:50:03 +08002250
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002251 disp->CmdNextSubpass(commandBuffer, contents);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002252}
2253
Jon Ashburn23d36b12016-02-02 17:47:28 -07002254LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2255vkCmdEndRenderPass(VkCommandBuffer commandBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002256 const VkLayerDispatchTable *disp;
2257
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002258 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002259
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002260 disp->CmdEndRenderPass(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002261}
2262
Jon Ashburn23d36b12016-02-02 17:47:28 -07002263LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2264vkCmdExecuteCommands(VkCommandBuffer commandBuffer,
2265 uint32_t commandBuffersCount,
2266 const VkCommandBuffer *pCommandBuffers) {
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002267 const VkLayerDispatchTable *disp;
2268
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002269 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002270
Jon Ashburn23d36b12016-02-02 17:47:28 -07002271 disp->CmdExecuteCommands(commandBuffer, commandBuffersCount,
2272 pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002273}