blob: eeea84b09ec7f0fa6d5eff05bdd371c327df57ef [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
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08001064VK_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 -06001065{
1066
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001067 return device_dispatch_table(device)->UpdateDescriptorSets(device, writeCount, pDescriptorWrites, copyCount, pDescriptorCopies);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001068}
1069
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001070VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicViewportState(VkDevice device, const VkDynamicVpStateCreateInfo* pCreateInfo, VkDynamicVpState* pState)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001071{
1072 char str[1024];
1073 if (!pCreateInfo) {
1074 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDynamicViewportState is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001075 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001076 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001077 else if (!vk_validate_vkdynamicvpstatecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001078 sprintf(str, "Parameter pCreateInfo to function CreateDynamicViewportState contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001079 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001080 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001081 VkResult result = device_dispatch_table(device)->CreateDynamicViewportState(device, pCreateInfo, pState);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001082 return result;
1083}
1084
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001085VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicRasterState(VkDevice device, const VkDynamicRsStateCreateInfo* pCreateInfo, VkDynamicRsState* pState)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001086{
1087 char str[1024];
1088 if (!pCreateInfo) {
1089 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDynamicRasterState is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001090 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001091 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001092 else if (!vk_validate_vkdynamicrsstatecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001093 sprintf(str, "Parameter pCreateInfo to function CreateDynamicRasterState contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001094 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001095 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001096 VkResult result = device_dispatch_table(device)->CreateDynamicRasterState(device, pCreateInfo, pState);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001097 return result;
1098}
1099
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001100VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(VkDevice device, const VkDynamicCbStateCreateInfo* pCreateInfo, VkDynamicCbState* pState)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001101{
1102 char str[1024];
1103 if (!pCreateInfo) {
1104 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDynamicColorBlendState is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001105 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001106 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001107 else if (!vk_validate_vkdynamiccbstatecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001108 sprintf(str, "Parameter pCreateInfo to function CreateDynamicColorBlendState contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001109 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001110 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001111 VkResult result = device_dispatch_table(device)->CreateDynamicColorBlendState(device, pCreateInfo, pState);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001112 return result;
1113}
1114
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001115VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(VkDevice device, const VkDynamicDsStateCreateInfo* pCreateInfo, VkDynamicDsState* pState)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001116{
1117 char str[1024];
1118 if (!pCreateInfo) {
1119 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDynamicDepthStencilState is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001120 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001121 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001122 else if (!vk_validate_vkdynamicdsstatecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001123 sprintf(str, "Parameter pCreateInfo to function CreateDynamicDepthStencilState contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001124 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001125 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001126 VkResult result = device_dispatch_table(device)->CreateDynamicDepthStencilState(device, pCreateInfo, pState);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001127 return result;
1128}
1129
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001130void PreCreateCommandBuffer(VkDevice device, const VkCmdBufferCreateInfo* pCreateInfo)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001131{
1132 if(device == nullptr)
1133 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001134 char const str[] = "vkCreateCommandBuffer parameter, VkDevice device, is "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001135 "nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001136 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001137 return;
1138 }
1139
1140 if(pCreateInfo == nullptr)
1141 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001142 char const str[] = "vkCreateCommandBuffer parameter, VkCmdBufferCreateInfo* pCreateInfo, is "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001143 "nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001144 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001145 return;
1146 }
1147
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001148 if(pCreateInfo->sType != VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001149 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001150 char const str[] = "vkCreateCommandBuffer parameter, VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO "\
1151 "pCreateInfo->sType, is not VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001152 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001153 return;
1154 }
1155}
1156
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001157void PostCreateCommandBuffer(VkResult result, VkCmdBuffer* pCmdBuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001158{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001159 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001160 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001161 // TODO: Spit out VkResult value.
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001162 char const str[] = "vkCreateCommandBuffer failed (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001163 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001164 return;
1165 }
1166
1167 if(pCmdBuffer == nullptr)
1168 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001169 char const str[] = "vkCreateCommandBuffer parameter, VkCmdBuffer* pCmdBuffer, is nullptr (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001170 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001171 return;
1172 }
1173}
1174
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001175VK_LAYER_EXPORT VkResult VKAPI vkCreateCommandBuffer(VkDevice device,
1176 const VkCmdBufferCreateInfo* pCreateInfo, VkCmdBuffer* pCmdBuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001177{
1178 PreCreateCommandBuffer(device, pCreateInfo);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001179 VkResult result = device_dispatch_table(device)->CreateCommandBuffer(device, pCreateInfo, pCmdBuffer);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001180 PostCreateCommandBuffer(result, pCmdBuffer);
1181 return result;
1182}
1183
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001184VK_LAYER_EXPORT VkResult VKAPI vkBeginCommandBuffer(VkCmdBuffer cmdBuffer, const VkCmdBufferBeginInfo* pBeginInfo)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001185{
1186 char str[1024];
1187 if (!pBeginInfo) {
1188 sprintf(str, "Struct ptr parameter pBeginInfo to function BeginCommandBuffer is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001189 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001190 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001191 else if (!vk_validate_vkcmdbufferbegininfo(pBeginInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001192 sprintf(str, "Parameter pBeginInfo to function BeginCommandBuffer contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001193 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001194 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001195 VkResult result = device_dispatch_table(cmdBuffer)->BeginCommandBuffer(cmdBuffer, pBeginInfo);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001196 return result;
1197}
1198
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001199VK_LAYER_EXPORT VkResult VKAPI vkEndCommandBuffer(VkCmdBuffer cmdBuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001200{
1201
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001202 VkResult result = device_dispatch_table(cmdBuffer)->EndCommandBuffer(cmdBuffer);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001203 return result;
1204}
1205
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001206VK_LAYER_EXPORT VkResult VKAPI vkResetCommandBuffer(VkCmdBuffer cmdBuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001207{
1208
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001209 VkResult result = device_dispatch_table(cmdBuffer)->ResetCommandBuffer(cmdBuffer);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001210 return result;
1211}
1212
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001213VK_LAYER_EXPORT void VKAPI vkCmdBindPipeline(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001214{
1215 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001216 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001217 sprintf(str, "Parameter pipelineBindPoint to function CmdBindPipeline has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001218 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001219 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001220 device_dispatch_table(cmdBuffer)->CmdBindPipeline(cmdBuffer, pipelineBindPoint, pipeline);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001221}
1222
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001223VK_LAYER_EXPORT void VKAPI vkCmdBindDynamicStateObject(VkCmdBuffer cmdBuffer, VkStateBindPoint stateBindPoint, VkDynamicStateObject state)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001224{
1225 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001226 if (!validate_VkStateBindPoint(stateBindPoint)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001227 sprintf(str, "Parameter stateBindPoint to function CmdBindDynamicStateObject has invalid value of %i.", (int)stateBindPoint);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001228 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001229 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001230 device_dispatch_table(cmdBuffer)->CmdBindDynamicStateObject(cmdBuffer, stateBindPoint, state);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001231}
1232
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001233VK_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 -06001234{
1235 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001236 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001237 sprintf(str, "Parameter pipelineBindPoint to function CmdBindDescriptorSets has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001238 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001239 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001240 device_dispatch_table(cmdBuffer)->CmdBindDescriptorSets(cmdBuffer, pipelineBindPoint, firstSet, setCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001241}
1242
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001243VK_LAYER_EXPORT void VKAPI vkCmdBindVertexBuffers(
1244 VkCmdBuffer cmdBuffer,
1245 uint32_t startBinding,
1246 uint32_t bindingCount,
1247 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001248 const VkDeviceSize* pOffsets)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001249{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001250 device_dispatch_table(cmdBuffer)->CmdBindVertexBuffers(cmdBuffer, startBinding, bindingCount, pBuffers, pOffsets);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001251}
1252
Tony Barbour8205d902015-04-16 15:59:00 -06001253VK_LAYER_EXPORT void VKAPI vkCmdBindIndexBuffer(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001254{
1255 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001256 if (!validate_VkIndexType(indexType)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001257 sprintf(str, "Parameter indexType to function CmdBindIndexBuffer has invalid value of %i.", (int)indexType);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001258 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001259 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001260 device_dispatch_table(cmdBuffer)->CmdBindIndexBuffer(cmdBuffer, buffer, offset, indexType);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001261}
1262
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001263VK_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 -06001264{
1265
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001266 device_dispatch_table(cmdBuffer)->CmdDraw(cmdBuffer, firstVertex, vertexCount, firstInstance, instanceCount);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001267}
1268
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001269VK_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 -06001270{
1271
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001272 device_dispatch_table(cmdBuffer)->CmdDrawIndexed(cmdBuffer, firstIndex, indexCount, vertexOffset, firstInstance, instanceCount);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001273}
1274
Tony Barbour8205d902015-04-16 15:59:00 -06001275VK_LAYER_EXPORT void VKAPI vkCmdDrawIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001276{
1277
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001278 device_dispatch_table(cmdBuffer)->CmdDrawIndirect(cmdBuffer, buffer, offset, count, stride);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001279}
1280
Tony Barbour8205d902015-04-16 15:59:00 -06001281VK_LAYER_EXPORT void VKAPI vkCmdDrawIndexedIndirect(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)->CmdDrawIndexedIndirect(cmdBuffer, buffer, offset, count, stride);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001285}
1286
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001287VK_LAYER_EXPORT void VKAPI vkCmdDispatch(VkCmdBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001288{
1289
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001290 device_dispatch_table(cmdBuffer)->CmdDispatch(cmdBuffer, x, y, z);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001291}
1292
Tony Barbour8205d902015-04-16 15:59:00 -06001293VK_LAYER_EXPORT void VKAPI vkCmdDispatchIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001294{
1295
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001296 device_dispatch_table(cmdBuffer)->CmdDispatchIndirect(cmdBuffer, buffer, offset);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001297}
1298
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001299VK_LAYER_EXPORT void VKAPI vkCmdCopyBuffer(VkCmdBuffer cmdBuffer, VkBuffer srcBuffer, VkBuffer destBuffer, uint32_t regionCount, const VkBufferCopy* pRegions)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001300{
1301 char str[1024];
1302 uint32_t i;
1303 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001304 if (!vk_validate_vkbuffercopy(&pRegions[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001305 sprintf(str, "Parameter pRegions[%i] to function CmdCopyBuffer contains an invalid value.", i);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001306 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001307 }
1308 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001309 device_dispatch_table(cmdBuffer)->CmdCopyBuffer(cmdBuffer, srcBuffer, destBuffer, regionCount, pRegions);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001310}
1311
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001312VK_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 -06001313{
1314 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001315 if (!validate_VkImageLayout(srcImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001316 sprintf(str, "Parameter srcImageLayout to function CmdCopyImage has invalid value of %i.", (int)srcImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001317 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001318 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001319 if (!validate_VkImageLayout(destImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001320 sprintf(str, "Parameter destImageLayout to function CmdCopyImage has invalid value of %i.", (int)destImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001321 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001322 }
1323 uint32_t i;
1324 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001325 if (!vk_validate_vkimagecopy(&pRegions[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001326 sprintf(str, "Parameter pRegions[%i] to function CmdCopyImage contains an invalid value.", i);
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 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001330 device_dispatch_table(cmdBuffer)->CmdCopyImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, regionCount, pRegions);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001331}
1332
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001333VK_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 -06001334{
1335 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001336 if (!validate_VkImageLayout(srcImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001337 sprintf(str, "Parameter srcImageLayout to function CmdBlitImage has invalid value of %i.", (int)srcImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001338 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001339 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001340 if (!validate_VkImageLayout(destImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001341 sprintf(str, "Parameter destImageLayout to function CmdBlitImage has invalid value of %i.", (int)destImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001342 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001343 }
1344 uint32_t i;
1345 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001346 if (!vk_validate_vkimageblit(&pRegions[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001347 sprintf(str, "Parameter pRegions[%i] to function CmdBlitImage contains an invalid value.", i);
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 }
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001351 //TODO: Add additional check for limitation from header rev 96.
1352 // VK_TEX_FILTER_NEAREST if the format that srcImage was created with is an integer-based format.
1353
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001354 device_dispatch_table(cmdBuffer)->CmdBlitImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, regionCount, pRegions, filter);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001355}
1356
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001357VK_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 -06001358{
1359 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001360 if (!validate_VkImageLayout(destImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001361 sprintf(str, "Parameter destImageLayout to function CmdCopyBufferToImage has invalid value of %i.", (int)destImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001362 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001363 }
1364 uint32_t i;
1365 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001366 if (!vk_validate_vkbufferimagecopy(&pRegions[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001367 sprintf(str, "Parameter pRegions[%i] to function CmdCopyBufferToImage contains an invalid value.", i);
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 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001371 device_dispatch_table(cmdBuffer)->CmdCopyBufferToImage(cmdBuffer, srcBuffer, destImage, destImageLayout, regionCount, pRegions);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001372}
1373
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001374VK_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 -06001375{
1376 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001377 if (!validate_VkImageLayout(srcImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001378 sprintf(str, "Parameter srcImageLayout to function CmdCopyImageToBuffer has invalid value of %i.", (int)srcImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001379 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001380 }
1381 uint32_t i;
1382 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001383 if (!vk_validate_vkbufferimagecopy(&pRegions[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001384 sprintf(str, "Parameter pRegions[%i] to function CmdCopyImageToBuffer contains an invalid value.", i);
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 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001388 device_dispatch_table(cmdBuffer)->CmdCopyImageToBuffer(cmdBuffer, srcImage, srcImageLayout, destBuffer, regionCount, pRegions);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001389}
1390
Tony Barbour8205d902015-04-16 15:59:00 -06001391VK_LAYER_EXPORT void VKAPI vkCmdUpdateBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const uint32_t* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001392{
1393
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001394 device_dispatch_table(cmdBuffer)->CmdUpdateBuffer(cmdBuffer, destBuffer, destOffset, dataSize, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001395}
1396
Tony Barbour8205d902015-04-16 15:59:00 -06001397VK_LAYER_EXPORT void VKAPI vkCmdFillBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001398{
1399
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001400 device_dispatch_table(cmdBuffer)->CmdFillBuffer(cmdBuffer, destBuffer, destOffset, fillSize, data);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001401}
1402
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001403VK_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 -06001404{
1405 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001406 if (!validate_VkImageLayout(imageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001407 sprintf(str, "Parameter imageLayout to function CmdClearColorImage has invalid value of %i.", (int)imageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001408 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001409 }
1410 uint32_t i;
1411 for (i = 0; i < rangeCount; i++) {
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001412 if (!vk_validate_vkimagesubresourcerange(&pRanges[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001413 sprintf(str, "Parameter pRanges[%i] to function CmdClearColorImage contains an invalid value.", i);
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 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001417 device_dispatch_table(cmdBuffer)->CmdClearColorImage(cmdBuffer, image, imageLayout, pColor, rangeCount, pRanges);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001418}
1419
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001420VK_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 -06001421{
1422 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001423 if (!validate_VkImageLayout(imageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001424 sprintf(str, "Parameter imageLayout to function CmdClearDepthStencil has invalid value of %i.", (int)imageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001425 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001426 }
1427 uint32_t i;
1428 for (i = 0; i < rangeCount; i++) {
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001429 if (!vk_validate_vkimagesubresourcerange(&pRanges[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001430 sprintf(str, "Parameter pRanges[%i] to function CmdClearDepthStencil contains an invalid value.", i);
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 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001434 device_dispatch_table(cmdBuffer)->CmdClearDepthStencil(cmdBuffer, image, imageLayout, depth, stencil, rangeCount, pRanges);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001435}
1436
Tony Barbour11f74372015-04-13 15:02:52 -06001437VK_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 -06001438{
1439 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001440 if (!validate_VkImageLayout(srcImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001441 sprintf(str, "Parameter srcImageLayout to function CmdResolveImage has invalid value of %i.", (int)srcImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001442 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001443 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001444 if (!validate_VkImageLayout(destImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001445 sprintf(str, "Parameter destImageLayout to function CmdResolveImage has invalid value of %i.", (int)destImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001446 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001447 }
1448 uint32_t i;
Tony Barbour11f74372015-04-13 15:02:52 -06001449 for (i = 0; i < regionCount; i++) {
1450 if (!vk_validate_vkimageresolve(&pRegions[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001451 sprintf(str, "Parameter pRects[%i] to function CmdResolveImage contains an invalid value.", i);
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 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001455 device_dispatch_table(cmdBuffer)->CmdResolveImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, regionCount, pRegions);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001456}
1457
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001458VK_LAYER_EXPORT void VKAPI vkCmdSetEvent(VkCmdBuffer cmdBuffer, VkEvent event, VkPipeEvent pipeEvent)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001459{
1460 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001461 if (!validate_VkPipeEvent(pipeEvent)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001462 sprintf(str, "Parameter pipeEvent to function CmdSetEvent has invalid value of %i.", (int)pipeEvent);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001463 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001464 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001465 device_dispatch_table(cmdBuffer)->CmdSetEvent(cmdBuffer, event, pipeEvent);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001466}
1467
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001468VK_LAYER_EXPORT void VKAPI vkCmdResetEvent(VkCmdBuffer cmdBuffer, VkEvent event, VkPipeEvent pipeEvent)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001469{
1470 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001471 if (!validate_VkPipeEvent(pipeEvent)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001472 sprintf(str, "Parameter pipeEvent to function CmdResetEvent has invalid value of %i.", (int)pipeEvent);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001473 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001474 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001475 device_dispatch_table(cmdBuffer)->CmdResetEvent(cmdBuffer, event, pipeEvent);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001476}
1477
Tony Barbour8205d902015-04-16 15:59:00 -06001478VK_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 -06001479{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001480 device_dispatch_table(cmdBuffer)->CmdWaitEvents(cmdBuffer, waitEvent, eventCount, pEvents, memBarrierCount, ppMemBarriers);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001481}
1482
Tony Barbour8205d902015-04-16 15:59:00 -06001483VK_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 -06001484{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001485 device_dispatch_table(cmdBuffer)->CmdPipelineBarrier(cmdBuffer, waitEvent, pipeEventCount, pPipeEvents, memBarrierCount, ppMemBarriers);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001486}
1487
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001488VK_LAYER_EXPORT void VKAPI vkCmdBeginQuery(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkFlags flags)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001489{
1490
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001491 device_dispatch_table(cmdBuffer)->CmdBeginQuery(cmdBuffer, queryPool, slot, flags);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001492}
1493
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001494VK_LAYER_EXPORT void VKAPI vkCmdEndQuery(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001495{
1496
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001497 device_dispatch_table(cmdBuffer)->CmdEndQuery(cmdBuffer, queryPool, slot);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001498}
1499
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001500VK_LAYER_EXPORT void VKAPI vkCmdResetQueryPool(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001501{
1502
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001503 device_dispatch_table(cmdBuffer)->CmdResetQueryPool(cmdBuffer, queryPool, startQuery, queryCount);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001504}
1505
Tony Barbour8205d902015-04-16 15:59:00 -06001506VK_LAYER_EXPORT void VKAPI vkCmdWriteTimestamp(VkCmdBuffer cmdBuffer, VkTimestampType timestampType, VkBuffer destBuffer, VkDeviceSize destOffset)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001507{
1508 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001509 if (!validate_VkTimestampType(timestampType)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001510 sprintf(str, "Parameter timestampType to function CmdWriteTimestamp has invalid value of %i.", (int)timestampType);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001511 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001512 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001513 device_dispatch_table(cmdBuffer)->CmdWriteTimestamp(cmdBuffer, timestampType, destBuffer, destOffset);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001514}
1515
Jeremy Hayescf469132015-04-17 10:36:53 -06001516VK_LAYER_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1517 VkCmdBuffer cmdBuffer,
1518 VkQueryPool queryPool,
1519 uint32_t startQuery,
1520 uint32_t queryCount,
1521 VkBuffer destBuffer,
1522 VkDeviceSize destOffset,
1523 VkDeviceSize destStride,
1524 VkQueryResultFlags flags)
1525{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001526 device_dispatch_table(cmdBuffer)->CmdCopyQueryPoolResults(cmdBuffer, queryPool, startQuery, queryCount, destBuffer, destOffset, destStride, flags);
Jeremy Hayescf469132015-04-17 10:36:53 -06001527}
1528
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001529VK_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 -06001530{
1531 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001532 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001533 sprintf(str, "Parameter pipelineBindPoint to function CmdInitAtomicCounters has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001534 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001535 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001536 device_dispatch_table(cmdBuffer)->CmdInitAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001537}
1538
Tony Barbour8205d902015-04-16 15:59:00 -06001539VK_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 -06001540{
1541 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001542 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001543 sprintf(str, "Parameter pipelineBindPoint to function CmdLoadAtomicCounters has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001544 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001545 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001546 device_dispatch_table(cmdBuffer)->CmdLoadAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, srcBuffer, srcOffset);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001547}
1548
Tony Barbour8205d902015-04-16 15:59:00 -06001549VK_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 -06001550{
1551 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001552 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001553 sprintf(str, "Parameter pipelineBindPoint to function CmdSaveAtomicCounters has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001554 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001555 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001556 device_dispatch_table(cmdBuffer)->CmdSaveAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, destBuffer, destOffset);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001557}
1558
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001559VK_LAYER_EXPORT VkResult VKAPI vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, VkFramebuffer* pFramebuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001560{
1561 char str[1024];
1562 if (!pCreateInfo) {
1563 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateFramebuffer is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001564 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001565 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001566 else if (!vk_validate_vkframebuffercreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001567 sprintf(str, "Parameter pCreateInfo to function CreateFramebuffer contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001568 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001569 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001570 VkResult result = device_dispatch_table(device)->CreateFramebuffer(device, pCreateInfo, pFramebuffer);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001571 return result;
1572}
1573
1574
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001575void PreCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001576{
1577 if(pCreateInfo == nullptr)
1578 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001579 char const str[] = "vkCreateRenderPass parameter, VkRenderPassCreateInfo* pCreateInfo, is "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001580 "nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001581 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001582 return;
1583 }
1584
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001585 if(pCreateInfo->sType != VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001586 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001587 char const str[] = "vkCreateRenderPass parameter, VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO "\
1588 "pCreateInfo->sType, is not VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001589 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001590 return;
1591 }
1592
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001593 if(!vk_validate_vkrect(&pCreateInfo->renderArea))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001594 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001595 char const str[] = "vkCreateRenderPass parameter, VkRect pCreateInfo->renderArea, is invalid "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001596 "(precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001597 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001598 return;
1599 }
1600
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001601 if(!vk_validate_vkextent2d(&pCreateInfo->extent))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001602 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001603 char const str[] = "vkCreateRenderPass parameter, VkExtent2D pCreateInfo->extent, is invalid "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001604 "(precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001605 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001606 return;
1607 }
1608
1609 if(pCreateInfo->pColorFormats == nullptr)
1610 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001611 char const str[] = "vkCreateRenderPass parameter, VkFormat* pCreateInfo->pColorFormats, "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001612 "is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001613 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001614 return;
1615 }
1616
1617 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1618 {
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001619 if(!validate_VkFormat(pCreateInfo->pColorFormats[i]))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001620 {
1621 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001622 ss << "vkCreateRenderPass parameter, VkFormat pCreateInfo->pColorFormats[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001623 "], is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001624 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001625 continue;
1626 }
1627
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001628 VkFormatProperties properties;
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001629 size_t size = sizeof(properties);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001630 VkResult result = device_dispatch_table(device)->GetFormatInfo(device, pCreateInfo->pColorFormats[i],
Tony Barbour8205d902015-04-16 15:59:00 -06001631 VK_FORMAT_INFO_TYPE_PROPERTIES, &size, &properties);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001632 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001633 {
1634 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001635 ss << "vkCreateRenderPass parameter, VkFormat pCreateInfo->pColorFormats[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001636 "], cannot be validated (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001637 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001638 continue;
1639 }
1640
1641 if((properties.linearTilingFeatures) == 0 && (properties.optimalTilingFeatures == 0))
1642 {
1643 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001644 ss << "vkCreateRenderPass parameter, VkFormat pCreateInfo->pColorFormats[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001645 "], contains unsupported format (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001646 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001647 continue;
1648 }
1649
1650 }
1651
1652 if(pCreateInfo->pColorLayouts == nullptr)
1653 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001654 char const str[] = "vkCreateRenderPass parameter, VkImageLayout* pCreateInfo->pColorLayouts, "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001655 "is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001656 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001657 return;
1658 }
1659
1660 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1661 {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001662 if(!validate_VkImageLayout(pCreateInfo->pColorLayouts[i]))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001663 {
1664 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001665 ss << "vkCreateRenderPass parameter, VkImageLayout pCreateInfo->pColorLayouts[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001666 "], is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001667 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001668 continue;
1669 }
1670 }
1671
1672 if(pCreateInfo->pColorLoadOps == nullptr)
1673 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001674 char const str[] = "vkCreateRenderPass parameter, VkAttachmentLoadOp* pCreateInfo->pColorLoadOps, "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001675 "is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001676 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001677 return;
1678 }
1679
1680 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1681 {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001682 if(!validate_VkAttachmentLoadOp(pCreateInfo->pColorLoadOps[i]))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001683 {
1684 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001685 ss << "vkCreateRenderPass parameter, VkAttachmentLoadOp pCreateInfo->pColorLoadOps[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001686 "], is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001687 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001688 continue;
1689 }
1690 }
1691
1692 if(pCreateInfo->pColorStoreOps == nullptr)
1693 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001694 char const str[] = "vkCreateRenderPass parameter, VkAttachmentStoreOp* pCreateInfo->pColorStoreOps, "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001695 "is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001696 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001697 return;
1698 }
1699
1700 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1701 {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001702 if(!validate_VkAttachmentStoreOp(pCreateInfo->pColorStoreOps[i]))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001703 {
1704 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001705 ss << "vkCreateRenderPass parameter, VkAttachmentStoreOp pCreateInfo->pColorStoreOps[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001706 "], is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001707 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001708 continue;
1709 }
1710 }
1711
1712 if(pCreateInfo->pColorLoadClearValues == nullptr)
1713 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001714 char const str[] = "vkCreateRenderPass parameter, VkClearColor* pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001715 "pColorLoadClearValues, is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001716 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001717 return;
1718 }
Jeremy Hayes6b7060b2015-04-07 09:49:05 -06001719
1720 if(pCreateInfo->pColorStoreOps == nullptr)
1721 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001722 char const str[] = "vkCreateRenderPass parameter, VK_ATTACHMENT_STORE_OP* pCreateInfo->pColorStoreOps, "\
Jeremy Hayes9bafb9f2015-04-07 13:38:03 -06001723 "is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001724 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayes6b7060b2015-04-07 09:49:05 -06001725 return;
1726 }
1727
Jeremy Hayes6b7060b2015-04-07 09:49:05 -06001728 if(pCreateInfo->pColorLoadClearValues == nullptr)
1729 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001730 char const str[] = "vkCreateRenderPass parameter, VK_CLEAR_COLOR* pCreateInfo->"\
Jeremy Hayes9bafb9f2015-04-07 13:38:03 -06001731 "pColorLoadClearValues, is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001732 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayes6b7060b2015-04-07 09:49:05 -06001733 return;
1734 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001735
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001736 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1737 {
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001738 if(!vk_validate_vkclearcolor(&(pCreateInfo->pColorLoadClearValues[i])))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001739 {
1740 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001741 ss << "vkCreateRenderPass parameter, VkClearColor pCreateInfo->pColorLoadClearValues[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001742 "], is invalid (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001743 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001744 continue;
1745 }
1746 }
1747
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001748 if(!validate_VkFormat(pCreateInfo->depthStencilFormat))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001749 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001750 char const str[] = "vkCreateRenderPass parameter, VkFormat pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001751 "depthStencilFormat, is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001752 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001753 return;
1754 }
1755
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001756 VkFormatProperties properties;
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001757 size_t size = sizeof(properties);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001758 VkResult result = device_dispatch_table(device)->GetFormatInfo(device, pCreateInfo->depthStencilFormat,
Tony Barbour8205d902015-04-16 15:59:00 -06001759 VK_FORMAT_INFO_TYPE_PROPERTIES, &size, &properties);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001760 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001761 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001762 char const str[] = "vkCreateRenderPass parameter, VkFormat pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001763 "depthStencilFormat, cannot be validated (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001764 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001765 return;
1766 }
1767
1768 if((properties.linearTilingFeatures) == 0 && (properties.optimalTilingFeatures == 0))
1769 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001770 char const str[] = "vkCreateRenderPass parameter, VkFormat pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001771 "depthStencilFormat, contains unsupported format (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001772 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001773 return;
1774 }
1775
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001776 if(!validate_VkImageLayout(pCreateInfo->depthStencilLayout))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001777 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001778 char const str[] = "vkCreateRenderPass parameter, VkImageLayout pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001779 "depthStencilLayout, is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001780 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001781 return;
1782 }
1783
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001784 if(!validate_VkAttachmentLoadOp(pCreateInfo->depthLoadOp))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001785 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001786 char const str[] = "vkCreateRenderPass parameter, VkAttachmentLoadOp pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001787 "depthLoadOp, is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001788 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001789 return;
1790 }
1791
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001792 if(!validate_VkAttachmentStoreOp(pCreateInfo->depthStoreOp))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001793 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001794 char const str[] = "vkCreateRenderPass parameter, VkAttachmentStoreOp pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001795 "depthStoreOp, is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001796 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001797 return;
1798 }
1799
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001800 if(!validate_VkAttachmentLoadOp(pCreateInfo->stencilLoadOp))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001801 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001802 char const str[] = "vkCreateRenderPass parameter, VkAttachmentLoadOp pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001803 "stencilLoadOp, is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001804 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001805 return;
1806 }
1807
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001808 if(!validate_VkAttachmentStoreOp(pCreateInfo->stencilStoreOp))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001809 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001810 char const str[] = "vkCreateRenderPass parameter, VkAttachmentStoreOp pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001811 "stencilStoreOp, is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001812 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001813 return;
1814 }
1815}
1816
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001817void PostCreateRenderPass(VkResult result, VkRenderPass* pRenderPass)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001818{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001819 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001820 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001821 // TODO: Spit out VkResult value.
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001822 char const str[] = "vkCreateRenderPass failed (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001823 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001824 return;
1825 }
1826
1827 if(pRenderPass == nullptr)
1828 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001829 char const str[] = "vkCreateRenderPass parameter, VkRenderPass* pRenderPass, is nullptr (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001830 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001831 return;
1832 }
1833}
1834
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001835VK_LAYER_EXPORT VkResult VKAPI vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, VkRenderPass* pRenderPass)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001836{
1837 PreCreateRenderPass(device, pCreateInfo);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001838 VkResult result = device_dispatch_table(device)->CreateRenderPass(device, pCreateInfo, pRenderPass);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001839 PostCreateRenderPass(result, pRenderPass);
1840 return result;
1841}
1842
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001843VK_LAYER_EXPORT void VKAPI vkCmdBeginRenderPass(VkCmdBuffer cmdBuffer, const VkRenderPassBegin* pRenderPassBegin)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001844{
1845 char str[1024];
1846 if (!pRenderPassBegin) {
1847 sprintf(str, "Struct ptr parameter pRenderPassBegin to function CmdBeginRenderPass is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001848 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001849 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001850 else if (!vk_validate_vkrenderpassbegin(pRenderPassBegin)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001851 sprintf(str, "Parameter pRenderPassBegin to function CmdBeginRenderPass contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001852 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001853 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001854 device_dispatch_table(cmdBuffer)->CmdBeginRenderPass(cmdBuffer, pRenderPassBegin);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001855}
1856
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001857VK_LAYER_EXPORT void VKAPI vkCmdEndRenderPass(VkCmdBuffer cmdBuffer, VkRenderPass renderPass)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001858{
1859
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001860 device_dispatch_table(cmdBuffer)->CmdEndRenderPass(cmdBuffer, renderPass);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001861}
1862
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001863VK_LAYER_EXPORT VkResult VKAPI vkDbgCreateMsgCallback(
1864 VkInstance instance,
1865 VkFlags msgFlags,
1866 const PFN_vkDbgMsgCallback pfnMsgCallback,
1867 void* pUserData,
1868 VkDbgMsgCallback* pMsgCallback)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001869{
Jon Ashburn5a10d212015-06-01 10:02:09 -06001870 VkLayerInstanceDispatchTable *pTable = instance_dispatch_table(instance);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001871 return layer_create_msg_callback(instance, pTable, msgFlags, pfnMsgCallback, pUserData, pMsgCallback);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001872}
1873
Courtney Goeltzenleuchter09f85042015-06-01 14:45:27 -06001874VK_LAYER_EXPORT VkResult VKAPI vkDbgDestroyMsgCallback(
1875 VkInstance instance,
1876 VkDbgMsgCallback msgCallback)
1877{
Courtney Goeltzenleuchter9f171942015-06-13 21:22:12 -06001878 VkLayerInstanceDispatchTable *pTable = instance_dispatch_table(instance);
Courtney Goeltzenleuchter09f85042015-06-01 14:45:27 -06001879 return layer_destroy_msg_callback(instance, pTable, msgCallback);
1880}
1881
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001882VK_LAYER_EXPORT void VKAPI vkCmdDbgMarkerBegin(VkCmdBuffer cmdBuffer, const char* pMarker)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001883{
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001884 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) cmdBuffer;
1885 if (!deviceExtMap[pDisp].debug_marker_enabled) {
Jon Ashburnf0615e22015-05-25 14:11:37 -06001886 char const str[] = "Attempt to use CmdDbgMarkerBegin but extension disabled!";
1887 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001888 return;
Jon Ashburnf0615e22015-05-25 14:11:37 -06001889 }
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001890 debug_marker_dispatch_table(cmdBuffer)->CmdDbgMarkerBegin(cmdBuffer, pMarker);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001891}
1892
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001893VK_LAYER_EXPORT void VKAPI vkCmdDbgMarkerEnd(VkCmdBuffer cmdBuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001894{
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001895 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) cmdBuffer;
1896 if (!deviceExtMap[pDisp].debug_marker_enabled) {
Jon Ashburnf0615e22015-05-25 14:11:37 -06001897 char const str[] = "Attempt to use CmdDbgMarkerEnd but extension disabled!";
1898 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001899 return;
Jon Ashburnf0615e22015-05-25 14:11:37 -06001900 }
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001901 debug_marker_dispatch_table(cmdBuffer)->CmdDbgMarkerEnd(cmdBuffer);
Jon Ashburnf0615e22015-05-25 14:11:37 -06001902}
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001903
Jon Ashburnf0615e22015-05-25 14:11:37 -06001904VkResult VKAPI vkDbgSetObjectTag(VkDevice device, VkObjectType objType, VkObject object, size_t tagSize, const void* pTag)
1905{
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001906 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) device;
1907 if (!deviceExtMap[pDisp].debug_marker_enabled) {
Jon Ashburnf0615e22015-05-25 14:11:37 -06001908 char const str[] = "Attempt to use DbgSetObjectTag but extension disabled!";
1909 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001910 return VK_ERROR_UNAVAILABLE;
Jon Ashburnf0615e22015-05-25 14:11:37 -06001911 }
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001912 debug_marker_dispatch_table(device)->DbgSetObjectTag(device, objType, object, tagSize, pTag);
Jon Ashburnf0615e22015-05-25 14:11:37 -06001913}
1914
1915VkResult VKAPI vkDbgSetObjectName(VkDevice device, VkObjectType objType, VkObject object, size_t nameSize, const char* pName)
1916{
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001917 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) device;
1918 if (!deviceExtMap[pDisp].debug_marker_enabled) {
Jon Ashburnf0615e22015-05-25 14:11:37 -06001919 char const str[] = "Attempt to use DbgSetObjectName but extension disabled!";
1920 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001921 return VK_ERROR_UNAVAILABLE;
Jon Ashburnf0615e22015-05-25 14:11:37 -06001922 }
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001923 debug_marker_dispatch_table(device)->DbgSetObjectName(device, objType, object, nameSize, pName);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001924}
1925
Chia-I Wu5b66aa52015-04-16 22:02:10 +08001926VK_LAYER_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(VkDisplayWSI display, VkDisplayInfoTypeWSI infoType, size_t* pDataSize, void* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001927{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001928 VkResult result = instance_dispatch_table(display)->GetDisplayInfoWSI(display, infoType, pDataSize, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001929 return result;
1930}
1931
Chia-I Wu5b66aa52015-04-16 22:02:10 +08001932VK_LAYER_EXPORT VkResult VKAPI vkCreateSwapChainWSI(VkDevice device, const VkSwapChainCreateInfoWSI* pCreateInfo, VkSwapChainWSI* pSwapChain)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001933{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001934 VkResult result = device_dispatch_table(device)->CreateSwapChainWSI(device, pCreateInfo, pSwapChain);
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 vkDestroySwapChainWSI(VkSwapChainWSI swapChain)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001939{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001940 VkResult result = device_dispatch_table(swapChain)->DestroySwapChainWSI(swapChain);
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 vkGetSwapChainInfoWSI(VkSwapChainWSI swapChain, VkSwapChainInfoTypeWSI infoType, size_t* pDataSize, void* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001945{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001946 VkResult result = device_dispatch_table(swapChain)->GetSwapChainInfoWSI(swapChain, infoType, pDataSize, pData);
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 vkQueuePresentWSI(VkQueue queue, const VkPresentInfoWSI* pPresentInfo)
1951{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001952 VkResult result = device_dispatch_table(queue)->QueuePresentWSI(queue, pPresentInfo);
Chia-I Wu5b66aa52015-04-16 22:02:10 +08001953 return result;
1954}
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001955
Jon Ashburn79b78ac2015-05-05 14:22:52 -06001956static inline void* layer_intercept_proc(const char *name)
1957{
1958 if (!name || name[0] != 'v' || name[1] != 'k')
1959 return NULL;
1960
1961 name += 2;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06001962 if (!strcmp(name, "DestroyDevice"))
1963 return (void*) vkDestroyDevice;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06001964 if (!strcmp(name, "GetDeviceQueue"))
1965 return (void*) vkGetDeviceQueue;
1966 if (!strcmp(name, "QueueSubmit"))
1967 return (void*) vkQueueSubmit;
1968 if (!strcmp(name, "QueueWaitIdle"))
1969 return (void*) vkQueueWaitIdle;
1970 if (!strcmp(name, "DeviceWaitIdle"))
1971 return (void*) vkDeviceWaitIdle;
1972 if (!strcmp(name, "AllocMemory"))
1973 return (void*) vkAllocMemory;
1974 if (!strcmp(name, "FreeMemory"))
1975 return (void*) vkFreeMemory;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06001976 if (!strcmp(name, "MapMemory"))
1977 return (void*) vkMapMemory;
1978 if (!strcmp(name, "UnmapMemory"))
1979 return (void*) vkUnmapMemory;
1980 if (!strcmp(name, "FlushMappedMemoryRanges"))
1981 return (void*) vkFlushMappedMemoryRanges;
1982 if (!strcmp(name, "InvalidateMappedMemoryRanges"))
1983 return (void*) vkInvalidateMappedMemoryRanges;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06001984 if (!strcmp(name, "OpenSharedMemory"))
1985 return (void*) vkOpenSharedMemory;
1986 if (!strcmp(name, "OpenSharedSemaphore"))
1987 return (void*) vkOpenSharedSemaphore;
1988 if (!strcmp(name, "OpenPeerMemory"))
1989 return (void*) vkOpenPeerMemory;
1990 if (!strcmp(name, "OpenPeerImage"))
1991 return (void*) vkOpenPeerImage;
1992 if (!strcmp(name, "DestroyObject"))
1993 return (void*) vkDestroyObject;
1994 if (!strcmp(name, "GetObjectInfo"))
1995 return (void*) vkGetObjectInfo;
1996 if (!strcmp(name, "CreateFence"))
1997 return (void*) vkCreateFence;
1998 if (!strcmp(name, "ResetFences"))
1999 return (void*) vkResetFences;
2000 if (!strcmp(name, "GetFenceStatus"))
2001 return (void*) vkGetFenceStatus;
2002 if (!strcmp(name, "WaitForFences"))
2003 return (void*) vkWaitForFences;
2004 if (!strcmp(name, "CreateSemaphore"))
2005 return (void*) vkCreateSemaphore;
2006 if (!strcmp(name, "QueueSignalSemaphore"))
2007 return (void*) vkQueueSignalSemaphore;
2008 if (!strcmp(name, "QueueWaitSemaphore"))
2009 return (void*) vkQueueWaitSemaphore;
2010 if (!strcmp(name, "CreateEvent"))
2011 return (void*) vkCreateEvent;
2012 if (!strcmp(name, "GetEventStatus"))
2013 return (void*) vkGetEventStatus;
2014 if (!strcmp(name, "SetEvent"))
2015 return (void*) vkSetEvent;
2016 if (!strcmp(name, "ResetEvent"))
2017 return (void*) vkResetEvent;
2018 if (!strcmp(name, "CreateQueryPool"))
2019 return (void*) vkCreateQueryPool;
2020 if (!strcmp(name, "GetQueryPoolResults"))
2021 return (void*) vkGetQueryPoolResults;
2022 if (!strcmp(name, "GetFormatInfo"))
2023 return (void*) vkGetFormatInfo;
2024 if (!strcmp(name, "CreateBuffer"))
2025 return (void*) vkCreateBuffer;
2026 if (!strcmp(name, "CreateBufferView"))
2027 return (void*) vkCreateBufferView;
2028 if (!strcmp(name, "CreateImage"))
2029 return (void*) vkCreateImage;
2030 if (!strcmp(name, "GetImageSubresourceInfo"))
2031 return (void*) vkGetImageSubresourceInfo;
2032 if (!strcmp(name, "CreateImageView"))
2033 return (void*) vkCreateImageView;
2034 if (!strcmp(name, "CreateColorAttachmentView"))
2035 return (void*) vkCreateColorAttachmentView;
2036 if (!strcmp(name, "CreateDepthStencilView"))
2037 return (void*) vkCreateDepthStencilView;
2038 if (!strcmp(name, "CreateShader"))
2039 return (void*) vkCreateShader;
2040 if (!strcmp(name, "CreateGraphicsPipeline"))
2041 return (void*) vkCreateGraphicsPipeline;
2042 if (!strcmp(name, "CreateGraphicsPipelineDerivative"))
2043 return (void*) vkCreateGraphicsPipelineDerivative;
2044 if (!strcmp(name, "CreateComputePipeline"))
2045 return (void*) vkCreateComputePipeline;
2046 if (!strcmp(name, "StorePipeline"))
2047 return (void*) vkStorePipeline;
2048 if (!strcmp(name, "LoadPipeline"))
2049 return (void*) vkLoadPipeline;
2050 if (!strcmp(name, "LoadPipelineDerivative"))
2051 return (void*) vkLoadPipelineDerivative;
2052 if (!strcmp(name, "CreatePipelineLayout"))
2053 return (void*) vkCreatePipelineLayout;
2054 if (!strcmp(name, "CreateSampler"))
2055 return (void*) vkCreateSampler;
2056 if (!strcmp(name, "CreateDescriptorSetLayout"))
2057 return (void*) vkCreateDescriptorSetLayout;
2058 if (!strcmp(name, "CreateDescriptorPool"))
2059 return (void*) vkCreateDescriptorPool;
2060 if (!strcmp(name, "ResetDescriptorPool"))
2061 return (void*) vkResetDescriptorPool;
2062 if (!strcmp(name, "AllocDescriptorSets"))
2063 return (void*) vkAllocDescriptorSets;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002064 if (!strcmp(name, "CreateDynamicViewportState"))
2065 return (void*) vkCreateDynamicViewportState;
2066 if (!strcmp(name, "CreateDynamicRasterState"))
2067 return (void*) vkCreateDynamicRasterState;
2068 if (!strcmp(name, "CreateDynamicColorBlendState"))
2069 return (void*) vkCreateDynamicColorBlendState;
2070 if (!strcmp(name, "CreateDynamicDepthStencilState"))
2071 return (void*) vkCreateDynamicDepthStencilState;
2072 if (!strcmp(name, "CreateCommandBuffer"))
2073 return (void*) vkCreateCommandBuffer;
2074 if (!strcmp(name, "BeginCommandBuffer"))
2075 return (void*) vkBeginCommandBuffer;
2076 if (!strcmp(name, "EndCommandBuffer"))
2077 return (void*) vkEndCommandBuffer;
2078 if (!strcmp(name, "ResetCommandBuffer"))
2079 return (void*) vkResetCommandBuffer;
2080 if (!strcmp(name, "CmdBindPipeline"))
2081 return (void*) vkCmdBindPipeline;
2082 if (!strcmp(name, "CmdBindDynamicStateObject"))
2083 return (void*) vkCmdBindDynamicStateObject;
2084 if (!strcmp(name, "CmdBindDescriptorSets"))
2085 return (void*) vkCmdBindDescriptorSets;
2086 if (!strcmp(name, "CmdBindVertexBuffers"))
2087 return (void*) vkCmdBindVertexBuffers;
2088 if (!strcmp(name, "CmdBindIndexBuffer"))
2089 return (void*) vkCmdBindIndexBuffer;
2090 if (!strcmp(name, "CmdDraw"))
2091 return (void*) vkCmdDraw;
2092 if (!strcmp(name, "CmdDrawIndexed"))
2093 return (void*) vkCmdDrawIndexed;
2094 if (!strcmp(name, "CmdDrawIndirect"))
2095 return (void*) vkCmdDrawIndirect;
2096 if (!strcmp(name, "CmdDrawIndexedIndirect"))
2097 return (void*) vkCmdDrawIndexedIndirect;
2098 if (!strcmp(name, "CmdDispatch"))
2099 return (void*) vkCmdDispatch;
2100 if (!strcmp(name, "CmdDispatchIndirect"))
2101 return (void*) vkCmdDispatchIndirect;
2102 if (!strcmp(name, "CmdCopyBuffer"))
2103 return (void*) vkCmdCopyBuffer;
2104 if (!strcmp(name, "CmdCopyImage"))
2105 return (void*) vkCmdCopyImage;
2106 if (!strcmp(name, "CmdBlitImage"))
2107 return (void*) vkCmdBlitImage;
2108 if (!strcmp(name, "CmdCopyBufferToImage"))
2109 return (void*) vkCmdCopyBufferToImage;
2110 if (!strcmp(name, "CmdCopyImageToBuffer"))
2111 return (void*) vkCmdCopyImageToBuffer;
2112 if (!strcmp(name, "CmdUpdateBuffer"))
2113 return (void*) vkCmdUpdateBuffer;
2114 if (!strcmp(name, "CmdFillBuffer"))
2115 return (void*) vkCmdFillBuffer;
2116 if (!strcmp(name, "CmdClearColorImage"))
2117 return (void*) vkCmdClearColorImage;
2118 if (!strcmp(name, "CmdClearDepthStencil"))
2119 return (void*) vkCmdClearDepthStencil;
2120 if (!strcmp(name, "CmdResolveImage"))
2121 return (void*) vkCmdResolveImage;
2122 if (!strcmp(name, "CmdSetEvent"))
2123 return (void*) vkCmdSetEvent;
2124 if (!strcmp(name, "CmdResetEvent"))
2125 return (void*) vkCmdResetEvent;
2126 if (!strcmp(name, "CmdWaitEvents"))
2127 return (void*) vkCmdWaitEvents;
2128 if (!strcmp(name, "CmdPipelineBarrier"))
2129 return (void*) vkCmdPipelineBarrier;
2130 if (!strcmp(name, "CmdBeginQuery"))
2131 return (void*) vkCmdBeginQuery;
2132 if (!strcmp(name, "CmdEndQuery"))
2133 return (void*) vkCmdEndQuery;
2134 if (!strcmp(name, "CmdResetQueryPool"))
2135 return (void*) vkCmdResetQueryPool;
2136 if (!strcmp(name, "CmdWriteTimestamp"))
2137 return (void*) vkCmdWriteTimestamp;
2138 if (!strcmp(name, "CmdCopyQueryPoolResults"))
2139 return (void*) vkCmdCopyQueryPoolResults;
2140 if (!strcmp(name, "CmdInitAtomicCounters"))
2141 return (void*) vkCmdInitAtomicCounters;
2142 if (!strcmp(name, "CmdLoadAtomicCounters"))
2143 return (void*) vkCmdLoadAtomicCounters;
2144 if (!strcmp(name, "CmdSaveAtomicCounters"))
2145 return (void*) vkCmdSaveAtomicCounters;
2146 if (!strcmp(name, "CreateFramebuffer"))
2147 return (void*) vkCreateFramebuffer;
2148 if (!strcmp(name, "CreateRenderPass"))
2149 return (void*) vkCreateRenderPass;
2150 if (!strcmp(name, "CmdBeginRenderPass"))
2151 return (void*) vkCmdBeginRenderPass;
2152 if (!strcmp(name, "CmdEndRenderPass"))
2153 return (void*) vkCmdEndRenderPass;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002154 if (!strcmp(name, "GetDisplayInfoWSI"))
2155 return (void*) vkGetDisplayInfoWSI;
2156 if (!strcmp(name, "CreateSwapChainWSI"))
2157 return (void*) vkCreateSwapChainWSI;
2158 if (!strcmp(name, "DestroySwapChainWSI"))
2159 return (void*) vkDestroySwapChainWSI;
2160 if (!strcmp(name, "GetSwapChainInfoWSI"))
2161 return (void*) vkGetSwapChainInfoWSI;
2162 if (!strcmp(name, "QueuePresentWSI"))
2163 return (void*) vkQueuePresentWSI;
2164
2165 return NULL;
2166}
2167
2168static inline void* layer_intercept_instance_proc(const char *name)
2169{
2170 if (!name || name[0] != 'v' || name[1] != 'k')
2171 return NULL;
2172
2173 name += 2;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002174 if (!strcmp(name, "CreateInstance"))
2175 return (void*) vkCreateInstance;
2176 if (!strcmp(name, "DestroyInstance"))
2177 return (void*) vkDestroyInstance;
2178 if (!strcmp(name, "GetPhysicalDeviceInfo"))
2179 return (void*) vkGetPhysicalDeviceInfo;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002180 if (!strcmp(name, "CreateDevice"))
2181 return (void*) vkCreateDevice;
2182 if (!strcmp(name, "GetGlobalExtensionInfo"))
2183 return (void*) vkGetGlobalExtensionInfo;
2184 if (!strcmp(name, "GetPhysicalDeviceExtensionInfo"))
2185 return (void*) vkGetPhysicalDeviceExtensionInfo;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002186 if (!strcmp(name, "GetMultiDeviceCompatibility"))
2187 return (void*) vkGetMultiDeviceCompatibility;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002188
2189 return NULL;
2190}
2191
Jon Ashburn1245cec2015-05-18 13:20:15 -06002192VK_LAYER_EXPORT void* VKAPI vkGetDeviceProcAddr(VkDevice device, const char* funcName)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002193{
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002194 void* addr;
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002195 if (device == NULL) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002196 return NULL;
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002197 }
2198
Jon Ashburnd9564002015-05-07 10:27:37 -06002199 loader_platform_thread_once(&initOnce, initParamChecker);
Jon Ashburn4f2575f2015-05-28 16:25:02 -06002200
2201 /* loader uses this to force layer initialization; device object is wrapped */
2202 if (!strcmp(funcName, "vkGetDeviceProcAddr")) {
2203 initDeviceTable((const VkBaseLayerObject *) device);
2204 return (void*) vkGetDeviceProcAddr;
2205 }
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002206
2207 addr = layer_intercept_proc(funcName);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002208 if (addr) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002209 return addr;
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002210 }
Jon Ashburn6f8cd632015-06-01 09:37:38 -06002211
2212 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) device;
2213 if (!deviceExtMap[pDisp].debug_marker_enabled)
2214 {
2215 if (!strcmp(funcName, "CmdDbgMarkerBegin"))
2216 return (void*) vkCmdDbgMarkerBegin;
2217 if (!strcmp(funcName, "CmdDbgMarkerEnd"))
2218 return (void*) vkCmdDbgMarkerEnd;
2219 if (!strcmp(funcName, "DbgSetObjectTag"))
2220 return (void*) vkDbgSetObjectTag;
2221 if (!strcmp(funcName, "DbgSetObjectName"))
2222 return (void*) vkDbgSetObjectName;
2223 }
2224 {
Jon Ashburn5a10d212015-06-01 10:02:09 -06002225 VkLayerDispatchTable* pTable = device_dispatch_table(device);
Jon Ashburn4f2575f2015-05-28 16:25:02 -06002226 if (pTable->GetDeviceProcAddr == NULL)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002227 return NULL;
Jon Ashburn4f2575f2015-05-28 16:25:02 -06002228 return pTable->GetDeviceProcAddr(device, funcName);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002229 }
2230}
2231
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002232VK_LAYER_EXPORT void* VKAPI vkGetInstanceProcAddr(VkInstance instance, const char* funcName)
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002233{
Courtney Goeltzenleuchter09f85042015-06-01 14:45:27 -06002234 void *fptr;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002235 void* addr;
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002236 if (instance == NULL) {
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002237 return NULL;
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002238 }
2239
Jon Ashburnd9564002015-05-07 10:27:37 -06002240 loader_platform_thread_once(&initOnce, initParamChecker);
Jon Ashburn4f2575f2015-05-28 16:25:02 -06002241
2242 /* loader uses this to force layer initialization; instance object is wrapped */
2243 if (!strcmp(funcName, "vkGetInstanceProcAddr")) {
2244 initInstanceTable((const VkBaseLayerObject *) instance);
2245 return (void*) vkGetInstanceProcAddr;
2246 }
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002247
2248 addr = layer_intercept_instance_proc(funcName);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002249 if (addr) {
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002250 return addr;
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002251 }
Courtney Goeltzenleuchter09f85042015-06-01 14:45:27 -06002252
2253 fptr = msg_callback_get_proc_addr(funcName);
2254 if (fptr)
2255 return fptr;
2256
Jon Ashburn5a10d212015-06-01 10:02:09 -06002257 VkLayerInstanceDispatchTable* pTable = instance_dispatch_table(instance);
2258 if (pTable->GetInstanceProcAddr == NULL)
2259 return NULL;
2260 return pTable->GetInstanceProcAddr(instance, funcName);
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002261}