blob: 99c5279354cf52c552348d516f943db90d4437f1 [file] [log] [blame]
Jon Ashburnd55a3942015-05-06 09:02:10 -06001/*
2 * Vulkan
3 *
4 * Copyright (C) 2014 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
Courtney Goeltzenleuchter7f5aafc2015-07-05 11:28:29 -060024#define _GNU_SOURCE
Jon Ashburn27cd5842015-05-12 17:26:48 -060025#include <stdlib.h>
26#include <string.h>
Jon Ashburnd55a3942015-05-06 09:02:10 -060027
Tobin Ehlisb835d1b2015-07-03 10:34:49 -060028#include "vk_loader_platform.h"
Jon Ashburnd55a3942015-05-06 09:02:10 -060029#include "loader.h"
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -060030#include "debug_report.h"
Ian Elliottd3ef02f2015-07-06 14:36:13 -060031#include "wsi_swapchain.h"
Jon Ashburnd55a3942015-05-06 09:02:10 -060032
Tobin Ehlisf37926f2015-05-13 11:57:18 -060033
Jon Ashburnd55a3942015-05-06 09:02:10 -060034/* Trampoline entrypoints */
Jon Ashburn27cd5842015-05-12 17:26:48 -060035LOADER_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchter57fb1572015-06-08 15:13:50 -060036 const VkInstanceCreateInfo* pCreateInfo,
Chia-I Wu3432a0c2015-10-27 18:04:07 +080037 const VkAllocationCallbacks* pAllocator,
Courtney Goeltzenleuchter57fb1572015-06-08 15:13:50 -060038 VkInstance* pInstance)
Jon Ashburn27cd5842015-05-12 17:26:48 -060039{
40 struct loader_instance *ptr_instance = NULL;
Jon Ashburn27cd5842015-05-12 17:26:48 -060041 VkResult res = VK_ERROR_INITIALIZATION_FAILED;
Jon Ashburn27cd5842015-05-12 17:26:48 -060042
Jon Ashburn8810c5f2015-08-18 18:04:47 -060043 loader_platform_thread_once(&once_init, loader_initialize);
Jon Ashburn27cd5842015-05-12 17:26:48 -060044
Chia-I Wuf7458c52015-10-26 21:10:41 +080045 if (pAllocator) {
Chia-I Wu3432a0c2015-10-27 18:04:07 +080046 ptr_instance = (struct loader_instance *) pAllocator->pfnAllocation(
Chia-I Wuf7458c52015-10-26 21:10:41 +080047 pAllocator->pUserData,
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -060048 sizeof(struct loader_instance),
49 sizeof(VkInstance),
Chia-I Wu3432a0c2015-10-27 18:04:07 +080050 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -060051 } else {
52 ptr_instance = (struct loader_instance *) malloc(sizeof(struct loader_instance));
53 }
Jon Ashburn27cd5842015-05-12 17:26:48 -060054 if (ptr_instance == NULL) {
55 return VK_ERROR_OUT_OF_HOST_MEMORY;
56 }
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -060057
Jon Ashburn87d6aa92015-08-28 15:19:27 -060058 tls_instance = ptr_instance;
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -060059 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburnb82c1852015-08-11 14:49:54 -060060 memset(ptr_instance, 0, sizeof(struct loader_instance));
Jon Ashburn07daee72015-05-21 18:13:33 -060061
Chia-I Wuf7458c52015-10-26 21:10:41 +080062 if (pAllocator) {
63 ptr_instance->alloc_callbacks = *pAllocator;
Courtney Goeltzenleuchter7f5aafc2015-07-05 11:28:29 -060064 }
65
Jon Ashburn3d002332015-08-20 16:35:30 -060066 /* Due to implicit layers need to get layer list even if
Chia-I Wud50a7d72015-10-26 20:48:51 +080067 * enabledLayerNameCount == 0 and VK_INSTANCE_LAYERS is unset. For now always
Jon Ashburn3d002332015-08-20 16:35:30 -060068 * get layer list (both instance and device) via loader_layer_scan(). */
69 memset(&ptr_instance->instance_layer_list, 0, sizeof(ptr_instance->instance_layer_list));
70 memset(&ptr_instance->device_layer_list, 0, sizeof(ptr_instance->device_layer_list));
Jon Ashburne39a4f82015-08-28 13:38:21 -060071 loader_layer_scan(ptr_instance,
72
73
74 &ptr_instance->instance_layer_list,
75 &ptr_instance->device_layer_list);
Jon Ashburn3d002332015-08-20 16:35:30 -060076
77 /* validate the app requested layers to be enabled */
Chia-I Wud50a7d72015-10-26 20:48:51 +080078 if (pCreateInfo->enabledLayerNameCount > 0) {
79 res = loader_validate_layers(pCreateInfo->enabledLayerNameCount,
Jon Ashburn3d002332015-08-20 16:35:30 -060080 pCreateInfo->ppEnabledLayerNames,
81 &ptr_instance->instance_layer_list);
82 if (res != VK_SUCCESS) {
Jon Ashburn1ff17592015-10-09 09:40:30 -060083 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn3d002332015-08-20 16:35:30 -060084 return res;
85 }
86 }
87
Jon Ashburn8810c5f2015-08-18 18:04:47 -060088 /* Scan/discover all ICD libraries */
89 memset(&ptr_instance->icd_libs, 0, sizeof(ptr_instance->icd_libs));
Jon Ashburne39a4f82015-08-28 13:38:21 -060090 loader_icd_scan(ptr_instance, &ptr_instance->icd_libs);
Jon Ashburn8810c5f2015-08-18 18:04:47 -060091
Jon Ashburneacfa3a2015-08-14 12:51:47 -060092 /* get extensions from all ICD's, merge so no duplicates, then validate */
Jon Ashburne39a4f82015-08-28 13:38:21 -060093 loader_get_icd_loader_instance_extensions(ptr_instance,
94 &ptr_instance->icd_libs,
95 &ptr_instance->ext_list);
96 res = loader_validate_instance_extensions(&ptr_instance->ext_list,
97 &ptr_instance->instance_layer_list,
98 pCreateInfo);
Jon Ashburneacfa3a2015-08-14 12:51:47 -060099 if (res != VK_SUCCESS) {
Jon Ashburne39a4f82015-08-28 13:38:21 -0600100 loader_delete_layer_properties(ptr_instance,
101 &ptr_instance->device_layer_list);
102 loader_delete_layer_properties(ptr_instance,
103 &ptr_instance->instance_layer_list);
104 loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
105 loader_destroy_ext_list(ptr_instance, &ptr_instance->ext_list);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600106 loader_platform_thread_unlock_mutex(&loader_lock);
107 loader_heap_free(ptr_instance, ptr_instance);
108 return res;
109 }
110
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600111 ptr_instance->disp = loader_heap_alloc(
112 ptr_instance,
113 sizeof(VkLayerInstanceDispatchTable),
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800114 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600115 if (ptr_instance->disp == NULL) {
Jon Ashburne39a4f82015-08-28 13:38:21 -0600116 loader_delete_layer_properties(ptr_instance,
117 &ptr_instance->device_layer_list);
118 loader_delete_layer_properties(ptr_instance,
119 &ptr_instance->instance_layer_list);
120 loader_scanned_icd_clear(ptr_instance,
121 &ptr_instance->icd_libs);
122 loader_destroy_ext_list(ptr_instance,
123 &ptr_instance->ext_list);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600124 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600125 loader_heap_free(ptr_instance, ptr_instance);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600126 return VK_ERROR_OUT_OF_HOST_MEMORY;
127 }
128 memcpy(ptr_instance->disp, &instance_disp, sizeof(instance_disp));
129 ptr_instance->next = loader.instances;
130 loader.instances = ptr_instance;
131
Jon Ashburnb82c1852015-08-11 14:49:54 -0600132 /* activate any layers on instance chain */
Jon Ashburne39a4f82015-08-28 13:38:21 -0600133 res = loader_enable_instance_layers(ptr_instance,
134 pCreateInfo,
135 &ptr_instance->instance_layer_list);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600136 if (res != VK_SUCCESS) {
Jon Ashburne39a4f82015-08-28 13:38:21 -0600137 loader_delete_layer_properties(ptr_instance,
138 &ptr_instance->device_layer_list);
139 loader_delete_layer_properties(ptr_instance,
140 &ptr_instance->instance_layer_list);
141 loader_scanned_icd_clear(ptr_instance,
142 &ptr_instance->icd_libs);
143 loader_destroy_ext_list(ptr_instance,
144 &ptr_instance->ext_list);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600145 loader.instances = ptr_instance->next;
146 loader_platform_thread_unlock_mutex(&loader_lock);
Courtney Goeltzenleuchter81095102015-07-06 09:08:37 -0600147 loader_heap_free(ptr_instance, ptr_instance->disp);
148 loader_heap_free(ptr_instance, ptr_instance);
149 return res;
150 }
Jon Ashburnb82c1852015-08-11 14:49:54 -0600151 loader_activate_instance_layers(ptr_instance);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600152
Ian Elliottd3ef02f2015-07-06 14:36:13 -0600153 wsi_swapchain_create_instance(ptr_instance, pCreateInfo);
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600154 debug_report_create_instance(ptr_instance, pCreateInfo);
Jon Ashburn07daee72015-05-21 18:13:33 -0600155
Jon Ashburn27cd5842015-05-12 17:26:48 -0600156
Jon Ashburn27cd5842015-05-12 17:26:48 -0600157 *pInstance = (VkInstance) ptr_instance;
Jon Ashburneed0c002015-05-21 17:42:17 -0600158
Chia-I Wuf7458c52015-10-26 21:10:41 +0800159 res = ptr_instance->disp->CreateInstance(pCreateInfo, pAllocator, pInstance);
Jon Ashburneed0c002015-05-21 17:42:17 -0600160
Courtney Goeltzenleuchterd971b612015-06-17 20:51:59 -0600161 /*
162 * Finally have the layers in place and everyone has seen
163 * the CreateInstance command go by. This allows the layer's
164 * GetInstanceProcAddr functions to return valid extension functions
165 * if enabled.
166 */
167 loader_activate_instance_layer_extensions(ptr_instance);
168
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600169 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600170 return res;
171}
172
Mark Lobodzinski2141f652015-09-07 13:59:43 -0600173LOADER_EXPORT void VKAPI vkDestroyInstance(
Chia-I Wuf7458c52015-10-26 21:10:41 +0800174 VkInstance instance,
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800175 const VkAllocationCallbacks* pAllocator)
Jon Ashburn27cd5842015-05-12 17:26:48 -0600176{
177 const VkLayerInstanceDispatchTable *disp;
Jon Ashburne0e64572015-09-30 12:56:42 -0600178 struct loader_instance *ptr_instance = NULL;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600179 disp = loader_get_instance_dispatch(instance);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600180
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600181 loader_platform_thread_lock_mutex(&loader_lock);
182
Jon Ashburne0e64572015-09-30 12:56:42 -0600183 ptr_instance = loader_get_instance(instance);
Chia-I Wuf7458c52015-10-26 21:10:41 +0800184 disp->DestroyInstance(instance, pAllocator);
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600185
Courtney Goeltzenleuchter7d0023c2015-06-08 15:09:22 -0600186 loader_deactivate_instance_layers(ptr_instance);
Jon Ashburneacfa3a2015-08-14 12:51:47 -0600187 loader_heap_free(ptr_instance, ptr_instance->disp);
188 loader_heap_free(ptr_instance, ptr_instance);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600189 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600190}
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600191
Jon Ashburn27cd5842015-05-12 17:26:48 -0600192LOADER_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
193 VkInstance instance,
194 uint32_t* pPhysicalDeviceCount,
195 VkPhysicalDevice* pPhysicalDevices)
196{
197 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600198 VkResult res;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600199 disp = loader_get_instance_dispatch(instance);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600200
201 loader_platform_thread_lock_mutex(&loader_lock);
202 res = disp->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount,
Jon Ashburn27cd5842015-05-12 17:26:48 -0600203 pPhysicalDevices);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600204 loader_platform_thread_unlock_mutex(&loader_lock);
205 return res;
Jon Ashburn27cd5842015-05-12 17:26:48 -0600206}
207
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600208LOADER_EXPORT void VKAPI vkGetPhysicalDeviceFeatures(
Jon Ashburn754864f2015-07-23 18:49:07 -0600209 VkPhysicalDevice gpu,
210 VkPhysicalDeviceFeatures *pFeatures)
211{
212 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn754864f2015-07-23 18:49:07 -0600213
214 disp = loader_get_instance_dispatch(gpu);
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600215 disp->GetPhysicalDeviceFeatures(gpu, pFeatures);
Jon Ashburn754864f2015-07-23 18:49:07 -0600216}
217
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600218LOADER_EXPORT void VKAPI vkGetPhysicalDeviceFormatProperties(
Jon Ashburn754864f2015-07-23 18:49:07 -0600219 VkPhysicalDevice gpu,
220 VkFormat format,
221 VkFormatProperties *pFormatInfo)
222{
223 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn754864f2015-07-23 18:49:07 -0600224
225 disp = loader_get_instance_dispatch(gpu);
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600226 disp->GetPhysicalDeviceFormatProperties(gpu, format, pFormatInfo);
Jon Ashburn754864f2015-07-23 18:49:07 -0600227}
228
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600229LOADER_EXPORT void VKAPI vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties)
Jon Ashburn754864f2015-07-23 18:49:07 -0600230{
231 const VkLayerInstanceDispatchTable *disp;
Jon Ashburn754864f2015-07-23 18:49:07 -0600232
233 disp = loader_get_instance_dispatch(physicalDevice);
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600234 disp->GetPhysicalDeviceImageFormatProperties(physicalDevice, format, type, tiling, usage, flags, pImageFormatProperties);
Jon Ashburn754864f2015-07-23 18:49:07 -0600235}
236
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600237LOADER_EXPORT void VKAPI vkGetPhysicalDeviceProperties(
Jon Ashburn27cd5842015-05-12 17:26:48 -0600238 VkPhysicalDevice gpu,
Tony Barbour59a47322015-06-24 16:06:58 -0600239 VkPhysicalDeviceProperties* pProperties)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600240{
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600241 const VkLayerInstanceDispatchTable *disp;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600242
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600243 disp = loader_get_instance_dispatch(gpu);
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600244 disp->GetPhysicalDeviceProperties(gpu, pProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600245}
246
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600247LOADER_EXPORT void VKAPI vkGetPhysicalDeviceQueueFamilyProperties(
Tony Barbour59a47322015-06-24 16:06:58 -0600248 VkPhysicalDevice gpu,
Chia-I Wud50a7d72015-10-26 20:48:51 +0800249 uint32_t* pQueueFamilyPropertyCount,
Cody Northropd0802882015-08-03 17:04:53 -0600250 VkQueueFamilyProperties* pQueueProperties)
Tony Barbour59a47322015-06-24 16:06:58 -0600251{
252 const VkLayerInstanceDispatchTable *disp;
Tony Barbour59a47322015-06-24 16:06:58 -0600253
254 disp = loader_get_instance_dispatch(gpu);
Chia-I Wud50a7d72015-10-26 20:48:51 +0800255 disp->GetPhysicalDeviceQueueFamilyProperties(gpu, pQueueFamilyPropertyCount, pQueueProperties);
Tony Barbour59a47322015-06-24 16:06:58 -0600256}
257
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600258LOADER_EXPORT void VKAPI vkGetPhysicalDeviceMemoryProperties(
Tony Barbour59a47322015-06-24 16:06:58 -0600259 VkPhysicalDevice gpu,
260 VkPhysicalDeviceMemoryProperties* pMemoryProperties)
261{
262 const VkLayerInstanceDispatchTable *disp;
Tony Barbour59a47322015-06-24 16:06:58 -0600263
264 disp = loader_get_instance_dispatch(gpu);
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600265 disp->GetPhysicalDeviceMemoryProperties(gpu, pMemoryProperties);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600266}
267
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600268LOADER_EXPORT VkResult VKAPI vkCreateDevice(
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600269 VkPhysicalDevice gpu,
270 const VkDeviceCreateInfo* pCreateInfo,
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800271 const VkAllocationCallbacks* pAllocator,
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600272 VkDevice* pDevice)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600273{
Jon Ashburnd55a3942015-05-06 09:02:10 -0600274 VkResult res;
275
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600276 loader_platform_thread_lock_mutex(&loader_lock);
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600277
Chia-I Wuf7458c52015-10-26 21:10:41 +0800278 res = loader_CreateDevice(gpu, pCreateInfo, pAllocator, pDevice);
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -0600279
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600280 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600281 return res;
282}
283
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800284LOADER_EXPORT void VKAPI vkDestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600285{
286 const VkLayerDispatchTable *disp;
Jon Ashburne39a4f82015-08-28 13:38:21 -0600287 struct loader_device *dev;
288 struct loader_icd *icd = loader_get_icd_and_device(device, &dev);
289 const struct loader_instance *inst = icd->this_instance;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600290 disp = loader_get_dispatch(device);
291
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600292 loader_platform_thread_lock_mutex(&loader_lock);
Chia-I Wuf7458c52015-10-26 21:10:41 +0800293 disp->DestroyDevice(device, pAllocator);
Jon Ashburne39a4f82015-08-28 13:38:21 -0600294 loader_remove_logical_device(inst, device);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600295 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600296}
297
Courtney Goeltzenleuchter35985f62015-09-14 17:22:16 -0600298LOADER_EXPORT VkResult VKAPI vkEnumerateDeviceExtensionProperties(
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600299 VkPhysicalDevice physicalDevice,
300 const char* pLayerName,
Chia-I Wud50a7d72015-10-26 20:48:51 +0800301 uint32_t* pPropertyCount,
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600302 VkExtensionProperties* pProperties)
Jon Ashburn6301a0f2015-05-29 13:15:39 -0600303{
304 VkResult res;
305
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600306 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700307
308 /* If pLayerName == NULL, then querying ICD extensions, pass this call
309 down the instance chain which will terminate in the ICD. This allows
310 layers to filter the extensions coming back up the chain.
311 If pLayerName != NULL then get layer extensions from manifest file. */
312 if (pLayerName == NULL || strlen(pLayerName) == 0) {
313 const VkLayerInstanceDispatchTable *disp;
314
315 disp = loader_get_instance_dispatch(physicalDevice);
316 res = disp->EnumerateDeviceExtensionProperties(physicalDevice, NULL, pPropertyCount, pProperties);
317 } else {
318 res = loader_EnumerateDeviceExtensionProperties(physicalDevice, pLayerName, pPropertyCount, pProperties);
319 }
320
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600321 loader_platform_thread_unlock_mutex(&loader_lock);
Tony Barbour59a47322015-06-24 16:06:58 -0600322 return res;
323}
324
Courtney Goeltzenleuchter35985f62015-09-14 17:22:16 -0600325LOADER_EXPORT VkResult VKAPI vkEnumerateDeviceLayerProperties(
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600326 VkPhysicalDevice physicalDevice,
Chia-I Wud50a7d72015-10-26 20:48:51 +0800327 uint32_t* pPropertyCount,
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600328 VkLayerProperties* pProperties)
Tony Barbour59a47322015-06-24 16:06:58 -0600329{
330 VkResult res;
331
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600332 loader_platform_thread_lock_mutex(&loader_lock);
Jon Ashburn00eb6c02015-11-02 17:40:01 -0700333
334 /* Don't dispatch this call down the instance chain, want all device layers
335 enumerated and instance chain may not contain all device layers */
Chia-I Wud50a7d72015-10-26 20:48:51 +0800336 res = loader_EnumerateDeviceLayerProperties(physicalDevice, pPropertyCount, pProperties);
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600337 loader_platform_thread_unlock_mutex(&loader_lock);
Jon Ashburn27cd5842015-05-12 17:26:48 -0600338 return res;
339}
340
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600341LOADER_EXPORT void VKAPI vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex, VkQueue* pQueue)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600342{
343 const VkLayerDispatchTable *disp;
Jon Ashburnd55a3942015-05-06 09:02:10 -0600344
345 disp = loader_get_dispatch(device);
346
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600347 disp->GetDeviceQueue(device, queueNodeIndex, queueIndex, pQueue);
348 loader_set_dispatch(*pQueue, disp);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600349}
350
Chia-I Wu40cf0ae2015-10-26 17:20:32 +0800351LOADER_EXPORT VkResult VKAPI vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600352{
353 const VkLayerDispatchTable *disp;
354
355 disp = loader_get_dispatch(queue);
356
Chia-I Wu40cf0ae2015-10-26 17:20:32 +0800357 return disp->QueueSubmit(queue, submitCount, pSubmits, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600358}
359
360LOADER_EXPORT VkResult VKAPI vkQueueWaitIdle(VkQueue queue)
361{
362 const VkLayerDispatchTable *disp;
363
364 disp = loader_get_dispatch(queue);
365
366 return disp->QueueWaitIdle(queue);
367}
368
369LOADER_EXPORT VkResult VKAPI vkDeviceWaitIdle(VkDevice device)
370{
371 const VkLayerDispatchTable *disp;
372
373 disp = loader_get_dispatch(device);
374
375 return disp->DeviceWaitIdle(device);
376}
377
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800378LOADER_EXPORT VkResult VKAPI vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600379{
380 const VkLayerDispatchTable *disp;
381
382 disp = loader_get_dispatch(device);
383
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800384 return disp->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600385}
386
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800387LOADER_EXPORT void VKAPI vkFreeMemory(VkDevice device, VkDeviceMemory mem, const VkAllocationCallbacks* pAllocator)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600388{
389 const VkLayerDispatchTable *disp;
390
391 disp = loader_get_dispatch(device);
392
Chia-I Wuf7458c52015-10-26 21:10:41 +0800393 disp->FreeMemory(device, mem, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600394}
395
Jon Ashburnd55a3942015-05-06 09:02:10 -0600396LOADER_EXPORT VkResult VKAPI vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset, VkDeviceSize size, VkFlags flags, void** ppData)
397{
398 const VkLayerDispatchTable *disp;
399
400 disp = loader_get_dispatch(device);
401
402 return disp->MapMemory(device, mem, offset, size, flags, ppData);
403}
404
Mark Lobodzinski2141f652015-09-07 13:59:43 -0600405LOADER_EXPORT void VKAPI vkUnmapMemory(VkDevice device, VkDeviceMemory mem)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600406{
407 const VkLayerDispatchTable *disp;
408
409 disp = loader_get_dispatch(device);
410
Mark Lobodzinski2141f652015-09-07 13:59:43 -0600411 disp->UnmapMemory(device, mem);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600412}
413
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800414LOADER_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600415{
416 const VkLayerDispatchTable *disp;
417
418 disp = loader_get_dispatch(device);
419
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800420 return disp->FlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600421}
422
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800423LOADER_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600424{
425 const VkLayerDispatchTable *disp;
426
427 disp = loader_get_dispatch(device);
428
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800429 return disp->InvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600430}
431
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600432LOADER_EXPORT void VKAPI vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes)
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -0600433{
434 const VkLayerDispatchTable *disp;
435
436 disp = loader_get_dispatch(device);
437
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600438 disp->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes);
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -0600439}
440
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600441LOADER_EXPORT VkResult VKAPI vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, VkDeviceSize offset)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600442{
443 const VkLayerDispatchTable *disp;
444
Mark Lobodzinski942b1722015-05-11 17:21:15 -0500445 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600446
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600447 return disp->BindBufferMemory(device, buffer, mem, offset);
448}
449
450LOADER_EXPORT VkResult VKAPI vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem, VkDeviceSize offset)
451{
452 const VkLayerDispatchTable *disp;
453
454 disp = loader_get_dispatch(device);
455
456 return disp->BindImageMemory(device, image, mem, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600457}
458
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600459LOADER_EXPORT void VKAPI vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements)
Jon Ashburn754864f2015-07-23 18:49:07 -0600460{
461 const VkLayerDispatchTable *disp;
462
463 disp = loader_get_dispatch(device);
464
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600465 disp->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -0600466}
467
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600468LOADER_EXPORT void VKAPI vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements)
Jon Ashburn754864f2015-07-23 18:49:07 -0600469{
470 const VkLayerDispatchTable *disp;
471
472 disp = loader_get_dispatch(device);
473
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600474 disp->GetImageMemoryRequirements(device, image, pMemoryRequirements);
Jon Ashburn754864f2015-07-23 18:49:07 -0600475}
476
Chia-I Wud50a7d72015-10-26 20:48:51 +0800477LOADER_EXPORT void VKAPI vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600478{
479 const VkLayerDispatchTable *disp;
480
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -0600481 disp = loader_get_dispatch(device);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600482
Chia-I Wud50a7d72015-10-26 20:48:51 +0800483 disp->GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600484}
485
Chia-I Wu5c17c962015-10-31 00:31:16 +0800486LOADER_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 -0600487{
488 const VkLayerInstanceDispatchTable *disp;
489
490 disp = loader_get_instance_dispatch(physicalDevice);
491
Chia-I Wud50a7d72015-10-26 20:48:51 +0800492 disp->GetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pPropertyCount, pProperties);
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -0600493}
494
Chia-I Wu1ff4c3d2015-10-26 16:55:27 +0800495LOADER_EXPORT VkResult VKAPI vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence)
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -0600496{
497 const VkLayerDispatchTable *disp;
498
499 disp = loader_get_dispatch(queue);
500
Chia-I Wu1ff4c3d2015-10-26 16:55:27 +0800501 return disp->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600502}
503
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800504LOADER_EXPORT VkResult VKAPI vkCreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600505{
506 const VkLayerDispatchTable *disp;
507
508 disp = loader_get_dispatch(device);
509
Chia-I Wuf7458c52015-10-26 21:10:41 +0800510 return disp->CreateFence(device, pCreateInfo, pAllocator, pFence);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600511}
512
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800513LOADER_EXPORT void VKAPI vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600514{
515 const VkLayerDispatchTable *disp;
516
517 disp = loader_get_dispatch(device);
518
Chia-I Wuf7458c52015-10-26 21:10:41 +0800519 disp->DestroyFence(device, fence, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600520}
521
Courtney Goeltzenleuchter2bf8f902015-06-18 17:28:20 -0600522LOADER_EXPORT VkResult VKAPI vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600523{
524 const VkLayerDispatchTable *disp;
525
526 disp = loader_get_dispatch(device);
527
528 return disp->ResetFences(device, fenceCount, pFences);
529}
530
531LOADER_EXPORT VkResult VKAPI vkGetFenceStatus(VkDevice device, VkFence fence)
532{
533 const VkLayerDispatchTable *disp;
534
535 disp = loader_get_dispatch(device);
536
537 return disp->GetFenceStatus(device, fence);
538}
539
Courtney Goeltzenleuchtercd2a0992015-07-09 11:44:38 -0600540LOADER_EXPORT VkResult VKAPI vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600541{
542 const VkLayerDispatchTable *disp;
543
544 disp = loader_get_dispatch(device);
545
546 return disp->WaitForFences(device, fenceCount, pFences, waitAll, timeout);
547}
548
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800549LOADER_EXPORT VkResult VKAPI vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600550{
551 const VkLayerDispatchTable *disp;
552
553 disp = loader_get_dispatch(device);
554
Chia-I Wuf7458c52015-10-26 21:10:41 +0800555 return disp->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600556}
557
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800558LOADER_EXPORT void VKAPI vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600559{
560 const VkLayerDispatchTable *disp;
561
562 disp = loader_get_dispatch(device);
563
Chia-I Wuf7458c52015-10-26 21:10:41 +0800564 disp->DestroySemaphore(device, semaphore, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600565}
566
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800567LOADER_EXPORT VkResult VKAPI vkCreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600568{
569 const VkLayerDispatchTable *disp;
570
571 disp = loader_get_dispatch(device);
572
Chia-I Wuf7458c52015-10-26 21:10:41 +0800573 return disp->CreateEvent(device, pCreateInfo, pAllocator, pEvent);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600574}
575
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800576LOADER_EXPORT void VKAPI vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600577{
578 const VkLayerDispatchTable *disp;
579
580 disp = loader_get_dispatch(device);
581
Chia-I Wuf7458c52015-10-26 21:10:41 +0800582 disp->DestroyEvent(device, event, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600583}
584
Jon Ashburnd55a3942015-05-06 09:02:10 -0600585LOADER_EXPORT VkResult VKAPI vkGetEventStatus(VkDevice device, VkEvent event)
586{
587 const VkLayerDispatchTable *disp;
588
589 disp = loader_get_dispatch(device);
590
591 return disp->GetEventStatus(device, event);
592}
593
594LOADER_EXPORT VkResult VKAPI vkSetEvent(VkDevice device, VkEvent event)
595{
596 const VkLayerDispatchTable *disp;
597
598 disp = loader_get_dispatch(device);
599
600 return disp->SetEvent(device, event);
601}
602
603LOADER_EXPORT VkResult VKAPI vkResetEvent(VkDevice device, VkEvent event)
604{
605 const VkLayerDispatchTable *disp;
606
607 disp = loader_get_dispatch(device);
608
609 return disp->ResetEvent(device, event);
610}
611
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800612LOADER_EXPORT VkResult VKAPI vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600613{
614 const VkLayerDispatchTable *disp;
615
616 disp = loader_get_dispatch(device);
617
Chia-I Wuf7458c52015-10-26 21:10:41 +0800618 return disp->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600619}
620
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800621LOADER_EXPORT void VKAPI vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600622{
623 const VkLayerDispatchTable *disp;
624
625 disp = loader_get_dispatch(device);
626
Chia-I Wuf7458c52015-10-26 21:10:41 +0800627 disp->DestroyQueryPool(device, queryPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600628}
629
Chia-I Wuccc93a72015-10-26 18:36:20 +0800630LOADER_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 -0600631{
632 const VkLayerDispatchTable *disp;
633
634 disp = loader_get_dispatch(device);
635
Chia-I Wuccc93a72015-10-26 18:36:20 +0800636 return disp->GetQueryPoolResults(device, queryPool, startQuery, queryCount, dataSize, pData, stride, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600637}
638
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800639LOADER_EXPORT VkResult VKAPI vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600640{
641 const VkLayerDispatchTable *disp;
642
643 disp = loader_get_dispatch(device);
644
Chia-I Wuf7458c52015-10-26 21:10:41 +0800645 return disp->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600646}
647
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800648LOADER_EXPORT void VKAPI vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600649{
650 const VkLayerDispatchTable *disp;
651
652 disp = loader_get_dispatch(device);
653
Chia-I Wuf7458c52015-10-26 21:10:41 +0800654 disp->DestroyBuffer(device, buffer, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600655}
656
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800657LOADER_EXPORT VkResult VKAPI vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600658{
659 const VkLayerDispatchTable *disp;
660
661 disp = loader_get_dispatch(device);
662
Chia-I Wuf7458c52015-10-26 21:10:41 +0800663 return disp->CreateBufferView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600664}
665
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800666LOADER_EXPORT void VKAPI vkDestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600667{
668 const VkLayerDispatchTable *disp;
669
670 disp = loader_get_dispatch(device);
671
Chia-I Wuf7458c52015-10-26 21:10:41 +0800672 disp->DestroyBufferView(device, bufferView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600673}
674
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800675LOADER_EXPORT VkResult VKAPI vkCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600676{
677 const VkLayerDispatchTable *disp;
678
679 disp = loader_get_dispatch(device);
680
Chia-I Wuf7458c52015-10-26 21:10:41 +0800681 return disp->CreateImage(device, pCreateInfo, pAllocator, pImage);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600682}
683
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800684LOADER_EXPORT void VKAPI vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600685{
686 const VkLayerDispatchTable *disp;
687
688 disp = loader_get_dispatch(device);
689
Chia-I Wuf7458c52015-10-26 21:10:41 +0800690 disp->DestroyImage(device, image, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600691}
692
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600693LOADER_EXPORT void VKAPI vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600694{
695 const VkLayerDispatchTable *disp;
696
697 disp = loader_get_dispatch(device);
698
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600699 disp->GetImageSubresourceLayout(device, image, pSubresource, pLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600700}
701
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800702LOADER_EXPORT VkResult VKAPI vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600703{
704 const VkLayerDispatchTable *disp;
705
706 disp = loader_get_dispatch(device);
707
Chia-I Wuf7458c52015-10-26 21:10:41 +0800708 return disp->CreateImageView(device, pCreateInfo, pAllocator, pView);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600709}
710
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800711LOADER_EXPORT void VKAPI vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600712{
713 const VkLayerDispatchTable *disp;
714
715 disp = loader_get_dispatch(device);
716
Chia-I Wuf7458c52015-10-26 21:10:41 +0800717 disp->DestroyImageView(device, imageView, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600718}
719
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800720LOADER_EXPORT VkResult VKAPI vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShader)
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -0600721{
722 const VkLayerDispatchTable *disp;
723
724 disp = loader_get_dispatch(device);
725
Chia-I Wuf7458c52015-10-26 21:10:41 +0800726 return disp->CreateShaderModule(device, pCreateInfo, pAllocator, pShader);
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -0600727}
728
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800729LOADER_EXPORT void VKAPI vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600730{
731 const VkLayerDispatchTable *disp;
732
733 disp = loader_get_dispatch(device);
734
Chia-I Wuf7458c52015-10-26 21:10:41 +0800735 disp->DestroyShaderModule(device, shaderModule, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600736}
737
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800738LOADER_EXPORT VkResult VKAPI vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600739{
740 const VkLayerDispatchTable *disp;
741
742 disp = loader_get_dispatch(device);
743
Chia-I Wuf7458c52015-10-26 21:10:41 +0800744 return disp->CreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600745}
746
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800747LOADER_EXPORT void VKAPI vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600748{
749 const VkLayerDispatchTable *disp;
750
751 disp = loader_get_dispatch(device);
752
Chia-I Wuf7458c52015-10-26 21:10:41 +0800753 disp->DestroyPipelineCache(device, pipelineCache, pAllocator);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600754}
755
Chia-I Wub16facd2015-10-26 19:17:06 +0800756LOADER_EXPORT VkResult VKAPI vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600757{
758 const VkLayerDispatchTable *disp;
759
760 disp = loader_get_dispatch(device);
761
Chia-I Wub16facd2015-10-26 19:17:06 +0800762 return disp->GetPipelineCacheData(device, pipelineCache, pDataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600763}
764
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800765LOADER_EXPORT VkResult VKAPI vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600766{
767 const VkLayerDispatchTable *disp;
768
769 disp = loader_get_dispatch(device);
770
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800771 return disp->MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600772}
773
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800774LOADER_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 -0600775{
776 const VkLayerDispatchTable *disp;
777
778 disp = loader_get_dispatch(device);
779
Chia-I Wuf7458c52015-10-26 21:10:41 +0800780 return disp->CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
Jon Ashburnc669cc62015-07-09 15:02:25 -0600781}
782
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800783LOADER_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 -0600784{
785 const VkLayerDispatchTable *disp;
786
787 disp = loader_get_dispatch(device);
788
Chia-I Wuf7458c52015-10-26 21:10:41 +0800789 return disp->CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600790}
791
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800792LOADER_EXPORT void VKAPI vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600793{
794 const VkLayerDispatchTable *disp;
795
796 disp = loader_get_dispatch(device);
797
Chia-I Wuf7458c52015-10-26 21:10:41 +0800798 disp->DestroyPipeline(device, pipeline, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600799}
800
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800801LOADER_EXPORT VkResult VKAPI vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600802{
803 const VkLayerDispatchTable *disp;
804
805 disp = loader_get_dispatch(device);
806
Chia-I Wuf7458c52015-10-26 21:10:41 +0800807 return disp->CreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600808}
809
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800810LOADER_EXPORT void VKAPI vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600811{
812 const VkLayerDispatchTable *disp;
813
814 disp = loader_get_dispatch(device);
815
Chia-I Wuf7458c52015-10-26 21:10:41 +0800816 disp->DestroyPipelineLayout(device, pipelineLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600817}
818
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800819LOADER_EXPORT VkResult VKAPI vkCreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600820{
821 const VkLayerDispatchTable *disp;
822
823 disp = loader_get_dispatch(device);
824
Chia-I Wuf7458c52015-10-26 21:10:41 +0800825 return disp->CreateSampler(device, pCreateInfo, pAllocator, pSampler);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600826}
827
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800828LOADER_EXPORT void VKAPI vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600829{
830 const VkLayerDispatchTable *disp;
831
832 disp = loader_get_dispatch(device);
833
Chia-I Wuf7458c52015-10-26 21:10:41 +0800834 disp->DestroySampler(device, sampler, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600835}
836
837
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800838LOADER_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600839{
840 const VkLayerDispatchTable *disp;
841
842 disp = loader_get_dispatch(device);
843
Chia-I Wuf7458c52015-10-26 21:10:41 +0800844 return disp->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600845}
846
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800847LOADER_EXPORT void VKAPI vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600848{
849 const VkLayerDispatchTable *disp;
850
851 disp = loader_get_dispatch(device);
852
Chia-I Wuf7458c52015-10-26 21:10:41 +0800853 disp->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600854}
855
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800856LOADER_EXPORT VkResult VKAPI vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600857{
858 const VkLayerDispatchTable *disp;
859
860 disp = loader_get_dispatch(device);
861
Chia-I Wuf7458c52015-10-26 21:10:41 +0800862 return disp->CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600863}
864
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800865LOADER_EXPORT void VKAPI vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600866{
867 const VkLayerDispatchTable *disp;
868
869 disp = loader_get_dispatch(device);
870
Chia-I Wuf7458c52015-10-26 21:10:41 +0800871 disp->DestroyDescriptorPool(device, descriptorPool, pAllocator);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -0600872}
873
874
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -0600875LOADER_EXPORT VkResult VKAPI vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600876{
877 const VkLayerDispatchTable *disp;
878
879 disp = loader_get_dispatch(device);
880
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -0600881 return disp->ResetDescriptorPool(device, descriptorPool, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600882}
883
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800884LOADER_EXPORT VkResult VKAPI vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600885{
886 const VkLayerDispatchTable *disp;
887
888 disp = loader_get_dispatch(device);
889
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800890 return disp->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600891}
892
Chia-I Wud50a7d72015-10-26 20:48:51 +0800893LOADER_EXPORT VkResult VKAPI vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets)
Tony Barbour34ec6922015-07-10 10:50:45 -0600894{
895 const VkLayerDispatchTable *disp;
896
897 disp = loader_get_dispatch(device);
898
Chia-I Wud50a7d72015-10-26 20:48:51 +0800899 return disp->FreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets);
Tony Barbour34ec6922015-07-10 10:50:45 -0600900}
901
Chia-I Wu40cf0ae2015-10-26 17:20:32 +0800902LOADER_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 -0600903{
904 const VkLayerDispatchTable *disp;
905
906 disp = loader_get_dispatch(device);
907
Chia-I Wu40cf0ae2015-10-26 17:20:32 +0800908 disp->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600909}
910
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800911LOADER_EXPORT VkResult VKAPI vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer)
Jon Ashburn754864f2015-07-23 18:49:07 -0600912{
913 const VkLayerDispatchTable *disp;
914
915 disp = loader_get_dispatch(device);
916
Chia-I Wuf7458c52015-10-26 21:10:41 +0800917 return disp->CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -0600918}
919
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800920LOADER_EXPORT void VKAPI vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator)
Jon Ashburn754864f2015-07-23 18:49:07 -0600921{
922 const VkLayerDispatchTable *disp;
923
924 disp = loader_get_dispatch(device);
925
Chia-I Wuf7458c52015-10-26 21:10:41 +0800926 disp->DestroyFramebuffer(device, framebuffer, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -0600927}
928
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800929LOADER_EXPORT VkResult VKAPI vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass)
Jon Ashburn754864f2015-07-23 18:49:07 -0600930{
931 const VkLayerDispatchTable *disp;
932
933 disp = loader_get_dispatch(device);
934
Chia-I Wuf7458c52015-10-26 21:10:41 +0800935 return disp->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
Jon Ashburn754864f2015-07-23 18:49:07 -0600936}
937
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800938LOADER_EXPORT void VKAPI vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator)
Jon Ashburn754864f2015-07-23 18:49:07 -0600939{
940 const VkLayerDispatchTable *disp;
941
942 disp = loader_get_dispatch(device);
943
Chia-I Wuf7458c52015-10-26 21:10:41 +0800944 disp->DestroyRenderPass(device, renderPass, pAllocator);
Jon Ashburn754864f2015-07-23 18:49:07 -0600945}
946
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600947LOADER_EXPORT void VKAPI vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity)
Jon Ashburn754864f2015-07-23 18:49:07 -0600948{
949 const VkLayerDispatchTable *disp;
950
951 disp = loader_get_dispatch(device);
952
Courtney Goeltzenleuchter06d89472015-10-20 16:40:38 -0600953 disp->GetRenderAreaGranularity(device, renderPass, pGranularity);
Jon Ashburn754864f2015-07-23 18:49:07 -0600954}
955
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800956LOADER_EXPORT VkResult VKAPI vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool)
Cody Northrope62183e2015-07-09 18:08:05 -0600957{
958 const VkLayerDispatchTable *disp;
959
960 disp = loader_get_dispatch(device);
961
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800962 return disp->CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool);
Cody Northrope62183e2015-07-09 18:08:05 -0600963}
964
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800965LOADER_EXPORT void VKAPI vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator)
Cody Northrope62183e2015-07-09 18:08:05 -0600966{
967 const VkLayerDispatchTable *disp;
968
969 disp = loader_get_dispatch(device);
970
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800971 disp->DestroyCommandPool(device, commandPool, pAllocator);
Cody Northrope62183e2015-07-09 18:08:05 -0600972}
973
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800974LOADER_EXPORT VkResult VKAPI vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags)
Cody Northrope62183e2015-07-09 18:08:05 -0600975{
976 const VkLayerDispatchTable *disp;
977
978 disp = loader_get_dispatch(device);
979
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800980 return disp->ResetCommandPool(device, commandPool, flags);
Cody Northrope62183e2015-07-09 18:08:05 -0600981}
982
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800983LOADER_EXPORT VkResult VKAPI vkAllocateCommandBuffers(
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -0600984 VkDevice device,
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800985 const VkCommandBufferAllocateInfo* pAllocateInfo,
986 VkCommandBuffer* pCommandBuffers)
Jon Ashburnd55a3942015-05-06 09:02:10 -0600987{
988 const VkLayerDispatchTable *disp;
989 VkResult res;
990
991 disp = loader_get_dispatch(device);
992
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800993 res = disp->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -0600994 if (res == VK_SUCCESS) {
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800995 for (uint32_t i =0; i < pAllocateInfo->bufferCount; i++) {
996 if (pCommandBuffers[i]) {
997 loader_init_dispatch(pCommandBuffers[i], disp);
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -0600998 }
999 }
Jon Ashburnd55a3942015-05-06 09:02:10 -06001000 }
1001
1002 return res;
1003}
1004
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -06001005LOADER_EXPORT void VKAPI vkFreeCommandBuffers(
1006 VkDevice device,
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001007 VkCommandPool commandPool,
Chia-I Wud50a7d72015-10-26 20:48:51 +08001008 uint32_t commandBufferCount,
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001009 const VkCommandBuffer* pCommandBuffers)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001010{
1011 const VkLayerDispatchTable *disp;
1012
1013 disp = loader_get_dispatch(device);
1014
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001015 disp->FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001016}
1017
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001018LOADER_EXPORT VkResult VKAPI vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001019{
1020 const VkLayerDispatchTable *disp;
1021
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001022 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001023
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001024 return disp->BeginCommandBuffer(commandBuffer, pBeginInfo);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001025}
1026
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001027LOADER_EXPORT VkResult VKAPI vkEndCommandBuffer(VkCommandBuffer commandBuffer)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001028{
1029 const VkLayerDispatchTable *disp;
1030
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001031 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001032
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001033 return disp->EndCommandBuffer(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001034}
1035
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001036LOADER_EXPORT VkResult VKAPI vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001037{
1038 const VkLayerDispatchTable *disp;
1039
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001040 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001041
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001042 return disp->ResetCommandBuffer(commandBuffer, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001043}
1044
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001045LOADER_EXPORT void VKAPI vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001046{
1047 const VkLayerDispatchTable *disp;
1048
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001049 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001050
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001051 disp->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001052}
1053
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001054LOADER_EXPORT void VKAPI vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport* pViewports)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001055{
1056 const VkLayerDispatchTable *disp;
1057
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001058 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001059
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001060 disp->CmdSetViewport(commandBuffer, viewportCount, pViewports);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001061}
1062
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001063LOADER_EXPORT void VKAPI vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D* pScissors)
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001064{
1065 const VkLayerDispatchTable *disp;
1066
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001067 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -06001068
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001069 disp->CmdSetScissor(commandBuffer, scissorCount, pScissors);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001070}
1071
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001072LOADER_EXPORT void VKAPI vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001073{
1074 const VkLayerDispatchTable *disp;
1075
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001076 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001077
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001078 disp->CmdSetLineWidth(commandBuffer, lineWidth);
Cody Northrop12365112015-08-17 11:10:49 -06001079}
1080
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001081LOADER_EXPORT void VKAPI vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor)
Cody Northrop12365112015-08-17 11:10:49 -06001082{
1083 const VkLayerDispatchTable *disp;
1084
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001085 disp = loader_get_dispatch(commandBuffer);
Cody Northrop12365112015-08-17 11:10:49 -06001086
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001087 disp->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001088}
1089
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001090LOADER_EXPORT void VKAPI vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4])
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001091{
1092 const VkLayerDispatchTable *disp;
1093
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001094 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001095
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001096 disp->CmdSetBlendConstants(commandBuffer, blendConstants);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001097}
1098
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001099LOADER_EXPORT void VKAPI vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds)
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001100{
1101 const VkLayerDispatchTable *disp;
1102
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001103 disp = loader_get_dispatch(commandBuffer);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001104
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001105 disp->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
Cody Northrop82485a82015-08-18 15:21:16 -06001106}
1107
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001108LOADER_EXPORT void VKAPI vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask)
Cody Northrop82485a82015-08-18 15:21:16 -06001109{
1110 const VkLayerDispatchTable *disp;
1111
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001112 disp = loader_get_dispatch(commandBuffer);
Cody Northrop82485a82015-08-18 15:21:16 -06001113
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001114 disp->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001115}
1116
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001117LOADER_EXPORT void VKAPI vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask)
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001118{
1119 const VkLayerDispatchTable *disp;
1120
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001121 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001122
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001123 disp->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001124}
1125
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001126LOADER_EXPORT void VKAPI vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference)
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001127{
1128 const VkLayerDispatchTable *disp;
1129
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001130 disp = loader_get_dispatch(commandBuffer);
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -06001131
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001132 disp->CmdSetStencilReference(commandBuffer, faceMask, reference);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001133}
1134
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001135LOADER_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 -06001136{
1137 const VkLayerDispatchTable *disp;
1138
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001139 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001140
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001141 disp->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001142}
1143
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001144LOADER_EXPORT void VKAPI vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001145{
1146 const VkLayerDispatchTable *disp;
1147
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001148 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001149
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001150 disp->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001151}
1152
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001153LOADER_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 -06001154{
1155 const VkLayerDispatchTable *disp;
1156
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001157 disp = loader_get_dispatch(commandBuffer);
Jon Ashburn754864f2015-07-23 18:49:07 -06001158
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001159 disp->CmdBindVertexBuffers(commandBuffer, startBinding, bindingCount, pBuffers, pOffsets);
Jon Ashburn754864f2015-07-23 18:49:07 -06001160}
1161
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001162LOADER_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 -06001163{
1164 const VkLayerDispatchTable *disp;
1165
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001166 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001167
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001168 disp->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001169}
1170
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001171LOADER_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 -06001172{
1173 const VkLayerDispatchTable *disp;
1174
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001175 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001176
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001177 disp->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001178}
1179
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001180LOADER_EXPORT void VKAPI vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001181{
1182 const VkLayerDispatchTable *disp;
1183
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001184 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001185
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001186 disp->CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001187}
1188
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001189LOADER_EXPORT void VKAPI vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001190{
1191 const VkLayerDispatchTable *disp;
1192
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001193 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001194
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001195 disp->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount, stride);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001196}
1197
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001198LOADER_EXPORT void VKAPI vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001199{
1200 const VkLayerDispatchTable *disp;
1201
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001202 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001203
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001204 disp->CmdDispatch(commandBuffer, x, y, z);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001205}
1206
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001207LOADER_EXPORT void VKAPI vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001208{
1209 const VkLayerDispatchTable *disp;
1210
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001211 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001212
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001213 disp->CmdDispatchIndirect(commandBuffer, buffer, offset);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001214}
1215
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001216LOADER_EXPORT void VKAPI vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001217{
1218 const VkLayerDispatchTable *disp;
1219
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001220 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001221
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001222 disp->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001223}
1224
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001225LOADER_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 -06001226{
1227 const VkLayerDispatchTable *disp;
1228
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001229 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001230
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001231 disp->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001232}
1233
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001234LOADER_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 -06001235{
1236 const VkLayerDispatchTable *disp;
1237
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001238 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001239
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001240 disp->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001241}
1242
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001243LOADER_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 -06001244{
1245 const VkLayerDispatchTable *disp;
1246
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001247 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001248
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001249 disp->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001250}
1251
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001252LOADER_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 -06001253{
1254 const VkLayerDispatchTable *disp;
1255
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001256 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001257
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001258 disp->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001259}
1260
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001261LOADER_EXPORT void VKAPI vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const uint32_t* pData)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001262{
1263 const VkLayerDispatchTable *disp;
1264
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001265 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001266
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001267 disp->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001268}
1269
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001270LOADER_EXPORT void VKAPI vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001271{
1272 const VkLayerDispatchTable *disp;
1273
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001274 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001275
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001276 disp->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001277}
1278
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001279LOADER_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 -06001280{
1281 const VkLayerDispatchTable *disp;
1282
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001283 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001284
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001285 disp->CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001286}
1287
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001288LOADER_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 -06001289{
1290 const VkLayerDispatchTable *disp;
1291
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001292 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001293
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001294 disp->CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges);
Chris Forbesd9be82b2015-06-22 17:21:59 +12001295}
1296
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001297LOADER_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 +12001298{
1299 const VkLayerDispatchTable *disp;
1300
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001301 disp = loader_get_dispatch(commandBuffer);
Chris Forbesd9be82b2015-06-22 17:21:59 +12001302
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001303 disp->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001304}
1305
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001306LOADER_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 -06001307{
1308 const VkLayerDispatchTable *disp;
1309
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001310 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001311
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001312 disp->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001313}
1314
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001315LOADER_EXPORT void VKAPI vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001316{
1317 const VkLayerDispatchTable *disp;
1318
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001319 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001320
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001321 disp->CmdSetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001322}
1323
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001324LOADER_EXPORT void VKAPI vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001325{
1326 const VkLayerDispatchTable *disp;
1327
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001328 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001329
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001330 disp->CmdResetEvent(commandBuffer, event, stageMask);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001331}
1332
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001333LOADER_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 -06001334{
1335 const VkLayerDispatchTable *disp;
1336
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001337 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001338
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001339 disp->CmdWaitEvents(commandBuffer, eventCount, pEvents, sourceStageMask, dstStageMask, memoryBarrierCount, ppMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001340}
1341
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001342LOADER_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 -06001343{
1344 const VkLayerDispatchTable *disp;
1345
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001346 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001347
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001348 disp->CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, ppMemoryBarriers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001349}
1350
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001351LOADER_EXPORT void VKAPI vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot, VkFlags flags)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001352{
1353 const VkLayerDispatchTable *disp;
1354
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001355 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001356
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001357 disp->CmdBeginQuery(commandBuffer, queryPool, slot, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001358}
1359
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001360LOADER_EXPORT void VKAPI vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001361{
1362 const VkLayerDispatchTable *disp;
1363
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001364 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001365
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001366 disp->CmdEndQuery(commandBuffer, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001367}
1368
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001369LOADER_EXPORT void VKAPI vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001370{
1371 const VkLayerDispatchTable *disp;
1372
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001373 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001374
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001375 disp->CmdResetQueryPool(commandBuffer, queryPool, startQuery, queryCount);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001376}
1377
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001378LOADER_EXPORT void VKAPI vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t slot)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001379{
1380 const VkLayerDispatchTable *disp;
1381
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001382 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001383
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001384 disp->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, slot);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001385}
1386
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001387LOADER_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 -06001388{
1389 const VkLayerDispatchTable *disp;
1390
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001391 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001392
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001393 disp->CmdCopyQueryPoolResults(commandBuffer, queryPool, startQuery, queryCount, dstBuffer, dstOffset, stride, flags);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001394}
1395
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001396LOADER_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 -06001397{
1398 const VkLayerDispatchTable *disp;
1399
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001400 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001401
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001402 disp->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, values);
Tony Barbour1d2cd3f2015-07-03 10:33:54 -06001403}
1404
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001405LOADER_EXPORT void VKAPI vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001406{
1407 const VkLayerDispatchTable *disp;
1408
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001409 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001410
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001411 disp->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
Chia-I Wu08accc62015-07-07 11:50:03 +08001412}
1413
Chia-I Wu1b99bb22015-10-27 19:25:11 +08001414LOADER_EXPORT void VKAPI vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents)
Chia-I Wu08accc62015-07-07 11:50:03 +08001415{
1416 const VkLayerDispatchTable *disp;
1417
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001418 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu08accc62015-07-07 11:50:03 +08001419
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001420 disp->CmdNextSubpass(commandBuffer, contents);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001421}
1422
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001423LOADER_EXPORT void VKAPI vkCmdEndRenderPass(VkCommandBuffer commandBuffer)
Jon Ashburnd55a3942015-05-06 09:02:10 -06001424{
1425 const VkLayerDispatchTable *disp;
1426
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001427 disp = loader_get_dispatch(commandBuffer);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001428
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001429 disp->CmdEndRenderPass(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08001430}
1431
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001432LOADER_EXPORT void VKAPI vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBuffersCount, const VkCommandBuffer* pCommandBuffers)
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08001433{
1434 const VkLayerDispatchTable *disp;
1435
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001436 disp = loader_get_dispatch(commandBuffer);
Chia-I Wu0b50a1c2015-06-26 15:34:39 +08001437
Chia-I Wu3432a0c2015-10-27 18:04:07 +08001438 disp->CmdExecuteCommands(commandBuffer, commandBuffersCount, pCommandBuffers);
Jon Ashburnd55a3942015-05-06 09:02:10 -06001439}