blob: c89b561037c0884084a3c26afa4273e57d16c9b8 [file] [log] [blame]
Jon Ashburnd55a3942015-05-06 09:02:10 -06001/*
Jon Ashburnd55a3942015-05-06 09:02:10 -06002 *
3 * Copyright (C) 2014 LunarG, Inc.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included
13 * in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
Courtney Goeltzenleuchter7f5aafc2015-07-05 11:28:29 -060023#define _GNU_SOURCE
Jon Ashburn27cd5842015-05-12 17:26:48 -060024#include <stdlib.h>
25#include <string.h>
Jon Ashburnd55a3942015-05-06 09:02:10 -060026
Tobin Ehlisb835d1b2015-07-03 10:34:49 -060027#include "vk_loader_platform.h"
Jon Ashburnd55a3942015-05-06 09:02:10 -060028#include "loader.h"
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -060029#include "debug_report.h"
Ian Elliottd3ef02f2015-07-06 14:36:13 -060030#include "wsi_swapchain.h"
Jon Ashburnd55a3942015-05-06 09:02:10 -060031
Tobin Ehlisf37926f2015-05-13 11:57:18 -060032
Jon Ashburnd55a3942015-05-06 09:02:10 -060033/* Trampoline entrypoints */
Jon Ashburn27cd5842015-05-12 17:26:48 -060034LOADER_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchter57fb1572015-06-08 15:13:50 -060035 const VkInstanceCreateInfo* pCreateInfo,
Chia-I Wu3432a0c2015-10-27 18:04:07 +080036 const VkAllocationCallbacks* pAllocator,
Courtney Goeltzenleuchter57fb1572015-06-08 15:13:50 -060037 VkInstance* pInstance)
Jon Ashburn27cd5842015-05-12 17:26:48 -060038{
39 struct loader_instance *ptr_instance = NULL;
Jon Ashburn27cd5842015-05-12 17:26:48 -060040 VkResult res = VK_ERROR_INITIALIZATION_FAILED;
Jon Ashburn27cd5842015-05-12 17:26:48 -060041
Jon Ashburn8810c5f2015-08-18 18:04:47 -060042 loader_platform_thread_once(&once_init, loader_initialize);
Jon Ashburn27cd5842015-05-12 17:26:48 -060043
Chia-I Wuf7458c52015-10-26 21:10:41 +080044 if (pAllocator) {
Chia-I Wu3432a0c2015-10-27 18:04:07 +080045 ptr_instance = (struct loader_instance *) pAllocator->pfnAllocation(
Chia-I Wuf7458c52015-10-26 21:10:41 +080046 pAllocator->pUserData,
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -060047 sizeof(struct loader_instance),
48 sizeof(VkInstance),
Chia-I Wu3432a0c2015-10-27 18:04:07 +080049 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -060050 } else {
51 ptr_instance = (struct loader_instance *) malloc(sizeof(struct loader_instance));
52 }
Jon Ashburn27cd5842015-05-12 17:26:48 -060053 if (ptr_instance == NULL) {
54 return VK_ERROR_OUT_OF_HOST_MEMORY;
55 }
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -060056
Jon Ashburn87d6aa92015-08-28 15:19:27 -060057 tls_instance = ptr_instance;
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -060058 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburnb82c1852015-08-11 14:49:54 -060059 memset(ptr_instance, 0, sizeof(struct loader_instance));
Jon Ashburn07daee72015-05-21 18:13:33 -060060
Chia-I Wuf7458c52015-10-26 21:10:41 +080061 if (pAllocator) {
62 ptr_instance->alloc_callbacks = *pAllocator;
Courtney Goeltzenleuchter7f5aafc2015-07-05 11:28:29 -060063 }
64
Jon Ashburn3d002332015-08-20 16:35:30 -060065 /* Due to implicit layers need to get layer list even if
Chia-I Wud50a7d72015-10-26 20:48:51 +080066 * enabledLayerNameCount == 0 and VK_INSTANCE_LAYERS is unset. For now always
Jon Ashburn3d002332015-08-20 16:35:30 -060067 * get layer list (both instance and device) via loader_layer_scan(). */
68 memset(&ptr_instance->instance_layer_list, 0, sizeof(ptr_instance->instance_layer_list));
69 memset(&ptr_instance->device_layer_list, 0, sizeof(ptr_instance->device_layer_list));
Jon Ashburne39a4f82015-08-28 13:38:21 -060070 loader_layer_scan(ptr_instance,
71
72
73 &ptr_instance->instance_layer_list,
74 &ptr_instance->device_layer_list);
Jon Ashburn3d002332015-08-20 16:35:30 -060075
76 /* validate the app requested layers to be enabled */
Chia-I Wud50a7d72015-10-26 20:48:51 +080077 if (pCreateInfo->enabledLayerNameCount > 0) {
78 res = loader_validate_layers(pCreateInfo->enabledLayerNameCount,
Jon Ashburn3d002332015-08-20 16:35:30 -060079 pCreateInfo->ppEnabledLayerNames,
80 &ptr_instance->instance_layer_list);
81 if (res != VK_SUCCESS) {
Jon Ashburn1ff17592015-10-09 09:40:30 -060082 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn3d002332015-08-20 16:35:30 -060083 return res;
84 }
85 }
86
Jon Ashburn8810c5f2015-08-18 18:04:47 -060087 /* Scan/discover all ICD libraries */
88 memset(&ptr_instance->icd_libs, 0, sizeof(ptr_instance->icd_libs));
Jon Ashburne39a4f82015-08-28 13:38:21 -060089 loader_icd_scan(ptr_instance, &ptr_instance->icd_libs);
Jon Ashburn8810c5f2015-08-18 18:04:47 -060090
Jon Ashburneacfa3a2015-08-14 12:51:47 -060091 /* get extensions from all ICD's, merge so no duplicates, then validate */
Jon Ashburne39a4f82015-08-28 13:38:21 -060092 loader_get_icd_loader_instance_extensions(ptr_instance,
93 &ptr_instance->icd_libs,
94 &ptr_instance->ext_list);
95 res = loader_validate_instance_extensions(&ptr_instance->ext_list,
96 &ptr_instance->instance_layer_list,
97 pCreateInfo);
Jon Ashburneacfa3a2015-08-14 12:51:47 -060098 if (res != VK_SUCCESS) {
Jon Ashburne39a4f82015-08-28 13:38:21 -060099 loader_delete_layer_properties(ptr_instance,
100 &ptr_instance->device_layer_list);
101 loader_delete_layer_properties(ptr_instance,
102 &ptr_instance->instance_layer_list);
103 loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
104 loader_destroy_ext_list(ptr_instance, &ptr_instance->ext_list);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600105 loader_platform_thread_unlock_mutex(&loader_lock);
106 loader_heap_free(ptr_instance, ptr_instance);
107 return res;
108 }
109
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600110 ptr_instance->disp = loader_heap_alloc(
111 ptr_instance,
112 sizeof(VkLayerInstanceDispatchTable),
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800113 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600114 if (ptr_instance->disp == NULL) {
Jon Ashburne39a4f82015-08-28 13:38:21 -0600115 loader_delete_layer_properties(ptr_instance,
116 &ptr_instance->device_layer_list);
117 loader_delete_layer_properties(ptr_instance,
118 &ptr_instance->instance_layer_list);
119 loader_scanned_icd_clear(ptr_instance,
120 &ptr_instance->icd_libs);
121 loader_destroy_ext_list(ptr_instance,
122 &ptr_instance->ext_list);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600123 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600124 loader_heap_free(ptr_instance, ptr_instance);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600125 return VK_ERROR_OUT_OF_HOST_MEMORY;
126 }
127 memcpy(ptr_instance->disp, &instance_disp, sizeof(instance_disp));
128 ptr_instance->next = loader.instances;
129 loader.instances = ptr_instance;
130
Jon Ashburnb82c1852015-08-11 14:49:54 -0600131 /* activate any layers on instance chain */
Jon Ashburne39a4f82015-08-28 13:38:21 -0600132 res = loader_enable_instance_layers(ptr_instance,
133 pCreateInfo,
134 &ptr_instance->instance_layer_list);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600135 if (res != VK_SUCCESS) {
Jon Ashburne39a4f82015-08-28 13:38:21 -0600136 loader_delete_layer_properties(ptr_instance,
137 &ptr_instance->device_layer_list);
138 loader_delete_layer_properties(ptr_instance,
139 &ptr_instance->instance_layer_list);
140 loader_scanned_icd_clear(ptr_instance,
141 &ptr_instance->icd_libs);
142 loader_destroy_ext_list(ptr_instance,
143 &ptr_instance->ext_list);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600144 loader.instances = ptr_instance->next;
145 loader_platform_thread_unlock_mutex(&loader_lock);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600146 loader_heap_free(ptr_instance, ptr_instance->disp);
147 loader_heap_free(ptr_instance, ptr_instance);
148 return res;
149 }
Jon Ashburnb82c1852015-08-11 14:49:54 -0600150 loader_activate_instance_layers(ptr_instance);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600151
Ian Elliottd3ef02f2015-07-06 14:36:13 -0600152 wsi_swapchain_create_instance(ptr_instance, pCreateInfo);
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600153 debug_report_create_instance(ptr_instance, pCreateInfo);
Jon Ashburn07daee72015-05-21 18:13:33 -0600154
Jon Ashburn27cd5842015-05-12 17:26:48 -0600155
Jon Ashburn27cd5842015-05-12 17:26:48 -0600156 *pInstance = (VkInstance) ptr_instance;
Jon Ashburneed0c002015-05-21 17:42:17 -0600157
Chia-I Wuf7458c52015-10-26 21:10:41 +0800158 res = ptr_instance->disp->CreateInstance(pCreateInfo, pAllocator, pInstance);
Jon Ashburneed0c002015-05-21 17:42:17 -0600159
Courtney Goeltzenleuchterd971b612015-06-17 20:51:59 -0600160 /*
161 * Finally have the layers in place and everyone has seen
162 * the CreateInstance command go by. This allows the layer's
163 * GetInstanceProcAddr functions to return valid extension functions
164 * if enabled.
165 */
166 loader_activate_instance_layer_extensions(ptr_instance);
167
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600168 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600169 return res;
170}
171
Mark Lobodzinski2141f652015-09-07 13:59:43 -0600172LOADER_EXPORT void VKAPI vkDestroyInstance(
Chia-I Wuf7458c52015-10-26 21:10:41 +0800173 VkInstance instance,
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800174 const VkAllocationCallbacks* pAllocator)
Jon Ashburn27cd5842015-05-12 17:26:48 -0600175{
176 const VkLayerInstanceDispatchTable *disp;
Jon Ashburne0e64572015-09-30 12:56:42 -0600177 struct loader_instance *ptr_instance = NULL;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600178 disp = loader_get_instance_dispatch(instance);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600179
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600180 loader_platform_thread_lock_mutex(&loader_lock);
181
Jon Ashburne0e64572015-09-30 12:56:42 -0600182 ptr_instance = loader_get_instance(instance);
Chia-I Wuf7458c52015-10-26 21:10:41 +0800183 disp->DestroyInstance(instance, pAllocator);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600184
Courtney Goeltzenleuchter7d0023c2015-06-08 15:09:22 -0600185 loader_deactivate_instance_layers(ptr_instance);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600186 loader_heap_free(ptr_instance, ptr_instance->disp);
187 loader_heap_free(ptr_instance, ptr_instance);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600188 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600189}
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600190
Jon Ashburn27cd5842015-05-12 17:26:48 -0600191LOADER_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
192 VkInstance instance,
193 uint32_t* pPhysicalDeviceCount,
194 VkPhysicalDevice* pPhysicalDevices)
195{
196 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600197 VkResult res;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600198 disp = loader_get_instance_dispatch(instance);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600199
200 loader_platform_thread_lock_mutex(&loader_lock);
201 res = disp->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount,
Jon Ashburn27cd5842015-05-12 17:26:48 -0600202 pPhysicalDevices);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600203 loader_platform_thread_unlock_mutex(&loader_lock);
204 return res;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600205}
206
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600207LOADER_EXPORT void VKAPI vkGetPhysicalDeviceFeatures(
Jon Ashburn754864f2015-07-23 18:49:07 -0600208 VkPhysicalDevice gpu,
209 VkPhysicalDeviceFeatures *pFeatures)
210{
211 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn754864f2015-07-23 18:49:07 -0600212
213 disp = loader_get_instance_dispatch(gpu);
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600214 disp->GetPhysicalDeviceFeatures(gpu, pFeatures);
Jon Ashburn754864f2015-07-23 18:49:07 -0600215}
216
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600217LOADER_EXPORT void VKAPI vkGetPhysicalDeviceFormatProperties(
Jon Ashburn754864f2015-07-23 18:49:07 -0600218 VkPhysicalDevice gpu,
219 VkFormat format,
220 VkFormatProperties *pFormatInfo)
221{
222 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn754864f2015-07-23 18:49:07 -0600223
224 disp = loader_get_instance_dispatch(gpu);
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600225 disp->GetPhysicalDeviceFormatProperties(gpu, format, pFormatInfo);
Jon Ashburn754864f2015-07-23 18:49:07 -0600226}
227
Chia-I Wu17241042015-10-31 00:31:16 +0800228LOADER_EXPORT VkResult VKAPI vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties)
Jon Ashburn754864f2015-07-23 18:49:07 -0600229{
230 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn754864f2015-07-23 18:49:07 -0600231
232 disp = loader_get_instance_dispatch(physicalDevice);
Chia-I Wu17241042015-10-31 00:31:16 +0800233 return disp->GetPhysicalDeviceImageFormatProperties(physicalDevice, format, type, tiling, usage, flags, pImageFormatProperties);
Jon Ashburn754864f2015-07-23 18:49:07 -0600234}
235
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600236LOADER_EXPORT void VKAPI vkGetPhysicalDeviceProperties(
Jon Ashburn27cd5842015-05-12 17:26:48 -0600237 VkPhysicalDevice gpu,
Tony Barbour59a47322015-06-24 16:06:58 -0600238 VkPhysicalDeviceProperties* pProperties)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600239{
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600240 const VkLayerInstanceDispatchTable *disp;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600241
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600242 disp = loader_get_instance_dispatch(gpu);
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600243 disp->GetPhysicalDeviceProperties(gpu, pProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600244}
245
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600246LOADER_EXPORT void VKAPI vkGetPhysicalDeviceQueueFamilyProperties(
Tony Barbour59a47322015-06-24 16:06:58 -0600247 VkPhysicalDevice gpu,
Chia-I Wud50a7d72015-10-26 20:48:51 +0800248 uint32_t* pQueueFamilyPropertyCount,
Cody Northropd0802882015-08-03 17:04:53 -0600249 VkQueueFamilyProperties* pQueueProperties)
Tony Barbour59a47322015-06-24 16:06:58 -0600250{
251 const VkLayerInstanceDispatchTable *disp;
Tony Barbour59a47322015-06-24 16:06:58 -0600252
253 disp = loader_get_instance_dispatch(gpu);
Chia-I Wud50a7d72015-10-26 20:48:51 +0800254 disp->GetPhysicalDeviceQueueFamilyProperties(gpu, pQueueFamilyPropertyCount, pQueueProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600255}
256
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600257LOADER_EXPORT void VKAPI vkGetPhysicalDeviceMemoryProperties(
Tony Barbour59a47322015-06-24 16:06:58 -0600258 VkPhysicalDevice gpu,
259 VkPhysicalDeviceMemoryProperties* pMemoryProperties)
260{
261 const VkLayerInstanceDispatchTable *disp;
Tony Barbour59a47322015-06-24 16:06:58 -0600262
263 disp = loader_get_instance_dispatch(gpu);
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600264 disp->GetPhysicalDeviceMemoryProperties(gpu, pMemoryProperties);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600265}
266
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600267LOADER_EXPORT VkResult VKAPI vkCreateDevice(
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600268 VkPhysicalDevice gpu,
269 const VkDeviceCreateInfo* pCreateInfo,
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800270 const VkAllocationCallbacks* pAllocator,
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600271 VkDevice* pDevice)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600272{
Jon Ashburnd55a3942015-05-06 09:02:10 -0600273 VkResult res;
274
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600275 loader_platform_thread_lock_mutex(&loader_lock);
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600276
Chia-I Wuf7458c52015-10-26 21:10:41 +0800277 res = loader_CreateDevice(gpu, pCreateInfo, pAllocator, pDevice);
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600278
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600279 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600280 return res;
281}
282
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800283LOADER_EXPORT void VKAPI vkDestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600284{
285 const VkLayerDispatchTable *disp;
Jon Ashburne39a4f82015-08-28 13:38:21 -0600286 struct loader_device *dev;
287 struct loader_icd *icd = loader_get_icd_and_device(device, &dev);
288 const struct loader_instance *inst = icd->this_instance;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600289 disp = loader_get_dispatch(device);
290
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600291 loader_platform_thread_lock_mutex(&loader_lock);
Chia-I Wuf7458c52015-10-26 21:10:41 +0800292 disp->DestroyDevice(device, pAllocator);
Jon Ashburne39a4f82015-08-28 13:38:21 -0600293 loader_remove_logical_device(inst, device);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600294 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600295}
296
Courtney Goeltzenleuchter35985f62015-09-14 17:22:16 -0600297LOADER_EXPORT VkResult VKAPI vkEnumerateDeviceExtensionProperties(
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600298 VkPhysicalDevice physicalDevice,
299 const char* pLayerName,
Chia-I Wud50a7d72015-10-26 20:48:51 +0800300 uint32_t* pPropertyCount,
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600301 VkExtensionProperties* pProperties)
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600302{
303 VkResult res;
304
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600305 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700306
307 /* If pLayerName == NULL, then querying ICD extensions, pass this call
308 down the instance chain which will terminate in the ICD. This allows
309 layers to filter the extensions coming back up the chain.
310 If pLayerName != NULL then get layer extensions from manifest file. */
311 if (pLayerName == NULL || strlen(pLayerName) == 0) {
312 const VkLayerInstanceDispatchTable *disp;
313
314 disp = loader_get_instance_dispatch(physicalDevice);
315 res = disp->EnumerateDeviceExtensionProperties(physicalDevice, NULL, pPropertyCount, pProperties);
316 } else {
317 res = loader_EnumerateDeviceExtensionProperties(physicalDevice, pLayerName, pPropertyCount, pProperties);
318 }
319
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600320 loader_platform_thread_unlock_mutex(&loader_lock);
Tony Barbour59a47322015-06-24 16:06:58 -0600321 return res;
322}
323
Courtney Goeltzenleuchter35985f62015-09-14 17:22:16 -0600324LOADER_EXPORT VkResult VKAPI vkEnumerateDeviceLayerProperties(
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600325 VkPhysicalDevice physicalDevice,
Chia-I Wud50a7d72015-10-26 20:48:51 +0800326 uint32_t* pPropertyCount,
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600327 VkLayerProperties* pProperties)
Tony Barbour59a47322015-06-24 16:06:58 -0600328{
329 VkResult res;
330
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600331 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700332
333 /* Don't dispatch this call down the instance chain, want all device layers
334 enumerated and instance chain may not contain all device layers */
Chia-I Wud50a7d72015-10-26 20:48:51 +0800335 res = loader_EnumerateDeviceLayerProperties(physicalDevice, pPropertyCount, pProperties);
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600336 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600337 return res;
338}
339
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600340LOADER_EXPORT void VKAPI vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex, VkQueue* pQueue)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600341{
342 const VkLayerDispatchTable *disp;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600343
344 disp = loader_get_dispatch(device);
345
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600346 disp->GetDeviceQueue(device, queueNodeIndex, queueIndex, pQueue);
347 loader_set_dispatch(*pQueue, disp);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600348}
349
Chia-I Wu40cf0ae2015-10-26 17:20:32 +0800350LOADER_EXPORT VkResult VKAPI vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600351{
352 const VkLayerDispatchTable *disp;
353
354 disp = loader_get_dispatch(queue);
355
Chia-I Wu40cf0ae2015-10-26 17:20:32 +0800356 return disp->QueueSubmit(queue, submitCount, pSubmits, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600357}
358
359LOADER_EXPORT VkResult VKAPI vkQueueWaitIdle(VkQueue queue)
360{
361 const VkLayerDispatchTable *disp;
362
363 disp = loader_get_dispatch(queue);
364
365 return disp->QueueWaitIdle(queue);
366}
367
368LOADER_EXPORT VkResult VKAPI vkDeviceWaitIdle(VkDevice device)
369{
370 const VkLayerDispatchTable *disp;
371
372 disp = loader_get_dispatch(device);
373
374 return disp->DeviceWaitIdle(device);
375}
376
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800377LOADER_EXPORT VkResult VKAPI vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600378{
379 const VkLayerDispatchTable *disp;
380
381 disp = loader_get_dispatch(device);
382
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800383 return disp->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600384}
385
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800386LOADER_EXPORT void VKAPI vkFreeMemory(VkDevice device, VkDeviceMemory mem, const VkAllocationCallbacks* pAllocator)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600387{
388 const VkLayerDispatchTable *disp;
389
390 disp = loader_get_dispatch(device);
391
Chia-I Wuf7458c52015-10-26 21:10:41 +0800392 disp->FreeMemory(device, mem, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600393}
394
Jon Ashburnd55a3942015-05-06 09:02:10 -0600395LOADER_EXPORT VkResult VKAPI vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset, VkDeviceSize size, VkFlags flags, void** ppData)
396{
397 const VkLayerDispatchTable *disp;
398
399 disp = loader_get_dispatch(device);
400
401 return disp->MapMemory(device, mem, offset, size, flags, ppData);
402}
403
Mark Lobodzinski2141f652015-09-07 13:59:43 -0600404LOADER_EXPORT void VKAPI vkUnmapMemory(VkDevice device, VkDeviceMemory mem)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600405{
406 const VkLayerDispatchTable *disp;
407
408 disp = loader_get_dispatch(device);
409
Mark Lobodzinski2141f652015-09-07 13:59:43 -0600410 disp->UnmapMemory(device, mem);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600411}
412
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800413LOADER_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600414{
415 const VkLayerDispatchTable *disp;
416
417 disp = loader_get_dispatch(device);
418
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800419 return disp->FlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600420}
421
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800422LOADER_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600423{
424 const VkLayerDispatchTable *disp;
425
426 disp = loader_get_dispatch(device);
427
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800428 return disp->InvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600429}
430
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600431LOADER_EXPORT void VKAPI vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes)
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -0600432{
433 const VkLayerDispatchTable *disp;
434
435 disp = loader_get_dispatch(device);
436
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600437 disp->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes);
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -0600438}
439
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600440LOADER_EXPORT VkResult VKAPI vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, VkDeviceSize offset)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600441{
442 const VkLayerDispatchTable *disp;
443
Mark Lobodzinski942b1722015-05-11 17:21:15 -0500444 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600445
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600446 return disp->BindBufferMemory(device, buffer, mem, offset);
447}
448
449LOADER_EXPORT VkResult VKAPI vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem, VkDeviceSize offset)
450{
451 const VkLayerDispatchTable *disp;
452
453 disp = loader_get_dispatch(device);
454
455 return disp->BindImageMemory(device, image, mem, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600456}
457
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600458LOADER_EXPORT void VKAPI vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements)
Jon Ashburn754864f2015-07-23 18:49:07 -0600459{
460 const VkLayerDispatchTable *disp;
461
462 disp = loader_get_dispatch(device);
463
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600464 disp->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -0600465}
466
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600467LOADER_EXPORT void VKAPI vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements)
Jon Ashburn754864f2015-07-23 18:49:07 -0600468{
469 const VkLayerDispatchTable *disp;
470
471 disp = loader_get_dispatch(device);
472
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600473 disp->GetImageMemoryRequirements(device, image, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -0600474}
475
Chia-I Wud50a7d72015-10-26 20:48:51 +0800476LOADER_EXPORT void VKAPI vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600477{
478 const VkLayerDispatchTable *disp;
479
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -0600480 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600481
Chia-I Wud50a7d72015-10-26 20:48:51 +0800482 disp->GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600483}
484
Chia-I Wu5c17c962015-10-31 00:31:16 +0800485LOADER_EXPORT void VKAPI vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties)
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -0600486{
487 const VkLayerInstanceDispatchTable *disp;
488
489 disp = loader_get_instance_dispatch(physicalDevice);
490
Chia-I Wud50a7d72015-10-26 20:48:51 +0800491 disp->GetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pPropertyCount, pProperties);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -0600492}
493
Chia-I Wu1ff4c3d2015-10-26 16:55:27 +0800494LOADER_EXPORT VkResult VKAPI vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence)
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -0600495{
496 const VkLayerDispatchTable *disp;
497
498 disp = loader_get_dispatch(queue);
499
Chia-I Wu1ff4c3d2015-10-26 16:55:27 +0800500 return disp->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600501}
502
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800503LOADER_EXPORT VkResult VKAPI vkCreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600504{
505 const VkLayerDispatchTable *disp;
506
507 disp = loader_get_dispatch(device);
508
Chia-I Wuf7458c52015-10-26 21:10:41 +0800509 return disp->CreateFence(device, pCreateInfo, pAllocator, pFence);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600510}
511
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800512LOADER_EXPORT void VKAPI vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600513{
514 const VkLayerDispatchTable *disp;
515
516 disp = loader_get_dispatch(device);
517
Chia-I Wuf7458c52015-10-26 21:10:41 +0800518 disp->DestroyFence(device, fence, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600519}
520
Courtney Goeltzenleuchter2bf8f902015-06-18 17:28:20 -0600521LOADER_EXPORT VkResult VKAPI vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600522{
523 const VkLayerDispatchTable *disp;
524
525 disp = loader_get_dispatch(device);
526
527 return disp->ResetFences(device, fenceCount, pFences);
528}
529
530LOADER_EXPORT VkResult VKAPI vkGetFenceStatus(VkDevice device, VkFence fence)
531{
532 const VkLayerDispatchTable *disp;
533
534 disp = loader_get_dispatch(device);
535
536 return disp->GetFenceStatus(device, fence);
537}
538
Courtney Goeltzenleuchtercd2a0992015-07-09 11:44:38 -0600539LOADER_EXPORT VkResult VKAPI vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600540{
541 const VkLayerDispatchTable *disp;
542
543 disp = loader_get_dispatch(device);
544
545 return disp->WaitForFences(device, fenceCount, pFences, waitAll, timeout);
546}
547
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800548LOADER_EXPORT VkResult VKAPI vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600549{
550 const VkLayerDispatchTable *disp;
551
552 disp = loader_get_dispatch(device);
553
Chia-I Wuf7458c52015-10-26 21:10:41 +0800554 return disp->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600555}
556
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800557LOADER_EXPORT void VKAPI vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600558{
559 const VkLayerDispatchTable *disp;
560
561 disp = loader_get_dispatch(device);
562
Chia-I Wuf7458c52015-10-26 21:10:41 +0800563 disp->DestroySemaphore(device, semaphore, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600564}
565
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800566LOADER_EXPORT VkResult VKAPI vkCreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600567{
568 const VkLayerDispatchTable *disp;
569
570 disp = loader_get_dispatch(device);
571
Chia-I Wuf7458c52015-10-26 21:10:41 +0800572 return disp->CreateEvent(device, pCreateInfo, pAllocator, pEvent);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600573}
574
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800575LOADER_EXPORT void VKAPI vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600576{
577 const VkLayerDispatchTable *disp;
578
579 disp = loader_get_dispatch(device);
580
Chia-I Wuf7458c52015-10-26 21:10:41 +0800581 disp->DestroyEvent(device, event, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600582}
583
Jon Ashburnd55a3942015-05-06 09:02:10 -0600584LOADER_EXPORT VkResult VKAPI vkGetEventStatus(VkDevice device, VkEvent event)
585{
586 const VkLayerDispatchTable *disp;
587
588 disp = loader_get_dispatch(device);
589
590 return disp->GetEventStatus(device, event);
591}
592
593LOADER_EXPORT VkResult VKAPI vkSetEvent(VkDevice device, VkEvent event)
594{
595 const VkLayerDispatchTable *disp;
596
597 disp = loader_get_dispatch(device);
598
599 return disp->SetEvent(device, event);
600}
601
602LOADER_EXPORT VkResult VKAPI vkResetEvent(VkDevice device, VkEvent event)
603{
604 const VkLayerDispatchTable *disp;
605
606 disp = loader_get_dispatch(device);
607
608 return disp->ResetEvent(device, event);
609}
610
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800611LOADER_EXPORT VkResult VKAPI vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600612{
613 const VkLayerDispatchTable *disp;
614
615 disp = loader_get_dispatch(device);
616
Chia-I Wuf7458c52015-10-26 21:10:41 +0800617 return disp->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600618}
619
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800620LOADER_EXPORT void VKAPI vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600621{
622 const VkLayerDispatchTable *disp;
623
624 disp = loader_get_dispatch(device);
625
Chia-I Wuf7458c52015-10-26 21:10:41 +0800626 disp->DestroyQueryPool(device, queryPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600627}
628
Chia-I Wuccc93a72015-10-26 18:36:20 +0800629LOADER_EXPORT VkResult VKAPI vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600630{
631 const VkLayerDispatchTable *disp;
632
633 disp = loader_get_dispatch(device);
634
Chia-I Wuccc93a72015-10-26 18:36:20 +0800635 return disp->GetQueryPoolResults(device, queryPool, startQuery, queryCount, dataSize, pData, stride, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600636}
637
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800638LOADER_EXPORT VkResult VKAPI vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600639{
640 const VkLayerDispatchTable *disp;
641
642 disp = loader_get_dispatch(device);
643
Chia-I Wuf7458c52015-10-26 21:10:41 +0800644 return disp->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600645}
646
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800647LOADER_EXPORT void VKAPI vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600648{
649 const VkLayerDispatchTable *disp;
650
651 disp = loader_get_dispatch(device);
652
Chia-I Wuf7458c52015-10-26 21:10:41 +0800653 disp->DestroyBuffer(device, buffer, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600654}
655
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800656LOADER_EXPORT VkResult VKAPI vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600657{
658 const VkLayerDispatchTable *disp;
659
660 disp = loader_get_dispatch(device);
661
Chia-I Wuf7458c52015-10-26 21:10:41 +0800662 return disp->CreateBufferView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600663}
664
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800665LOADER_EXPORT void VKAPI vkDestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600666{
667 const VkLayerDispatchTable *disp;
668
669 disp = loader_get_dispatch(device);
670
Chia-I Wuf7458c52015-10-26 21:10:41 +0800671 disp->DestroyBufferView(device, bufferView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600672}
673
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800674LOADER_EXPORT VkResult VKAPI vkCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600675{
676 const VkLayerDispatchTable *disp;
677
678 disp = loader_get_dispatch(device);
679
Chia-I Wuf7458c52015-10-26 21:10:41 +0800680 return disp->CreateImage(device, pCreateInfo, pAllocator, pImage);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600681}
682
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800683LOADER_EXPORT void VKAPI vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600684{
685 const VkLayerDispatchTable *disp;
686
687 disp = loader_get_dispatch(device);
688
Chia-I Wuf7458c52015-10-26 21:10:41 +0800689 disp->DestroyImage(device, image, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600690}
691
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600692LOADER_EXPORT void VKAPI vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600693{
694 const VkLayerDispatchTable *disp;
695
696 disp = loader_get_dispatch(device);
697
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600698 disp->GetImageSubresourceLayout(device, image, pSubresource, pLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600699}
700
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800701LOADER_EXPORT VkResult VKAPI vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600702{
703 const VkLayerDispatchTable *disp;
704
705 disp = loader_get_dispatch(device);
706
Chia-I Wuf7458c52015-10-26 21:10:41 +0800707 return disp->CreateImageView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600708}
709
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800710LOADER_EXPORT void VKAPI vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600711{
712 const VkLayerDispatchTable *disp;
713
714 disp = loader_get_dispatch(device);
715
Chia-I Wuf7458c52015-10-26 21:10:41 +0800716 disp->DestroyImageView(device, imageView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600717}
718
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800719LOADER_EXPORT VkResult VKAPI vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShader)
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -0600720{
721 const VkLayerDispatchTable *disp;
722
723 disp = loader_get_dispatch(device);
724
Chia-I Wuf7458c52015-10-26 21:10:41 +0800725 return disp->CreateShaderModule(device, pCreateInfo, pAllocator, pShader);
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -0600726}
727
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800728LOADER_EXPORT void VKAPI vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600729{
730 const VkLayerDispatchTable *disp;
731
732 disp = loader_get_dispatch(device);
733
Chia-I Wuf7458c52015-10-26 21:10:41 +0800734 disp->DestroyShaderModule(device, shaderModule, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600735}
736
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800737LOADER_EXPORT VkResult VKAPI vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600738{
739 const VkLayerDispatchTable *disp;
740
741 disp = loader_get_dispatch(device);
742
Chia-I Wuf7458c52015-10-26 21:10:41 +0800743 return disp->CreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600744}
745
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800746LOADER_EXPORT void VKAPI vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600747{
748 const VkLayerDispatchTable *disp;
749
750 disp = loader_get_dispatch(device);
751
Chia-I Wuf7458c52015-10-26 21:10:41 +0800752 disp->DestroyPipelineCache(device, pipelineCache, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600753}
754
Chia-I Wub16facd2015-10-26 19:17:06 +0800755LOADER_EXPORT VkResult VKAPI vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600756{
757 const VkLayerDispatchTable *disp;
758
759 disp = loader_get_dispatch(device);
760
Chia-I Wub16facd2015-10-26 19:17:06 +0800761 return disp->GetPipelineCacheData(device, pipelineCache, pDataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600762}
763
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800764LOADER_EXPORT VkResult VKAPI vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600765{
766 const VkLayerDispatchTable *disp;
767
768 disp = loader_get_dispatch(device);
769
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800770 return disp->MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600771}
772
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800773LOADER_EXPORT VkResult VKAPI vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600774{
775 const VkLayerDispatchTable *disp;
776
777 disp = loader_get_dispatch(device);
778
Chia-I Wuf7458c52015-10-26 21:10:41 +0800779 return disp->CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
Jon Ashburnc669cc62015-07-09 15:02:25 -0600780}
781
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800782LOADER_EXPORT VkResult VKAPI vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines)
Jon Ashburnc669cc62015-07-09 15:02:25 -0600783{
784 const VkLayerDispatchTable *disp;
785
786 disp = loader_get_dispatch(device);
787
Chia-I Wuf7458c52015-10-26 21:10:41 +0800788 return disp->CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600789}
790
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800791LOADER_EXPORT void VKAPI vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600792{
793 const VkLayerDispatchTable *disp;
794
795 disp = loader_get_dispatch(device);
796
Chia-I Wuf7458c52015-10-26 21:10:41 +0800797 disp->DestroyPipeline(device, pipeline, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600798}
799
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800800LOADER_EXPORT VkResult VKAPI vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600801{
802 const VkLayerDispatchTable *disp;
803
804 disp = loader_get_dispatch(device);
805
Chia-I Wuf7458c52015-10-26 21:10:41 +0800806 return disp->CreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600807}
808
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800809LOADER_EXPORT void VKAPI vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600810{
811 const VkLayerDispatchTable *disp;
812
813 disp = loader_get_dispatch(device);
814
Chia-I Wuf7458c52015-10-26 21:10:41 +0800815 disp->DestroyPipelineLayout(device, pipelineLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600816}
817
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800818LOADER_EXPORT VkResult VKAPI vkCreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600819{
820 const VkLayerDispatchTable *disp;
821
822 disp = loader_get_dispatch(device);
823
Chia-I Wuf7458c52015-10-26 21:10:41 +0800824 return disp->CreateSampler(device, pCreateInfo, pAllocator, pSampler);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600825}
826
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800827LOADER_EXPORT void VKAPI vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600828{
829 const VkLayerDispatchTable *disp;
830
831 disp = loader_get_dispatch(device);
832
Chia-I Wuf7458c52015-10-26 21:10:41 +0800833 disp->DestroySampler(device, sampler, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600834}
835
836
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800837LOADER_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600838{
839 const VkLayerDispatchTable *disp;
840
841 disp = loader_get_dispatch(device);
842
Chia-I Wuf7458c52015-10-26 21:10:41 +0800843 return disp->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600844}
845
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800846LOADER_EXPORT void VKAPI vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600847{
848 const VkLayerDispatchTable *disp;
849
850 disp = loader_get_dispatch(device);
851
Chia-I Wuf7458c52015-10-26 21:10:41 +0800852 disp->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600853}
854
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800855LOADER_EXPORT VkResult VKAPI vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600856{
857 const VkLayerDispatchTable *disp;
858
859 disp = loader_get_dispatch(device);
860
Chia-I Wuf7458c52015-10-26 21:10:41 +0800861 return disp->CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600862}
863
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800864LOADER_EXPORT void VKAPI vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600865{
866 const VkLayerDispatchTable *disp;
867
868 disp = loader_get_dispatch(device);
869
Chia-I Wuf7458c52015-10-26 21:10:41 +0800870 disp->DestroyDescriptorPool(device, descriptorPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600871}
872
873
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -0600874LOADER_EXPORT VkResult VKAPI vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600875{
876 const VkLayerDispatchTable *disp;
877
878 disp = loader_get_dispatch(device);
879
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -0600880 return disp->ResetDescriptorPool(device, descriptorPool, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600881}
882
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800883LOADER_EXPORT VkResult VKAPI vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600884{
885 const VkLayerDispatchTable *disp;
886
887 disp = loader_get_dispatch(device);
888
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800889 return disp->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600890}
891
Chia-I Wud50a7d72015-10-26 20:48:51 +0800892LOADER_EXPORT VkResult VKAPI vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets)
Tony Barbour34ec6922015-07-10 10:50:45 -0600893{
894 const VkLayerDispatchTable *disp;
895
896 disp = loader_get_dispatch(device);
897
Chia-I Wud50a7d72015-10-26 20:48:51 +0800898 return disp->FreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets);
Tony Barbour34ec6922015-07-10 10:50:45 -0600899}
900
Chia-I Wu40cf0ae2015-10-26 17:20:32 +0800901LOADER_EXPORT void VKAPI vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600902{
903 const VkLayerDispatchTable *disp;
904
905 disp = loader_get_dispatch(device);
906
Chia-I Wu40cf0ae2015-10-26 17:20:32 +0800907 disp->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600908}
909
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800910LOADER_EXPORT VkResult VKAPI vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer)
Jon Ashburn754864f2015-07-23 18:49:07 -0600911{
912 const VkLayerDispatchTable *disp;
913
914 disp = loader_get_dispatch(device);
915
Chia-I Wuf7458c52015-10-26 21:10:41 +0800916 return disp->CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -0600917}
918
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800919LOADER_EXPORT void VKAPI vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator)
Jon Ashburn754864f2015-07-23 18:49:07 -0600920{
921 const VkLayerDispatchTable *disp;
922
923 disp = loader_get_dispatch(device);
924
Chia-I Wuf7458c52015-10-26 21:10:41 +0800925 disp->DestroyFramebuffer(device, framebuffer, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -0600926}
927
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800928LOADER_EXPORT VkResult VKAPI vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass)
Jon Ashburn754864f2015-07-23 18:49:07 -0600929{
930 const VkLayerDispatchTable *disp;
931
932 disp = loader_get_dispatch(device);
933
Chia-I Wuf7458c52015-10-26 21:10:41 +0800934 return disp->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
Jon Ashburn754864f2015-07-23 18:49:07 -0600935}
936
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800937LOADER_EXPORT void VKAPI vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator)
Jon Ashburn754864f2015-07-23 18:49:07 -0600938{
939 const VkLayerDispatchTable *disp;
940
941 disp = loader_get_dispatch(device);
942
Chia-I Wuf7458c52015-10-26 21:10:41 +0800943 disp->DestroyRenderPass(device, renderPass, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -0600944}
945
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600946LOADER_EXPORT void VKAPI vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity)
Jon Ashburn754864f2015-07-23 18:49:07 -0600947{
948 const VkLayerDispatchTable *disp;
949
950 disp = loader_get_dispatch(device);
951
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600952 disp->GetRenderAreaGranularity(device, renderPass, pGranularity);
Jon Ashburn754864f2015-07-23 18:49:07 -0600953}
954
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800955LOADER_EXPORT VkResult VKAPI vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool)
Cody Northrope62183e2015-07-09 18:08:05 -0600956{
957 const VkLayerDispatchTable *disp;
958
959 disp = loader_get_dispatch(device);
960
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800961 return disp->CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool);
Cody Northrope62183e2015-07-09 18:08:05 -0600962}
963
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800964LOADER_EXPORT void VKAPI vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator)
Cody Northrope62183e2015-07-09 18:08:05 -0600965{
966 const VkLayerDispatchTable *disp;
967
968 disp = loader_get_dispatch(device);
969
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800970 disp->DestroyCommandPool(device, commandPool, pAllocator);
Cody Northrope62183e2015-07-09 18:08:05 -0600971}
972
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800973LOADER_EXPORT VkResult VKAPI vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags)
Cody Northrope62183e2015-07-09 18:08:05 -0600974{
975 const VkLayerDispatchTable *disp;
976
977 disp = loader_get_dispatch(device);
978
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800979 return disp->ResetCommandPool(device, commandPool, flags);
Cody Northrope62183e2015-07-09 18:08:05 -0600980}
981
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800982LOADER_EXPORT VkResult VKAPI vkAllocateCommandBuffers(
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -0600983 VkDevice device,
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800984 const VkCommandBufferAllocateInfo* pAllocateInfo,
985 VkCommandBuffer* pCommandBuffers)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600986{
987 const VkLayerDispatchTable *disp;
988 VkResult res;
989
990 disp = loader_get_dispatch(device);
991
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800992 res = disp->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600993 if (res == VK_SUCCESS) {
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800994 for (uint32_t i =0; i < pAllocateInfo->bufferCount; i++) {
995 if (pCommandBuffers[i]) {
996 loader_init_dispatch(pCommandBuffers[i], disp);
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -0600997 }
998 }
Jon Ashburnd55a3942015-05-06 09:02:10 -0600999 }
1000
1001 return res;
1002}
1003
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001004LOADER_EXPORT void VKAPI vkFreeCommandBuffers(
1005 VkDevice device,
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001006 VkCommandPool commandPool,
Chia-I Wud50a7d72015-10-26 20:48:51 +08001007 uint32_t commandBufferCount,
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001008 const VkCommandBuffer* pCommandBuffers)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001009{
1010 const VkLayerDispatchTable *disp;
1011
1012 disp = loader_get_dispatch(device);
1013
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001014 disp->FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001015}
1016
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001017LOADER_EXPORT VkResult VKAPI vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001018{
1019 const VkLayerDispatchTable *disp;
1020
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001021 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001022
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001023 return disp->BeginCommandBuffer(commandBuffer, pBeginInfo);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001024}
1025
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001026LOADER_EXPORT VkResult VKAPI vkEndCommandBuffer(VkCommandBuffer commandBuffer)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001027{
1028 const VkLayerDispatchTable *disp;
1029
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001030 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001031
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001032 return disp->EndCommandBuffer(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001033}
1034
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001035LOADER_EXPORT VkResult VKAPI vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001036{
1037 const VkLayerDispatchTable *disp;
1038
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001039 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001040
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001041 return disp->ResetCommandBuffer(commandBuffer, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001042}
1043
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001044LOADER_EXPORT void VKAPI vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001045{
1046 const VkLayerDispatchTable *disp;
1047
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001048 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001049
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001050 disp->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001051}
1052
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001053LOADER_EXPORT void VKAPI vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport* pViewports)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001054{
1055 const VkLayerDispatchTable *disp;
1056
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001057 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001058
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001059 disp->CmdSetViewport(commandBuffer, viewportCount, pViewports);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001060}
1061
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001062LOADER_EXPORT void VKAPI vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D* pScissors)
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001063{
1064 const VkLayerDispatchTable *disp;
1065
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001066 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001067
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001068 disp->CmdSetScissor(commandBuffer, scissorCount, pScissors);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001069}
1070
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001071LOADER_EXPORT void VKAPI vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001072{
1073 const VkLayerDispatchTable *disp;
1074
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001075 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001076
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001077 disp->CmdSetLineWidth(commandBuffer, lineWidth);
Cody Northrop12365112015-08-17 11:10:49 -06001078}
1079
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001080LOADER_EXPORT void VKAPI vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor)
Cody Northrop12365112015-08-17 11:10:49 -06001081{
1082 const VkLayerDispatchTable *disp;
1083
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001084 disp = loader_get_dispatch(commandBuffer);
Cody Northrop12365112015-08-17 11:10:49 -06001085
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001086 disp->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001087}
1088
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001089LOADER_EXPORT void VKAPI vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4])
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001090{
1091 const VkLayerDispatchTable *disp;
1092
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001093 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001094
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001095 disp->CmdSetBlendConstants(commandBuffer, blendConstants);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001096}
1097
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001098LOADER_EXPORT void VKAPI vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001099{
1100 const VkLayerDispatchTable *disp;
1101
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001102 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001103
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001104 disp->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
Cody Northrop82485a82015-08-18 15:21:16 -06001105}
1106
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001107LOADER_EXPORT void VKAPI vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask)
Cody Northrop82485a82015-08-18 15:21:16 -06001108{
1109 const VkLayerDispatchTable *disp;
1110
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001111 disp = loader_get_dispatch(commandBuffer);
Cody Northrop82485a82015-08-18 15:21:16 -06001112
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001113 disp->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001114}
1115
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001116LOADER_EXPORT void VKAPI vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask)
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001117{
1118 const VkLayerDispatchTable *disp;
1119
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001120 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001121
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001122 disp->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001123}
1124
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001125LOADER_EXPORT void VKAPI vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference)
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001126{
1127 const VkLayerDispatchTable *disp;
1128
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001129 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001130
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001131 disp->CmdSetStencilReference(commandBuffer, faceMask, reference);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001132}
1133
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001134LOADER_EXPORT void VKAPI vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001135{
1136 const VkLayerDispatchTable *disp;
1137
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001138 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001139
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001140 disp->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001141}
1142
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001143LOADER_EXPORT void VKAPI vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001144{
1145 const VkLayerDispatchTable *disp;
1146
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001147 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001148
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001149 disp->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001150}
1151
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001152LOADER_EXPORT void VKAPI vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t startBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets)
Jon Ashburn754864f2015-07-23 18:49:07 -06001153{
1154 const VkLayerDispatchTable *disp;
1155
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001156 disp = loader_get_dispatch(commandBuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001157
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001158 disp->CmdBindVertexBuffers(commandBuffer, startBinding, bindingCount, pBuffers, pOffsets);
Jon Ashburn754864f2015-07-23 18:49:07 -06001159}
1160
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001161LOADER_EXPORT void VKAPI vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001162{
1163 const VkLayerDispatchTable *disp;
1164
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001165 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001166
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001167 disp->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001168}
1169
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001170LOADER_EXPORT void VKAPI vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001171{
1172 const VkLayerDispatchTable *disp;
1173
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001174 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001175
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001176 disp->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001177}
1178
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001179LOADER_EXPORT void VKAPI vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001180{
1181 const VkLayerDispatchTable *disp;
1182
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001183 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001184
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001185 disp->CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001186}
1187
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001188LOADER_EXPORT void VKAPI vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001189{
1190 const VkLayerDispatchTable *disp;
1191
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001192 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001193
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001194 disp->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount, stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001195}
1196
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001197LOADER_EXPORT void VKAPI vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001198{
1199 const VkLayerDispatchTable *disp;
1200
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001201 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001202
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001203 disp->CmdDispatch(commandBuffer, x, y, z);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001204}
1205
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001206LOADER_EXPORT void VKAPI vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001207{
1208 const VkLayerDispatchTable *disp;
1209
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001210 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001211
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001212 disp->CmdDispatchIndirect(commandBuffer, buffer, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001213}
1214
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001215LOADER_EXPORT void VKAPI vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001216{
1217 const VkLayerDispatchTable *disp;
1218
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001219 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001220
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001221 disp->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001222}
1223
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001224LOADER_EXPORT void VKAPI vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001225{
1226 const VkLayerDispatchTable *disp;
1227
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001228 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001229
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001230 disp->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001231}
1232
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001233LOADER_EXPORT void VKAPI vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001234{
1235 const VkLayerDispatchTable *disp;
1236
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001237 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001238
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001239 disp->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001240}
1241
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001242LOADER_EXPORT void VKAPI vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001243{
1244 const VkLayerDispatchTable *disp;
1245
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001246 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001247
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001248 disp->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001249}
1250
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001251LOADER_EXPORT void VKAPI vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001252{
1253 const VkLayerDispatchTable *disp;
1254
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001255 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001256
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001257 disp->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001258}
1259
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001260LOADER_EXPORT void VKAPI vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const uint32_t* pData)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001261{
1262 const VkLayerDispatchTable *disp;
1263
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001264 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001265
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001266 disp->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001267}
1268
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001269LOADER_EXPORT void VKAPI vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001270{
1271 const VkLayerDispatchTable *disp;
1272
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001273 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001274
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001275 disp->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001276}
1277
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001278LOADER_EXPORT void VKAPI vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001279{
1280 const VkLayerDispatchTable *disp;
1281
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001282 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001283
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001284 disp->CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001285}
1286
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001287LOADER_EXPORT void VKAPI vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001288{
1289 const VkLayerDispatchTable *disp;
1290
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001291 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001292
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001293 disp->CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges);
Chris Forbesd9be82b2015-06-22 17:21:59 +12001294}
1295
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001296LOADER_EXPORT void VKAPI vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects)
Chris Forbesd9be82b2015-06-22 17:21:59 +12001297{
1298 const VkLayerDispatchTable *disp;
1299
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001300 disp = loader_get_dispatch(commandBuffer);
Chris Forbesd9be82b2015-06-22 17:21:59 +12001301
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001302 disp->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001303}
1304
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001305LOADER_EXPORT void VKAPI vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001306{
1307 const VkLayerDispatchTable *disp;
1308
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001309 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001310
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001311 disp->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001312}
1313
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001314LOADER_EXPORT void VKAPI vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001315{
1316 const VkLayerDispatchTable *disp;
1317
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001318 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001319
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001320 disp->CmdSetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001321}
1322
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001323LOADER_EXPORT void VKAPI vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001324{
1325 const VkLayerDispatchTable *disp;
1326
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001327 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001328
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001329 disp->CmdResetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001330}
1331
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001332LOADER_EXPORT void VKAPI vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags sourceStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const void* const* ppMemoryBarriers)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001333{
1334 const VkLayerDispatchTable *disp;
1335
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001336 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001337
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001338 disp->CmdWaitEvents(commandBuffer, eventCount, pEvents, sourceStageMask, dstStageMask, memoryBarrierCount, ppMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001339}
1340
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001341LOADER_EXPORT void VKAPI vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const void* const* ppMemoryBarriers)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001342{
1343 const VkLayerDispatchTable *disp;
1344
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001345 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001346
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001347 disp->CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, ppMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001348}
1349
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001350LOADER_EXPORT void VKAPI vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot, VkFlags flags)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001351{
1352 const VkLayerDispatchTable *disp;
1353
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001354 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001355
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001356 disp->CmdBeginQuery(commandBuffer, queryPool, slot, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001357}
1358
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001359LOADER_EXPORT void VKAPI vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001360{
1361 const VkLayerDispatchTable *disp;
1362
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001363 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001364
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001365 disp->CmdEndQuery(commandBuffer, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001366}
1367
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001368LOADER_EXPORT void VKAPI vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001369{
1370 const VkLayerDispatchTable *disp;
1371
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001372 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001373
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001374 disp->CmdResetQueryPool(commandBuffer, queryPool, startQuery, queryCount);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001375}
1376
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001377LOADER_EXPORT void VKAPI vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t slot)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001378{
1379 const VkLayerDispatchTable *disp;
1380
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001381 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001382
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001383 disp->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001384}
1385
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001386LOADER_EXPORT void VKAPI vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkFlags flags)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001387{
1388 const VkLayerDispatchTable *disp;
1389
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001390 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001391
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001392 disp->CmdCopyQueryPoolResults(commandBuffer, queryPool, startQuery, queryCount, dstBuffer, dstOffset, stride, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001393}
1394
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001395LOADER_EXPORT void VKAPI vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* values)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001396{
1397 const VkLayerDispatchTable *disp;
1398
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001399 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001400
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001401 disp->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, values);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001402}
1403
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001404LOADER_EXPORT void VKAPI vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001405{
1406 const VkLayerDispatchTable *disp;
1407
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001408 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001409
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001410 disp->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
Chia-I Wu08accc62015-07-07 11:50:03 +08001411}
1412
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001413LOADER_EXPORT void VKAPI vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents)
Chia-I Wu08accc62015-07-07 11:50:03 +08001414{
1415 const VkLayerDispatchTable *disp;
1416
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001417 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu08accc62015-07-07 11:50:03 +08001418
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001419 disp->CmdNextSubpass(commandBuffer, contents);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001420}
1421
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001422LOADER_EXPORT void VKAPI vkCmdEndRenderPass(VkCommandBuffer commandBuffer)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001423{
1424 const VkLayerDispatchTable *disp;
1425
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001426 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001427
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001428 disp->CmdEndRenderPass(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08001429}
1430
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001431LOADER_EXPORT void VKAPI vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBuffersCount, const VkCommandBuffer* pCommandBuffers)
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08001432{
1433 const VkLayerDispatchTable *disp;
1434
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001435 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08001436
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001437 disp->CmdExecuteCommands(commandBuffer, commandBuffersCount, pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001438}