blob: 81513f9385395a2bfef3a62c3e9d69723d0e698d [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
Mark Younga7c51fd2016-09-16 10:18:42 -0600716 // Initialize any device extension dispatch entry's from the instance list
Jon Ashburn1530c342016-02-26 13:14:27 -0700717 loader_init_dispatch_dev_ext(inst, dev);
718
Mark Younga7c51fd2016-09-16 10:18:42 -0600719 // Initialize WSI device extensions as part of core dispatch since loader
720 // has dedicated trampoline code for these*/
Jon Ashburn1530c342016-02-26 13:14:27 -0700721 loader_init_device_extension_dispatch_table(
722 &dev->loader_dispatch,
Mark Younga7c51fd2016-09-16 10:18:42 -0600723 dev->loader_dispatch.core_dispatch.GetDeviceProcAddr, *pDevice);
724
725 // The loader needs to override some terminating device procs. Usually,
726 // these are device procs which need to go through a loader terminator.
727 // This needs to occur if the loader needs to perform some work prior
728 // to passing the work along to the ICD.
729 loader_override_terminating_device_proc(*pDevice, &dev->loader_dispatch);
Jon Ashburn1530c342016-02-26 13:14:27 -0700730
Mark Young0ad83132016-06-30 13:02:42 -0600731out:
732
733 // Failure cleanup
734 if (VK_SUCCESS != res) {
735 if (NULL != dev) {
736 loader_destroy_logical_device(inst, dev, pAllocator);
737 }
738 }
739
740 if (NULL != icd_exts.list) {
741 loader_destroy_generic_list(inst,
742 (struct loader_generic_list *)&icd_exts);
743 }
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600744 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600745 return res;
746}
747
Jon Ashburn23d36b12016-02-02 17:47:28 -0700748LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
749vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600750 const VkLayerDispatchTable *disp;
Jon Ashburne39a4f82015-08-28 13:38:21 -0600751 struct loader_device *dev;
Andrzej Kotlowskib168b1a2016-02-03 09:41:53 +0100752
Jeremy Hayesd8726c22016-04-21 13:19:41 -0600753 if (device == VK_NULL_HANDLE) {
754 return;
755 }
756
Andrzej Kotlowskib168b1a2016-02-03 09:41:53 +0100757 loader_platform_thread_lock_mutex(&loader_lock);
758
Mark Young16573c72016-06-28 10:52:43 -0600759 struct loader_icd *icd = loader_get_icd_and_device(device, &dev, NULL);
Jon Ashburne39a4f82015-08-28 13:38:21 -0600760 const struct loader_instance *inst = icd->this_instance;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600761 disp = loader_get_dispatch(device);
762
Chia-I Wuf7458c52015-10-26 21:10:41 +0800763 disp->DestroyDevice(device, pAllocator);
Jon Ashburn781a7ae2015-11-19 15:43:26 -0700764 dev->device = NULL;
Mark Young0ad83132016-06-30 13:02:42 -0600765 loader_remove_logical_device(inst, icd, dev, pAllocator);
Jon Ashburn781a7ae2015-11-19 15:43:26 -0700766
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600767 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600768}
769
Jon Ashburn23d36b12016-02-02 17:47:28 -0700770LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
771vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
772 const char *pLayerName,
773 uint32_t *pPropertyCount,
774 VkExtensionProperties *pProperties) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700775 VkResult res = VK_SUCCESS;
Jon Ashburn787eb252016-03-24 15:49:57 -0600776 struct loader_physical_device_tramp *phys_dev;
777 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600778
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600779 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700780
781 /* If pLayerName == NULL, then querying ICD extensions, pass this call
782 down the instance chain which will terminate in the ICD. This allows
783 layers to filter the extensions coming back up the chain.
784 If pLayerName != NULL then get layer extensions from manifest file. */
Jon Ashburn23d36b12016-02-02 17:47:28 -0700785 if (pLayerName == NULL || strlen(pLayerName) == 0) {
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700786 const VkLayerInstanceDispatchTable *disp;
787
788 disp = loader_get_instance_dispatch(physicalDevice);
Jon Ashburn23d36b12016-02-02 17:47:28 -0700789 res = disp->EnumerateDeviceExtensionProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -0700790 phys_dev->phys_dev, NULL, pPropertyCount, pProperties);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700791 } else {
Jon Ashburn014438f2016-03-01 19:51:07 -0700792
Jon Ashburndc5d9202016-02-29 13:00:51 -0700793 uint32_t count;
794 uint32_t copy_size;
Piers Daniell295fe402016-03-29 11:51:11 -0600795 const struct loader_instance *inst = phys_dev->this_instance;
Jon Ashburnb8726962016-04-08 15:03:35 -0600796 struct loader_device_extension_list *dev_ext_list = NULL;
797 struct loader_device_extension_list local_ext_list;
798 memset(&local_ext_list, 0, sizeof(local_ext_list));
Jon Ashburndc5d9202016-02-29 13:00:51 -0700799 if (vk_string_validate(MaxLoaderStringLength, pLayerName) ==
Jon Ashburn014438f2016-03-01 19:51:07 -0700800 VK_STRING_ERROR_NONE) {
Jon Ashburnb8726962016-04-08 15:03:35 -0600801 if (strcmp(pLayerName, std_validation_str) == 0) {
802 struct loader_layer_list local_list;
803 memset(&local_list, 0, sizeof(local_list));
804 for (uint32_t i = 0; i < sizeof(std_validation_names) /
805 sizeof(std_validation_names[0]);
806 i++) {
Jon Ashburncc407a22016-04-15 09:25:03 -0600807 loader_find_layer_name_add_list(
808 NULL, std_validation_names[i],
Jon Ashburn491cd042016-05-16 14:01:18 -0600809 VK_LAYER_TYPE_INSTANCE_EXPLICIT, &inst->instance_layer_list,
Jon Ashburncc407a22016-04-15 09:25:03 -0600810 &local_list);
Jon Ashburnb8726962016-04-08 15:03:35 -0600811 }
812 for (uint32_t i = 0; i < local_list.count; i++) {
813 struct loader_device_extension_list *ext_list =
Jon Ashburncc407a22016-04-15 09:25:03 -0600814 &local_list.list[i].device_extension_list;
Jon Ashburnb8726962016-04-08 15:03:35 -0600815 for (uint32_t j = 0; j < ext_list->count; j++) {
816 loader_add_to_dev_ext_list(NULL, &local_ext_list,
817 &ext_list->list[j].props, 0,
818 NULL);
819 }
820 }
821 dev_ext_list = &local_ext_list;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700822
Jon Ashburnb8726962016-04-08 15:03:35 -0600823 } else {
Jon Ashburn491cd042016-05-16 14:01:18 -0600824 for (uint32_t i = 0; i < inst->instance_layer_list.count; i++) {
Jon Ashburnb8726962016-04-08 15:03:35 -0600825 struct loader_layer_properties *props =
Jon Ashburn491cd042016-05-16 14:01:18 -0600826 &inst->instance_layer_list.list[i];
Jon Ashburnb8726962016-04-08 15:03:35 -0600827 if (strcmp(props->info.layerName, pLayerName) == 0) {
828 dev_ext_list = &props->device_extension_list;
829 }
Jon Ashburndc5d9202016-02-29 13:00:51 -0700830 }
831 }
Jon Ashburnb8726962016-04-08 15:03:35 -0600832
Jon Ashburndc5d9202016-02-29 13:00:51 -0700833 count = (dev_ext_list == NULL) ? 0 : dev_ext_list->count;
834 if (pProperties == NULL) {
835 *pPropertyCount = count;
Jon Ashburncc407a22016-04-15 09:25:03 -0600836 loader_destroy_generic_list(
837 inst, (struct loader_generic_list *)&local_ext_list);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700838 loader_platform_thread_unlock_mutex(&loader_lock);
839 return VK_SUCCESS;
840 }
841
842 copy_size = *pPropertyCount < count ? *pPropertyCount : count;
843 for (uint32_t i = 0; i < copy_size; i++) {
844 memcpy(&pProperties[i], &dev_ext_list->list[i].props,
Jon Ashburn014438f2016-03-01 19:51:07 -0700845 sizeof(VkExtensionProperties));
Jon Ashburndc5d9202016-02-29 13:00:51 -0700846 }
847 *pPropertyCount = copy_size;
848
Jon Ashburncc407a22016-04-15 09:25:03 -0600849 loader_destroy_generic_list(
850 inst, (struct loader_generic_list *)&local_ext_list);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700851 if (copy_size < count) {
852 loader_platform_thread_unlock_mutex(&loader_lock);
853 return VK_INCOMPLETE;
854 }
855 } else {
Jon Ashburn014438f2016-03-01 19:51:07 -0700856 loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
857 "vkEnumerateDeviceExtensionProperties: pLayerName "
858 "is too long or is badly formed");
859 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700860 return VK_ERROR_EXTENSION_NOT_PRESENT;
861 }
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700862 }
863
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600864 loader_platform_thread_unlock_mutex(&loader_lock);
Tony Barbour59a47322015-06-24 16:06:58 -0600865 return res;
866}
867
Jon Ashburn23d36b12016-02-02 17:47:28 -0700868LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
869vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
870 uint32_t *pPropertyCount,
871 VkLayerProperties *pProperties) {
Jon Ashburndc5d9202016-02-29 13:00:51 -0700872 uint32_t copy_size;
Jon Ashburn787eb252016-03-24 15:49:57 -0600873 struct loader_physical_device_tramp *phys_dev;
Jon Ashburn491cd042016-05-16 14:01:18 -0600874 struct loader_layer_list *enabled_layers, layers_list;
875 uint32_t std_val_count = sizeof(std_validation_names) /
876 sizeof(std_validation_names[0]);
877 memset(&layers_list, 0, sizeof(layers_list));
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600878 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700879
880 /* Don't dispatch this call down the instance chain, want all device layers
881 enumerated and instance chain may not contain all device layers */
Jon Ashburn491cd042016-05-16 14:01:18 -0600882 // TODO re-evaluate the above statement we maybe able to start calling
883 // down the chain
Jon Ashburndc5d9202016-02-29 13:00:51 -0700884
Jon Ashburn787eb252016-03-24 15:49:57 -0600885 phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
Piers Daniell295fe402016-03-29 11:51:11 -0600886 const struct loader_instance *inst = phys_dev->this_instance;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700887
Jon Ashburn491cd042016-05-16 14:01:18 -0600888 uint32_t count = inst->activated_layer_list.count;
889 if (inst->activated_layers_are_std_val)
890 count = count - std_val_count + 1;
Jon Ashburndc5d9202016-02-29 13:00:51 -0700891 if (pProperties == NULL) {
892 *pPropertyCount = count;
893 loader_platform_thread_unlock_mutex(&loader_lock);
894 return VK_SUCCESS;
895 }
Jon Ashburn491cd042016-05-16 14:01:18 -0600896 /* make sure to enumerate standard_validation if that is what was used
897 at the instance layer enablement */
898 if (inst->activated_layers_are_std_val) {
899 enabled_layers = &layers_list;
900 enabled_layers->count = count;
901 enabled_layers->capacity = enabled_layers->count *
902 sizeof(struct loader_layer_properties);
Mark Young0ad83132016-06-30 13:02:42 -0600903 enabled_layers->list = loader_instance_heap_alloc(inst, enabled_layers->capacity,
Jon Ashburn491cd042016-05-16 14:01:18 -0600904 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
905 if (!enabled_layers->list)
906 return VK_ERROR_OUT_OF_HOST_MEMORY;
907
908 uint32_t j = 0;
909 for (uint32_t i = 0; i < inst->activated_layer_list.count; j++) {
910
911 if (loader_find_layer_name_array(
912 inst->activated_layer_list.list[i].info.layerName,
913 std_val_count, std_validation_names)) {
914 struct loader_layer_properties props;
915 loader_init_std_validation_props(&props);
Mark Young0ad83132016-06-30 13:02:42 -0600916 VkResult err = loader_copy_layer_properties(inst,
917 &enabled_layers->list[j],
918 &props);
919 if (err != VK_SUCCESS) {
920 return err;
921 }
Jon Ashburn491cd042016-05-16 14:01:18 -0600922 i += std_val_count;
923 }
924 else {
Mark Young0ad83132016-06-30 13:02:42 -0600925 VkResult err = loader_copy_layer_properties(inst,
926 &enabled_layers->list[j],
927 &inst->activated_layer_list.list[i++]);
928 if (err != VK_SUCCESS) {
929 return err;
930 }
Jon Ashburn491cd042016-05-16 14:01:18 -0600931 }
932 }
933 }
934 else {
935 enabled_layers = (struct loader_layer_list *) &inst->activated_layer_list;
936 }
937
Jon Ashburndc5d9202016-02-29 13:00:51 -0700938
939 copy_size = (*pPropertyCount < count) ? *pPropertyCount : count;
940 for (uint32_t i = 0; i < copy_size; i++) {
Jon Ashburn491cd042016-05-16 14:01:18 -0600941 memcpy(&pProperties[i], &(enabled_layers->list[i].info),
Jon Ashburndc5d9202016-02-29 13:00:51 -0700942 sizeof(VkLayerProperties));
943 }
944 *pPropertyCount = copy_size;
945
Mark Young0ad83132016-06-30 13:02:42 -0600946 if (inst->activated_layers_are_std_val) {
Jon Ashburn491cd042016-05-16 14:01:18 -0600947 loader_delete_layer_properties(inst, enabled_layers);
Mark Young0ad83132016-06-30 13:02:42 -0600948 }
Jon Ashburndc5d9202016-02-29 13:00:51 -0700949 if (copy_size < count) {
950 loader_platform_thread_unlock_mutex(&loader_lock);
951 return VK_INCOMPLETE;
952 }
953
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600954 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburndc5d9202016-02-29 13:00:51 -0700955 return VK_SUCCESS;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600956}
957
Jon Ashburn23d36b12016-02-02 17:47:28 -0700958LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
959vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex,
960 VkQueue *pQueue) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600961 const VkLayerDispatchTable *disp;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600962
963 disp = loader_get_dispatch(device);
964
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600965 disp->GetDeviceQueue(device, queueNodeIndex, queueIndex, pQueue);
966 loader_set_dispatch(*pQueue, disp);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600967}
968
Jon Ashburn23d36b12016-02-02 17:47:28 -0700969LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
970vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits,
971 VkFence fence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600972 const VkLayerDispatchTable *disp;
973
974 disp = loader_get_dispatch(queue);
975
Chia-I Wu40cf0ae2015-10-26 17:20:32 +0800976 return disp->QueueSubmit(queue, submitCount, pSubmits, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600977}
978
Jon Ashburn23d36b12016-02-02 17:47:28 -0700979LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600980 const VkLayerDispatchTable *disp;
981
982 disp = loader_get_dispatch(queue);
983
984 return disp->QueueWaitIdle(queue);
985}
986
Jon Ashburn23d36b12016-02-02 17:47:28 -0700987LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600988 const VkLayerDispatchTable *disp;
989
990 disp = loader_get_dispatch(device);
991
992 return disp->DeviceWaitIdle(device);
993}
994
Jon Ashburn23d36b12016-02-02 17:47:28 -0700995LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
996vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
997 const VkAllocationCallbacks *pAllocator,
998 VkDeviceMemory *pMemory) {
Jon Ashburnd55a3942015-05-06 09:02:10 -0600999 const VkLayerDispatchTable *disp;
1000
1001 disp = loader_get_dispatch(device);
1002
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001003 return disp->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001004}
1005
Jon Ashburn23d36b12016-02-02 17:47:28 -07001006LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1007vkFreeMemory(VkDevice device, VkDeviceMemory mem,
1008 const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001009 const VkLayerDispatchTable *disp;
1010
1011 disp = loader_get_dispatch(device);
1012
Chia-I Wuf7458c52015-10-26 21:10:41 +08001013 disp->FreeMemory(device, mem, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001014}
1015
Jon Ashburn23d36b12016-02-02 17:47:28 -07001016LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1017vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset,
1018 VkDeviceSize size, VkFlags flags, void **ppData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001019 const VkLayerDispatchTable *disp;
1020
1021 disp = loader_get_dispatch(device);
1022
1023 return disp->MapMemory(device, mem, offset, size, flags, ppData);
1024}
1025
Jon Ashburn23d36b12016-02-02 17:47:28 -07001026LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1027vkUnmapMemory(VkDevice device, VkDeviceMemory mem) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001028 const VkLayerDispatchTable *disp;
1029
1030 disp = loader_get_dispatch(device);
1031
Mark Lobodzinski2141f652015-09-07 13:59:43 -06001032 disp->UnmapMemory(device, mem);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001033}
1034
Jon Ashburn23d36b12016-02-02 17:47:28 -07001035LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1036vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
1037 const VkMappedMemoryRange *pMemoryRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001038 const VkLayerDispatchTable *disp;
1039
1040 disp = loader_get_dispatch(device);
1041
Jon Ashburn23d36b12016-02-02 17:47:28 -07001042 return disp->FlushMappedMemoryRanges(device, memoryRangeCount,
1043 pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001044}
1045
Jon Ashburn23d36b12016-02-02 17:47:28 -07001046LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1047vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
1048 const VkMappedMemoryRange *pMemoryRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001049 const VkLayerDispatchTable *disp;
1050
1051 disp = loader_get_dispatch(device);
1052
Jon Ashburn23d36b12016-02-02 17:47:28 -07001053 return disp->InvalidateMappedMemoryRanges(device, memoryRangeCount,
1054 pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001055}
1056
Jon Ashburn23d36b12016-02-02 17:47:28 -07001057LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1058vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory,
1059 VkDeviceSize *pCommittedMemoryInBytes) {
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -06001060 const VkLayerDispatchTable *disp;
1061
1062 disp = loader_get_dispatch(device);
1063
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001064 disp->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes);
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -06001065}
1066
Jon Ashburn23d36b12016-02-02 17:47:28 -07001067LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1068vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem,
1069 VkDeviceSize offset) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001070 const VkLayerDispatchTable *disp;
1071
Mark Lobodzinski942b1722015-05-11 17:21:15 -05001072 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001073
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001074 return disp->BindBufferMemory(device, buffer, mem, offset);
1075}
1076
Jon Ashburn23d36b12016-02-02 17:47:28 -07001077LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1078vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem,
1079 VkDeviceSize offset) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001080 const VkLayerDispatchTable *disp;
1081
1082 disp = loader_get_dispatch(device);
1083
1084 return disp->BindImageMemory(device, image, mem, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001085}
1086
Jon Ashburn23d36b12016-02-02 17:47:28 -07001087LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1088vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer,
1089 VkMemoryRequirements *pMemoryRequirements) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001090 const VkLayerDispatchTable *disp;
1091
1092 disp = loader_get_dispatch(device);
1093
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001094 disp->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -06001095}
1096
Jon Ashburn23d36b12016-02-02 17:47:28 -07001097LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1098vkGetImageMemoryRequirements(VkDevice device, VkImage image,
1099 VkMemoryRequirements *pMemoryRequirements) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001100 const VkLayerDispatchTable *disp;
1101
1102 disp = loader_get_dispatch(device);
1103
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001104 disp->GetImageMemoryRequirements(device, image, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -06001105}
1106
Jon Ashburn23d36b12016-02-02 17:47:28 -07001107LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements(
1108 VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount,
1109 VkSparseImageMemoryRequirements *pSparseMemoryRequirements) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001110 const VkLayerDispatchTable *disp;
1111
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001112 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001113
Jon Ashburn23d36b12016-02-02 17:47:28 -07001114 disp->GetImageSparseMemoryRequirements(device, image,
1115 pSparseMemoryRequirementCount,
1116 pSparseMemoryRequirements);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001117}
1118
Jon Ashburn23d36b12016-02-02 17:47:28 -07001119LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1120vkGetPhysicalDeviceSparseImageFormatProperties(
1121 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
1122 VkSampleCountFlagBits samples, VkImageUsageFlags usage,
1123 VkImageTiling tiling, uint32_t *pPropertyCount,
1124 VkSparseImageFormatProperties *pProperties) {
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001125 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn014438f2016-03-01 19:51:07 -07001126 VkPhysicalDevice unwrapped_phys_dev =
1127 loader_unwrap_physical_device(physicalDevice);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001128 disp = loader_get_instance_dispatch(physicalDevice);
1129
Jon Ashburn23d36b12016-02-02 17:47:28 -07001130 disp->GetPhysicalDeviceSparseImageFormatProperties(
Jon Ashburn014438f2016-03-01 19:51:07 -07001131 unwrapped_phys_dev, format, type, samples, usage, tiling,
1132 pPropertyCount, pProperties);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001133}
1134
Jon Ashburn23d36b12016-02-02 17:47:28 -07001135LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1136vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount,
1137 const VkBindSparseInfo *pBindInfo, VkFence fence) {
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -06001138 const VkLayerDispatchTable *disp;
1139
1140 disp = loader_get_dispatch(queue);
1141
Chia-I Wu1ff4c3d2015-10-26 16:55:27 +08001142 return disp->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001143}
1144
Jon Ashburn23d36b12016-02-02 17:47:28 -07001145LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1146vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo,
1147 const VkAllocationCallbacks *pAllocator, VkFence *pFence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001148 const VkLayerDispatchTable *disp;
1149
1150 disp = loader_get_dispatch(device);
1151
Chia-I Wuf7458c52015-10-26 21:10:41 +08001152 return disp->CreateFence(device, pCreateInfo, pAllocator, pFence);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001153}
1154
Jon Ashburn23d36b12016-02-02 17:47:28 -07001155LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1156vkDestroyFence(VkDevice device, VkFence fence,
1157 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001158 const VkLayerDispatchTable *disp;
1159
1160 disp = loader_get_dispatch(device);
1161
Chia-I Wuf7458c52015-10-26 21:10:41 +08001162 disp->DestroyFence(device, fence, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001163}
1164
Jon Ashburn23d36b12016-02-02 17:47:28 -07001165LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1166vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001167 const VkLayerDispatchTable *disp;
1168
1169 disp = loader_get_dispatch(device);
1170
1171 return disp->ResetFences(device, fenceCount, pFences);
1172}
1173
Jon Ashburn23d36b12016-02-02 17:47:28 -07001174LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1175vkGetFenceStatus(VkDevice device, VkFence fence) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001176 const VkLayerDispatchTable *disp;
1177
1178 disp = loader_get_dispatch(device);
1179
1180 return disp->GetFenceStatus(device, fence);
1181}
1182
Jon Ashburn23d36b12016-02-02 17:47:28 -07001183LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1184vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences,
1185 VkBool32 waitAll, uint64_t timeout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001186 const VkLayerDispatchTable *disp;
1187
1188 disp = loader_get_dispatch(device);
1189
1190 return disp->WaitForFences(device, fenceCount, pFences, waitAll, timeout);
1191}
1192
Jon Ashburn23d36b12016-02-02 17:47:28 -07001193LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1194vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo,
1195 const VkAllocationCallbacks *pAllocator,
1196 VkSemaphore *pSemaphore) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001197 const VkLayerDispatchTable *disp;
1198
1199 disp = loader_get_dispatch(device);
1200
Chia-I Wuf7458c52015-10-26 21:10:41 +08001201 return disp->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001202}
1203
Jon Ashburn23d36b12016-02-02 17:47:28 -07001204LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1205vkDestroySemaphore(VkDevice device, VkSemaphore semaphore,
1206 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001207 const VkLayerDispatchTable *disp;
1208
1209 disp = loader_get_dispatch(device);
1210
Chia-I Wuf7458c52015-10-26 21:10:41 +08001211 disp->DestroySemaphore(device, semaphore, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001212}
1213
Jon Ashburn23d36b12016-02-02 17:47:28 -07001214LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1215vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo,
1216 const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001217 const VkLayerDispatchTable *disp;
1218
1219 disp = loader_get_dispatch(device);
1220
Chia-I Wuf7458c52015-10-26 21:10:41 +08001221 return disp->CreateEvent(device, pCreateInfo, pAllocator, pEvent);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001222}
1223
Jon Ashburn23d36b12016-02-02 17:47:28 -07001224LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1225vkDestroyEvent(VkDevice device, VkEvent event,
1226 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001227 const VkLayerDispatchTable *disp;
1228
1229 disp = loader_get_dispatch(device);
1230
Chia-I Wuf7458c52015-10-26 21:10:41 +08001231 disp->DestroyEvent(device, event, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001232}
1233
Jon Ashburn23d36b12016-02-02 17:47:28 -07001234LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1235vkGetEventStatus(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001236 const VkLayerDispatchTable *disp;
1237
1238 disp = loader_get_dispatch(device);
1239
1240 return disp->GetEventStatus(device, event);
1241}
1242
Jon Ashburn23d36b12016-02-02 17:47:28 -07001243LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1244vkSetEvent(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001245 const VkLayerDispatchTable *disp;
1246
1247 disp = loader_get_dispatch(device);
1248
1249 return disp->SetEvent(device, event);
1250}
1251
Jon Ashburn23d36b12016-02-02 17:47:28 -07001252LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1253vkResetEvent(VkDevice device, VkEvent event) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001254 const VkLayerDispatchTable *disp;
1255
1256 disp = loader_get_dispatch(device);
1257
1258 return disp->ResetEvent(device, event);
1259}
1260
Jon Ashburn23d36b12016-02-02 17:47:28 -07001261LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1262vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo,
1263 const VkAllocationCallbacks *pAllocator,
1264 VkQueryPool *pQueryPool) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001265 const VkLayerDispatchTable *disp;
1266
1267 disp = loader_get_dispatch(device);
1268
Chia-I Wuf7458c52015-10-26 21:10:41 +08001269 return disp->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001270}
1271
Jon Ashburn23d36b12016-02-02 17:47:28 -07001272LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1273vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool,
1274 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001275 const VkLayerDispatchTable *disp;
1276
1277 disp = loader_get_dispatch(device);
1278
Chia-I Wuf7458c52015-10-26 21:10:41 +08001279 disp->DestroyQueryPool(device, queryPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001280}
1281
Jon Ashburn23d36b12016-02-02 17:47:28 -07001282LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1283vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool,
1284 uint32_t firstQuery, uint32_t queryCount, size_t dataSize,
1285 void *pData, VkDeviceSize stride,
1286 VkQueryResultFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001287 const VkLayerDispatchTable *disp;
1288
1289 disp = loader_get_dispatch(device);
1290
Jon Ashburn23d36b12016-02-02 17:47:28 -07001291 return disp->GetQueryPoolResults(device, queryPool, firstQuery, queryCount,
1292 dataSize, pData, stride, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001293}
1294
Jon Ashburn23d36b12016-02-02 17:47:28 -07001295LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1296vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo,
1297 const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001298 const VkLayerDispatchTable *disp;
1299
1300 disp = loader_get_dispatch(device);
1301
Chia-I Wuf7458c52015-10-26 21:10:41 +08001302 return disp->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001303}
1304
Jon Ashburn23d36b12016-02-02 17:47:28 -07001305LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1306vkDestroyBuffer(VkDevice device, VkBuffer buffer,
1307 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001308 const VkLayerDispatchTable *disp;
1309
1310 disp = loader_get_dispatch(device);
1311
Chia-I Wuf7458c52015-10-26 21:10:41 +08001312 disp->DestroyBuffer(device, buffer, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001313}
1314
Jon Ashburn23d36b12016-02-02 17:47:28 -07001315LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1316vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo,
1317 const VkAllocationCallbacks *pAllocator,
1318 VkBufferView *pView) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001319 const VkLayerDispatchTable *disp;
1320
1321 disp = loader_get_dispatch(device);
1322
Chia-I Wuf7458c52015-10-26 21:10:41 +08001323 return disp->CreateBufferView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001324}
1325
Jon Ashburn23d36b12016-02-02 17:47:28 -07001326LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1327vkDestroyBufferView(VkDevice device, VkBufferView bufferView,
1328 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001329 const VkLayerDispatchTable *disp;
1330
1331 disp = loader_get_dispatch(device);
1332
Chia-I Wuf7458c52015-10-26 21:10:41 +08001333 disp->DestroyBufferView(device, bufferView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001334}
1335
Jon Ashburn23d36b12016-02-02 17:47:28 -07001336LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1337vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
1338 const VkAllocationCallbacks *pAllocator, VkImage *pImage) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001339 const VkLayerDispatchTable *disp;
1340
1341 disp = loader_get_dispatch(device);
1342
Chia-I Wuf7458c52015-10-26 21:10:41 +08001343 return disp->CreateImage(device, pCreateInfo, pAllocator, pImage);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001344}
1345
Jon Ashburn23d36b12016-02-02 17:47:28 -07001346LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1347vkDestroyImage(VkDevice device, VkImage image,
1348 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001349 const VkLayerDispatchTable *disp;
1350
1351 disp = loader_get_dispatch(device);
1352
Chia-I Wuf7458c52015-10-26 21:10:41 +08001353 disp->DestroyImage(device, image, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001354}
1355
Jon Ashburn23d36b12016-02-02 17:47:28 -07001356LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1357vkGetImageSubresourceLayout(VkDevice device, VkImage image,
1358 const VkImageSubresource *pSubresource,
1359 VkSubresourceLayout *pLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001360 const VkLayerDispatchTable *disp;
1361
1362 disp = loader_get_dispatch(device);
1363
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001364 disp->GetImageSubresourceLayout(device, image, pSubresource, pLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001365}
1366
Jon Ashburn23d36b12016-02-02 17:47:28 -07001367LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1368vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo,
1369 const VkAllocationCallbacks *pAllocator, VkImageView *pView) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001370 const VkLayerDispatchTable *disp;
1371
1372 disp = loader_get_dispatch(device);
1373
Chia-I Wuf7458c52015-10-26 21:10:41 +08001374 return disp->CreateImageView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001375}
1376
Jon Ashburn23d36b12016-02-02 17:47:28 -07001377LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1378vkDestroyImageView(VkDevice device, VkImageView imageView,
1379 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001380 const VkLayerDispatchTable *disp;
1381
1382 disp = loader_get_dispatch(device);
1383
Chia-I Wuf7458c52015-10-26 21:10:41 +08001384 disp->DestroyImageView(device, imageView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001385}
1386
Jon Ashburn23d36b12016-02-02 17:47:28 -07001387LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1388vkCreateShaderModule(VkDevice device,
1389 const VkShaderModuleCreateInfo *pCreateInfo,
1390 const VkAllocationCallbacks *pAllocator,
1391 VkShaderModule *pShader) {
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -06001392 const VkLayerDispatchTable *disp;
1393
1394 disp = loader_get_dispatch(device);
1395
Chia-I Wuf7458c52015-10-26 21:10:41 +08001396 return disp->CreateShaderModule(device, pCreateInfo, pAllocator, pShader);
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -06001397}
1398
Jon Ashburn23d36b12016-02-02 17:47:28 -07001399LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1400vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule,
1401 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001402 const VkLayerDispatchTable *disp;
1403
1404 disp = loader_get_dispatch(device);
1405
Chia-I Wuf7458c52015-10-26 21:10:41 +08001406 disp->DestroyShaderModule(device, shaderModule, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001407}
1408
Jon Ashburn23d36b12016-02-02 17:47:28 -07001409LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1410vkCreatePipelineCache(VkDevice device,
1411 const VkPipelineCacheCreateInfo *pCreateInfo,
1412 const VkAllocationCallbacks *pAllocator,
1413 VkPipelineCache *pPipelineCache) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001414 const VkLayerDispatchTable *disp;
1415
1416 disp = loader_get_dispatch(device);
1417
Jon Ashburn23d36b12016-02-02 17:47:28 -07001418 return disp->CreatePipelineCache(device, pCreateInfo, pAllocator,
1419 pPipelineCache);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001420}
1421
Jon Ashburn23d36b12016-02-02 17:47:28 -07001422LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1423vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache,
1424 const VkAllocationCallbacks *pAllocator) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001425 const VkLayerDispatchTable *disp;
1426
1427 disp = loader_get_dispatch(device);
1428
Chia-I Wuf7458c52015-10-26 21:10:41 +08001429 disp->DestroyPipelineCache(device, pipelineCache, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001430}
1431
Jon Ashburn23d36b12016-02-02 17:47:28 -07001432LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1433vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache,
1434 size_t *pDataSize, void *pData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001435 const VkLayerDispatchTable *disp;
1436
1437 disp = loader_get_dispatch(device);
1438
Chia-I Wub16facd2015-10-26 19:17:06 +08001439 return disp->GetPipelineCacheData(device, pipelineCache, pDataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001440}
1441
Jon Ashburn23d36b12016-02-02 17:47:28 -07001442LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1443vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache,
1444 uint32_t srcCacheCount,
1445 const VkPipelineCache *pSrcCaches) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001446 const VkLayerDispatchTable *disp;
1447
1448 disp = loader_get_dispatch(device);
1449
Jon Ashburn23d36b12016-02-02 17:47:28 -07001450 return disp->MergePipelineCaches(device, dstCache, srcCacheCount,
1451 pSrcCaches);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001452}
1453
Jon Ashburn23d36b12016-02-02 17:47:28 -07001454LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1455vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache,
1456 uint32_t createInfoCount,
1457 const VkGraphicsPipelineCreateInfo *pCreateInfos,
1458 const VkAllocationCallbacks *pAllocator,
1459 VkPipeline *pPipelines) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001460 const VkLayerDispatchTable *disp;
1461
1462 disp = loader_get_dispatch(device);
1463
Jon Ashburn23d36b12016-02-02 17:47:28 -07001464 return disp->CreateGraphicsPipelines(device, pipelineCache, createInfoCount,
1465 pCreateInfos, pAllocator, pPipelines);
Jon Ashburnc669cc62015-07-09 15:02:25 -06001466}
1467
Jon Ashburn23d36b12016-02-02 17:47:28 -07001468LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1469vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache,
1470 uint32_t createInfoCount,
1471 const VkComputePipelineCreateInfo *pCreateInfos,
1472 const VkAllocationCallbacks *pAllocator,
1473 VkPipeline *pPipelines) {
Jon Ashburnc669cc62015-07-09 15:02:25 -06001474 const VkLayerDispatchTable *disp;
1475
1476 disp = loader_get_dispatch(device);
1477
Jon Ashburn23d36b12016-02-02 17:47:28 -07001478 return disp->CreateComputePipelines(device, pipelineCache, createInfoCount,
1479 pCreateInfos, pAllocator, pPipelines);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001480}
1481
Jon Ashburn23d36b12016-02-02 17:47:28 -07001482LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1483vkDestroyPipeline(VkDevice device, VkPipeline pipeline,
1484 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001485 const VkLayerDispatchTable *disp;
1486
1487 disp = loader_get_dispatch(device);
1488
Chia-I Wuf7458c52015-10-26 21:10:41 +08001489 disp->DestroyPipeline(device, pipeline, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001490}
1491
Jon Ashburn23d36b12016-02-02 17:47:28 -07001492LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1493vkCreatePipelineLayout(VkDevice device,
1494 const VkPipelineLayoutCreateInfo *pCreateInfo,
1495 const VkAllocationCallbacks *pAllocator,
1496 VkPipelineLayout *pPipelineLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001497 const VkLayerDispatchTable *disp;
1498
1499 disp = loader_get_dispatch(device);
1500
Jon Ashburn23d36b12016-02-02 17:47:28 -07001501 return disp->CreatePipelineLayout(device, pCreateInfo, pAllocator,
1502 pPipelineLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001503}
1504
Jon Ashburn23d36b12016-02-02 17:47:28 -07001505LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1506vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout,
1507 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001508 const VkLayerDispatchTable *disp;
1509
1510 disp = loader_get_dispatch(device);
1511
Chia-I Wuf7458c52015-10-26 21:10:41 +08001512 disp->DestroyPipelineLayout(device, pipelineLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001513}
1514
Jon Ashburn23d36b12016-02-02 17:47:28 -07001515LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1516vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo,
1517 const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001518 const VkLayerDispatchTable *disp;
1519
1520 disp = loader_get_dispatch(device);
1521
Chia-I Wuf7458c52015-10-26 21:10:41 +08001522 return disp->CreateSampler(device, pCreateInfo, pAllocator, pSampler);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001523}
1524
Jon Ashburn23d36b12016-02-02 17:47:28 -07001525LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1526vkDestroySampler(VkDevice device, VkSampler sampler,
1527 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001528 const VkLayerDispatchTable *disp;
1529
1530 disp = loader_get_dispatch(device);
1531
Chia-I Wuf7458c52015-10-26 21:10:41 +08001532 disp->DestroySampler(device, sampler, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001533}
1534
Jon Ashburn23d36b12016-02-02 17:47:28 -07001535LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1536vkCreateDescriptorSetLayout(VkDevice device,
1537 const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
1538 const VkAllocationCallbacks *pAllocator,
1539 VkDescriptorSetLayout *pSetLayout) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001540 const VkLayerDispatchTable *disp;
1541
1542 disp = loader_get_dispatch(device);
1543
Jon Ashburn23d36b12016-02-02 17:47:28 -07001544 return disp->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator,
1545 pSetLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001546}
1547
Jon Ashburn23d36b12016-02-02 17:47:28 -07001548LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1549vkDestroyDescriptorSetLayout(VkDevice device,
1550 VkDescriptorSetLayout descriptorSetLayout,
1551 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001552 const VkLayerDispatchTable *disp;
1553
1554 disp = loader_get_dispatch(device);
1555
Chia-I Wuf7458c52015-10-26 21:10:41 +08001556 disp->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001557}
1558
Jon Ashburn23d36b12016-02-02 17:47:28 -07001559LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1560vkCreateDescriptorPool(VkDevice device,
1561 const VkDescriptorPoolCreateInfo *pCreateInfo,
1562 const VkAllocationCallbacks *pAllocator,
1563 VkDescriptorPool *pDescriptorPool) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001564 const VkLayerDispatchTable *disp;
1565
1566 disp = loader_get_dispatch(device);
1567
Jon Ashburn23d36b12016-02-02 17:47:28 -07001568 return disp->CreateDescriptorPool(device, pCreateInfo, pAllocator,
1569 pDescriptorPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001570}
1571
Jon Ashburn23d36b12016-02-02 17:47:28 -07001572LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1573vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
1574 const VkAllocationCallbacks *pAllocator) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001575 const VkLayerDispatchTable *disp;
1576
1577 disp = loader_get_dispatch(device);
1578
Chia-I Wuf7458c52015-10-26 21:10:41 +08001579 disp->DestroyDescriptorPool(device, descriptorPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001580}
1581
Jon Ashburn23d36b12016-02-02 17:47:28 -07001582LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1583vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
1584 VkDescriptorPoolResetFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001585 const VkLayerDispatchTable *disp;
1586
1587 disp = loader_get_dispatch(device);
1588
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001589 return disp->ResetDescriptorPool(device, descriptorPool, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001590}
1591
Jon Ashburn23d36b12016-02-02 17:47:28 -07001592LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1593vkAllocateDescriptorSets(VkDevice device,
1594 const VkDescriptorSetAllocateInfo *pAllocateInfo,
1595 VkDescriptorSet *pDescriptorSets) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001596 const VkLayerDispatchTable *disp;
1597
1598 disp = loader_get_dispatch(device);
1599
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001600 return disp->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001601}
1602
Jon Ashburn23d36b12016-02-02 17:47:28 -07001603LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1604vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool,
1605 uint32_t descriptorSetCount,
1606 const VkDescriptorSet *pDescriptorSets) {
Tony Barbour34ec6922015-07-10 10:50:45 -06001607 const VkLayerDispatchTable *disp;
1608
1609 disp = loader_get_dispatch(device);
1610
Jon Ashburn23d36b12016-02-02 17:47:28 -07001611 return disp->FreeDescriptorSets(device, descriptorPool, descriptorSetCount,
1612 pDescriptorSets);
Tony Barbour34ec6922015-07-10 10:50:45 -06001613}
1614
Jon Ashburn23d36b12016-02-02 17:47:28 -07001615LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1616vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount,
1617 const VkWriteDescriptorSet *pDescriptorWrites,
1618 uint32_t descriptorCopyCount,
1619 const VkCopyDescriptorSet *pDescriptorCopies) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001620 const VkLayerDispatchTable *disp;
1621
1622 disp = loader_get_dispatch(device);
1623
Jon Ashburn23d36b12016-02-02 17:47:28 -07001624 disp->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites,
1625 descriptorCopyCount, pDescriptorCopies);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001626}
1627
Jon Ashburn23d36b12016-02-02 17:47:28 -07001628LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1629vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo,
1630 const VkAllocationCallbacks *pAllocator,
1631 VkFramebuffer *pFramebuffer) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001632 const VkLayerDispatchTable *disp;
1633
1634 disp = loader_get_dispatch(device);
1635
Jon Ashburn23d36b12016-02-02 17:47:28 -07001636 return disp->CreateFramebuffer(device, pCreateInfo, pAllocator,
1637 pFramebuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001638}
1639
Jon Ashburn23d36b12016-02-02 17:47:28 -07001640LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1641vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer,
1642 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001643 const VkLayerDispatchTable *disp;
1644
1645 disp = loader_get_dispatch(device);
1646
Chia-I Wuf7458c52015-10-26 21:10:41 +08001647 disp->DestroyFramebuffer(device, framebuffer, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -06001648}
1649
Jon Ashburn23d36b12016-02-02 17:47:28 -07001650LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1651vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
1652 const VkAllocationCallbacks *pAllocator,
1653 VkRenderPass *pRenderPass) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001654 const VkLayerDispatchTable *disp;
1655
1656 disp = loader_get_dispatch(device);
1657
Chia-I Wuf7458c52015-10-26 21:10:41 +08001658 return disp->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
Jon Ashburn754864f2015-07-23 18:49:07 -06001659}
1660
Jon Ashburn23d36b12016-02-02 17:47:28 -07001661LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1662vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass,
1663 const VkAllocationCallbacks *pAllocator) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001664 const VkLayerDispatchTable *disp;
1665
1666 disp = loader_get_dispatch(device);
1667
Chia-I Wuf7458c52015-10-26 21:10:41 +08001668 disp->DestroyRenderPass(device, renderPass, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -06001669}
1670
Jon Ashburn23d36b12016-02-02 17:47:28 -07001671LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1672vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass,
1673 VkExtent2D *pGranularity) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001674 const VkLayerDispatchTable *disp;
1675
1676 disp = loader_get_dispatch(device);
1677
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -06001678 disp->GetRenderAreaGranularity(device, renderPass, pGranularity);
Jon Ashburn754864f2015-07-23 18:49:07 -06001679}
1680
Jon Ashburn23d36b12016-02-02 17:47:28 -07001681LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1682vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo,
1683 const VkAllocationCallbacks *pAllocator,
1684 VkCommandPool *pCommandPool) {
Cody Northrope62183e2015-07-09 18:08:05 -06001685 const VkLayerDispatchTable *disp;
1686
1687 disp = loader_get_dispatch(device);
1688
Jon Ashburn23d36b12016-02-02 17:47:28 -07001689 return disp->CreateCommandPool(device, pCreateInfo, pAllocator,
1690 pCommandPool);
Cody Northrope62183e2015-07-09 18:08:05 -06001691}
1692
Jon Ashburn23d36b12016-02-02 17:47:28 -07001693LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1694vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool,
1695 const VkAllocationCallbacks *pAllocator) {
Cody Northrope62183e2015-07-09 18:08:05 -06001696 const VkLayerDispatchTable *disp;
1697
1698 disp = loader_get_dispatch(device);
1699
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001700 disp->DestroyCommandPool(device, commandPool, pAllocator);
Cody Northrope62183e2015-07-09 18:08:05 -06001701}
1702
Jon Ashburn23d36b12016-02-02 17:47:28 -07001703LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1704vkResetCommandPool(VkDevice device, VkCommandPool commandPool,
1705 VkCommandPoolResetFlags flags) {
Cody Northrope62183e2015-07-09 18:08:05 -06001706 const VkLayerDispatchTable *disp;
1707
1708 disp = loader_get_dispatch(device);
1709
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001710 return disp->ResetCommandPool(device, commandPool, flags);
Cody Northrope62183e2015-07-09 18:08:05 -06001711}
1712
Jon Ashburn23d36b12016-02-02 17:47:28 -07001713LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1714vkAllocateCommandBuffers(VkDevice device,
1715 const VkCommandBufferAllocateInfo *pAllocateInfo,
1716 VkCommandBuffer *pCommandBuffers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001717 const VkLayerDispatchTable *disp;
1718 VkResult res;
1719
1720 disp = loader_get_dispatch(device);
1721
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001722 res = disp->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001723 if (res == VK_SUCCESS) {
Jon Ashburn23d36b12016-02-02 17:47:28 -07001724 for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; i++) {
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001725 if (pCommandBuffers[i]) {
1726 loader_init_dispatch(pCommandBuffers[i], disp);
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001727 }
1728 }
Jon Ashburnd55a3942015-05-06 09:02:10 -06001729 }
1730
1731 return res;
1732}
1733
Jon Ashburn23d36b12016-02-02 17:47:28 -07001734LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1735vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool,
1736 uint32_t commandBufferCount,
1737 const VkCommandBuffer *pCommandBuffers) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001738 const VkLayerDispatchTable *disp;
1739
1740 disp = loader_get_dispatch(device);
1741
Jon Ashburn23d36b12016-02-02 17:47:28 -07001742 disp->FreeCommandBuffers(device, commandPool, commandBufferCount,
1743 pCommandBuffers);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001744}
1745
Jon Ashburn23d36b12016-02-02 17:47:28 -07001746LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1747vkBeginCommandBuffer(VkCommandBuffer commandBuffer,
1748 const VkCommandBufferBeginInfo *pBeginInfo) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001749 const VkLayerDispatchTable *disp;
1750
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001751 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001752
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001753 return disp->BeginCommandBuffer(commandBuffer, pBeginInfo);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001754}
1755
Jon Ashburn23d36b12016-02-02 17:47:28 -07001756LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1757vkEndCommandBuffer(VkCommandBuffer commandBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001758 const VkLayerDispatchTable *disp;
1759
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001760 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001761
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001762 return disp->EndCommandBuffer(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001763}
1764
Jon Ashburn23d36b12016-02-02 17:47:28 -07001765LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
1766vkResetCommandBuffer(VkCommandBuffer commandBuffer,
1767 VkCommandBufferResetFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001768 const VkLayerDispatchTable *disp;
1769
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001770 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001771
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001772 return disp->ResetCommandBuffer(commandBuffer, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001773}
1774
Jon Ashburn23d36b12016-02-02 17:47:28 -07001775LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1776vkCmdBindPipeline(VkCommandBuffer commandBuffer,
1777 VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001778 const VkLayerDispatchTable *disp;
1779
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001780 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001781
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001782 disp->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001783}
1784
Jon Ashburn23d36b12016-02-02 17:47:28 -07001785LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1786vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport,
1787 uint32_t viewportCount, const VkViewport *pViewports) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001788 const VkLayerDispatchTable *disp;
1789
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001790 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001791
Jon Ashburn23d36b12016-02-02 17:47:28 -07001792 disp->CmdSetViewport(commandBuffer, firstViewport, viewportCount,
1793 pViewports);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001794}
1795
Jon Ashburn23d36b12016-02-02 17:47:28 -07001796LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1797vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor,
1798 uint32_t scissorCount, const VkRect2D *pScissors) {
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001799 const VkLayerDispatchTable *disp;
1800
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001801 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001802
Jon Ashburn19d3bf12015-12-30 14:06:55 -07001803 disp->CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001804}
1805
Jon Ashburn23d36b12016-02-02 17:47:28 -07001806LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1807vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001808 const VkLayerDispatchTable *disp;
1809
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001810 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001811
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001812 disp->CmdSetLineWidth(commandBuffer, lineWidth);
Cody Northrop12365112015-08-17 11:10:49 -06001813}
1814
Jon Ashburn23d36b12016-02-02 17:47:28 -07001815LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1816vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor,
1817 float depthBiasClamp, float depthBiasSlopeFactor) {
Cody Northrop12365112015-08-17 11:10:49 -06001818 const VkLayerDispatchTable *disp;
1819
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001820 disp = loader_get_dispatch(commandBuffer);
Cody Northrop12365112015-08-17 11:10:49 -06001821
Jon Ashburn23d36b12016-02-02 17:47:28 -07001822 disp->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor,
1823 depthBiasClamp, depthBiasSlopeFactor);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001824}
1825
Jon Ashburn23d36b12016-02-02 17:47:28 -07001826LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1827vkCmdSetBlendConstants(VkCommandBuffer commandBuffer,
1828 const float blendConstants[4]) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001829 const VkLayerDispatchTable *disp;
1830
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001831 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001832
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001833 disp->CmdSetBlendConstants(commandBuffer, blendConstants);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001834}
1835
Jon Ashburn23d36b12016-02-02 17:47:28 -07001836LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1837vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds,
1838 float maxDepthBounds) {
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001839 const VkLayerDispatchTable *disp;
1840
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001841 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001842
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001843 disp->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
Cody Northrop82485a82015-08-18 15:21:16 -06001844}
1845
Jon Ashburn23d36b12016-02-02 17:47:28 -07001846LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1847vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer,
1848 VkStencilFaceFlags faceMask, uint32_t compareMask) {
Cody Northrop82485a82015-08-18 15:21:16 -06001849 const VkLayerDispatchTable *disp;
1850
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001851 disp = loader_get_dispatch(commandBuffer);
Cody Northrop82485a82015-08-18 15:21:16 -06001852
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001853 disp->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001854}
1855
Jon Ashburn23d36b12016-02-02 17:47:28 -07001856LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1857vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer,
1858 VkStencilFaceFlags faceMask, uint32_t writeMask) {
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001859 const VkLayerDispatchTable *disp;
1860
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001861 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001862
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001863 disp->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001864}
1865
Jon Ashburn23d36b12016-02-02 17:47:28 -07001866LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1867vkCmdSetStencilReference(VkCommandBuffer commandBuffer,
1868 VkStencilFaceFlags faceMask, uint32_t reference) {
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001869 const VkLayerDispatchTable *disp;
1870
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001871 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001872
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001873 disp->CmdSetStencilReference(commandBuffer, faceMask, reference);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001874}
1875
Jon Ashburn23d36b12016-02-02 17:47:28 -07001876LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets(
1877 VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
1878 VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount,
1879 const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount,
1880 const uint32_t *pDynamicOffsets) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001881 const VkLayerDispatchTable *disp;
1882
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001883 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001884
Jon Ashburn23d36b12016-02-02 17:47:28 -07001885 disp->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout,
1886 firstSet, descriptorSetCount, pDescriptorSets,
1887 dynamicOffsetCount, pDynamicOffsets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001888}
1889
Jon Ashburn23d36b12016-02-02 17:47:28 -07001890LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1891vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer,
1892 VkDeviceSize offset, VkIndexType indexType) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001893 const VkLayerDispatchTable *disp;
1894
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001895 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001896
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001897 disp->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001898}
1899
Jon Ashburn23d36b12016-02-02 17:47:28 -07001900LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1901vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding,
1902 uint32_t bindingCount, const VkBuffer *pBuffers,
1903 const VkDeviceSize *pOffsets) {
Jon Ashburn754864f2015-07-23 18:49:07 -06001904 const VkLayerDispatchTable *disp;
1905
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001906 disp = loader_get_dispatch(commandBuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001907
Jon Ashburn23d36b12016-02-02 17:47:28 -07001908 disp->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount,
1909 pBuffers, pOffsets);
Jon Ashburn754864f2015-07-23 18:49:07 -06001910}
1911
Jon Ashburn23d36b12016-02-02 17:47:28 -07001912LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1913vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount,
1914 uint32_t instanceCount, uint32_t firstVertex,
1915 uint32_t firstInstance) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001916 const VkLayerDispatchTable *disp;
1917
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001918 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001919
Jon Ashburn23d36b12016-02-02 17:47:28 -07001920 disp->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex,
1921 firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001922}
1923
Jon Ashburn23d36b12016-02-02 17:47:28 -07001924LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1925vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount,
1926 uint32_t instanceCount, uint32_t firstIndex,
1927 int32_t vertexOffset, uint32_t firstInstance) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001928 const VkLayerDispatchTable *disp;
1929
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001930 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001931
Jon Ashburn23d36b12016-02-02 17:47:28 -07001932 disp->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex,
1933 vertexOffset, firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001934}
1935
Jon Ashburn23d36b12016-02-02 17:47:28 -07001936LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1937vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1938 VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001939 const VkLayerDispatchTable *disp;
1940
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001941 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001942
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001943 disp->CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001944}
1945
Jon Ashburn23d36b12016-02-02 17:47:28 -07001946LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1947vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1948 VkDeviceSize offset, uint32_t drawCount,
1949 uint32_t stride) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001950 const VkLayerDispatchTable *disp;
1951
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001952 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001953
Jon Ashburn23d36b12016-02-02 17:47:28 -07001954 disp->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount,
1955 stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001956}
1957
Jon Ashburn23d36b12016-02-02 17:47:28 -07001958LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1959vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y,
1960 uint32_t z) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001961 const VkLayerDispatchTable *disp;
1962
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001963 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001964
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001965 disp->CmdDispatch(commandBuffer, x, y, z);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001966}
1967
Jon Ashburn23d36b12016-02-02 17:47:28 -07001968LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1969vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
1970 VkDeviceSize offset) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001971 const VkLayerDispatchTable *disp;
1972
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001973 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001974
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001975 disp->CmdDispatchIndirect(commandBuffer, buffer, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001976}
1977
Jon Ashburn23d36b12016-02-02 17:47:28 -07001978LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1979vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer,
1980 VkBuffer dstBuffer, uint32_t regionCount,
1981 const VkBufferCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001982 const VkLayerDispatchTable *disp;
1983
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001984 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001985
Jon Ashburn23d36b12016-02-02 17:47:28 -07001986 disp->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount,
1987 pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001988}
1989
Jon Ashburn23d36b12016-02-02 17:47:28 -07001990LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
1991vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage,
1992 VkImageLayout srcImageLayout, VkImage dstImage,
1993 VkImageLayout dstImageLayout, uint32_t regionCount,
1994 const VkImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06001995 const VkLayerDispatchTable *disp;
1996
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001997 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001998
Jon Ashburn23d36b12016-02-02 17:47:28 -07001999 disp->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage,
2000 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002001}
2002
Jon Ashburn23d36b12016-02-02 17:47:28 -07002003LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2004vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage,
2005 VkImageLayout srcImageLayout, VkImage dstImage,
2006 VkImageLayout dstImageLayout, uint32_t regionCount,
2007 const VkImageBlit *pRegions, VkFilter filter) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002008 const VkLayerDispatchTable *disp;
2009
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002010 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002011
Jon Ashburn23d36b12016-02-02 17:47:28 -07002012 disp->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage,
2013 dstImageLayout, regionCount, pRegions, filter);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002014}
2015
Jon Ashburn23d36b12016-02-02 17:47:28 -07002016LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2017vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer,
2018 VkImage dstImage, VkImageLayout dstImageLayout,
2019 uint32_t regionCount,
2020 const VkBufferImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002021 const VkLayerDispatchTable *disp;
2022
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002023 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002024
Jon Ashburn23d36b12016-02-02 17:47:28 -07002025 disp->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage,
2026 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002027}
2028
Jon Ashburn23d36b12016-02-02 17:47:28 -07002029LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2030vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage,
2031 VkImageLayout srcImageLayout, VkBuffer dstBuffer,
2032 uint32_t regionCount,
2033 const VkBufferImageCopy *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002034 const VkLayerDispatchTable *disp;
2035
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002036 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002037
Jon Ashburn23d36b12016-02-02 17:47:28 -07002038 disp->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout,
2039 dstBuffer, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002040}
2041
Jon Ashburn23d36b12016-02-02 17:47:28 -07002042LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2043vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
2044 VkDeviceSize dstOffset, VkDeviceSize dataSize,
Karl Schultzee344492016-07-11 15:09:57 -06002045 const void *pData) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002046 const VkLayerDispatchTable *disp;
2047
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002048 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002049
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002050 disp->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002051}
2052
Jon Ashburn23d36b12016-02-02 17:47:28 -07002053LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2054vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
2055 VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002056 const VkLayerDispatchTable *disp;
2057
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002058 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002059
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002060 disp->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002061}
2062
Jon Ashburn23d36b12016-02-02 17:47:28 -07002063LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2064vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image,
2065 VkImageLayout imageLayout, const VkClearColorValue *pColor,
2066 uint32_t rangeCount,
2067 const VkImageSubresourceRange *pRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002068 const VkLayerDispatchTable *disp;
2069
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002070 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002071
Jon Ashburn23d36b12016-02-02 17:47:28 -07002072 disp->CmdClearColorImage(commandBuffer, image, imageLayout, pColor,
2073 rangeCount, pRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002074}
2075
Jon Ashburn23d36b12016-02-02 17:47:28 -07002076LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2077vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image,
2078 VkImageLayout imageLayout,
2079 const VkClearDepthStencilValue *pDepthStencil,
2080 uint32_t rangeCount,
2081 const VkImageSubresourceRange *pRanges) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002082 const VkLayerDispatchTable *disp;
2083
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002084 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002085
Jon Ashburn23d36b12016-02-02 17:47:28 -07002086 disp->CmdClearDepthStencilImage(commandBuffer, image, imageLayout,
2087 pDepthStencil, rangeCount, pRanges);
Chris Forbesd9be82b2015-06-22 17:21:59 +12002088}
2089
Jon Ashburn23d36b12016-02-02 17:47:28 -07002090LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2091vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
2092 const VkClearAttachment *pAttachments, uint32_t rectCount,
2093 const VkClearRect *pRects) {
Chris Forbesd9be82b2015-06-22 17:21:59 +12002094 const VkLayerDispatchTable *disp;
2095
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002096 disp = loader_get_dispatch(commandBuffer);
Chris Forbesd9be82b2015-06-22 17:21:59 +12002097
Jon Ashburn23d36b12016-02-02 17:47:28 -07002098 disp->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments,
2099 rectCount, pRects);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002100}
2101
Jon Ashburn23d36b12016-02-02 17:47:28 -07002102LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2103vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage,
2104 VkImageLayout srcImageLayout, VkImage dstImage,
2105 VkImageLayout dstImageLayout, uint32_t regionCount,
2106 const VkImageResolve *pRegions) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002107 const VkLayerDispatchTable *disp;
2108
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002109 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002110
Jon Ashburn23d36b12016-02-02 17:47:28 -07002111 disp->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage,
2112 dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002113}
2114
Jon Ashburn23d36b12016-02-02 17:47:28 -07002115LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2116vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event,
2117 VkPipelineStageFlags stageMask) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002118 const VkLayerDispatchTable *disp;
2119
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002120 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002121
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002122 disp->CmdSetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002123}
2124
Jon Ashburn23d36b12016-02-02 17:47:28 -07002125LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2126vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event,
2127 VkPipelineStageFlags stageMask) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002128 const VkLayerDispatchTable *disp;
2129
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002130 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002131
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002132 disp->CmdResetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002133}
2134
Jon Ashburn23d36b12016-02-02 17:47:28 -07002135LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2136vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount,
2137 const VkEvent *pEvents, VkPipelineStageFlags sourceStageMask,
2138 VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount,
2139 const VkMemoryBarrier *pMemoryBarriers,
2140 uint32_t bufferMemoryBarrierCount,
2141 const VkBufferMemoryBarrier *pBufferMemoryBarriers,
2142 uint32_t imageMemoryBarrierCount,
2143 const VkImageMemoryBarrier *pImageMemoryBarriers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002144 const VkLayerDispatchTable *disp;
2145
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002146 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002147
Jon Ashburnf19916e2016-01-11 13:12:43 -07002148 disp->CmdWaitEvents(commandBuffer, eventCount, pEvents, sourceStageMask,
2149 dstStageMask, memoryBarrierCount, pMemoryBarriers,
2150 bufferMemoryBarrierCount, pBufferMemoryBarriers,
2151 imageMemoryBarrierCount, pImageMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002152}
2153
Jon Ashburnf19916e2016-01-11 13:12:43 -07002154LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier(
Jon Ashburn23d36b12016-02-02 17:47:28 -07002155 VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask,
2156 VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags,
2157 uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers,
2158 uint32_t bufferMemoryBarrierCount,
2159 const VkBufferMemoryBarrier *pBufferMemoryBarriers,
2160 uint32_t imageMemoryBarrierCount,
2161 const VkImageMemoryBarrier *pImageMemoryBarriers) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002162 const VkLayerDispatchTable *disp;
2163
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002164 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002165
Jon Ashburn23d36b12016-02-02 17:47:28 -07002166 disp->CmdPipelineBarrier(
2167 commandBuffer, srcStageMask, dstStageMask, dependencyFlags,
2168 memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount,
2169 pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002170}
2171
Jon Ashburn23d36b12016-02-02 17:47:28 -07002172LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2173vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2174 uint32_t slot, VkFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002175 const VkLayerDispatchTable *disp;
2176
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002177 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002178
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002179 disp->CmdBeginQuery(commandBuffer, queryPool, slot, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002180}
2181
Jon Ashburn23d36b12016-02-02 17:47:28 -07002182LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2183vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2184 uint32_t slot) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002185 const VkLayerDispatchTable *disp;
2186
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002187 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002188
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002189 disp->CmdEndQuery(commandBuffer, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002190}
2191
Jon Ashburn23d36b12016-02-02 17:47:28 -07002192LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2193vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2194 uint32_t firstQuery, uint32_t queryCount) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002195 const VkLayerDispatchTable *disp;
2196
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002197 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002198
Jon Ashburn19d3bf12015-12-30 14:06:55 -07002199 disp->CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002200}
2201
Jon Ashburn23d36b12016-02-02 17:47:28 -07002202LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2203vkCmdWriteTimestamp(VkCommandBuffer commandBuffer,
2204 VkPipelineStageFlagBits pipelineStage,
2205 VkQueryPool queryPool, uint32_t slot) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002206 const VkLayerDispatchTable *disp;
2207
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002208 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002209
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002210 disp->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002211}
2212
Jon Ashburn23d36b12016-02-02 17:47:28 -07002213LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2214vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
2215 uint32_t firstQuery, uint32_t queryCount,
2216 VkBuffer dstBuffer, VkDeviceSize dstOffset,
2217 VkDeviceSize stride, VkFlags flags) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002218 const VkLayerDispatchTable *disp;
2219
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002220 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002221
Jon Ashburn23d36b12016-02-02 17:47:28 -07002222 disp->CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery,
2223 queryCount, dstBuffer, dstOffset, stride,
2224 flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002225}
2226
Jon Ashburn23d36b12016-02-02 17:47:28 -07002227LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2228vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout,
2229 VkShaderStageFlags stageFlags, uint32_t offset,
2230 uint32_t size, const void *pValues) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002231 const VkLayerDispatchTable *disp;
2232
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002233 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002234
Jon Ashburn23d36b12016-02-02 17:47:28 -07002235 disp->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size,
2236 pValues);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06002237}
2238
Jon Ashburn23d36b12016-02-02 17:47:28 -07002239LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2240vkCmdBeginRenderPass(VkCommandBuffer commandBuffer,
2241 const VkRenderPassBeginInfo *pRenderPassBegin,
2242 VkSubpassContents contents) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002243 const VkLayerDispatchTable *disp;
2244
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002245 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002246
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002247 disp->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
Chia-I Wu08accc62015-07-07 11:50:03 +08002248}
2249
Jon Ashburn23d36b12016-02-02 17:47:28 -07002250LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2251vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) {
Chia-I Wu08accc62015-07-07 11:50:03 +08002252 const VkLayerDispatchTable *disp;
2253
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002254 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu08accc62015-07-07 11:50:03 +08002255
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002256 disp->CmdNextSubpass(commandBuffer, contents);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002257}
2258
Jon Ashburn23d36b12016-02-02 17:47:28 -07002259LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2260vkCmdEndRenderPass(VkCommandBuffer commandBuffer) {
Jon Ashburnd55a3942015-05-06 09:02:10 -06002261 const VkLayerDispatchTable *disp;
2262
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002263 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002264
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002265 disp->CmdEndRenderPass(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002266}
2267
Jon Ashburn23d36b12016-02-02 17:47:28 -07002268LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
2269vkCmdExecuteCommands(VkCommandBuffer commandBuffer,
2270 uint32_t commandBuffersCount,
2271 const VkCommandBuffer *pCommandBuffers) {
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002272 const VkLayerDispatchTable *disp;
2273
Chia-I Wu3432a0c2015-10-27 18:04:07 +08002274 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08002275
Jon Ashburn23d36b12016-02-02 17:47:28 -07002276 disp->CmdExecuteCommands(commandBuffer, commandBuffersCount,
2277 pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06002278}