blob: 20608ede2d5af103468b3202b885ab5e6065cb5f [file] [log] [blame]
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001/*
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002 * Vulkan
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06003 *
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 */
24
25#include <stdio.h>
26#include <stdlib.h>
27#include <string.h>
28
29#include <iostream>
30#include <string>
31#include <sstream>
Mark Lobodzinski3723c512015-05-26 10:58:40 -050032#include <unordered_map>
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060033
34#include "loader_platform.h"
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060035#include "vkLayer.h"
Jon Ashburnf0615e22015-05-25 14:11:37 -060036#include "vk_debug_marker_layer.h"
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060037#include "layers_config.h"
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060038#include "vk_enum_validate_helper.h"
39#include "vk_struct_validate_helper.h"
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060040//The following is #included again to catch certain OS-specific functions being used:
41#include "loader_platform.h"
42
43#include "layers_msg.h"
Jon Ashburn6f8cd632015-06-01 09:37:38 -060044#include "layers_debug_marker_table.h"
Jon Ashburn5a10d212015-06-01 10:02:09 -060045#include "layers_table.h"
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060046
Jon Ashburnd9564002015-05-07 10:27:37 -060047static LOADER_PLATFORM_THREAD_ONCE_DECLARATION(initOnce);
Jon Ashburn6f8cd632015-06-01 09:37:38 -060048struct devExts {
49 bool debug_marker_enabled;
50};
Jon Ashburn6f8cd632015-06-01 09:37:38 -060051static std::unordered_map<void *, struct devExts> deviceExtMap;
Mark Lobodzinski3723c512015-05-26 10:58:40 -050052
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060053
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060054#include "vk_dispatch_table_helper.h"
Jon Ashburnd9564002015-05-07 10:27:37 -060055
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060056static void initParamChecker(void)
57{
58
59 const char *strOpt;
60 // initialize ParamChecker options
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060061 getLayerOptionEnum("ParamCheckerReportLevel", (uint32_t *) &g_reportFlags);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060062 g_actionIsDefault = getLayerOptionEnum("ParamCheckerDebugAction", (uint32_t *) &g_debugAction);
63
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060064 if (g_debugAction & VK_DBG_LAYER_ACTION_LOG_MSG)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060065 {
66 strOpt = getLayerOption("ParamCheckerLogFilename");
67 if (strOpt)
68 {
69 g_logFile = fopen(strOpt, "w");
70 }
71 if (g_logFile == NULL)
72 g_logFile = stdout;
73 }
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060074}
75
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060076void PreCreateInstance(const VkApplicationInfo* pAppInfo, const VkAllocCallbacks* pAllocCb)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060077{
78 if(pAppInfo == nullptr)
79 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060080 char const str[] = "vkCreateInstance parameter, VkApplicationInfo* pAppInfo, is "\
Mike Stroyan0ae32252015-04-06 15:24:46 -060081 "nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060082 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060083 return;
84 }
85
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060086 if(pAppInfo->sType != VK_STRUCTURE_TYPE_APPLICATION_INFO)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060087 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060088 char const str[] = "vkCreateInstance parameter, VK_STRUCTURE_TYPE_APPLICATION_INFO "\
89 "pAppInfo->sType, is not VK_STRUCTURE_TYPE_APPLICATION_INFO (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060090 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060091 return;
92 }
93
94 // TODO: What else can validated in pAppInfo?
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060095 // TODO: VK_API_VERSION validation.
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060096
97 // It's okay if pAllocCb is a nullptr.
98 if(pAllocCb != nullptr)
99 {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600100 if(!vk_validate_vkalloccallbacks(pAllocCb))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600101 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600102 char const str[] = "vkCreateInstance parameter, VkAllocCallbacks* pAllocCb, "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600103 "contains an invalid value (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600104 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600105 return;
106 }
107 }
108}
109
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600110void PostCreateInstance(VkResult result, const VkInstanceCreateInfo *pCreateInfo, VkInstance* pInstance)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600111{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600112 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600113 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600114 // TODO: Spit out VkResult value.
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600115 char const str[] = "vkCreateInstance failed (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600116 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600117 return;
118 }
119
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600120 enable_debug_report(pCreateInfo->extensionCount, pCreateInfo->pEnabledExtensions);
121
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600122 if(pInstance == nullptr)
123 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600124 char const str[] = "vkCreateInstance parameter, VkInstance* pInstance, is nullptr "\
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600125 "(postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600126 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600127 return;
128 }
Courtney Goeltzenleuchterf4a2eba2015-06-08 14:58:39 -0600129
130 VkLayerInstanceDispatchTable *pTable = instance_dispatch_table(*pInstance);
131 debug_report_init_instance_extension_dispatch_table(
132 pTable,
133 pTable->GetInstanceProcAddr,
134 *pInstance);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600135}
136
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600137VK_LAYER_EXPORT VkResult VKAPI vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, VkInstance* pInstance)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600138{
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600139 loader_platform_thread_once(&initOnce, initParamChecker);
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600140
Jon Ashburn29669a42015-04-04 14:52:07 -0600141 PreCreateInstance(pCreateInfo->pAppInfo, pCreateInfo->pAllocCb);
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500142 VkResult result = instance_dispatch_table(*pInstance)->CreateInstance(pCreateInfo, pInstance);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600143 PostCreateInstance(result, pCreateInfo, pInstance);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600144 return result;
145}
146
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600147VK_LAYER_EXPORT VkResult VKAPI vkDestroyInstance(VkInstance instance)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600148{
Courtney Goeltzenleuchter9f171942015-06-13 21:22:12 -0600149 dispatch_key key = get_dispatch_key(instance);
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500150 VkResult res = instance_dispatch_table(instance)->DestroyInstance(instance);
Courtney Goeltzenleuchter9f171942015-06-13 21:22:12 -0600151 destroy_instance_dispatch_table(key);
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500152 return res;
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600153}
154
Tony Barbour8205d902015-04-16 15:59:00 -0600155VK_LAYER_EXPORT VkResult VKAPI vkGetPhysicalDeviceInfo(VkPhysicalDevice gpu, VkPhysicalDeviceInfoType infoType, size_t* pDataSize, void* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600156{
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600157 char str[1024];
Tony Barbour8205d902015-04-16 15:59:00 -0600158 if (!validate_VkPhysicalDeviceInfoType(infoType)) {
159 sprintf(str, "Parameter infoType to function GetPhysicalDeviceInfo has invalid value of %i.", (int)infoType);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600160 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600161 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500162 VkResult result = instance_dispatch_table(gpu)->GetPhysicalDeviceInfo(gpu, infoType, pDataSize, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600163 return result;
164}
165
Tony Barbour8205d902015-04-16 15:59:00 -0600166void PreCreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo* pCreateInfo)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600167{
168 if(gpu == nullptr)
169 {
Tony Barbour8205d902015-04-16 15:59:00 -0600170 char const str[] = "vkCreateDevice parameter, VkPhysicalDevice gpu, is nullptr "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600171 "(precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600172 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600173 return;
174 }
175
176 if(pCreateInfo == nullptr)
177 {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600178 char const str[] = "vkCreateDevice parameter, VkDeviceCreateInfo* pCreateInfo, is "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600179 "nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600180 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600181 return;
182 }
183
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600184 if(pCreateInfo->sType != VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600185 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600186 char const str[] = "vkCreateDevice parameter, VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO "\
187 "pCreateInfo->sType, is not VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600188 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600189 return;
190 }
191
192 if(pCreateInfo->queueRecordCount == 0)
193 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600194 char const str[] = "vkCreateDevice parameter, uint32_t pCreateInfo->queueRecordCount, is "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600195 "zero (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600196 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600197 return;
198 }
199
200 if(pCreateInfo->pRequestedQueues == nullptr)
201 {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600202 char const str[] = "vkCreateDevice parameter, VkDeviceQueueCreateInfo* pCreateInfo->pRequestedQueues, is "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600203 "nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600204 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600205 return;
206 }
207
208 for(uint32_t i = 0; i < pCreateInfo->queueRecordCount; ++i)
209 {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600210 if(!vk_validate_vkdevicequeuecreateinfo(&(pCreateInfo->pRequestedQueues[i])))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600211 {
212 std::stringstream ss;
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600213 ss << "vkCreateDevice parameter, VkDeviceQueueCreateInfo pCreateInfo->pRequestedQueues[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600214 "], is invalid (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600215 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600216 continue;
217 }
218 }
219
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600220}
221
Jon Ashburnf0615e22015-05-25 14:11:37 -0600222static void createDeviceRegisterExtensions(const VkDeviceCreateInfo* pCreateInfo, VkDevice device)
223{
224 uint32_t i, ext_idx;
Jon Ashburn6f8cd632015-06-01 09:37:38 -0600225 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) device;
226 deviceExtMap[pDisp].debug_marker_enabled = false;
Jon Ashburnf0615e22015-05-25 14:11:37 -0600227 for (i = 0; i < pCreateInfo->extensionCount; i++) {
228 if (strcmp(pCreateInfo->pEnabledExtensions[i].name, DEBUG_MARKER_EXTENSION_NAME) == 0) {
Jon Ashburn6f8cd632015-06-01 09:37:38 -0600229 /* Found a matching extension name, mark it enabled and init dispatch table*/
230 initDebugMarkerTable(device);
231 deviceExtMap[pDisp].debug_marker_enabled = true;
232
Jon Ashburnf0615e22015-05-25 14:11:37 -0600233 }
234
235 }
236}
237
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600238void PostCreateDevice(VkResult result, const VkDeviceCreateInfo *pCreateInfo, VkDevice* pDevice)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600239{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600240 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600241 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600242 // TODO: Spit out VkResult value.
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600243 char const str[] = "vkCreateDevice failed (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600244 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600245 return;
246 }
247
248 if(pDevice == nullptr)
249 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600250 char const str[] = "vkCreateDevice parameter, VkDevice* pDevice, is nullptr (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600251 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600252 return;
253 }
Jon Ashburn6f8cd632015-06-01 09:37:38 -0600254 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) *pDevice;
255 enable_debug_report(pCreateInfo->extensionCount, pCreateInfo->pEnabledExtensions);
256 createDeviceRegisterExtensions(pCreateInfo, *pDevice);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600257}
258
Tony Barbour8205d902015-04-16 15:59:00 -0600259VK_LAYER_EXPORT VkResult VKAPI vkCreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo* pCreateInfo, VkDevice* pDevice)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600260{
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600261 PreCreateDevice(gpu, pCreateInfo);
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500262 VkResult result = instance_dispatch_table(gpu)->CreateDevice(gpu, pCreateInfo, pDevice);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600263 PostCreateDevice(result, pCreateInfo, pDevice);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600264 return result;
265}
266
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600267VK_LAYER_EXPORT VkResult VKAPI vkDestroyDevice(VkDevice device)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600268{
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500269 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) device;
Courtney Goeltzenleuchter9f171942015-06-13 21:22:12 -0600270 dispatch_key key = get_dispatch_key(device);
Jon Ashburn5a10d212015-06-01 10:02:09 -0600271 VkResult result = device_dispatch_table(device)->DestroyDevice(device);
Courtney Goeltzenleuchter9f171942015-06-13 21:22:12 -0600272 destroy_device_dispatch_table(key);
Jon Ashburn6f8cd632015-06-01 09:37:38 -0600273 tableDebugMarkerMap.erase(pDisp);
274 deviceExtMap.erase(pDisp);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600275 return result;
276}
277
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600278#define PARAM_CHECKER_LAYER_EXT_ARRAY_SIZE 2
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600279static const VkExtensionProperties pcExts[PARAM_CHECKER_LAYER_EXT_ARRAY_SIZE] = {
280 {
281 VK_STRUCTURE_TYPE_EXTENSION_PROPERTIES,
282 "ParamChecker",
283 0x10,
284 "Sample layer: ParamChecker",
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600285 },
286 {
287 VK_STRUCTURE_TYPE_EXTENSION_PROPERTIES,
288 "Validation",
289 0x10,
290 "Sample layer: ParamChecker",
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600291 }
Jon Ashburneb2728b2015-04-10 14:33:07 -0600292};
293
294VK_LAYER_EXPORT VkResult VKAPI vkGetGlobalExtensionInfo(
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600295 VkExtensionInfoType infoType,
296 uint32_t extensionIndex,
297 size_t* pDataSize,
298 void* pData)
Jon Ashburneb2728b2015-04-10 14:33:07 -0600299{
Jon Ashburneb2728b2015-04-10 14:33:07 -0600300 /* This entrypoint is NOT going to init it's own dispatch table since loader calls here early */
Jon Ashburneb2728b2015-04-10 14:33:07 -0600301 uint32_t *count;
302
303 if (pDataSize == NULL)
304 return VK_ERROR_INVALID_POINTER;
305
306 switch (infoType) {
307 case VK_EXTENSION_INFO_TYPE_COUNT:
308 *pDataSize = sizeof(uint32_t);
309 if (pData == NULL)
310 return VK_SUCCESS;
311 count = (uint32_t *) pData;
312 *count = PARAM_CHECKER_LAYER_EXT_ARRAY_SIZE;
313 break;
314 case VK_EXTENSION_INFO_TYPE_PROPERTIES:
315 *pDataSize = sizeof(VkExtensionProperties);
316 if (pData == NULL)
317 return VK_SUCCESS;
318 if (extensionIndex >= PARAM_CHECKER_LAYER_EXT_ARRAY_SIZE)
319 return VK_ERROR_INVALID_VALUE;
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600320 memcpy((VkExtensionProperties *) pData, &pcExts[extensionIndex], sizeof(VkExtensionProperties));
Jon Ashburneb2728b2015-04-10 14:33:07 -0600321 break;
322 default:
323 return VK_ERROR_INVALID_VALUE;
324 };
325
326 return VK_SUCCESS;
327}
328
Jon Ashburn0b2ec1d2015-06-15 16:08:39 -0600329#define PARAM_CHECKER_LAYER_DEV_EXT_ARRAY_SIZE 3
330static const VkExtensionProperties pcDevExts[PARAM_CHECKER_LAYER_DEV_EXT_ARRAY_SIZE] = {
331 {
332 VK_STRUCTURE_TYPE_EXTENSION_PROPERTIES,
333 "ParamChecker",
334 0x10,
335 "Sample layer: ParamChecker",
336 },
337 {
338 VK_STRUCTURE_TYPE_EXTENSION_PROPERTIES,
339 "Validation",
340 0x10,
341 "Sample layer: ParamChecker",
342 },
343 {
344 VK_STRUCTURE_TYPE_EXTENSION_PROPERTIES,
345 DEBUG_MARKER_EXTENSION_NAME,
346 0x10,
347 "Sample layer: ParamChecker",
348 }
349};
Jeremy Hayescf469132015-04-17 10:36:53 -0600350VK_LAYER_EXPORT VkResult VKAPI vkGetPhysicalDeviceExtensionInfo(
351 VkPhysicalDevice gpu,
352 VkExtensionInfoType infoType,
353 uint32_t extensionIndex,
354 size_t* pDataSize,
355 void* pData)
356{
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600357 /* This entrypoint is NOT going to init it's own dispatch table since loader calls here early */
358 uint32_t *count;
359
360 if (pDataSize == NULL)
361 return VK_ERROR_INVALID_POINTER;
362
363 switch (infoType) {
364 case VK_EXTENSION_INFO_TYPE_COUNT:
365 *pDataSize = sizeof(uint32_t);
366 if (pData == NULL)
367 return VK_SUCCESS;
368 count = (uint32_t *) pData;
Jon Ashburn0b2ec1d2015-06-15 16:08:39 -0600369 *count = PARAM_CHECKER_LAYER_DEV_EXT_ARRAY_SIZE;
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600370 break;
371 case VK_EXTENSION_INFO_TYPE_PROPERTIES:
372 *pDataSize = sizeof(VkExtensionProperties);
373 if (pData == NULL)
374 return VK_SUCCESS;
Jon Ashburn0b2ec1d2015-06-15 16:08:39 -0600375 if (extensionIndex >= PARAM_CHECKER_LAYER_DEV_EXT_ARRAY_SIZE)
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600376 return VK_ERROR_INVALID_VALUE;
Jon Ashburn0b2ec1d2015-06-15 16:08:39 -0600377 memcpy((VkExtensionProperties *) pData, &pcDevExts[extensionIndex], sizeof(VkExtensionProperties));
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600378 break;
379 default:
380 return VK_ERROR_INVALID_VALUE;
381 };
382
383 return VK_SUCCESS;
Jeremy Hayescf469132015-04-17 10:36:53 -0600384}
385
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600386VK_LAYER_EXPORT VkResult VKAPI vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex, VkQueue* pQueue)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600387{
388
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500389 VkResult result = device_dispatch_table(device)->GetDeviceQueue(device, queueNodeIndex, queueIndex, pQueue);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600390 return result;
391}
392
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600393VK_LAYER_EXPORT VkResult VKAPI vkQueueSubmit(VkQueue queue, uint32_t cmdBufferCount, const VkCmdBuffer* pCmdBuffers, VkFence fence)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600394{
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500395 VkResult result = device_dispatch_table(queue)->QueueSubmit(queue, cmdBufferCount, pCmdBuffers, fence);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600396 return result;
397}
398
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600399VK_LAYER_EXPORT VkResult VKAPI vkQueueWaitIdle(VkQueue queue)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600400{
401
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500402 VkResult result = device_dispatch_table(queue)->QueueWaitIdle(queue);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600403 return result;
404}
405
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600406VK_LAYER_EXPORT VkResult VKAPI vkDeviceWaitIdle(VkDevice device)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600407{
408
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500409 VkResult result = device_dispatch_table(device)->DeviceWaitIdle(device);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600410 return result;
411}
412
Tony Barbour8205d902015-04-16 15:59:00 -0600413VK_LAYER_EXPORT VkResult VKAPI vkAllocMemory(VkDevice device, const VkMemoryAllocInfo* pAllocInfo, VkDeviceMemory* pMem)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600414{
415 char str[1024];
416 if (!pAllocInfo) {
417 sprintf(str, "Struct ptr parameter pAllocInfo to function AllocMemory is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600418 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600419 } else if (!vk_validate_vkmemoryallocinfo(pAllocInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600420 sprintf(str, "Parameter pAllocInfo to function AllocMemory contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600421 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600422 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500423 VkResult result = device_dispatch_table(device)->AllocMemory(device, pAllocInfo, pMem);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600424 return result;
425}
426
Mike Stroyan230e6252015-04-17 12:36:38 -0600427VK_LAYER_EXPORT VkResult VKAPI vkFreeMemory(VkDevice device, VkDeviceMemory mem)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600428{
429
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500430 VkResult result = device_dispatch_table(device)->FreeMemory(device, mem);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600431 return result;
432}
433
Mike Stroyan230e6252015-04-17 12:36:38 -0600434VK_LAYER_EXPORT VkResult VKAPI vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset, VkDeviceSize size, VkFlags flags, void** ppData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600435{
436
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500437 VkResult result = device_dispatch_table(device)->MapMemory(device, mem, offset, size, flags, ppData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600438 return result;
439}
440
Mike Stroyan230e6252015-04-17 12:36:38 -0600441VK_LAYER_EXPORT VkResult VKAPI vkUnmapMemory(VkDevice device, VkDeviceMemory mem)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600442{
443
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500444 VkResult result = device_dispatch_table(device)->UnmapMemory(device, mem);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600445 return result;
446}
447
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -0600448VK_LAYER_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
449 VkDevice device,
450 uint32_t memRangeCount,
451 const VkMappedMemoryRange* pMemRanges)
Tony Barbour859ceab2015-04-16 19:23:13 -0600452{
453
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500454 VkResult result = device_dispatch_table(device)->FlushMappedMemoryRanges(device, memRangeCount, pMemRanges);
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -0600455 return result;
456}
457
458VK_LAYER_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
459 VkDevice device,
460 uint32_t memRangeCount,
461 const VkMappedMemoryRange* pMemRanges)
462{
463
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500464 VkResult result = device_dispatch_table(device)->InvalidateMappedMemoryRanges(device, memRangeCount, pMemRanges);
Tony Barbour859ceab2015-04-16 19:23:13 -0600465 return result;
466}
467
Tony Barbour8205d902015-04-16 15:59:00 -0600468VK_LAYER_EXPORT VkResult VKAPI vkGetMultiDeviceCompatibility(VkPhysicalDevice gpu0, VkPhysicalDevice gpu1, VkPhysicalDeviceCompatibilityInfo* pInfo)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600469{
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600470
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500471 VkResult result = instance_dispatch_table(gpu0)->GetMultiDeviceCompatibility(gpu0, gpu1, pInfo);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600472 return result;
473}
474
Tony Barbour8205d902015-04-16 15:59:00 -0600475VK_LAYER_EXPORT VkResult VKAPI vkOpenSharedMemory(VkDevice device, const VkMemoryOpenInfo* pOpenInfo, VkDeviceMemory* pMem)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600476{
477 char str[1024];
478 if (!pOpenInfo) {
479 sprintf(str, "Struct ptr parameter pOpenInfo to function OpenSharedMemory is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600480 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600481 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600482 else if (!vk_validate_vkmemoryopeninfo(pOpenInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600483 sprintf(str, "Parameter pOpenInfo to function OpenSharedMemory contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600484 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600485 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500486 VkResult result = device_dispatch_table(device)->OpenSharedMemory(device, pOpenInfo, pMem);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600487 return result;
488}
489
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600490VK_LAYER_EXPORT VkResult VKAPI vkOpenSharedSemaphore(VkDevice device, const VkSemaphoreOpenInfo* pOpenInfo, VkSemaphore* pSemaphore)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600491{
492 char str[1024];
493 if (!pOpenInfo) {
494 sprintf(str, "Struct ptr parameter pOpenInfo to function OpenSharedSemaphore is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600495 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600496 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600497 else if (!vk_validate_vksemaphoreopeninfo(pOpenInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600498 sprintf(str, "Parameter pOpenInfo to function OpenSharedSemaphore contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600499 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600500 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500501 VkResult result = device_dispatch_table(device)->OpenSharedSemaphore(device, pOpenInfo, pSemaphore);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600502 return result;
503}
504
Tony Barbour8205d902015-04-16 15:59:00 -0600505VK_LAYER_EXPORT VkResult VKAPI vkOpenPeerMemory(VkDevice device, const VkPeerMemoryOpenInfo* pOpenInfo, VkDeviceMemory* pMem)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600506{
507 char str[1024];
508 if (!pOpenInfo) {
509 sprintf(str, "Struct ptr parameter pOpenInfo to function OpenPeerMemory is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600510 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600511 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600512 else if (!vk_validate_vkpeermemoryopeninfo(pOpenInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600513 sprintf(str, "Parameter pOpenInfo to function OpenPeerMemory contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600514 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600515 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500516 VkResult result = device_dispatch_table(device)->OpenPeerMemory(device, pOpenInfo, pMem);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600517 return result;
518}
519
Tony Barbour8205d902015-04-16 15:59:00 -0600520VK_LAYER_EXPORT VkResult VKAPI vkOpenPeerImage(VkDevice device, const VkPeerImageOpenInfo* pOpenInfo, VkImage* pImage, VkDeviceMemory* pMem)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600521{
522 char str[1024];
523 if (!pOpenInfo) {
524 sprintf(str, "Struct ptr parameter pOpenInfo to function OpenPeerImage is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600525 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600526 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600527 else if (!vk_validate_vkpeerimageopeninfo(pOpenInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600528 sprintf(str, "Parameter pOpenInfo to function OpenPeerImage contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600529 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600530 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500531 VkResult result = device_dispatch_table(device)->OpenPeerImage(device, pOpenInfo, pImage, pMem);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600532 return result;
533}
534
Mike Stroyan230e6252015-04-17 12:36:38 -0600535VK_LAYER_EXPORT VkResult VKAPI vkDestroyObject(VkDevice device, VkObjectType objType, VkObject object)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600536{
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500537 VkResult result = device_dispatch_table(device)->DestroyObject(device, objType, object);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600538 return result;
539}
540
Mike Stroyan230e6252015-04-17 12:36:38 -0600541VK_LAYER_EXPORT VkResult VKAPI vkGetObjectInfo(VkDevice device, VkObjectType objType, VkObject object, VkObjectInfoType infoType, size_t* pDataSize, void* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600542{
543 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600544 if (!validate_VkObjectInfoType(infoType)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600545 sprintf(str, "Parameter infoType to function GetObjectInfo has invalid value of %i.", (int)infoType);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600546 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600547 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500548 VkResult result = device_dispatch_table(device)->GetObjectInfo(device, objType, object, infoType, pDataSize, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600549 return result;
550}
551
Mark Lobodzinski23182612015-05-29 09:32:35 -0500552VK_LAYER_EXPORT VkResult VKAPI vkBindObjectMemory(VkDevice device, VkObjectType objType, VkObject object, VkDeviceMemory mem, VkDeviceSize offset)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600553{
554
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500555 VkResult result = device_dispatch_table(device)->BindObjectMemory(device, objType, object, mem, offset);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600556 return result;
557}
558
Mark Lobodzinski23182612015-05-29 09:32:35 -0500559VK_LAYER_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(VkQueue queue, VkBuffer buffer, VkDeviceSize rangeOffset, VkDeviceSize rangeSize, VkDeviceMemory mem, VkDeviceSize memOffset)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600560{
561
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500562 VkResult result = device_dispatch_table(queue)->QueueBindSparseBufferMemory(queue, buffer, rangeOffset, rangeSize, mem, memOffset);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600563 return result;
564}
565
Mark Lobodzinski23182612015-05-29 09:32:35 -0500566VK_LAYER_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(VkQueue queue, VkImage image, const VkImageMemoryBindInfo* pBindInfo, VkDeviceMemory mem, VkDeviceSize memOffset)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600567{
568 char str[1024];
Jeremy Hayes47536532015-04-15 15:20:03 -0600569 if (!pBindInfo) {
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -0500570 sprintf(str, "Struct ptr parameter pBindInfo to function QueueBindSparseImageMemory is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600571 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600572 }
Jeremy Hayes47536532015-04-15 15:20:03 -0600573 else if (!vk_validate_vkimagememorybindinfo(pBindInfo)) {
574 sprintf(str, "Parameter pBindInfo to function BindImageMemoryRange contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600575 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600576 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500577 VkResult result = device_dispatch_table(queue)->QueueBindSparseImageMemory(queue, image, pBindInfo, mem, memOffset);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600578 return result;
579}
580
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600581VK_LAYER_EXPORT VkResult VKAPI vkCreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, VkFence* pFence)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600582{
583 char str[1024];
584 if (!pCreateInfo) {
585 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateFence is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600586 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600587 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600588 else if (!vk_validate_vkfencecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600589 sprintf(str, "Parameter pCreateInfo to function CreateFence contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600590 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600591 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500592 VkResult result = device_dispatch_table(device)->CreateFence(device, pCreateInfo, pFence);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600593 return result;
594}
595
Mike Stroyan230e6252015-04-17 12:36:38 -0600596VK_LAYER_EXPORT VkResult VKAPI vkGetFenceStatus(VkDevice device, VkFence fence)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600597{
598
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500599 VkResult result = device_dispatch_table(device)->GetFenceStatus(device, fence);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600600 return result;
601}
602
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600603VK_LAYER_EXPORT VkResult VKAPI vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, bool32_t waitAll, uint64_t timeout)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600604{
605
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500606 VkResult result = device_dispatch_table(device)->WaitForFences(device, fenceCount, pFences, waitAll, timeout);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600607 return result;
608}
609
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600610VK_LAYER_EXPORT VkResult VKAPI vkResetFences(VkDevice device, uint32_t fenceCount, VkFence* pFences)
Mark Lobodzinskiebe814d2015-04-07 16:07:57 -0500611{
612
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500613 VkResult result = device_dispatch_table(device)->ResetFences(device, fenceCount, pFences);
Mark Lobodzinskiebe814d2015-04-07 16:07:57 -0500614 return result;
615}
616
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600617VK_LAYER_EXPORT VkResult VKAPI vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, VkSemaphore* pSemaphore)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600618{
619 char str[1024];
620 if (!pCreateInfo) {
621 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateSemaphore is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600622 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600623 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600624 else if (!vk_validate_vksemaphorecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600625 sprintf(str, "Parameter pCreateInfo to function CreateSemaphore contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600626 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600627 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500628 VkResult result = device_dispatch_table(device)->CreateSemaphore(device, pCreateInfo, pSemaphore);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600629 return result;
630}
631
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600632VK_LAYER_EXPORT VkResult VKAPI vkQueueSignalSemaphore(VkQueue queue, VkSemaphore semaphore)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600633{
634
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500635 VkResult result = device_dispatch_table(queue)->QueueSignalSemaphore(queue, semaphore);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600636 return result;
637}
638
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600639VK_LAYER_EXPORT VkResult VKAPI vkQueueWaitSemaphore(VkQueue queue, VkSemaphore semaphore)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600640{
641
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500642 VkResult result = device_dispatch_table(queue)->QueueWaitSemaphore(queue, semaphore);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600643 return result;
644}
645
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600646VK_LAYER_EXPORT VkResult VKAPI vkCreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, VkEvent* pEvent)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600647{
648 char str[1024];
649 if (!pCreateInfo) {
650 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateEvent is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600651 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600652 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600653 else if (!vk_validate_vkeventcreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600654 sprintf(str, "Parameter pCreateInfo to function CreateEvent contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600655 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600656 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500657 VkResult result = device_dispatch_table(device)->CreateEvent(device, pCreateInfo, pEvent);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600658 return result;
659}
660
Mike Stroyan230e6252015-04-17 12:36:38 -0600661VK_LAYER_EXPORT VkResult VKAPI vkGetEventStatus(VkDevice device, VkEvent event)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600662{
663
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500664 VkResult result = device_dispatch_table(device)->GetEventStatus(device, event);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600665 return result;
666}
667
Mike Stroyan230e6252015-04-17 12:36:38 -0600668VK_LAYER_EXPORT VkResult VKAPI vkSetEvent(VkDevice device, VkEvent event)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600669{
670
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500671 VkResult result = device_dispatch_table(device)->SetEvent(device, event);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600672 return result;
673}
674
Mike Stroyan230e6252015-04-17 12:36:38 -0600675VK_LAYER_EXPORT VkResult VKAPI vkResetEvent(VkDevice device, VkEvent event)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600676{
677
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500678 VkResult result = device_dispatch_table(device)->ResetEvent(device, event);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600679 return result;
680}
681
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600682VK_LAYER_EXPORT VkResult VKAPI vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, VkQueryPool* pQueryPool)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600683{
684 char str[1024];
685 if (!pCreateInfo) {
686 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateQueryPool is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600687 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600688 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600689 else if (!vk_validate_vkquerypoolcreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600690 sprintf(str, "Parameter pCreateInfo to function CreateQueryPool contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600691 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600692 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500693 VkResult result = device_dispatch_table(device)->CreateQueryPool(device, pCreateInfo, pQueryPool);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600694 return result;
695}
696
Mike Stroyan230e6252015-04-17 12:36:38 -0600697VK_LAYER_EXPORT VkResult VKAPI vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, size_t* pDataSize, void* pData, VkQueryResultFlags flags)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600698{
699
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500700 VkResult result = device_dispatch_table(device)->GetQueryPoolResults(device, queryPool, startQuery, queryCount, pDataSize, pData, flags);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600701 return result;
702}
703
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600704VK_LAYER_EXPORT VkResult VKAPI vkGetFormatInfo(VkDevice device, VkFormat format, VkFormatInfoType infoType, size_t* pDataSize, void* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600705{
706 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -0600707 if (!validate_VkFormat(format)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600708 sprintf(str, "Parameter format to function GetFormatInfo has invalid value of %i.", (int)format);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600709 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600710 }
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -0600711 if (!validate_VkFormatInfoType(infoType)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600712 sprintf(str, "Parameter infoType to function GetFormatInfo has invalid value of %i.", (int)infoType);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600713 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600714 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500715 VkResult result = device_dispatch_table(device)->GetFormatInfo(device, format, infoType, pDataSize, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600716 return result;
717}
718
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600719VK_LAYER_EXPORT VkResult VKAPI vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, VkBuffer* pBuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600720{
721 char str[1024];
722 if (!pCreateInfo) {
723 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateBuffer is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600724 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600725 }
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600726 else if (!vk_validate_vkbuffercreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600727 sprintf(str, "Parameter pCreateInfo to function CreateBuffer contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600728 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600729 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500730 VkResult result = device_dispatch_table(device)->CreateBuffer(device, pCreateInfo, pBuffer);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600731 return result;
732}
733
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600734VK_LAYER_EXPORT VkResult VKAPI vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, VkBufferView* pView)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600735{
736 char str[1024];
737 if (!pCreateInfo) {
738 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateBufferView is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600739 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600740 }
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600741 else if (!vk_validate_vkbufferviewcreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600742 sprintf(str, "Parameter pCreateInfo to function CreateBufferView contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600743 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600744 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500745 VkResult result = device_dispatch_table(device)->CreateBufferView(device, pCreateInfo, pView);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600746 return result;
747}
748
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600749void PreCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600750{
751 if(pCreateInfo == nullptr)
752 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600753 char const str[] = "vkCreateImage parameter, VkImageCreateInfo* pCreateInfo, is "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600754 "nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600755 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600756 return;
757 }
758
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600759 if(pCreateInfo->sType != VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600760 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600761 char const str[] = "vkCreateImage parameter, VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO "\
762 "pCreateInfo->sType, is not VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600763 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600764 return;
765 }
766
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600767 if (!validate_VkImageType(pCreateInfo->imageType))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600768 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600769 char const str[] = "vkCreateImage parameter, VkImageType pCreateInfo->imageType, is "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600770 "unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600771 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600772 return;
773 }
774
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -0600775 if (!validate_VkFormat(pCreateInfo->format))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600776 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600777 char const str[] = "vkCreateImage parameter, VkFormat pCreateInfo->format, is "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600778 "unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600779 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600780 return;
781 }
782
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600783 VkFormatProperties properties;
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600784 size_t size = sizeof(properties);
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500785 VkResult result = device_dispatch_table(device)->GetFormatInfo(device, pCreateInfo->format,
Tony Barbour8205d902015-04-16 15:59:00 -0600786 VK_FORMAT_INFO_TYPE_PROPERTIES, &size, &properties);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600787 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600788 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600789 char const str[] = "vkCreateImage parameter, VkFormat pCreateInfo->format, cannot be "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600790 "validated (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600791 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600792 return;
793 }
794
795 if((properties.linearTilingFeatures) == 0 && (properties.optimalTilingFeatures == 0))
796 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600797 char const str[] = "vkCreateImage parameter, VkFormat pCreateInfo->format, contains "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600798 "unsupported format (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600799 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600800 return;
801 }
802
803 // TODO: Can we check device-specific limits?
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600804 if (!vk_validate_vkextent3d(&pCreateInfo->extent))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600805 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600806 char const str[] = "vkCreateImage parameter, VkExtent3D pCreateInfo->extent, is invalid "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600807 "(precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600808 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600809 return;
810 }
811
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600812 if (!validate_VkImageTiling(pCreateInfo->tiling))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600813 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600814 char const str[] = "vkCreateImage parameter, VkImageTiling pCreateInfo->tiling, is "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600815 "unrecoginized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600816 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600817 return;
818 }
819}
820
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600821void PostCreateImage(VkResult result, VkImage* pImage)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600822{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600823 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600824 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600825 // TODO: Spit out VkResult value.
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600826 char const str[] = "vkCreateImage failed (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600827 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600828 return;
829 }
830
831 if(pImage == nullptr)
832 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600833 char const str[] = "vkCreateImage parameter, VkImage* pImage, is nullptr (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600834 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600835 return;
836 }
837}
838
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600839VK_LAYER_EXPORT VkResult VKAPI vkCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, VkImage* pImage)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600840{
841 PreCreateImage(device, pCreateInfo);
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500842 VkResult result = device_dispatch_table(device)->CreateImage(device, pCreateInfo, pImage);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600843 PostCreateImage(result, pImage);
844 return result;
845}
846
Mike Stroyan230e6252015-04-17 12:36:38 -0600847VK_LAYER_EXPORT VkResult VKAPI vkGetImageSubresourceInfo(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceInfoType infoType, size_t* pDataSize, void* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600848{
849 char str[1024];
850 if (!pSubresource) {
851 sprintf(str, "Struct ptr parameter pSubresource to function GetImageSubresourceInfo is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600852 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -0600853 } else if (!vk_validate_vkimagesubresource(pSubresource)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600854 sprintf(str, "Parameter pSubresource to function GetImageSubresourceInfo contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600855 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600856 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600857 if (!validate_VkSubresourceInfoType(infoType)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600858 sprintf(str, "Parameter infoType to function GetImageSubresourceInfo has invalid value of %i.", (int)infoType);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600859 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600860 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500861 VkResult result = device_dispatch_table(device)->GetImageSubresourceInfo(device, image, pSubresource, infoType, pDataSize, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600862 return result;
863}
864
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600865VK_LAYER_EXPORT VkResult VKAPI vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, VkImageView* pView)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600866{
867 char str[1024];
868 if (!pCreateInfo) {
869 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateImageView is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600870 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600871 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600872 else if (!vk_validate_vkimageviewcreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600873 sprintf(str, "Parameter pCreateInfo to function CreateImageView contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600874 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600875 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500876 VkResult result = device_dispatch_table(device)->CreateImageView(device, pCreateInfo, pView);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600877 return result;
878}
879
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600880VK_LAYER_EXPORT VkResult VKAPI vkCreateColorAttachmentView(VkDevice device, const VkColorAttachmentViewCreateInfo* pCreateInfo, VkColorAttachmentView* pView)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600881{
882 char str[1024];
883 if (!pCreateInfo) {
884 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateColorAttachmentView is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600885 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600886 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600887 else if (!vk_validate_vkcolorattachmentviewcreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600888 sprintf(str, "Parameter pCreateInfo to function CreateColorAttachmentView contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600889 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600890 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500891 VkResult result = device_dispatch_table(device)->CreateColorAttachmentView(device, pCreateInfo, pView);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600892 return result;
893}
894
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600895VK_LAYER_EXPORT VkResult VKAPI vkCreateDepthStencilView(VkDevice device, const VkDepthStencilViewCreateInfo* pCreateInfo, VkDepthStencilView* pView)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600896{
897 char str[1024];
898 if (!pCreateInfo) {
899 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDepthStencilView is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600900 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600901 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600902 else if (!vk_validate_vkdepthstencilviewcreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600903 sprintf(str, "Parameter pCreateInfo to function CreateDepthStencilView contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600904 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600905 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500906 VkResult result = device_dispatch_table(device)->CreateDepthStencilView(device, pCreateInfo, pView);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600907 return result;
908}
909
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600910VK_LAYER_EXPORT VkResult VKAPI vkCreateShader(VkDevice device, const VkShaderCreateInfo* pCreateInfo, VkShader* pShader)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600911{
912 char str[1024];
913 if (!pCreateInfo) {
914 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateShader is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600915 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600916 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600917 else if (!vk_validate_vkshadercreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600918 sprintf(str, "Parameter pCreateInfo to function CreateShader contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600919 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600920 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500921 VkResult result = device_dispatch_table(device)->CreateShader(device, pCreateInfo, pShader);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600922 return result;
923}
924
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600925VK_LAYER_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(VkDevice device, const VkGraphicsPipelineCreateInfo* pCreateInfo, VkPipeline* pPipeline)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600926{
927 char str[1024];
928 if (!pCreateInfo) {
929 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateGraphicsPipeline is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600930 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600931 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600932 else if (!vk_validate_vkgraphicspipelinecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600933 sprintf(str, "Parameter pCreateInfo to function CreateGraphicsPipeline contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600934 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600935 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500936 VkResult result = device_dispatch_table(device)->CreateGraphicsPipeline(device, pCreateInfo, pPipeline);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600937 return result;
938}
939
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600940VK_LAYER_EXPORT VkResult VKAPI vkCreateGraphicsPipelineDerivative(VkDevice device, const VkGraphicsPipelineCreateInfo* pCreateInfo, VkPipeline basePipeline, VkPipeline* pPipeline)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600941{
942 char str[1024];
943 if (!pCreateInfo) {
944 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateGraphicsPipelineDerivative is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600945 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600946 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600947 else if (!vk_validate_vkgraphicspipelinecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600948 sprintf(str, "Parameter pCreateInfo to function CreateGraphicsPipelineDerivative contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600949 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600950 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500951 VkResult result = device_dispatch_table(device)->CreateGraphicsPipelineDerivative(device, pCreateInfo, basePipeline, pPipeline);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600952 return result;
953}
954
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600955VK_LAYER_EXPORT VkResult VKAPI vkCreateComputePipeline(VkDevice device, const VkComputePipelineCreateInfo* pCreateInfo, VkPipeline* pPipeline)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600956{
957 char str[1024];
958 if (!pCreateInfo) {
959 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateComputePipeline is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600960 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600961 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600962 else if (!vk_validate_vkcomputepipelinecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600963 sprintf(str, "Parameter pCreateInfo to function CreateComputePipeline contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600964 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600965 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500966 VkResult result = device_dispatch_table(device)->CreateComputePipeline(device, pCreateInfo, pPipeline);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600967 return result;
968}
969
Mike Stroyan230e6252015-04-17 12:36:38 -0600970VK_LAYER_EXPORT VkResult VKAPI vkStorePipeline(VkDevice device, VkPipeline pipeline, size_t* pDataSize, void* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600971{
972
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500973 VkResult result = device_dispatch_table(device)->StorePipeline(device, pipeline, pDataSize, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600974 return result;
975}
976
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600977VK_LAYER_EXPORT VkResult VKAPI vkLoadPipeline(VkDevice device, size_t dataSize, const void* pData, VkPipeline* pPipeline)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600978{
979
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500980 VkResult result = device_dispatch_table(device)->LoadPipeline(device, dataSize, pData, pPipeline);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600981 return result;
982}
983
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600984VK_LAYER_EXPORT VkResult VKAPI vkLoadPipelineDerivative(VkDevice device, size_t dataSize, const void* pData, VkPipeline basePipeline, VkPipeline* pPipeline)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600985{
986
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500987 VkResult result = device_dispatch_table(device)->LoadPipelineDerivative(device, dataSize, pData, basePipeline, pPipeline);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600988 return result;
989}
990
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600991VK_LAYER_EXPORT VkResult VKAPI vkCreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, VkSampler* pSampler)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600992{
993 char str[1024];
994 if (!pCreateInfo) {
995 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateSampler is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600996 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600997 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600998 else if (!vk_validate_vksamplercreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600999 sprintf(str, "Parameter pCreateInfo to function CreateSampler contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001000 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001001 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001002 VkResult result = device_dispatch_table(device)->CreateSampler(device, pCreateInfo, pSampler);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001003 return result;
1004}
1005
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001006VK_LAYER_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayout* pSetLayout)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001007{
1008 char str[1024];
1009 if (!pCreateInfo) {
1010 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDescriptorSetLayout is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001011 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001012 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001013 else if (!vk_validate_vkdescriptorsetlayoutcreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001014 sprintf(str, "Parameter pCreateInfo to function CreateDescriptorSetLayout contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001015 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001016 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001017 VkResult result = device_dispatch_table(device)->CreateDescriptorSetLayout(device, pCreateInfo, pSetLayout);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001018 return result;
1019}
1020
Mark Lobodzinski556f7212015-04-17 14:11:39 -05001021VK_LAYER_EXPORT VkResult VKAPI vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, VkPipelineLayout* pPipelineLayout)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001022{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001023 VkResult result = device_dispatch_table(device)->CreatePipelineLayout(device, pCreateInfo, pPipelineLayout);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001024 return result;
1025}
1026
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001027VK_LAYER_EXPORT VkResult VKAPI vkCreateDescriptorPool(VkDevice device, VkDescriptorPoolUsage poolUsage, uint32_t maxSets, const VkDescriptorPoolCreateInfo* pCreateInfo, VkDescriptorPool* pDescriptorPool)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001028{
1029 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001030 if (!validate_VkDescriptorPoolUsage(poolUsage)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001031 sprintf(str, "Parameter poolUsage to function CreateDescriptorPool has invalid value of %i.", (int)poolUsage);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001032 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001033 }
1034 if (!pCreateInfo) {
1035 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDescriptorPool is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001036 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001037 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001038 else if (!vk_validate_vkdescriptorpoolcreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001039 sprintf(str, "Parameter pCreateInfo to function CreateDescriptorPool contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001040 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001041 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001042 VkResult result = device_dispatch_table(device)->CreateDescriptorPool(device, poolUsage, maxSets, pCreateInfo, pDescriptorPool);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001043 return result;
1044}
1045
Mike Stroyan230e6252015-04-17 12:36:38 -06001046VK_LAYER_EXPORT VkResult VKAPI vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001047{
1048
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001049 VkResult result = device_dispatch_table(device)->ResetDescriptorPool(device, descriptorPool);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001050 return result;
1051}
1052
Mike Stroyan230e6252015-04-17 12:36:38 -06001053VK_LAYER_EXPORT VkResult VKAPI vkAllocDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorSetUsage setUsage, uint32_t count, const VkDescriptorSetLayout* pSetLayouts, VkDescriptorSet* pDescriptorSets, uint32_t* pCount)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001054{
1055 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001056 if (!validate_VkDescriptorSetUsage(setUsage)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001057 sprintf(str, "Parameter setUsage to function AllocDescriptorSets has invalid value of %i.", (int)setUsage);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001058 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001059 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001060 VkResult result = device_dispatch_table(device)->AllocDescriptorSets(device, descriptorPool, setUsage, count, pSetLayouts, pDescriptorSets, pCount);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001061 return result;
1062}
1063
Mike Stroyan230e6252015-04-17 12:36:38 -06001064VK_LAYER_EXPORT void VKAPI vkClearDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001065{
1066
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001067 device_dispatch_table(device)->ClearDescriptorSets(device, descriptorPool, count, pDescriptorSets);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001068}
1069
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08001070VK_LAYER_EXPORT VkResult VKAPI vkUpdateDescriptorSets(VkDevice device, uint32_t writeCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t copyCount, const VkCopyDescriptorSet* pDescriptorCopies)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001071{
1072
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001073 return device_dispatch_table(device)->UpdateDescriptorSets(device, writeCount, pDescriptorWrites, copyCount, pDescriptorCopies);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001074}
1075
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001076VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicViewportState(VkDevice device, const VkDynamicVpStateCreateInfo* pCreateInfo, VkDynamicVpState* pState)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001077{
1078 char str[1024];
1079 if (!pCreateInfo) {
1080 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDynamicViewportState is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001081 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001082 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001083 else if (!vk_validate_vkdynamicvpstatecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001084 sprintf(str, "Parameter pCreateInfo to function CreateDynamicViewportState contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001085 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001086 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001087 VkResult result = device_dispatch_table(device)->CreateDynamicViewportState(device, pCreateInfo, pState);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001088 return result;
1089}
1090
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001091VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicRasterState(VkDevice device, const VkDynamicRsStateCreateInfo* pCreateInfo, VkDynamicRsState* pState)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001092{
1093 char str[1024];
1094 if (!pCreateInfo) {
1095 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDynamicRasterState is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001096 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001097 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001098 else if (!vk_validate_vkdynamicrsstatecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001099 sprintf(str, "Parameter pCreateInfo to function CreateDynamicRasterState contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001100 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001101 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001102 VkResult result = device_dispatch_table(device)->CreateDynamicRasterState(device, pCreateInfo, pState);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001103 return result;
1104}
1105
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001106VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(VkDevice device, const VkDynamicCbStateCreateInfo* pCreateInfo, VkDynamicCbState* pState)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001107{
1108 char str[1024];
1109 if (!pCreateInfo) {
1110 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDynamicColorBlendState is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001111 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001112 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001113 else if (!vk_validate_vkdynamiccbstatecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001114 sprintf(str, "Parameter pCreateInfo to function CreateDynamicColorBlendState contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001115 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001116 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001117 VkResult result = device_dispatch_table(device)->CreateDynamicColorBlendState(device, pCreateInfo, pState);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001118 return result;
1119}
1120
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001121VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(VkDevice device, const VkDynamicDsStateCreateInfo* pCreateInfo, VkDynamicDsState* pState)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001122{
1123 char str[1024];
1124 if (!pCreateInfo) {
1125 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDynamicDepthStencilState is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001126 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001127 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001128 else if (!vk_validate_vkdynamicdsstatecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001129 sprintf(str, "Parameter pCreateInfo to function CreateDynamicDepthStencilState contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001130 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001131 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001132 VkResult result = device_dispatch_table(device)->CreateDynamicDepthStencilState(device, pCreateInfo, pState);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001133 return result;
1134}
1135
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001136void PreCreateCommandBuffer(VkDevice device, const VkCmdBufferCreateInfo* pCreateInfo)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001137{
1138 if(device == nullptr)
1139 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001140 char const str[] = "vkCreateCommandBuffer parameter, VkDevice device, is "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001141 "nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001142 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001143 return;
1144 }
1145
1146 if(pCreateInfo == nullptr)
1147 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001148 char const str[] = "vkCreateCommandBuffer parameter, VkCmdBufferCreateInfo* pCreateInfo, is "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001149 "nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001150 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001151 return;
1152 }
1153
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001154 if(pCreateInfo->sType != VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001155 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001156 char const str[] = "vkCreateCommandBuffer parameter, VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO "\
1157 "pCreateInfo->sType, is not VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001158 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001159 return;
1160 }
1161}
1162
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001163void PostCreateCommandBuffer(VkResult result, VkCmdBuffer* pCmdBuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001164{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001165 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001166 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001167 // TODO: Spit out VkResult value.
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001168 char const str[] = "vkCreateCommandBuffer failed (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001169 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001170 return;
1171 }
1172
1173 if(pCmdBuffer == nullptr)
1174 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001175 char const str[] = "vkCreateCommandBuffer parameter, VkCmdBuffer* pCmdBuffer, is nullptr (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001176 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001177 return;
1178 }
1179}
1180
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001181VK_LAYER_EXPORT VkResult VKAPI vkCreateCommandBuffer(VkDevice device,
1182 const VkCmdBufferCreateInfo* pCreateInfo, VkCmdBuffer* pCmdBuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001183{
1184 PreCreateCommandBuffer(device, pCreateInfo);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001185 VkResult result = device_dispatch_table(device)->CreateCommandBuffer(device, pCreateInfo, pCmdBuffer);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001186 PostCreateCommandBuffer(result, pCmdBuffer);
1187 return result;
1188}
1189
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001190VK_LAYER_EXPORT VkResult VKAPI vkBeginCommandBuffer(VkCmdBuffer cmdBuffer, const VkCmdBufferBeginInfo* pBeginInfo)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001191{
1192 char str[1024];
1193 if (!pBeginInfo) {
1194 sprintf(str, "Struct ptr parameter pBeginInfo to function BeginCommandBuffer is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001195 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001196 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001197 else if (!vk_validate_vkcmdbufferbegininfo(pBeginInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001198 sprintf(str, "Parameter pBeginInfo to function BeginCommandBuffer contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001199 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001200 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001201 VkResult result = device_dispatch_table(cmdBuffer)->BeginCommandBuffer(cmdBuffer, pBeginInfo);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001202 return result;
1203}
1204
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001205VK_LAYER_EXPORT VkResult VKAPI vkEndCommandBuffer(VkCmdBuffer cmdBuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001206{
1207
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001208 VkResult result = device_dispatch_table(cmdBuffer)->EndCommandBuffer(cmdBuffer);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001209 return result;
1210}
1211
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001212VK_LAYER_EXPORT VkResult VKAPI vkResetCommandBuffer(VkCmdBuffer cmdBuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001213{
1214
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001215 VkResult result = device_dispatch_table(cmdBuffer)->ResetCommandBuffer(cmdBuffer);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001216 return result;
1217}
1218
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001219VK_LAYER_EXPORT void VKAPI vkCmdBindPipeline(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001220{
1221 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001222 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001223 sprintf(str, "Parameter pipelineBindPoint to function CmdBindPipeline has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001224 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001225 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001226 device_dispatch_table(cmdBuffer)->CmdBindPipeline(cmdBuffer, pipelineBindPoint, pipeline);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001227}
1228
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001229VK_LAYER_EXPORT void VKAPI vkCmdBindDynamicStateObject(VkCmdBuffer cmdBuffer, VkStateBindPoint stateBindPoint, VkDynamicStateObject state)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001230{
1231 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001232 if (!validate_VkStateBindPoint(stateBindPoint)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001233 sprintf(str, "Parameter stateBindPoint to function CmdBindDynamicStateObject has invalid value of %i.", (int)stateBindPoint);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001234 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001235 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001236 device_dispatch_table(cmdBuffer)->CmdBindDynamicStateObject(cmdBuffer, stateBindPoint, state);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001237}
1238
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001239VK_LAYER_EXPORT void VKAPI vkCmdBindDescriptorSets(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, uint32_t firstSet, uint32_t setCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001240{
1241 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001242 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001243 sprintf(str, "Parameter pipelineBindPoint to function CmdBindDescriptorSets has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001244 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001245 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001246 device_dispatch_table(cmdBuffer)->CmdBindDescriptorSets(cmdBuffer, pipelineBindPoint, firstSet, setCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001247}
1248
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001249VK_LAYER_EXPORT void VKAPI vkCmdBindVertexBuffers(
1250 VkCmdBuffer cmdBuffer,
1251 uint32_t startBinding,
1252 uint32_t bindingCount,
1253 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001254 const VkDeviceSize* pOffsets)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001255{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001256 device_dispatch_table(cmdBuffer)->CmdBindVertexBuffers(cmdBuffer, startBinding, bindingCount, pBuffers, pOffsets);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001257}
1258
Tony Barbour8205d902015-04-16 15:59:00 -06001259VK_LAYER_EXPORT void VKAPI vkCmdBindIndexBuffer(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001260{
1261 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001262 if (!validate_VkIndexType(indexType)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001263 sprintf(str, "Parameter indexType to function CmdBindIndexBuffer has invalid value of %i.", (int)indexType);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001264 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001265 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001266 device_dispatch_table(cmdBuffer)->CmdBindIndexBuffer(cmdBuffer, buffer, offset, indexType);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001267}
1268
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001269VK_LAYER_EXPORT void VKAPI vkCmdDraw(VkCmdBuffer cmdBuffer, uint32_t firstVertex, uint32_t vertexCount, uint32_t firstInstance, uint32_t instanceCount)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001270{
1271
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001272 device_dispatch_table(cmdBuffer)->CmdDraw(cmdBuffer, firstVertex, vertexCount, firstInstance, instanceCount);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001273}
1274
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001275VK_LAYER_EXPORT void VKAPI vkCmdDrawIndexed(VkCmdBuffer cmdBuffer, uint32_t firstIndex, uint32_t indexCount, int32_t vertexOffset, uint32_t firstInstance, uint32_t instanceCount)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001276{
1277
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001278 device_dispatch_table(cmdBuffer)->CmdDrawIndexed(cmdBuffer, firstIndex, indexCount, vertexOffset, firstInstance, instanceCount);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001279}
1280
Tony Barbour8205d902015-04-16 15:59:00 -06001281VK_LAYER_EXPORT void VKAPI vkCmdDrawIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001282{
1283
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001284 device_dispatch_table(cmdBuffer)->CmdDrawIndirect(cmdBuffer, buffer, offset, count, stride);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001285}
1286
Tony Barbour8205d902015-04-16 15:59:00 -06001287VK_LAYER_EXPORT void VKAPI vkCmdDrawIndexedIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001288{
1289
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001290 device_dispatch_table(cmdBuffer)->CmdDrawIndexedIndirect(cmdBuffer, buffer, offset, count, stride);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001291}
1292
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001293VK_LAYER_EXPORT void VKAPI vkCmdDispatch(VkCmdBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001294{
1295
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001296 device_dispatch_table(cmdBuffer)->CmdDispatch(cmdBuffer, x, y, z);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001297}
1298
Tony Barbour8205d902015-04-16 15:59:00 -06001299VK_LAYER_EXPORT void VKAPI vkCmdDispatchIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001300{
1301
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001302 device_dispatch_table(cmdBuffer)->CmdDispatchIndirect(cmdBuffer, buffer, offset);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001303}
1304
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001305VK_LAYER_EXPORT void VKAPI vkCmdCopyBuffer(VkCmdBuffer cmdBuffer, VkBuffer srcBuffer, VkBuffer destBuffer, uint32_t regionCount, const VkBufferCopy* pRegions)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001306{
1307 char str[1024];
1308 uint32_t i;
1309 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001310 if (!vk_validate_vkbuffercopy(&pRegions[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001311 sprintf(str, "Parameter pRegions[%i] to function CmdCopyBuffer contains an invalid value.", i);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001312 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001313 }
1314 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001315 device_dispatch_table(cmdBuffer)->CmdCopyBuffer(cmdBuffer, srcBuffer, destBuffer, regionCount, pRegions);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001316}
1317
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001318VK_LAYER_EXPORT void VKAPI vkCmdCopyImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageCopy* pRegions)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001319{
1320 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001321 if (!validate_VkImageLayout(srcImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001322 sprintf(str, "Parameter srcImageLayout to function CmdCopyImage has invalid value of %i.", (int)srcImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001323 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001324 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001325 if (!validate_VkImageLayout(destImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001326 sprintf(str, "Parameter destImageLayout to function CmdCopyImage has invalid value of %i.", (int)destImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001327 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001328 }
1329 uint32_t i;
1330 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001331 if (!vk_validate_vkimagecopy(&pRegions[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001332 sprintf(str, "Parameter pRegions[%i] to function CmdCopyImage contains an invalid value.", i);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001333 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001334 }
1335 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001336 device_dispatch_table(cmdBuffer)->CmdCopyImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, regionCount, pRegions);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001337}
1338
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001339VK_LAYER_EXPORT void VKAPI vkCmdBlitImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkTexFilter filter)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001340{
1341 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001342 if (!validate_VkImageLayout(srcImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001343 sprintf(str, "Parameter srcImageLayout to function CmdBlitImage has invalid value of %i.", (int)srcImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001344 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001345 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001346 if (!validate_VkImageLayout(destImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001347 sprintf(str, "Parameter destImageLayout to function CmdBlitImage has invalid value of %i.", (int)destImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001348 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001349 }
1350 uint32_t i;
1351 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001352 if (!vk_validate_vkimageblit(&pRegions[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001353 sprintf(str, "Parameter pRegions[%i] to function CmdBlitImage contains an invalid value.", i);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001354 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001355 }
1356 }
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001357 //TODO: Add additional check for limitation from header rev 96.
1358 // VK_TEX_FILTER_NEAREST if the format that srcImage was created with is an integer-based format.
1359
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001360 device_dispatch_table(cmdBuffer)->CmdBlitImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, regionCount, pRegions, filter);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001361}
1362
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001363VK_LAYER_EXPORT void VKAPI vkCmdCopyBufferToImage(VkCmdBuffer cmdBuffer, VkBuffer srcBuffer, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001364{
1365 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001366 if (!validate_VkImageLayout(destImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001367 sprintf(str, "Parameter destImageLayout to function CmdCopyBufferToImage has invalid value of %i.", (int)destImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001368 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001369 }
1370 uint32_t i;
1371 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001372 if (!vk_validate_vkbufferimagecopy(&pRegions[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001373 sprintf(str, "Parameter pRegions[%i] to function CmdCopyBufferToImage contains an invalid value.", i);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001374 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001375 }
1376 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001377 device_dispatch_table(cmdBuffer)->CmdCopyBufferToImage(cmdBuffer, srcBuffer, destImage, destImageLayout, regionCount, pRegions);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001378}
1379
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001380VK_LAYER_EXPORT void VKAPI vkCmdCopyImageToBuffer(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer destBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001381{
1382 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001383 if (!validate_VkImageLayout(srcImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001384 sprintf(str, "Parameter srcImageLayout to function CmdCopyImageToBuffer has invalid value of %i.", (int)srcImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001385 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001386 }
1387 uint32_t i;
1388 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001389 if (!vk_validate_vkbufferimagecopy(&pRegions[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001390 sprintf(str, "Parameter pRegions[%i] to function CmdCopyImageToBuffer contains an invalid value.", i);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001391 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001392 }
1393 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001394 device_dispatch_table(cmdBuffer)->CmdCopyImageToBuffer(cmdBuffer, srcImage, srcImageLayout, destBuffer, regionCount, pRegions);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001395}
1396
Tony Barbour8205d902015-04-16 15:59:00 -06001397VK_LAYER_EXPORT void VKAPI vkCmdUpdateBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const uint32_t* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001398{
1399
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001400 device_dispatch_table(cmdBuffer)->CmdUpdateBuffer(cmdBuffer, destBuffer, destOffset, dataSize, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001401}
1402
Tony Barbour8205d902015-04-16 15:59:00 -06001403VK_LAYER_EXPORT void VKAPI vkCmdFillBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001404{
1405
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001406 device_dispatch_table(cmdBuffer)->CmdFillBuffer(cmdBuffer, destBuffer, destOffset, fillSize, data);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001407}
1408
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001409VK_LAYER_EXPORT void VKAPI vkCmdClearColorImage(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColor* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001410{
1411 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001412 if (!validate_VkImageLayout(imageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001413 sprintf(str, "Parameter imageLayout to function CmdClearColorImage has invalid value of %i.", (int)imageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001414 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001415 }
1416 uint32_t i;
1417 for (i = 0; i < rangeCount; i++) {
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001418 if (!vk_validate_vkimagesubresourcerange(&pRanges[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001419 sprintf(str, "Parameter pRanges[%i] to function CmdClearColorImage contains an invalid value.", i);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001420 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001421 }
1422 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001423 device_dispatch_table(cmdBuffer)->CmdClearColorImage(cmdBuffer, image, imageLayout, pColor, rangeCount, pRanges);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001424}
1425
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001426VK_LAYER_EXPORT void VKAPI vkCmdClearDepthStencil(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, float depth, uint32_t stencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001427{
1428 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001429 if (!validate_VkImageLayout(imageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001430 sprintf(str, "Parameter imageLayout to function CmdClearDepthStencil has invalid value of %i.", (int)imageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001431 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001432 }
1433 uint32_t i;
1434 for (i = 0; i < rangeCount; i++) {
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001435 if (!vk_validate_vkimagesubresourcerange(&pRanges[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001436 sprintf(str, "Parameter pRanges[%i] to function CmdClearDepthStencil contains an invalid value.", i);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001437 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001438 }
1439 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001440 device_dispatch_table(cmdBuffer)->CmdClearDepthStencil(cmdBuffer, image, imageLayout, depth, stencil, rangeCount, pRanges);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001441}
1442
Tony Barbour11f74372015-04-13 15:02:52 -06001443VK_LAYER_EXPORT void VKAPI vkCmdResolveImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageResolve* pRegions)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001444{
1445 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001446 if (!validate_VkImageLayout(srcImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001447 sprintf(str, "Parameter srcImageLayout to function CmdResolveImage has invalid value of %i.", (int)srcImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001448 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001449 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001450 if (!validate_VkImageLayout(destImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001451 sprintf(str, "Parameter destImageLayout to function CmdResolveImage has invalid value of %i.", (int)destImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001452 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001453 }
1454 uint32_t i;
Tony Barbour11f74372015-04-13 15:02:52 -06001455 for (i = 0; i < regionCount; i++) {
1456 if (!vk_validate_vkimageresolve(&pRegions[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001457 sprintf(str, "Parameter pRects[%i] to function CmdResolveImage contains an invalid value.", i);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001458 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001459 }
1460 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001461 device_dispatch_table(cmdBuffer)->CmdResolveImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, regionCount, pRegions);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001462}
1463
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001464VK_LAYER_EXPORT void VKAPI vkCmdSetEvent(VkCmdBuffer cmdBuffer, VkEvent event, VkPipeEvent pipeEvent)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001465{
1466 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001467 if (!validate_VkPipeEvent(pipeEvent)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001468 sprintf(str, "Parameter pipeEvent to function CmdSetEvent has invalid value of %i.", (int)pipeEvent);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001469 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001470 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001471 device_dispatch_table(cmdBuffer)->CmdSetEvent(cmdBuffer, event, pipeEvent);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001472}
1473
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001474VK_LAYER_EXPORT void VKAPI vkCmdResetEvent(VkCmdBuffer cmdBuffer, VkEvent event, VkPipeEvent pipeEvent)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001475{
1476 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001477 if (!validate_VkPipeEvent(pipeEvent)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001478 sprintf(str, "Parameter pipeEvent to function CmdResetEvent has invalid value of %i.", (int)pipeEvent);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001479 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001480 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001481 device_dispatch_table(cmdBuffer)->CmdResetEvent(cmdBuffer, event, pipeEvent);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001482}
1483
Tony Barbour8205d902015-04-16 15:59:00 -06001484VK_LAYER_EXPORT void VKAPI vkCmdWaitEvents(VkCmdBuffer cmdBuffer, VkWaitEvent waitEvent, uint32_t eventCount, const VkEvent* pEvents, uint32_t memBarrierCount, const void** ppMemBarriers)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001485{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001486 device_dispatch_table(cmdBuffer)->CmdWaitEvents(cmdBuffer, waitEvent, eventCount, pEvents, memBarrierCount, ppMemBarriers);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001487}
1488
Tony Barbour8205d902015-04-16 15:59:00 -06001489VK_LAYER_EXPORT void VKAPI vkCmdPipelineBarrier(VkCmdBuffer cmdBuffer, VkWaitEvent waitEvent, uint32_t pipeEventCount, const VkPipeEvent* pPipeEvents, uint32_t memBarrierCount, const void** ppMemBarriers)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001490{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001491 device_dispatch_table(cmdBuffer)->CmdPipelineBarrier(cmdBuffer, waitEvent, pipeEventCount, pPipeEvents, memBarrierCount, ppMemBarriers);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001492}
1493
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001494VK_LAYER_EXPORT void VKAPI vkCmdBeginQuery(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkFlags flags)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001495{
1496
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001497 device_dispatch_table(cmdBuffer)->CmdBeginQuery(cmdBuffer, queryPool, slot, flags);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001498}
1499
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001500VK_LAYER_EXPORT void VKAPI vkCmdEndQuery(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001501{
1502
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001503 device_dispatch_table(cmdBuffer)->CmdEndQuery(cmdBuffer, queryPool, slot);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001504}
1505
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001506VK_LAYER_EXPORT void VKAPI vkCmdResetQueryPool(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001507{
1508
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001509 device_dispatch_table(cmdBuffer)->CmdResetQueryPool(cmdBuffer, queryPool, startQuery, queryCount);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001510}
1511
Tony Barbour8205d902015-04-16 15:59:00 -06001512VK_LAYER_EXPORT void VKAPI vkCmdWriteTimestamp(VkCmdBuffer cmdBuffer, VkTimestampType timestampType, VkBuffer destBuffer, VkDeviceSize destOffset)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001513{
1514 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001515 if (!validate_VkTimestampType(timestampType)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001516 sprintf(str, "Parameter timestampType to function CmdWriteTimestamp has invalid value of %i.", (int)timestampType);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001517 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001518 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001519 device_dispatch_table(cmdBuffer)->CmdWriteTimestamp(cmdBuffer, timestampType, destBuffer, destOffset);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001520}
1521
Jeremy Hayescf469132015-04-17 10:36:53 -06001522VK_LAYER_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1523 VkCmdBuffer cmdBuffer,
1524 VkQueryPool queryPool,
1525 uint32_t startQuery,
1526 uint32_t queryCount,
1527 VkBuffer destBuffer,
1528 VkDeviceSize destOffset,
1529 VkDeviceSize destStride,
1530 VkQueryResultFlags flags)
1531{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001532 device_dispatch_table(cmdBuffer)->CmdCopyQueryPoolResults(cmdBuffer, queryPool, startQuery, queryCount, destBuffer, destOffset, destStride, flags);
Jeremy Hayescf469132015-04-17 10:36:53 -06001533}
1534
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001535VK_LAYER_EXPORT void VKAPI vkCmdInitAtomicCounters(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, uint32_t startCounter, uint32_t counterCount, const uint32_t* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001536{
1537 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001538 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001539 sprintf(str, "Parameter pipelineBindPoint to function CmdInitAtomicCounters has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001540 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001541 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001542 device_dispatch_table(cmdBuffer)->CmdInitAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001543}
1544
Tony Barbour8205d902015-04-16 15:59:00 -06001545VK_LAYER_EXPORT void VKAPI vkCmdLoadAtomicCounters(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, uint32_t startCounter, uint32_t counterCount, VkBuffer srcBuffer, VkDeviceSize srcOffset)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001546{
1547 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001548 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001549 sprintf(str, "Parameter pipelineBindPoint to function CmdLoadAtomicCounters has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001550 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001551 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001552 device_dispatch_table(cmdBuffer)->CmdLoadAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, srcBuffer, srcOffset);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001553}
1554
Tony Barbour8205d902015-04-16 15:59:00 -06001555VK_LAYER_EXPORT void VKAPI vkCmdSaveAtomicCounters(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, uint32_t startCounter, uint32_t counterCount, VkBuffer destBuffer, VkDeviceSize destOffset)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001556{
1557 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001558 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001559 sprintf(str, "Parameter pipelineBindPoint to function CmdSaveAtomicCounters has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001560 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001561 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001562 device_dispatch_table(cmdBuffer)->CmdSaveAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, destBuffer, destOffset);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001563}
1564
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001565VK_LAYER_EXPORT VkResult VKAPI vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, VkFramebuffer* pFramebuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001566{
1567 char str[1024];
1568 if (!pCreateInfo) {
1569 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateFramebuffer is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001570 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001571 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001572 else if (!vk_validate_vkframebuffercreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001573 sprintf(str, "Parameter pCreateInfo to function CreateFramebuffer contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001574 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001575 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001576 VkResult result = device_dispatch_table(device)->CreateFramebuffer(device, pCreateInfo, pFramebuffer);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001577 return result;
1578}
1579
1580
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001581void PreCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001582{
1583 if(pCreateInfo == nullptr)
1584 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001585 char const str[] = "vkCreateRenderPass parameter, VkRenderPassCreateInfo* pCreateInfo, is "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001586 "nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001587 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001588 return;
1589 }
1590
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001591 if(pCreateInfo->sType != VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001592 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001593 char const str[] = "vkCreateRenderPass parameter, VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO "\
1594 "pCreateInfo->sType, is not VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001595 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001596 return;
1597 }
1598
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001599 if(!vk_validate_vkrect(&pCreateInfo->renderArea))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001600 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001601 char const str[] = "vkCreateRenderPass parameter, VkRect pCreateInfo->renderArea, is invalid "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001602 "(precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001603 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001604 return;
1605 }
1606
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001607 if(!vk_validate_vkextent2d(&pCreateInfo->extent))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001608 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001609 char const str[] = "vkCreateRenderPass parameter, VkExtent2D pCreateInfo->extent, is invalid "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001610 "(precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001611 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001612 return;
1613 }
1614
1615 if(pCreateInfo->pColorFormats == nullptr)
1616 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001617 char const str[] = "vkCreateRenderPass parameter, VkFormat* pCreateInfo->pColorFormats, "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001618 "is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001619 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001620 return;
1621 }
1622
1623 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1624 {
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001625 if(!validate_VkFormat(pCreateInfo->pColorFormats[i]))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001626 {
1627 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001628 ss << "vkCreateRenderPass parameter, VkFormat pCreateInfo->pColorFormats[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001629 "], is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001630 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001631 continue;
1632 }
1633
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001634 VkFormatProperties properties;
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001635 size_t size = sizeof(properties);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001636 VkResult result = device_dispatch_table(device)->GetFormatInfo(device, pCreateInfo->pColorFormats[i],
Tony Barbour8205d902015-04-16 15:59:00 -06001637 VK_FORMAT_INFO_TYPE_PROPERTIES, &size, &properties);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001638 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001639 {
1640 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001641 ss << "vkCreateRenderPass parameter, VkFormat pCreateInfo->pColorFormats[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001642 "], cannot be validated (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001643 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001644 continue;
1645 }
1646
1647 if((properties.linearTilingFeatures) == 0 && (properties.optimalTilingFeatures == 0))
1648 {
1649 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001650 ss << "vkCreateRenderPass parameter, VkFormat pCreateInfo->pColorFormats[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001651 "], contains unsupported format (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001652 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001653 continue;
1654 }
1655
1656 }
1657
1658 if(pCreateInfo->pColorLayouts == nullptr)
1659 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001660 char const str[] = "vkCreateRenderPass parameter, VkImageLayout* pCreateInfo->pColorLayouts, "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001661 "is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001662 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001663 return;
1664 }
1665
1666 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1667 {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001668 if(!validate_VkImageLayout(pCreateInfo->pColorLayouts[i]))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001669 {
1670 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001671 ss << "vkCreateRenderPass parameter, VkImageLayout pCreateInfo->pColorLayouts[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001672 "], is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001673 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001674 continue;
1675 }
1676 }
1677
1678 if(pCreateInfo->pColorLoadOps == nullptr)
1679 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001680 char const str[] = "vkCreateRenderPass parameter, VkAttachmentLoadOp* pCreateInfo->pColorLoadOps, "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001681 "is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001682 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001683 return;
1684 }
1685
1686 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1687 {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001688 if(!validate_VkAttachmentLoadOp(pCreateInfo->pColorLoadOps[i]))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001689 {
1690 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001691 ss << "vkCreateRenderPass parameter, VkAttachmentLoadOp pCreateInfo->pColorLoadOps[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001692 "], is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001693 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001694 continue;
1695 }
1696 }
1697
1698 if(pCreateInfo->pColorStoreOps == nullptr)
1699 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001700 char const str[] = "vkCreateRenderPass parameter, VkAttachmentStoreOp* pCreateInfo->pColorStoreOps, "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001701 "is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001702 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001703 return;
1704 }
1705
1706 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1707 {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001708 if(!validate_VkAttachmentStoreOp(pCreateInfo->pColorStoreOps[i]))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001709 {
1710 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001711 ss << "vkCreateRenderPass parameter, VkAttachmentStoreOp pCreateInfo->pColorStoreOps[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001712 "], is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001713 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001714 continue;
1715 }
1716 }
1717
1718 if(pCreateInfo->pColorLoadClearValues == nullptr)
1719 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001720 char const str[] = "vkCreateRenderPass parameter, VkClearColor* pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001721 "pColorLoadClearValues, is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001722 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001723 return;
1724 }
Jeremy Hayes6b7060b2015-04-07 09:49:05 -06001725
1726 if(pCreateInfo->pColorStoreOps == nullptr)
1727 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001728 char const str[] = "vkCreateRenderPass parameter, VK_ATTACHMENT_STORE_OP* pCreateInfo->pColorStoreOps, "\
Jeremy Hayes9bafb9f2015-04-07 13:38:03 -06001729 "is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001730 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayes6b7060b2015-04-07 09:49:05 -06001731 return;
1732 }
1733
Jeremy Hayes6b7060b2015-04-07 09:49:05 -06001734 if(pCreateInfo->pColorLoadClearValues == nullptr)
1735 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001736 char const str[] = "vkCreateRenderPass parameter, VK_CLEAR_COLOR* pCreateInfo->"\
Jeremy Hayes9bafb9f2015-04-07 13:38:03 -06001737 "pColorLoadClearValues, is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001738 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayes6b7060b2015-04-07 09:49:05 -06001739 return;
1740 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001741
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001742 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1743 {
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001744 if(!vk_validate_vkclearcolor(&(pCreateInfo->pColorLoadClearValues[i])))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001745 {
1746 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001747 ss << "vkCreateRenderPass parameter, VkClearColor pCreateInfo->pColorLoadClearValues[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001748 "], is invalid (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001749 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001750 continue;
1751 }
1752 }
1753
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001754 if(!validate_VkFormat(pCreateInfo->depthStencilFormat))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001755 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001756 char const str[] = "vkCreateRenderPass parameter, VkFormat pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001757 "depthStencilFormat, is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001758 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001759 return;
1760 }
1761
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001762 VkFormatProperties properties;
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001763 size_t size = sizeof(properties);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001764 VkResult result = device_dispatch_table(device)->GetFormatInfo(device, pCreateInfo->depthStencilFormat,
Tony Barbour8205d902015-04-16 15:59:00 -06001765 VK_FORMAT_INFO_TYPE_PROPERTIES, &size, &properties);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001766 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001767 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001768 char const str[] = "vkCreateRenderPass parameter, VkFormat pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001769 "depthStencilFormat, cannot be validated (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001770 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001771 return;
1772 }
1773
1774 if((properties.linearTilingFeatures) == 0 && (properties.optimalTilingFeatures == 0))
1775 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001776 char const str[] = "vkCreateRenderPass parameter, VkFormat pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001777 "depthStencilFormat, contains unsupported format (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001778 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001779 return;
1780 }
1781
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001782 if(!validate_VkImageLayout(pCreateInfo->depthStencilLayout))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001783 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001784 char const str[] = "vkCreateRenderPass parameter, VkImageLayout pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001785 "depthStencilLayout, is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001786 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001787 return;
1788 }
1789
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001790 if(!validate_VkAttachmentLoadOp(pCreateInfo->depthLoadOp))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001791 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001792 char const str[] = "vkCreateRenderPass parameter, VkAttachmentLoadOp pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001793 "depthLoadOp, is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001794 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001795 return;
1796 }
1797
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001798 if(!validate_VkAttachmentStoreOp(pCreateInfo->depthStoreOp))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001799 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001800 char const str[] = "vkCreateRenderPass parameter, VkAttachmentStoreOp pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001801 "depthStoreOp, is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001802 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001803 return;
1804 }
1805
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001806 if(!validate_VkAttachmentLoadOp(pCreateInfo->stencilLoadOp))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001807 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001808 char const str[] = "vkCreateRenderPass parameter, VkAttachmentLoadOp pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001809 "stencilLoadOp, is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001810 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001811 return;
1812 }
1813
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001814 if(!validate_VkAttachmentStoreOp(pCreateInfo->stencilStoreOp))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001815 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001816 char const str[] = "vkCreateRenderPass parameter, VkAttachmentStoreOp pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001817 "stencilStoreOp, is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001818 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001819 return;
1820 }
1821}
1822
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001823void PostCreateRenderPass(VkResult result, VkRenderPass* pRenderPass)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001824{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001825 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001826 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001827 // TODO: Spit out VkResult value.
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001828 char const str[] = "vkCreateRenderPass failed (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001829 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001830 return;
1831 }
1832
1833 if(pRenderPass == nullptr)
1834 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001835 char const str[] = "vkCreateRenderPass parameter, VkRenderPass* pRenderPass, is nullptr (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001836 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001837 return;
1838 }
1839}
1840
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001841VK_LAYER_EXPORT VkResult VKAPI vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, VkRenderPass* pRenderPass)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001842{
1843 PreCreateRenderPass(device, pCreateInfo);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001844 VkResult result = device_dispatch_table(device)->CreateRenderPass(device, pCreateInfo, pRenderPass);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001845 PostCreateRenderPass(result, pRenderPass);
1846 return result;
1847}
1848
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001849VK_LAYER_EXPORT void VKAPI vkCmdBeginRenderPass(VkCmdBuffer cmdBuffer, const VkRenderPassBegin* pRenderPassBegin)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001850{
1851 char str[1024];
1852 if (!pRenderPassBegin) {
1853 sprintf(str, "Struct ptr parameter pRenderPassBegin to function CmdBeginRenderPass is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001854 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001855 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001856 else if (!vk_validate_vkrenderpassbegin(pRenderPassBegin)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001857 sprintf(str, "Parameter pRenderPassBegin to function CmdBeginRenderPass contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001858 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001859 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001860 device_dispatch_table(cmdBuffer)->CmdBeginRenderPass(cmdBuffer, pRenderPassBegin);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001861}
1862
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001863VK_LAYER_EXPORT void VKAPI vkCmdEndRenderPass(VkCmdBuffer cmdBuffer, VkRenderPass renderPass)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001864{
1865
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001866 device_dispatch_table(cmdBuffer)->CmdEndRenderPass(cmdBuffer, renderPass);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001867}
1868
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001869VK_LAYER_EXPORT VkResult VKAPI vkDbgCreateMsgCallback(
1870 VkInstance instance,
1871 VkFlags msgFlags,
1872 const PFN_vkDbgMsgCallback pfnMsgCallback,
1873 void* pUserData,
1874 VkDbgMsgCallback* pMsgCallback)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001875{
Jon Ashburn5a10d212015-06-01 10:02:09 -06001876 VkLayerInstanceDispatchTable *pTable = instance_dispatch_table(instance);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001877 return layer_create_msg_callback(instance, pTable, msgFlags, pfnMsgCallback, pUserData, pMsgCallback);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001878}
1879
Courtney Goeltzenleuchter09f85042015-06-01 14:45:27 -06001880VK_LAYER_EXPORT VkResult VKAPI vkDbgDestroyMsgCallback(
1881 VkInstance instance,
1882 VkDbgMsgCallback msgCallback)
1883{
Courtney Goeltzenleuchter9f171942015-06-13 21:22:12 -06001884 VkLayerInstanceDispatchTable *pTable = instance_dispatch_table(instance);
Courtney Goeltzenleuchter09f85042015-06-01 14:45:27 -06001885 return layer_destroy_msg_callback(instance, pTable, msgCallback);
1886}
1887
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001888VK_LAYER_EXPORT void VKAPI vkCmdDbgMarkerBegin(VkCmdBuffer cmdBuffer, const char* pMarker)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001889{
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001890 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) cmdBuffer;
1891 if (!deviceExtMap[pDisp].debug_marker_enabled) {
Jon Ashburnf0615e22015-05-25 14:11:37 -06001892 char const str[] = "Attempt to use CmdDbgMarkerBegin but extension disabled!";
1893 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001894 return;
Jon Ashburnf0615e22015-05-25 14:11:37 -06001895 }
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001896 debug_marker_dispatch_table(cmdBuffer)->CmdDbgMarkerBegin(cmdBuffer, pMarker);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001897}
1898
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001899VK_LAYER_EXPORT void VKAPI vkCmdDbgMarkerEnd(VkCmdBuffer cmdBuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001900{
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001901 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) cmdBuffer;
1902 if (!deviceExtMap[pDisp].debug_marker_enabled) {
Jon Ashburnf0615e22015-05-25 14:11:37 -06001903 char const str[] = "Attempt to use CmdDbgMarkerEnd but extension disabled!";
1904 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001905 return;
Jon Ashburnf0615e22015-05-25 14:11:37 -06001906 }
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001907 debug_marker_dispatch_table(cmdBuffer)->CmdDbgMarkerEnd(cmdBuffer);
Jon Ashburnf0615e22015-05-25 14:11:37 -06001908}
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001909
Jon Ashburnf0615e22015-05-25 14:11:37 -06001910VkResult VKAPI vkDbgSetObjectTag(VkDevice device, VkObjectType objType, VkObject object, size_t tagSize, const void* pTag)
1911{
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001912 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) device;
1913 if (!deviceExtMap[pDisp].debug_marker_enabled) {
Jon Ashburnf0615e22015-05-25 14:11:37 -06001914 char const str[] = "Attempt to use DbgSetObjectTag but extension disabled!";
1915 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001916 return VK_ERROR_UNAVAILABLE;
Jon Ashburnf0615e22015-05-25 14:11:37 -06001917 }
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001918 debug_marker_dispatch_table(device)->DbgSetObjectTag(device, objType, object, tagSize, pTag);
Jon Ashburnf0615e22015-05-25 14:11:37 -06001919}
1920
1921VkResult VKAPI vkDbgSetObjectName(VkDevice device, VkObjectType objType, VkObject object, size_t nameSize, const char* pName)
1922{
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001923 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) device;
1924 if (!deviceExtMap[pDisp].debug_marker_enabled) {
Jon Ashburnf0615e22015-05-25 14:11:37 -06001925 char const str[] = "Attempt to use DbgSetObjectName but extension disabled!";
1926 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001927 return VK_ERROR_UNAVAILABLE;
Jon Ashburnf0615e22015-05-25 14:11:37 -06001928 }
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001929 debug_marker_dispatch_table(device)->DbgSetObjectName(device, objType, object, nameSize, pName);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001930}
1931
Chia-I Wu5b66aa52015-04-16 22:02:10 +08001932VK_LAYER_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(VkDisplayWSI display, VkDisplayInfoTypeWSI infoType, size_t* pDataSize, void* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001933{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001934 VkResult result = instance_dispatch_table(display)->GetDisplayInfoWSI(display, infoType, pDataSize, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001935 return result;
1936}
1937
Chia-I Wu5b66aa52015-04-16 22:02:10 +08001938VK_LAYER_EXPORT VkResult VKAPI vkCreateSwapChainWSI(VkDevice device, const VkSwapChainCreateInfoWSI* pCreateInfo, VkSwapChainWSI* pSwapChain)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001939{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001940 VkResult result = device_dispatch_table(device)->CreateSwapChainWSI(device, pCreateInfo, pSwapChain);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001941 return result;
1942}
1943
Chia-I Wu5b66aa52015-04-16 22:02:10 +08001944VK_LAYER_EXPORT VkResult VKAPI vkDestroySwapChainWSI(VkSwapChainWSI swapChain)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001945{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001946 VkResult result = device_dispatch_table(swapChain)->DestroySwapChainWSI(swapChain);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001947 return result;
1948}
1949
Chia-I Wu5b66aa52015-04-16 22:02:10 +08001950VK_LAYER_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(VkSwapChainWSI swapChain, VkSwapChainInfoTypeWSI infoType, size_t* pDataSize, void* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001951{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001952 VkResult result = device_dispatch_table(swapChain)->GetSwapChainInfoWSI(swapChain, infoType, pDataSize, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001953 return result;
1954}
1955
Chia-I Wu5b66aa52015-04-16 22:02:10 +08001956VK_LAYER_EXPORT VkResult VKAPI vkQueuePresentWSI(VkQueue queue, const VkPresentInfoWSI* pPresentInfo)
1957{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001958 VkResult result = device_dispatch_table(queue)->QueuePresentWSI(queue, pPresentInfo);
Chia-I Wu5b66aa52015-04-16 22:02:10 +08001959 return result;
1960}
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001961
Jon Ashburn79b78ac2015-05-05 14:22:52 -06001962static inline void* layer_intercept_proc(const char *name)
1963{
1964 if (!name || name[0] != 'v' || name[1] != 'k')
1965 return NULL;
1966
1967 name += 2;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06001968 if (!strcmp(name, "DestroyDevice"))
1969 return (void*) vkDestroyDevice;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06001970 if (!strcmp(name, "GetDeviceQueue"))
1971 return (void*) vkGetDeviceQueue;
1972 if (!strcmp(name, "QueueSubmit"))
1973 return (void*) vkQueueSubmit;
1974 if (!strcmp(name, "QueueWaitIdle"))
1975 return (void*) vkQueueWaitIdle;
1976 if (!strcmp(name, "DeviceWaitIdle"))
1977 return (void*) vkDeviceWaitIdle;
1978 if (!strcmp(name, "AllocMemory"))
1979 return (void*) vkAllocMemory;
1980 if (!strcmp(name, "FreeMemory"))
1981 return (void*) vkFreeMemory;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06001982 if (!strcmp(name, "MapMemory"))
1983 return (void*) vkMapMemory;
1984 if (!strcmp(name, "UnmapMemory"))
1985 return (void*) vkUnmapMemory;
1986 if (!strcmp(name, "FlushMappedMemoryRanges"))
1987 return (void*) vkFlushMappedMemoryRanges;
1988 if (!strcmp(name, "InvalidateMappedMemoryRanges"))
1989 return (void*) vkInvalidateMappedMemoryRanges;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06001990 if (!strcmp(name, "OpenSharedMemory"))
1991 return (void*) vkOpenSharedMemory;
1992 if (!strcmp(name, "OpenSharedSemaphore"))
1993 return (void*) vkOpenSharedSemaphore;
1994 if (!strcmp(name, "OpenPeerMemory"))
1995 return (void*) vkOpenPeerMemory;
1996 if (!strcmp(name, "OpenPeerImage"))
1997 return (void*) vkOpenPeerImage;
1998 if (!strcmp(name, "DestroyObject"))
1999 return (void*) vkDestroyObject;
2000 if (!strcmp(name, "GetObjectInfo"))
2001 return (void*) vkGetObjectInfo;
2002 if (!strcmp(name, "CreateFence"))
2003 return (void*) vkCreateFence;
2004 if (!strcmp(name, "ResetFences"))
2005 return (void*) vkResetFences;
2006 if (!strcmp(name, "GetFenceStatus"))
2007 return (void*) vkGetFenceStatus;
2008 if (!strcmp(name, "WaitForFences"))
2009 return (void*) vkWaitForFences;
2010 if (!strcmp(name, "CreateSemaphore"))
2011 return (void*) vkCreateSemaphore;
2012 if (!strcmp(name, "QueueSignalSemaphore"))
2013 return (void*) vkQueueSignalSemaphore;
2014 if (!strcmp(name, "QueueWaitSemaphore"))
2015 return (void*) vkQueueWaitSemaphore;
2016 if (!strcmp(name, "CreateEvent"))
2017 return (void*) vkCreateEvent;
2018 if (!strcmp(name, "GetEventStatus"))
2019 return (void*) vkGetEventStatus;
2020 if (!strcmp(name, "SetEvent"))
2021 return (void*) vkSetEvent;
2022 if (!strcmp(name, "ResetEvent"))
2023 return (void*) vkResetEvent;
2024 if (!strcmp(name, "CreateQueryPool"))
2025 return (void*) vkCreateQueryPool;
2026 if (!strcmp(name, "GetQueryPoolResults"))
2027 return (void*) vkGetQueryPoolResults;
2028 if (!strcmp(name, "GetFormatInfo"))
2029 return (void*) vkGetFormatInfo;
2030 if (!strcmp(name, "CreateBuffer"))
2031 return (void*) vkCreateBuffer;
2032 if (!strcmp(name, "CreateBufferView"))
2033 return (void*) vkCreateBufferView;
2034 if (!strcmp(name, "CreateImage"))
2035 return (void*) vkCreateImage;
2036 if (!strcmp(name, "GetImageSubresourceInfo"))
2037 return (void*) vkGetImageSubresourceInfo;
2038 if (!strcmp(name, "CreateImageView"))
2039 return (void*) vkCreateImageView;
2040 if (!strcmp(name, "CreateColorAttachmentView"))
2041 return (void*) vkCreateColorAttachmentView;
2042 if (!strcmp(name, "CreateDepthStencilView"))
2043 return (void*) vkCreateDepthStencilView;
2044 if (!strcmp(name, "CreateShader"))
2045 return (void*) vkCreateShader;
2046 if (!strcmp(name, "CreateGraphicsPipeline"))
2047 return (void*) vkCreateGraphicsPipeline;
2048 if (!strcmp(name, "CreateGraphicsPipelineDerivative"))
2049 return (void*) vkCreateGraphicsPipelineDerivative;
2050 if (!strcmp(name, "CreateComputePipeline"))
2051 return (void*) vkCreateComputePipeline;
2052 if (!strcmp(name, "StorePipeline"))
2053 return (void*) vkStorePipeline;
2054 if (!strcmp(name, "LoadPipeline"))
2055 return (void*) vkLoadPipeline;
2056 if (!strcmp(name, "LoadPipelineDerivative"))
2057 return (void*) vkLoadPipelineDerivative;
2058 if (!strcmp(name, "CreatePipelineLayout"))
2059 return (void*) vkCreatePipelineLayout;
2060 if (!strcmp(name, "CreateSampler"))
2061 return (void*) vkCreateSampler;
2062 if (!strcmp(name, "CreateDescriptorSetLayout"))
2063 return (void*) vkCreateDescriptorSetLayout;
2064 if (!strcmp(name, "CreateDescriptorPool"))
2065 return (void*) vkCreateDescriptorPool;
2066 if (!strcmp(name, "ResetDescriptorPool"))
2067 return (void*) vkResetDescriptorPool;
2068 if (!strcmp(name, "AllocDescriptorSets"))
2069 return (void*) vkAllocDescriptorSets;
2070 if (!strcmp(name, "ClearDescriptorSets"))
2071 return (void*) vkClearDescriptorSets;
2072 if (!strcmp(name, "CreateDynamicViewportState"))
2073 return (void*) vkCreateDynamicViewportState;
2074 if (!strcmp(name, "CreateDynamicRasterState"))
2075 return (void*) vkCreateDynamicRasterState;
2076 if (!strcmp(name, "CreateDynamicColorBlendState"))
2077 return (void*) vkCreateDynamicColorBlendState;
2078 if (!strcmp(name, "CreateDynamicDepthStencilState"))
2079 return (void*) vkCreateDynamicDepthStencilState;
2080 if (!strcmp(name, "CreateCommandBuffer"))
2081 return (void*) vkCreateCommandBuffer;
2082 if (!strcmp(name, "BeginCommandBuffer"))
2083 return (void*) vkBeginCommandBuffer;
2084 if (!strcmp(name, "EndCommandBuffer"))
2085 return (void*) vkEndCommandBuffer;
2086 if (!strcmp(name, "ResetCommandBuffer"))
2087 return (void*) vkResetCommandBuffer;
2088 if (!strcmp(name, "CmdBindPipeline"))
2089 return (void*) vkCmdBindPipeline;
2090 if (!strcmp(name, "CmdBindDynamicStateObject"))
2091 return (void*) vkCmdBindDynamicStateObject;
2092 if (!strcmp(name, "CmdBindDescriptorSets"))
2093 return (void*) vkCmdBindDescriptorSets;
2094 if (!strcmp(name, "CmdBindVertexBuffers"))
2095 return (void*) vkCmdBindVertexBuffers;
2096 if (!strcmp(name, "CmdBindIndexBuffer"))
2097 return (void*) vkCmdBindIndexBuffer;
2098 if (!strcmp(name, "CmdDraw"))
2099 return (void*) vkCmdDraw;
2100 if (!strcmp(name, "CmdDrawIndexed"))
2101 return (void*) vkCmdDrawIndexed;
2102 if (!strcmp(name, "CmdDrawIndirect"))
2103 return (void*) vkCmdDrawIndirect;
2104 if (!strcmp(name, "CmdDrawIndexedIndirect"))
2105 return (void*) vkCmdDrawIndexedIndirect;
2106 if (!strcmp(name, "CmdDispatch"))
2107 return (void*) vkCmdDispatch;
2108 if (!strcmp(name, "CmdDispatchIndirect"))
2109 return (void*) vkCmdDispatchIndirect;
2110 if (!strcmp(name, "CmdCopyBuffer"))
2111 return (void*) vkCmdCopyBuffer;
2112 if (!strcmp(name, "CmdCopyImage"))
2113 return (void*) vkCmdCopyImage;
2114 if (!strcmp(name, "CmdBlitImage"))
2115 return (void*) vkCmdBlitImage;
2116 if (!strcmp(name, "CmdCopyBufferToImage"))
2117 return (void*) vkCmdCopyBufferToImage;
2118 if (!strcmp(name, "CmdCopyImageToBuffer"))
2119 return (void*) vkCmdCopyImageToBuffer;
2120 if (!strcmp(name, "CmdUpdateBuffer"))
2121 return (void*) vkCmdUpdateBuffer;
2122 if (!strcmp(name, "CmdFillBuffer"))
2123 return (void*) vkCmdFillBuffer;
2124 if (!strcmp(name, "CmdClearColorImage"))
2125 return (void*) vkCmdClearColorImage;
2126 if (!strcmp(name, "CmdClearDepthStencil"))
2127 return (void*) vkCmdClearDepthStencil;
2128 if (!strcmp(name, "CmdResolveImage"))
2129 return (void*) vkCmdResolveImage;
2130 if (!strcmp(name, "CmdSetEvent"))
2131 return (void*) vkCmdSetEvent;
2132 if (!strcmp(name, "CmdResetEvent"))
2133 return (void*) vkCmdResetEvent;
2134 if (!strcmp(name, "CmdWaitEvents"))
2135 return (void*) vkCmdWaitEvents;
2136 if (!strcmp(name, "CmdPipelineBarrier"))
2137 return (void*) vkCmdPipelineBarrier;
2138 if (!strcmp(name, "CmdBeginQuery"))
2139 return (void*) vkCmdBeginQuery;
2140 if (!strcmp(name, "CmdEndQuery"))
2141 return (void*) vkCmdEndQuery;
2142 if (!strcmp(name, "CmdResetQueryPool"))
2143 return (void*) vkCmdResetQueryPool;
2144 if (!strcmp(name, "CmdWriteTimestamp"))
2145 return (void*) vkCmdWriteTimestamp;
2146 if (!strcmp(name, "CmdCopyQueryPoolResults"))
2147 return (void*) vkCmdCopyQueryPoolResults;
2148 if (!strcmp(name, "CmdInitAtomicCounters"))
2149 return (void*) vkCmdInitAtomicCounters;
2150 if (!strcmp(name, "CmdLoadAtomicCounters"))
2151 return (void*) vkCmdLoadAtomicCounters;
2152 if (!strcmp(name, "CmdSaveAtomicCounters"))
2153 return (void*) vkCmdSaveAtomicCounters;
2154 if (!strcmp(name, "CreateFramebuffer"))
2155 return (void*) vkCreateFramebuffer;
2156 if (!strcmp(name, "CreateRenderPass"))
2157 return (void*) vkCreateRenderPass;
2158 if (!strcmp(name, "CmdBeginRenderPass"))
2159 return (void*) vkCmdBeginRenderPass;
2160 if (!strcmp(name, "CmdEndRenderPass"))
2161 return (void*) vkCmdEndRenderPass;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002162 if (!strcmp(name, "GetDisplayInfoWSI"))
2163 return (void*) vkGetDisplayInfoWSI;
2164 if (!strcmp(name, "CreateSwapChainWSI"))
2165 return (void*) vkCreateSwapChainWSI;
2166 if (!strcmp(name, "DestroySwapChainWSI"))
2167 return (void*) vkDestroySwapChainWSI;
2168 if (!strcmp(name, "GetSwapChainInfoWSI"))
2169 return (void*) vkGetSwapChainInfoWSI;
2170 if (!strcmp(name, "QueuePresentWSI"))
2171 return (void*) vkQueuePresentWSI;
2172
2173 return NULL;
2174}
2175
2176static inline void* layer_intercept_instance_proc(const char *name)
2177{
2178 if (!name || name[0] != 'v' || name[1] != 'k')
2179 return NULL;
2180
2181 name += 2;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002182 if (!strcmp(name, "CreateInstance"))
2183 return (void*) vkCreateInstance;
2184 if (!strcmp(name, "DestroyInstance"))
2185 return (void*) vkDestroyInstance;
2186 if (!strcmp(name, "GetPhysicalDeviceInfo"))
2187 return (void*) vkGetPhysicalDeviceInfo;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002188 if (!strcmp(name, "CreateDevice"))
2189 return (void*) vkCreateDevice;
2190 if (!strcmp(name, "GetGlobalExtensionInfo"))
2191 return (void*) vkGetGlobalExtensionInfo;
2192 if (!strcmp(name, "GetPhysicalDeviceExtensionInfo"))
2193 return (void*) vkGetPhysicalDeviceExtensionInfo;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002194 if (!strcmp(name, "GetMultiDeviceCompatibility"))
2195 return (void*) vkGetMultiDeviceCompatibility;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002196
2197 return NULL;
2198}
2199
Jon Ashburn1245cec2015-05-18 13:20:15 -06002200VK_LAYER_EXPORT void* VKAPI vkGetDeviceProcAddr(VkDevice device, const char* funcName)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002201{
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002202 void* addr;
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002203 if (device == NULL) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002204 return NULL;
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002205 }
2206
Jon Ashburnd9564002015-05-07 10:27:37 -06002207 loader_platform_thread_once(&initOnce, initParamChecker);
Jon Ashburn4f2575f2015-05-28 16:25:02 -06002208
2209 /* loader uses this to force layer initialization; device object is wrapped */
2210 if (!strcmp(funcName, "vkGetDeviceProcAddr")) {
2211 initDeviceTable((const VkBaseLayerObject *) device);
2212 return (void*) vkGetDeviceProcAddr;
2213 }
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002214
2215 addr = layer_intercept_proc(funcName);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002216 if (addr) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002217 return addr;
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002218 }
Jon Ashburn6f8cd632015-06-01 09:37:38 -06002219
2220 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) device;
2221 if (!deviceExtMap[pDisp].debug_marker_enabled)
2222 {
2223 if (!strcmp(funcName, "CmdDbgMarkerBegin"))
2224 return (void*) vkCmdDbgMarkerBegin;
2225 if (!strcmp(funcName, "CmdDbgMarkerEnd"))
2226 return (void*) vkCmdDbgMarkerEnd;
2227 if (!strcmp(funcName, "DbgSetObjectTag"))
2228 return (void*) vkDbgSetObjectTag;
2229 if (!strcmp(funcName, "DbgSetObjectName"))
2230 return (void*) vkDbgSetObjectName;
2231 }
2232 {
Jon Ashburn5a10d212015-06-01 10:02:09 -06002233 VkLayerDispatchTable* pTable = device_dispatch_table(device);
Jon Ashburn4f2575f2015-05-28 16:25:02 -06002234 if (pTable->GetDeviceProcAddr == NULL)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002235 return NULL;
Jon Ashburn4f2575f2015-05-28 16:25:02 -06002236 return pTable->GetDeviceProcAddr(device, funcName);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002237 }
2238}
2239
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002240VK_LAYER_EXPORT void* VKAPI vkGetInstanceProcAddr(VkInstance instance, const char* funcName)
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002241{
Courtney Goeltzenleuchter09f85042015-06-01 14:45:27 -06002242 void *fptr;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002243 void* addr;
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002244 if (instance == NULL) {
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002245 return NULL;
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002246 }
2247
Jon Ashburnd9564002015-05-07 10:27:37 -06002248 loader_platform_thread_once(&initOnce, initParamChecker);
Jon Ashburn4f2575f2015-05-28 16:25:02 -06002249
2250 /* loader uses this to force layer initialization; instance object is wrapped */
2251 if (!strcmp(funcName, "vkGetInstanceProcAddr")) {
2252 initInstanceTable((const VkBaseLayerObject *) instance);
2253 return (void*) vkGetInstanceProcAddr;
2254 }
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002255
2256 addr = layer_intercept_instance_proc(funcName);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002257 if (addr) {
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002258 return addr;
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002259 }
Courtney Goeltzenleuchter09f85042015-06-01 14:45:27 -06002260
2261 fptr = msg_callback_get_proc_addr(funcName);
2262 if (fptr)
2263 return fptr;
2264
Jon Ashburn5a10d212015-06-01 10:02:09 -06002265 VkLayerInstanceDispatchTable* pTable = instance_dispatch_table(instance);
2266 if (pTable->GetInstanceProcAddr == NULL)
2267 return NULL;
2268 return pTable->GetInstanceProcAddr(instance, funcName);
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002269}