blob: f7807142e409a4000e3f95554faa166f6888f17d [file] [log] [blame]
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001/*
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06002 * Vulkan
Jeremy Hayesa8b1a8d2015-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>
32
33#include "loader_platform.h"
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -060034#include "vkLayer.h"
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -060035#include "layers_config.h"
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -060036#include "vk_enum_validate_helper.h"
37#include "vk_struct_validate_helper.h"
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -060038//The following is #included again to catch certain OS-specific functions being used:
39#include "loader_platform.h"
40
41#include "layers_msg.h"
42
Jon Ashburnbacb0f52015-04-06 10:58:22 -060043static VkLayerDispatchTable nextTable;
44static VkBaseLayerObject *pCurObj;
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -060045static LOADER_PLATFORM_THREAD_ONCE_DECLARATION(tabOnce);
46
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -060047#include "vk_dispatch_table_helper.h"
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -060048static void initParamChecker(void)
49{
50
51 const char *strOpt;
52 // initialize ParamChecker options
53 getLayerOptionEnum("ParamCheckerReportLevel", (uint32_t *) &g_reportingLevel);
54 g_actionIsDefault = getLayerOptionEnum("ParamCheckerDebugAction", (uint32_t *) &g_debugAction);
55
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -060056 if (g_debugAction & VK_DBG_LAYER_ACTION_LOG_MSG)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -060057 {
58 strOpt = getLayerOption("ParamCheckerLogFilename");
59 if (strOpt)
60 {
61 g_logFile = fopen(strOpt, "w");
62 }
63 if (g_logFile == NULL)
64 g_logFile = stdout;
65 }
66
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060067 PFN_vkGetProcAddr fpNextGPA;
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -060068 fpNextGPA = pCurObj->pGPA;
69 assert(fpNextGPA);
70
Tony Barbourd1c35722015-04-16 15:59:00 -060071 layer_initialize_dispatch_table(&nextTable, fpNextGPA, (VkPhysicalDevice) pCurObj->nextObject);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -060072}
73
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060074void PreCreateInstance(const VkApplicationInfo* pAppInfo, const VkAllocCallbacks* pAllocCb)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -060075{
76 if(pAppInfo == nullptr)
77 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060078 char const str[] = "vkCreateInstance parameter, VkApplicationInfo* pAppInfo, is "\
Mike Stroyan1c8d4d82015-04-06 15:24:46 -060079 "nullptr (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -060080 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -060081 return;
82 }
83
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -060084 if(pAppInfo->sType != VK_STRUCTURE_TYPE_APPLICATION_INFO)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -060085 {
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -060086 char const str[] = "vkCreateInstance parameter, VK_STRUCTURE_TYPE_APPLICATION_INFO "\
87 "pAppInfo->sType, is not VK_STRUCTURE_TYPE_APPLICATION_INFO (precondition).";
88 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -060089 return;
90 }
91
92 // TODO: What else can validated in pAppInfo?
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -060093 // TODO: VK_API_VERSION validation.
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -060094
95 // It's okay if pAllocCb is a nullptr.
96 if(pAllocCb != nullptr)
97 {
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -060098 if(!vk_validate_vkalloccallbacks(pAllocCb))
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -060099 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600100 char const str[] = "vkCreateInstance parameter, VkAllocCallbacks* pAllocCb, "\
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600101 "contains an invalid value (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600102 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600103 return;
104 }
105 }
106}
107
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600108void PostCreateInstance(VkResult result, VkInstance* pInstance)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600109{
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600110 if(result != VK_SUCCESS)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600111 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600112 // TODO: Spit out VkResult value.
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600113 char const str[] = "vkCreateInstance failed (postcondition).";
114 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600115 return;
116 }
117
118 if(pInstance == nullptr)
119 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600120 char const str[] = "vkCreateInstance parameter, VkInstance* pInstance, is nullptr "\
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600121 "(postcondition).";
122 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600123 return;
124 }
125}
126
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600127VK_LAYER_EXPORT VkResult VKAPI vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, VkInstance* pInstance)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600128{
Jon Ashburnb317fad2015-04-04 14:52:07 -0600129 PreCreateInstance(pCreateInfo->pAppInfo, pCreateInfo->pAllocCb);
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600130 VkResult result = nextTable.CreateInstance(pCreateInfo, pInstance);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600131 PostCreateInstance(result, pInstance);
132 return result;
133}
134
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600135VK_LAYER_EXPORT VkResult VKAPI vkDestroyInstance(VkInstance instance)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600136{
137
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600138 VkResult result = nextTable.DestroyInstance(instance);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600139 return result;
140}
141
Tony Barbourd1c35722015-04-16 15:59:00 -0600142VK_LAYER_EXPORT VkResult VKAPI vkGetPhysicalDeviceInfo(VkPhysicalDevice gpu, VkPhysicalDeviceInfoType infoType, size_t* pDataSize, void* pData)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600143{
Jon Ashburn4d9f4652015-04-08 21:33:34 -0600144 pCurObj = (VkBaseLayerObject *) gpu;
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600145 loader_platform_thread_once(&tabOnce, initParamChecker);
146 char str[1024];
Tony Barbourd1c35722015-04-16 15:59:00 -0600147 if (!validate_VkPhysicalDeviceInfoType(infoType)) {
148 sprintf(str, "Parameter infoType to function GetPhysicalDeviceInfo has invalid value of %i.", (int)infoType);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600149 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600150 }
Tony Barbourd1c35722015-04-16 15:59:00 -0600151 VkResult result = nextTable.GetPhysicalDeviceInfo(gpu, infoType, pDataSize, pData);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600152 return result;
153}
154
Tony Barbourd1c35722015-04-16 15:59:00 -0600155void PreCreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo* pCreateInfo)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600156{
157 if(gpu == nullptr)
158 {
Tony Barbourd1c35722015-04-16 15:59:00 -0600159 char const str[] = "vkCreateDevice parameter, VkPhysicalDevice gpu, is nullptr "\
Jeremy Hayesb1792dd2015-04-07 09:49:05 -0600160 "(precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600161 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600162 return;
163 }
164
165 if(pCreateInfo == nullptr)
166 {
Courtney Goeltzenleuchter95487bc2015-04-14 18:48:46 -0600167 char const str[] = "vkCreateDevice parameter, VkDeviceCreateInfo* pCreateInfo, is "\
Jeremy Hayesb1792dd2015-04-07 09:49:05 -0600168 "nullptr (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600169 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600170 return;
171 }
172
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600173 if(pCreateInfo->sType != VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600174 {
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600175 char const str[] = "vkCreateDevice parameter, VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO "\
176 "pCreateInfo->sType, is not VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO (precondition).";
177 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600178 return;
179 }
180
181 if(pCreateInfo->queueRecordCount == 0)
182 {
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600183 char const str[] = "vkCreateDevice parameter, uint32_t pCreateInfo->queueRecordCount, is "\
Jeremy Hayesb1792dd2015-04-07 09:49:05 -0600184 "zero (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600185 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600186 return;
187 }
188
189 if(pCreateInfo->pRequestedQueues == nullptr)
190 {
Courtney Goeltzenleuchter95487bc2015-04-14 18:48:46 -0600191 char const str[] = "vkCreateDevice parameter, VkDeviceQueueCreateInfo* pCreateInfo->pRequestedQueues, is "\
Jeremy Hayesb1792dd2015-04-07 09:49:05 -0600192 "nullptr (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600193 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600194 return;
195 }
196
197 for(uint32_t i = 0; i < pCreateInfo->queueRecordCount; ++i)
198 {
Courtney Goeltzenleuchter95487bc2015-04-14 18:48:46 -0600199 if(!vk_validate_vkdevicequeuecreateinfo(&(pCreateInfo->pRequestedQueues[i])))
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600200 {
201 std::stringstream ss;
Courtney Goeltzenleuchter95487bc2015-04-14 18:48:46 -0600202 ss << "vkCreateDevice parameter, VkDeviceQueueCreateInfo pCreateInfo->pRequestedQueues[" << i <<
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600203 "], is invalid (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600204 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600205 continue;
206 }
207 }
208
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600209}
210
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600211void PostCreateDevice(VkResult result, VkDevice* pDevice)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600212{
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600213 if(result != VK_SUCCESS)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600214 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600215 // TODO: Spit out VkResult value.
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600216 char const str[] = "vkCreateDevice failed (postcondition).";
217 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600218 return;
219 }
220
221 if(pDevice == nullptr)
222 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600223 char const str[] = "vkCreateDevice parameter, VkDevice* pDevice, is nullptr (postcondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600224 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600225 return;
226 }
227}
228
Tony Barbourd1c35722015-04-16 15:59:00 -0600229VK_LAYER_EXPORT VkResult VKAPI vkCreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo* pCreateInfo, VkDevice* pDevice)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600230{
Jon Ashburn4d9f4652015-04-08 21:33:34 -0600231 pCurObj = (VkBaseLayerObject *) gpu;
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600232 loader_platform_thread_once(&tabOnce, initParamChecker);
233 PreCreateDevice(gpu, pCreateInfo);
Jon Ashburn4d9f4652015-04-08 21:33:34 -0600234 VkResult result = nextTable.CreateDevice(gpu, pCreateInfo, pDevice);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600235 PostCreateDevice(result, pDevice);
236 return result;
237}
238
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600239VK_LAYER_EXPORT VkResult VKAPI vkDestroyDevice(VkDevice device)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600240{
241
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600242 VkResult result = nextTable.DestroyDevice(device);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600243 return result;
244}
245
Jon Ashburn9fd4cc42015-04-10 14:33:07 -0600246struct extProps {
247 uint32_t version;
248 const char * const name;
249};
250
Jon Ashburn120cfbe2015-04-14 14:12:59 -0600251#define PARAM_CHECKER_LAYER_EXT_ARRAY_SIZE 2
Jon Ashburn9fd4cc42015-04-10 14:33:07 -0600252static const struct extProps pcExts[PARAM_CHECKER_LAYER_EXT_ARRAY_SIZE] = {
253 // TODO what is the version?
254 0x10, "ParamChecker",
Jon Ashburn120cfbe2015-04-14 14:12:59 -0600255 0x10, "Validation",
Jon Ashburn9fd4cc42015-04-10 14:33:07 -0600256};
257
258VK_LAYER_EXPORT VkResult VKAPI vkGetGlobalExtensionInfo(
259 VkExtensionInfoType infoType,
260 uint32_t extensionIndex,
261 size_t* pDataSize,
262 void* pData)
263{
Jon Ashburn9fd4cc42015-04-10 14:33:07 -0600264 /* This entrypoint is NOT going to init it's own dispatch table since loader calls here early */
265 VkExtensionProperties *ext_props;
266 uint32_t *count;
267
268 if (pDataSize == NULL)
269 return VK_ERROR_INVALID_POINTER;
270
271 switch (infoType) {
272 case VK_EXTENSION_INFO_TYPE_COUNT:
273 *pDataSize = sizeof(uint32_t);
274 if (pData == NULL)
275 return VK_SUCCESS;
276 count = (uint32_t *) pData;
277 *count = PARAM_CHECKER_LAYER_EXT_ARRAY_SIZE;
278 break;
279 case VK_EXTENSION_INFO_TYPE_PROPERTIES:
280 *pDataSize = sizeof(VkExtensionProperties);
281 if (pData == NULL)
282 return VK_SUCCESS;
283 if (extensionIndex >= PARAM_CHECKER_LAYER_EXT_ARRAY_SIZE)
284 return VK_ERROR_INVALID_VALUE;
285 ext_props = (VkExtensionProperties *) pData;
286 ext_props->version = pcExts[extensionIndex].version;
287 strncpy(ext_props->extName, pcExts[extensionIndex].name,
288 VK_MAX_EXTENSION_NAME);
289 ext_props->extName[VK_MAX_EXTENSION_NAME - 1] = '\0';
290 break;
291 default:
292 return VK_ERROR_INVALID_VALUE;
293 };
294
295 return VK_SUCCESS;
296}
297
Jeremy Hayesad367152015-04-17 10:36:53 -0600298VK_LAYER_EXPORT VkResult VKAPI vkGetPhysicalDeviceExtensionInfo(
299 VkPhysicalDevice gpu,
300 VkExtensionInfoType infoType,
301 uint32_t extensionIndex,
302 size_t* pDataSize,
303 void* pData)
304{
305 VkResult result = nextTable.GetPhysicalDeviceExtensionInfo(gpu, infoType, extensionIndex, pDataSize, pData);
306 return result;
307}
308
Courtney Goeltzenleuchterd9dc0c72015-04-20 11:04:54 -0600309VK_LAYER_EXPORT VkResult VKAPI vkEnumerateLayers(VkPhysicalDevice gpu, size_t maxStringSize, size_t* pLayerCount, char* const* pOutLayers, void* pReserved)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600310{
311 char str[1024];
312 if (gpu != NULL) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600313 sprintf(str, "At start of layered EnumerateLayers\n");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600314 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, nullptr, 0, 0, "PARAMCHECK", str);
Jon Ashburn4d9f4652015-04-08 21:33:34 -0600315 pCurObj = (VkBaseLayerObject *) gpu;
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600316 loader_platform_thread_once(&tabOnce, initParamChecker);
Courtney Goeltzenleuchterd9dc0c72015-04-20 11:04:54 -0600317 VkResult result = nextTable.EnumerateLayers(gpu, maxStringSize, pLayerCount, pOutLayers, pReserved);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600318 sprintf(str, "Completed layered EnumerateLayers\n");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600319 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, nullptr, 0, 0, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600320 fflush(stdout);
321 return result;
322 } else {
Courtney Goeltzenleuchterd9dc0c72015-04-20 11:04:54 -0600323 if (pLayerCount == NULL || pOutLayers == NULL || pOutLayers[0] == NULL)
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600324 return VK_ERROR_INVALID_POINTER;
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600325 // This layer compatible with all GPUs
Courtney Goeltzenleuchterd9dc0c72015-04-20 11:04:54 -0600326 *pLayerCount = 1;
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600327 strncpy(pOutLayers[0], "ParamChecker", maxStringSize);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600328 return VK_SUCCESS;
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600329 }
330}
331
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600332VK_LAYER_EXPORT VkResult VKAPI vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex, VkQueue* pQueue)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600333{
334
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600335 VkResult result = nextTable.GetDeviceQueue(device, queueNodeIndex, queueIndex, pQueue);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600336 return result;
337}
338
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600339VK_LAYER_EXPORT VkResult VKAPI vkQueueSubmit(VkQueue queue, uint32_t cmdBufferCount, const VkCmdBuffer* pCmdBuffers, VkFence fence)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600340{
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600341 VkResult result = nextTable.QueueSubmit(queue, cmdBufferCount, pCmdBuffers, fence);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600342 return result;
343}
344
Tony Barbourd1c35722015-04-16 15:59:00 -0600345VK_LAYER_EXPORT VkResult VKAPI vkQueueAddMemReferences(VkQueue queue, uint32_t count, const VkDeviceMemory* pMems)
Courtney Goeltzenleuchterad5c0a52015-04-08 13:57:08 -0600346{
Courtney Goeltzenleuchterf68ad722015-04-16 13:38:46 -0600347 VkResult result = nextTable.QueueAddMemReferences(queue, count, pMems);
Courtney Goeltzenleuchterad5c0a52015-04-08 13:57:08 -0600348 return result;
349}
350
Tony Barbourd1c35722015-04-16 15:59:00 -0600351VK_LAYER_EXPORT VkResult VKAPI vkQueueRemoveMemReferences(VkQueue queue, uint32_t count, const VkDeviceMemory* pMems)
Courtney Goeltzenleuchterad5c0a52015-04-08 13:57:08 -0600352{
Courtney Goeltzenleuchterf68ad722015-04-16 13:38:46 -0600353 VkResult result = nextTable.QueueRemoveMemReferences(queue, count, pMems);
Courtney Goeltzenleuchterad5c0a52015-04-08 13:57:08 -0600354 return result;
355}
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600356VK_LAYER_EXPORT VkResult VKAPI vkQueueWaitIdle(VkQueue queue)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600357{
358
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600359 VkResult result = nextTable.QueueWaitIdle(queue);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600360 return result;
361}
362
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600363VK_LAYER_EXPORT VkResult VKAPI vkDeviceWaitIdle(VkDevice device)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600364{
365
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600366 VkResult result = nextTable.DeviceWaitIdle(device);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600367 return result;
368}
369
Tony Barbourd1c35722015-04-16 15:59:00 -0600370VK_LAYER_EXPORT VkResult VKAPI vkAllocMemory(VkDevice device, const VkMemoryAllocInfo* pAllocInfo, VkDeviceMemory* pMem)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600371{
372 char str[1024];
373 if (!pAllocInfo) {
374 sprintf(str, "Struct ptr parameter pAllocInfo to function AllocMemory is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600375 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Courtney Goeltzenleuchter95487bc2015-04-14 18:48:46 -0600376 } else if (!vk_validate_vkmemoryallocinfo(pAllocInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600377 sprintf(str, "Parameter pAllocInfo to function AllocMemory contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600378 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600379 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600380 VkResult result = nextTable.AllocMemory(device, pAllocInfo, pMem);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600381 return result;
382}
383
Mike Stroyanb050c682015-04-17 12:36:38 -0600384VK_LAYER_EXPORT VkResult VKAPI vkFreeMemory(VkDevice device, VkDeviceMemory mem)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600385{
386
Mike Stroyanb050c682015-04-17 12:36:38 -0600387 VkResult result = nextTable.FreeMemory(device, mem);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600388 return result;
389}
390
Mike Stroyanb050c682015-04-17 12:36:38 -0600391VK_LAYER_EXPORT VkResult VKAPI vkSetMemoryPriority(VkDevice device, VkDeviceMemory mem, VkMemoryPriority priority)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600392{
393 char str[1024];
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600394 if (!validate_VkMemoryPriority(priority)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600395 sprintf(str, "Parameter priority to function SetMemoryPriority has invalid value of %i.", (int)priority);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600396 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600397 }
Mike Stroyanb050c682015-04-17 12:36:38 -0600398 VkResult result = nextTable.SetMemoryPriority(device, mem, priority);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600399 return result;
400}
401
Mike Stroyanb050c682015-04-17 12:36:38 -0600402VK_LAYER_EXPORT VkResult VKAPI vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset, VkDeviceSize size, VkFlags flags, void** ppData)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600403{
404
Mike Stroyanb050c682015-04-17 12:36:38 -0600405 VkResult result = nextTable.MapMemory(device, mem, offset, size, flags, ppData);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600406 return result;
407}
408
Mike Stroyanb050c682015-04-17 12:36:38 -0600409VK_LAYER_EXPORT VkResult VKAPI vkUnmapMemory(VkDevice device, VkDeviceMemory mem)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600410{
411
Mike Stroyanb050c682015-04-17 12:36:38 -0600412 VkResult result = nextTable.UnmapMemory(device, mem);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600413 return result;
414}
415
Mike Stroyanb050c682015-04-17 12:36:38 -0600416VK_LAYER_EXPORT VkResult VKAPI vkFlushMappedMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset, VkDeviceSize size)
Tony Barbourb1250542015-04-16 19:23:13 -0600417{
418
Mike Stroyanb050c682015-04-17 12:36:38 -0600419 VkResult result = nextTable.FlushMappedMemory(device, mem, offset, size);
Tony Barbourb1250542015-04-16 19:23:13 -0600420 return result;
421}
422
Tony Barbourd1c35722015-04-16 15:59:00 -0600423VK_LAYER_EXPORT VkResult VKAPI vkPinSystemMemory(VkDevice device, const void* pSysMem, size_t memSize, VkDeviceMemory* pMem)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600424{
425
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600426 VkResult result = nextTable.PinSystemMemory(device, pSysMem, memSize, pMem);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600427 return result;
428}
429
Tony Barbourd1c35722015-04-16 15:59:00 -0600430VK_LAYER_EXPORT VkResult VKAPI vkGetMultiDeviceCompatibility(VkPhysicalDevice gpu0, VkPhysicalDevice gpu1, VkPhysicalDeviceCompatibilityInfo* pInfo)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600431{
Jon Ashburn4d9f4652015-04-08 21:33:34 -0600432 pCurObj = (VkBaseLayerObject *) gpu0;
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600433 loader_platform_thread_once(&tabOnce, initParamChecker);
434
Tony Barbourd1c35722015-04-16 15:59:00 -0600435 VkResult result = nextTable.GetMultiDeviceCompatibility(gpu0, gpu1, pInfo);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600436 return result;
437}
438
Tony Barbourd1c35722015-04-16 15:59:00 -0600439VK_LAYER_EXPORT VkResult VKAPI vkOpenSharedMemory(VkDevice device, const VkMemoryOpenInfo* pOpenInfo, VkDeviceMemory* pMem)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600440{
441 char str[1024];
442 if (!pOpenInfo) {
443 sprintf(str, "Struct ptr parameter pOpenInfo to function OpenSharedMemory is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600444 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600445 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600446 else if (!vk_validate_vkmemoryopeninfo(pOpenInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600447 sprintf(str, "Parameter pOpenInfo to function OpenSharedMemory contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600448 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600449 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600450 VkResult result = nextTable.OpenSharedMemory(device, pOpenInfo, pMem);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600451 return result;
452}
453
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600454VK_LAYER_EXPORT VkResult VKAPI vkOpenSharedSemaphore(VkDevice device, const VkSemaphoreOpenInfo* pOpenInfo, VkSemaphore* pSemaphore)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600455{
456 char str[1024];
457 if (!pOpenInfo) {
458 sprintf(str, "Struct ptr parameter pOpenInfo to function OpenSharedSemaphore is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600459 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600460 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600461 else if (!vk_validate_vksemaphoreopeninfo(pOpenInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600462 sprintf(str, "Parameter pOpenInfo to function OpenSharedSemaphore contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600463 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600464 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600465 VkResult result = nextTable.OpenSharedSemaphore(device, pOpenInfo, pSemaphore);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600466 return result;
467}
468
Tony Barbourd1c35722015-04-16 15:59:00 -0600469VK_LAYER_EXPORT VkResult VKAPI vkOpenPeerMemory(VkDevice device, const VkPeerMemoryOpenInfo* pOpenInfo, VkDeviceMemory* pMem)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600470{
471 char str[1024];
472 if (!pOpenInfo) {
473 sprintf(str, "Struct ptr parameter pOpenInfo to function OpenPeerMemory is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600474 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600475 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600476 else if (!vk_validate_vkpeermemoryopeninfo(pOpenInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600477 sprintf(str, "Parameter pOpenInfo to function OpenPeerMemory contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600478 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600479 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600480 VkResult result = nextTable.OpenPeerMemory(device, pOpenInfo, pMem);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600481 return result;
482}
483
Tony Barbourd1c35722015-04-16 15:59:00 -0600484VK_LAYER_EXPORT VkResult VKAPI vkOpenPeerImage(VkDevice device, const VkPeerImageOpenInfo* pOpenInfo, VkImage* pImage, VkDeviceMemory* pMem)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600485{
486 char str[1024];
487 if (!pOpenInfo) {
488 sprintf(str, "Struct ptr parameter pOpenInfo to function OpenPeerImage is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600489 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600490 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600491 else if (!vk_validate_vkpeerimageopeninfo(pOpenInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600492 sprintf(str, "Parameter pOpenInfo to function OpenPeerImage contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600493 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600494 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600495 VkResult result = nextTable.OpenPeerImage(device, pOpenInfo, pImage, pMem);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600496 return result;
497}
498
Mike Stroyanb050c682015-04-17 12:36:38 -0600499VK_LAYER_EXPORT VkResult VKAPI vkDestroyObject(VkDevice device, VkObjectType objType, VkObject object)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600500{
501
Mike Stroyanb050c682015-04-17 12:36:38 -0600502 VkResult result = nextTable.DestroyObject(device, objType, object);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600503 return result;
504}
505
Mike Stroyanb050c682015-04-17 12:36:38 -0600506VK_LAYER_EXPORT VkResult VKAPI vkGetObjectInfo(VkDevice device, VkObjectType objType, VkObject object, VkObjectInfoType infoType, size_t* pDataSize, void* pData)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600507{
508 char str[1024];
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600509 if (!validate_VkObjectInfoType(infoType)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600510 sprintf(str, "Parameter infoType to function GetObjectInfo has invalid value of %i.", (int)infoType);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600511 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600512 }
Mike Stroyanb050c682015-04-17 12:36:38 -0600513 VkResult result = nextTable.GetObjectInfo(device, objType, object, infoType, pDataSize, pData);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600514 return result;
515}
516
Mike Stroyanb050c682015-04-17 12:36:38 -0600517VK_LAYER_EXPORT VkResult VKAPI vkQueueBindObjectMemory(VkQueue queue, VkObjectType objType, VkObject object, uint32_t allocationIdx, VkDeviceMemory mem, VkDeviceSize offset)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600518{
519
Mike Stroyanb050c682015-04-17 12:36:38 -0600520 VkResult result = nextTable.QueueBindObjectMemory(queue, objType, object, allocationIdx, mem, offset);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600521 return result;
522}
523
Mike Stroyanb050c682015-04-17 12:36:38 -0600524VK_LAYER_EXPORT VkResult VKAPI vkQueueBindObjectMemoryRange(VkQueue queue, VkObjectType objType, VkObject object, uint32_t allocationIdx, VkDeviceSize rangeOffset, VkDeviceSize rangeSize, VkDeviceMemory mem, VkDeviceSize memOffset)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600525{
526
Mike Stroyanb050c682015-04-17 12:36:38 -0600527 VkResult result = nextTable.QueueBindObjectMemoryRange(queue, objType, object, allocationIdx, rangeOffset, rangeSize, mem, memOffset);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600528 return result;
529}
530
Tony Barbourd1c35722015-04-16 15:59:00 -0600531VK_LAYER_EXPORT VkResult VKAPI vkQueueBindImageMemoryRange(VkQueue queue, VkImage image, uint32_t allocationIdx, const VkImageMemoryBindInfo* pBindInfo, VkDeviceMemory mem, VkDeviceSize memOffset)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600532{
533 char str[1024];
Jeremy Hayesaf0d72c2015-04-15 15:20:03 -0600534 if (!pBindInfo) {
535 sprintf(str, "Struct ptr parameter pBindInfo to function QueueBindImageMemoryRange is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600536 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600537 }
Jeremy Hayesaf0d72c2015-04-15 15:20:03 -0600538 else if (!vk_validate_vkimagememorybindinfo(pBindInfo)) {
539 sprintf(str, "Parameter pBindInfo to function BindImageMemoryRange contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600540 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600541 }
Jeremy Hayesaf0d72c2015-04-15 15:20:03 -0600542 VkResult result = nextTable.QueueBindImageMemoryRange(queue, image, allocationIdx, pBindInfo, mem, memOffset);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600543 return result;
544}
545
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600546VK_LAYER_EXPORT VkResult VKAPI vkCreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, VkFence* pFence)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600547{
548 char str[1024];
549 if (!pCreateInfo) {
550 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateFence is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600551 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600552 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600553 else if (!vk_validate_vkfencecreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600554 sprintf(str, "Parameter pCreateInfo to function CreateFence contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600555 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600556 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600557 VkResult result = nextTable.CreateFence(device, pCreateInfo, pFence);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600558 return result;
559}
560
Mike Stroyanb050c682015-04-17 12:36:38 -0600561VK_LAYER_EXPORT VkResult VKAPI vkGetFenceStatus(VkDevice device, VkFence fence)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600562{
563
Mike Stroyanb050c682015-04-17 12:36:38 -0600564 VkResult result = nextTable.GetFenceStatus(device, fence);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600565 return result;
566}
567
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600568VK_LAYER_EXPORT VkResult VKAPI vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, bool32_t waitAll, uint64_t timeout)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600569{
570
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600571 VkResult result = nextTable.WaitForFences(device, fenceCount, pFences, waitAll, timeout);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600572 return result;
573}
574
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600575VK_LAYER_EXPORT VkResult VKAPI vkResetFences(VkDevice device, uint32_t fenceCount, VkFence* pFences)
Mark Lobodzinski148e1582015-04-07 16:07:57 -0500576{
577
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600578 VkResult result = nextTable.ResetFences(device, fenceCount, pFences);
Mark Lobodzinski148e1582015-04-07 16:07:57 -0500579 return result;
580}
581
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600582VK_LAYER_EXPORT VkResult VKAPI vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, VkSemaphore* pSemaphore)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600583{
584 char str[1024];
585 if (!pCreateInfo) {
586 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateSemaphore is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600587 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600588 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600589 else if (!vk_validate_vksemaphorecreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600590 sprintf(str, "Parameter pCreateInfo to function CreateSemaphore contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600591 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600592 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600593 VkResult result = nextTable.CreateSemaphore(device, pCreateInfo, pSemaphore);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600594 return result;
595}
596
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600597VK_LAYER_EXPORT VkResult VKAPI vkQueueSignalSemaphore(VkQueue queue, VkSemaphore semaphore)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600598{
599
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600600 VkResult result = nextTable.QueueSignalSemaphore(queue, semaphore);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600601 return result;
602}
603
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600604VK_LAYER_EXPORT VkResult VKAPI vkQueueWaitSemaphore(VkQueue queue, VkSemaphore semaphore)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600605{
606
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600607 VkResult result = nextTable.QueueWaitSemaphore(queue, semaphore);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600608 return result;
609}
610
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600611VK_LAYER_EXPORT VkResult VKAPI vkCreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, VkEvent* pEvent)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600612{
613 char str[1024];
614 if (!pCreateInfo) {
615 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateEvent is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600616 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600617 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600618 else if (!vk_validate_vkeventcreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600619 sprintf(str, "Parameter pCreateInfo to function CreateEvent contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600620 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600621 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600622 VkResult result = nextTable.CreateEvent(device, pCreateInfo, pEvent);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600623 return result;
624}
625
Mike Stroyanb050c682015-04-17 12:36:38 -0600626VK_LAYER_EXPORT VkResult VKAPI vkGetEventStatus(VkDevice device, VkEvent event)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600627{
628
Mike Stroyanb050c682015-04-17 12:36:38 -0600629 VkResult result = nextTable.GetEventStatus(device, event);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600630 return result;
631}
632
Mike Stroyanb050c682015-04-17 12:36:38 -0600633VK_LAYER_EXPORT VkResult VKAPI vkSetEvent(VkDevice device, VkEvent event)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600634{
635
Mike Stroyanb050c682015-04-17 12:36:38 -0600636 VkResult result = nextTable.SetEvent(device, event);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600637 return result;
638}
639
Mike Stroyanb050c682015-04-17 12:36:38 -0600640VK_LAYER_EXPORT VkResult VKAPI vkResetEvent(VkDevice device, VkEvent event)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600641{
642
Mike Stroyanb050c682015-04-17 12:36:38 -0600643 VkResult result = nextTable.ResetEvent(device, event);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600644 return result;
645}
646
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600647VK_LAYER_EXPORT VkResult VKAPI vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, VkQueryPool* pQueryPool)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600648{
649 char str[1024];
650 if (!pCreateInfo) {
651 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateQueryPool is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600652 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600653 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600654 else if (!vk_validate_vkquerypoolcreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600655 sprintf(str, "Parameter pCreateInfo to function CreateQueryPool contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600656 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600657 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600658 VkResult result = nextTable.CreateQueryPool(device, pCreateInfo, pQueryPool);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600659 return result;
660}
661
Mike Stroyanb050c682015-04-17 12:36:38 -0600662VK_LAYER_EXPORT VkResult VKAPI vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, size_t* pDataSize, void* pData, VkQueryResultFlags flags)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600663{
664
Mike Stroyanb050c682015-04-17 12:36:38 -0600665 VkResult result = nextTable.GetQueryPoolResults(device, queryPool, startQuery, queryCount, pDataSize, pData, flags);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600666 return result;
667}
668
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600669VK_LAYER_EXPORT VkResult VKAPI vkGetFormatInfo(VkDevice device, VkFormat format, VkFormatInfoType infoType, size_t* pDataSize, void* pData)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600670{
671 char str[1024];
Courtney Goeltzenleuchtera6d58802015-04-10 17:06:20 -0600672 if (!validate_VkFormat(format)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600673 sprintf(str, "Parameter format to function GetFormatInfo has invalid value of %i.", (int)format);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600674 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600675 }
Courtney Goeltzenleuchtera6d58802015-04-10 17:06:20 -0600676 if (!validate_VkFormatInfoType(infoType)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600677 sprintf(str, "Parameter infoType to function GetFormatInfo has invalid value of %i.", (int)infoType);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600678 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600679 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600680 VkResult result = nextTable.GetFormatInfo(device, format, infoType, pDataSize, pData);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600681 return result;
682}
683
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600684VK_LAYER_EXPORT VkResult VKAPI vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, VkBuffer* pBuffer)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600685{
686 char str[1024];
687 if (!pCreateInfo) {
688 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateBuffer is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600689 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600690 }
Courtney Goeltzenleuchter95487bc2015-04-14 18:48:46 -0600691 else if (!vk_validate_vkbuffercreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600692 sprintf(str, "Parameter pCreateInfo to function CreateBuffer contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600693 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600694 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600695 VkResult result = nextTable.CreateBuffer(device, pCreateInfo, pBuffer);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600696 return result;
697}
698
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600699VK_LAYER_EXPORT VkResult VKAPI vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, VkBufferView* pView)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600700{
701 char str[1024];
702 if (!pCreateInfo) {
703 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateBufferView is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600704 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600705 }
Courtney Goeltzenleuchter95487bc2015-04-14 18:48:46 -0600706 else if (!vk_validate_vkbufferviewcreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600707 sprintf(str, "Parameter pCreateInfo to function CreateBufferView contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600708 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600709 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600710 VkResult result = nextTable.CreateBufferView(device, pCreateInfo, pView);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600711 return result;
712}
713
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600714void PreCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600715{
716 if(pCreateInfo == nullptr)
717 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600718 char const str[] = "vkCreateImage parameter, VkImageCreateInfo* pCreateInfo, is "\
Jeremy Hayesb1792dd2015-04-07 09:49:05 -0600719 "nullptr (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600720 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600721 return;
722 }
723
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600724 if(pCreateInfo->sType != VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600725 {
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600726 char const str[] = "vkCreateImage parameter, VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO "\
727 "pCreateInfo->sType, is not VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO (precondition).";
728 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600729 return;
730 }
731
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600732 if (!validate_VkImageType(pCreateInfo->imageType))
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600733 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600734 char const str[] = "vkCreateImage parameter, VkImageType pCreateInfo->imageType, is "\
Jeremy Hayesb1792dd2015-04-07 09:49:05 -0600735 "unrecognized (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600736 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600737 return;
738 }
739
Courtney Goeltzenleuchtera6d58802015-04-10 17:06:20 -0600740 if (!validate_VkFormat(pCreateInfo->format))
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600741 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600742 char const str[] = "vkCreateImage parameter, VkFormat pCreateInfo->format, is "\
Jeremy Hayesb1792dd2015-04-07 09:49:05 -0600743 "unrecognized (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600744 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600745 return;
746 }
747
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600748 VkFormatProperties properties;
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600749 size_t size = sizeof(properties);
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600750 VkResult result = nextTable.GetFormatInfo(device, pCreateInfo->format,
Tony Barbourd1c35722015-04-16 15:59:00 -0600751 VK_FORMAT_INFO_TYPE_PROPERTIES, &size, &properties);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600752 if(result != VK_SUCCESS)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600753 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600754 char const str[] = "vkCreateImage parameter, VkFormat pCreateInfo->format, cannot be "\
Jeremy Hayesb1792dd2015-04-07 09:49:05 -0600755 "validated (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600756 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600757 return;
758 }
759
760 if((properties.linearTilingFeatures) == 0 && (properties.optimalTilingFeatures == 0))
761 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600762 char const str[] = "vkCreateImage parameter, VkFormat pCreateInfo->format, contains "\
Jeremy Hayesb1792dd2015-04-07 09:49:05 -0600763 "unsupported format (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600764 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600765 return;
766 }
767
768 // TODO: Can we check device-specific limits?
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600769 if (!vk_validate_vkextent3d(&pCreateInfo->extent))
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600770 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600771 char const str[] = "vkCreateImage parameter, VkExtent3D pCreateInfo->extent, is invalid "\
Jeremy Hayesb1792dd2015-04-07 09:49:05 -0600772 "(precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600773 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600774 return;
775 }
776
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600777 if (!validate_VkImageTiling(pCreateInfo->tiling))
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600778 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600779 char const str[] = "vkCreateImage parameter, VkImageTiling pCreateInfo->tiling, is "\
Jeremy Hayesb1792dd2015-04-07 09:49:05 -0600780 "unrecoginized (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600781 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600782 return;
783 }
784}
785
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600786void PostCreateImage(VkResult result, VkImage* pImage)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600787{
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600788 if(result != VK_SUCCESS)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600789 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600790 // TODO: Spit out VkResult value.
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600791 char const str[] = "vkCreateImage failed (postcondition).";
792 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600793 return;
794 }
795
796 if(pImage == nullptr)
797 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600798 char const str[] = "vkCreateImage parameter, VkImage* pImage, is nullptr (postcondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600799 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600800 return;
801 }
802}
803
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600804VK_LAYER_EXPORT VkResult VKAPI vkCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, VkImage* pImage)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600805{
806 PreCreateImage(device, pCreateInfo);
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600807 VkResult result = nextTable.CreateImage(device, pCreateInfo, pImage);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600808 PostCreateImage(result, pImage);
809 return result;
810}
811
Mike Stroyanb050c682015-04-17 12:36:38 -0600812VK_LAYER_EXPORT VkResult VKAPI vkGetImageSubresourceInfo(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceInfoType infoType, size_t* pDataSize, void* pData)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600813{
814 char str[1024];
815 if (!pSubresource) {
816 sprintf(str, "Struct ptr parameter pSubresource to function GetImageSubresourceInfo is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600817 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Courtney Goeltzenleuchtera6d58802015-04-10 17:06:20 -0600818 } else if (!vk_validate_vkimagesubresource(pSubresource)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600819 sprintf(str, "Parameter pSubresource to function GetImageSubresourceInfo contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600820 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600821 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600822 if (!validate_VkSubresourceInfoType(infoType)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600823 sprintf(str, "Parameter infoType to function GetImageSubresourceInfo has invalid value of %i.", (int)infoType);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600824 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600825 }
Mike Stroyanb050c682015-04-17 12:36:38 -0600826 VkResult result = nextTable.GetImageSubresourceInfo(device, image, pSubresource, infoType, pDataSize, pData);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600827 return result;
828}
829
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600830VK_LAYER_EXPORT VkResult VKAPI vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, VkImageView* pView)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600831{
832 char str[1024];
833 if (!pCreateInfo) {
834 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateImageView is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600835 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600836 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600837 else if (!vk_validate_vkimageviewcreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600838 sprintf(str, "Parameter pCreateInfo to function CreateImageView contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600839 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600840 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600841 VkResult result = nextTable.CreateImageView(device, pCreateInfo, pView);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600842 return result;
843}
844
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600845VK_LAYER_EXPORT VkResult VKAPI vkCreateColorAttachmentView(VkDevice device, const VkColorAttachmentViewCreateInfo* pCreateInfo, VkColorAttachmentView* pView)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600846{
847 char str[1024];
848 if (!pCreateInfo) {
849 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateColorAttachmentView is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600850 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600851 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600852 else if (!vk_validate_vkcolorattachmentviewcreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600853 sprintf(str, "Parameter pCreateInfo to function CreateColorAttachmentView contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600854 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600855 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600856 VkResult result = nextTable.CreateColorAttachmentView(device, pCreateInfo, pView);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600857 return result;
858}
859
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600860VK_LAYER_EXPORT VkResult VKAPI vkCreateDepthStencilView(VkDevice device, const VkDepthStencilViewCreateInfo* pCreateInfo, VkDepthStencilView* pView)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600861{
862 char str[1024];
863 if (!pCreateInfo) {
864 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDepthStencilView is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600865 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600866 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600867 else if (!vk_validate_vkdepthstencilviewcreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600868 sprintf(str, "Parameter pCreateInfo to function CreateDepthStencilView contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600869 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600870 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600871 VkResult result = nextTable.CreateDepthStencilView(device, pCreateInfo, pView);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600872 return result;
873}
874
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600875VK_LAYER_EXPORT VkResult VKAPI vkCreateShader(VkDevice device, const VkShaderCreateInfo* pCreateInfo, VkShader* pShader)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600876{
877 char str[1024];
878 if (!pCreateInfo) {
879 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateShader is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600880 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600881 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600882 else if (!vk_validate_vkshadercreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600883 sprintf(str, "Parameter pCreateInfo to function CreateShader contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600884 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600885 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600886 VkResult result = nextTable.CreateShader(device, pCreateInfo, pShader);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600887 return result;
888}
889
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600890VK_LAYER_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(VkDevice device, const VkGraphicsPipelineCreateInfo* pCreateInfo, VkPipeline* pPipeline)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600891{
892 char str[1024];
893 if (!pCreateInfo) {
894 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateGraphicsPipeline is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600895 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600896 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600897 else if (!vk_validate_vkgraphicspipelinecreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600898 sprintf(str, "Parameter pCreateInfo to function CreateGraphicsPipeline contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600899 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600900 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600901 VkResult result = nextTable.CreateGraphicsPipeline(device, pCreateInfo, pPipeline);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600902 return result;
903}
904
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600905VK_LAYER_EXPORT VkResult VKAPI vkCreateGraphicsPipelineDerivative(VkDevice device, const VkGraphicsPipelineCreateInfo* pCreateInfo, VkPipeline basePipeline, VkPipeline* pPipeline)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600906{
907 char str[1024];
908 if (!pCreateInfo) {
909 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateGraphicsPipelineDerivative is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600910 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600911 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600912 else if (!vk_validate_vkgraphicspipelinecreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600913 sprintf(str, "Parameter pCreateInfo to function CreateGraphicsPipelineDerivative contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600914 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600915 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600916 VkResult result = nextTable.CreateGraphicsPipelineDerivative(device, pCreateInfo, basePipeline, pPipeline);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600917 return result;
918}
919
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600920VK_LAYER_EXPORT VkResult VKAPI vkCreateComputePipeline(VkDevice device, const VkComputePipelineCreateInfo* pCreateInfo, VkPipeline* pPipeline)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600921{
922 char str[1024];
923 if (!pCreateInfo) {
924 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateComputePipeline is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600925 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600926 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600927 else if (!vk_validate_vkcomputepipelinecreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600928 sprintf(str, "Parameter pCreateInfo to function CreateComputePipeline contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600929 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600930 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600931 VkResult result = nextTable.CreateComputePipeline(device, pCreateInfo, pPipeline);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600932 return result;
933}
934
Mike Stroyanb050c682015-04-17 12:36:38 -0600935VK_LAYER_EXPORT VkResult VKAPI vkStorePipeline(VkDevice device, VkPipeline pipeline, size_t* pDataSize, void* pData)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600936{
937
Mike Stroyanb050c682015-04-17 12:36:38 -0600938 VkResult result = nextTable.StorePipeline(device, pipeline, pDataSize, pData);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600939 return result;
940}
941
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600942VK_LAYER_EXPORT VkResult VKAPI vkLoadPipeline(VkDevice device, size_t dataSize, const void* pData, VkPipeline* pPipeline)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600943{
944
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600945 VkResult result = nextTable.LoadPipeline(device, dataSize, pData, pPipeline);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600946 return result;
947}
948
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600949VK_LAYER_EXPORT VkResult VKAPI vkLoadPipelineDerivative(VkDevice device, size_t dataSize, const void* pData, VkPipeline basePipeline, VkPipeline* pPipeline)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600950{
951
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600952 VkResult result = nextTable.LoadPipelineDerivative(device, dataSize, pData, basePipeline, pPipeline);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600953 return result;
954}
955
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600956VK_LAYER_EXPORT VkResult VKAPI vkCreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, VkSampler* pSampler)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600957{
958 char str[1024];
959 if (!pCreateInfo) {
960 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateSampler is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600961 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600962 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600963 else if (!vk_validate_vksamplercreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600964 sprintf(str, "Parameter pCreateInfo to function CreateSampler contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600965 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600966 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600967 VkResult result = nextTable.CreateSampler(device, pCreateInfo, pSampler);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600968 return result;
969}
970
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600971VK_LAYER_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayout* pSetLayout)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600972{
973 char str[1024];
974 if (!pCreateInfo) {
975 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDescriptorSetLayout is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600976 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600977 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600978 else if (!vk_validate_vkdescriptorsetlayoutcreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600979 sprintf(str, "Parameter pCreateInfo to function CreateDescriptorSetLayout contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600980 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600981 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600982 VkResult result = nextTable.CreateDescriptorSetLayout(device, pCreateInfo, pSetLayout);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600983 return result;
984}
985
Mark Lobodzinski0fadf5f2015-04-17 14:11:39 -0500986VK_LAYER_EXPORT VkResult VKAPI vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, VkPipelineLayout* pPipelineLayout)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600987{
Mark Lobodzinski0fadf5f2015-04-17 14:11:39 -0500988 VkResult result = nextTable.CreatePipelineLayout(device, pCreateInfo, pPipelineLayout);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600989 return result;
990}
991
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600992VK_LAYER_EXPORT VkResult VKAPI vkBeginDescriptorPoolUpdate(VkDevice device, VkDescriptorUpdateMode updateMode)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600993{
994 char str[1024];
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -0600995 if (!validate_VkDescriptorUpdateMode(updateMode)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600996 sprintf(str, "Parameter updateMode to function BeginDescriptorPoolUpdate has invalid value of %i.", (int)updateMode);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600997 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -0600998 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600999 VkResult result = nextTable.BeginDescriptorPoolUpdate(device, updateMode);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001000 return result;
1001}
1002
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001003VK_LAYER_EXPORT VkResult VKAPI vkEndDescriptorPoolUpdate(VkDevice device, VkCmdBuffer cmd)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001004{
1005
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001006 VkResult result = nextTable.EndDescriptorPoolUpdate(device, cmd);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001007 return result;
1008}
1009
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001010VK_LAYER_EXPORT VkResult VKAPI vkCreateDescriptorPool(VkDevice device, VkDescriptorPoolUsage poolUsage, uint32_t maxSets, const VkDescriptorPoolCreateInfo* pCreateInfo, VkDescriptorPool* pDescriptorPool)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001011{
1012 char str[1024];
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001013 if (!validate_VkDescriptorPoolUsage(poolUsage)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001014 sprintf(str, "Parameter poolUsage to function CreateDescriptorPool has invalid value of %i.", (int)poolUsage);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001015 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001016 }
1017 if (!pCreateInfo) {
1018 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDescriptorPool is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001019 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001020 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001021 else if (!vk_validate_vkdescriptorpoolcreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001022 sprintf(str, "Parameter pCreateInfo to function CreateDescriptorPool contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001023 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001024 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001025 VkResult result = nextTable.CreateDescriptorPool(device, poolUsage, maxSets, pCreateInfo, pDescriptorPool);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001026 return result;
1027}
1028
Mike Stroyanb050c682015-04-17 12:36:38 -06001029VK_LAYER_EXPORT VkResult VKAPI vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001030{
1031
Mike Stroyanb050c682015-04-17 12:36:38 -06001032 VkResult result = nextTable.ResetDescriptorPool(device, descriptorPool);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001033 return result;
1034}
1035
Mike Stroyanb050c682015-04-17 12:36:38 -06001036VK_LAYER_EXPORT VkResult VKAPI vkAllocDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorSetUsage setUsage, uint32_t count, const VkDescriptorSetLayout* pSetLayouts, VkDescriptorSet* pDescriptorSets, uint32_t* pCount)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001037{
1038 char str[1024];
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001039 if (!validate_VkDescriptorSetUsage(setUsage)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001040 sprintf(str, "Parameter setUsage to function AllocDescriptorSets has invalid value of %i.", (int)setUsage);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001041 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001042 }
Mike Stroyanb050c682015-04-17 12:36:38 -06001043 VkResult result = nextTable.AllocDescriptorSets(device, descriptorPool, setUsage, count, pSetLayouts, pDescriptorSets, pCount);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001044 return result;
1045}
1046
Mike Stroyanb050c682015-04-17 12:36:38 -06001047VK_LAYER_EXPORT void VKAPI vkClearDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001048{
1049
Mike Stroyanb050c682015-04-17 12:36:38 -06001050 nextTable.ClearDescriptorSets(device, descriptorPool, count, pDescriptorSets);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001051}
1052
Mike Stroyanb050c682015-04-17 12:36:38 -06001053VK_LAYER_EXPORT void VKAPI vkUpdateDescriptors(VkDevice device, VkDescriptorSet descriptorSet, uint32_t updateCount, const void** ppUpdateArray)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001054{
1055
Mike Stroyanb050c682015-04-17 12:36:38 -06001056 nextTable.UpdateDescriptors(device, descriptorSet, updateCount, ppUpdateArray);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001057}
1058
Courtney Goeltzenleuchter502744a2015-04-10 16:24:50 -06001059VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicViewportState(VkDevice device, const VkDynamicVpStateCreateInfo* pCreateInfo, VkDynamicVpState* pState)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001060{
1061 char str[1024];
1062 if (!pCreateInfo) {
1063 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDynamicViewportState is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001064 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001065 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001066 else if (!vk_validate_vkdynamicvpstatecreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001067 sprintf(str, "Parameter pCreateInfo to function CreateDynamicViewportState contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001068 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001069 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001070 VkResult result = nextTable.CreateDynamicViewportState(device, pCreateInfo, pState);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001071 return result;
1072}
1073
Courtney Goeltzenleuchter502744a2015-04-10 16:24:50 -06001074VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicRasterState(VkDevice device, const VkDynamicRsStateCreateInfo* pCreateInfo, VkDynamicRsState* pState)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001075{
1076 char str[1024];
1077 if (!pCreateInfo) {
1078 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDynamicRasterState is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001079 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001080 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001081 else if (!vk_validate_vkdynamicrsstatecreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001082 sprintf(str, "Parameter pCreateInfo to function CreateDynamicRasterState contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001083 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001084 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001085 VkResult result = nextTable.CreateDynamicRasterState(device, pCreateInfo, pState);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001086 return result;
1087}
1088
Courtney Goeltzenleuchter502744a2015-04-10 16:24:50 -06001089VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(VkDevice device, const VkDynamicCbStateCreateInfo* pCreateInfo, VkDynamicCbState* pState)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001090{
1091 char str[1024];
1092 if (!pCreateInfo) {
1093 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDynamicColorBlendState is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001094 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001095 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001096 else if (!vk_validate_vkdynamiccbstatecreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001097 sprintf(str, "Parameter pCreateInfo to function CreateDynamicColorBlendState contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001098 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001099 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001100 VkResult result = nextTable.CreateDynamicColorBlendState(device, pCreateInfo, pState);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001101 return result;
1102}
1103
Courtney Goeltzenleuchter502744a2015-04-10 16:24:50 -06001104VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(VkDevice device, const VkDynamicDsStateCreateInfo* pCreateInfo, VkDynamicDsState* pState)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001105{
1106 char str[1024];
1107 if (!pCreateInfo) {
1108 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDynamicDepthStencilState is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001109 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001110 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001111 else if (!vk_validate_vkdynamicdsstatecreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001112 sprintf(str, "Parameter pCreateInfo to function CreateDynamicDepthStencilState contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001113 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001114 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001115 VkResult result = nextTable.CreateDynamicDepthStencilState(device, pCreateInfo, pState);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001116 return result;
1117}
1118
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001119void PreCreateCommandBuffer(VkDevice device, const VkCmdBufferCreateInfo* pCreateInfo)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001120{
1121 if(device == nullptr)
1122 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001123 char const str[] = "vkCreateCommandBuffer parameter, VkDevice device, is "\
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001124 "nullptr (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001125 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001126 return;
1127 }
1128
1129 if(pCreateInfo == nullptr)
1130 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001131 char const str[] = "vkCreateCommandBuffer parameter, VkCmdBufferCreateInfo* pCreateInfo, is "\
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001132 "nullptr (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001133 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001134 return;
1135 }
1136
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001137 if(pCreateInfo->sType != VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001138 {
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001139 char const str[] = "vkCreateCommandBuffer parameter, VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO "\
1140 "pCreateInfo->sType, is not VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO (precondition).";
1141 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001142 return;
1143 }
1144}
1145
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001146void PostCreateCommandBuffer(VkResult result, VkCmdBuffer* pCmdBuffer)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001147{
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001148 if(result != VK_SUCCESS)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001149 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001150 // TODO: Spit out VkResult value.
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001151 char const str[] = "vkCreateCommandBuffer failed (postcondition).";
1152 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001153 return;
1154 }
1155
1156 if(pCmdBuffer == nullptr)
1157 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001158 char const str[] = "vkCreateCommandBuffer parameter, VkCmdBuffer* pCmdBuffer, is nullptr (postcondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001159 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001160 return;
1161 }
1162}
1163
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001164VK_LAYER_EXPORT VkResult VKAPI vkCreateCommandBuffer(VkDevice device,
1165 const VkCmdBufferCreateInfo* pCreateInfo, VkCmdBuffer* pCmdBuffer)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001166{
1167 PreCreateCommandBuffer(device, pCreateInfo);
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001168 VkResult result = nextTable.CreateCommandBuffer(device, pCreateInfo, pCmdBuffer);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001169 PostCreateCommandBuffer(result, pCmdBuffer);
1170 return result;
1171}
1172
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001173VK_LAYER_EXPORT VkResult VKAPI vkBeginCommandBuffer(VkCmdBuffer cmdBuffer, const VkCmdBufferBeginInfo* pBeginInfo)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001174{
1175 char str[1024];
1176 if (!pBeginInfo) {
1177 sprintf(str, "Struct ptr parameter pBeginInfo to function BeginCommandBuffer is NULL.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001178 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001179 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001180 else if (!vk_validate_vkcmdbufferbegininfo(pBeginInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001181 sprintf(str, "Parameter pBeginInfo to function BeginCommandBuffer contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001182 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001183 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001184 VkResult result = nextTable.BeginCommandBuffer(cmdBuffer, pBeginInfo);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001185 return result;
1186}
1187
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001188VK_LAYER_EXPORT VkResult VKAPI vkEndCommandBuffer(VkCmdBuffer cmdBuffer)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001189{
1190
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001191 VkResult result = nextTable.EndCommandBuffer(cmdBuffer);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001192 return result;
1193}
1194
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001195VK_LAYER_EXPORT VkResult VKAPI vkResetCommandBuffer(VkCmdBuffer cmdBuffer)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001196{
1197
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001198 VkResult result = nextTable.ResetCommandBuffer(cmdBuffer);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001199 return result;
1200}
1201
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001202VK_LAYER_EXPORT void VKAPI vkCmdBindPipeline(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001203{
1204 char str[1024];
Courtney Goeltzenleuchtera6d58802015-04-10 17:06:20 -06001205 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001206 sprintf(str, "Parameter pipelineBindPoint to function CmdBindPipeline has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001207 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001208 }
1209 nextTable.CmdBindPipeline(cmdBuffer, pipelineBindPoint, pipeline);
1210}
1211
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001212VK_LAYER_EXPORT void VKAPI vkCmdBindDynamicStateObject(VkCmdBuffer cmdBuffer, VkStateBindPoint stateBindPoint, VkDynamicStateObject state)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001213{
1214 char str[1024];
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001215 if (!validate_VkStateBindPoint(stateBindPoint)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001216 sprintf(str, "Parameter stateBindPoint to function CmdBindDynamicStateObject has invalid value of %i.", (int)stateBindPoint);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001217 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001218 }
1219 nextTable.CmdBindDynamicStateObject(cmdBuffer, stateBindPoint, state);
1220}
1221
Cody Northropd4c1a502015-04-16 13:41:56 -06001222VK_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 Hayesa8b1a8d2015-04-06 13:46:11 -06001223{
1224 char str[1024];
Courtney Goeltzenleuchtera6d58802015-04-10 17:06:20 -06001225 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001226 sprintf(str, "Parameter pipelineBindPoint to function CmdBindDescriptorSets has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001227 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001228 }
Cody Northropd4c1a502015-04-16 13:41:56 -06001229 nextTable.CmdBindDescriptorSets(cmdBuffer, pipelineBindPoint, firstSet, setCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001230}
1231
Courtney Goeltzenleuchterf68ad722015-04-16 13:38:46 -06001232VK_LAYER_EXPORT void VKAPI vkCmdBindVertexBuffers(
1233 VkCmdBuffer cmdBuffer,
1234 uint32_t startBinding,
1235 uint32_t bindingCount,
1236 const VkBuffer* pBuffers,
Tony Barbourd1c35722015-04-16 15:59:00 -06001237 const VkDeviceSize* pOffsets)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001238{
Courtney Goeltzenleuchterf68ad722015-04-16 13:38:46 -06001239 nextTable.CmdBindVertexBuffers(cmdBuffer, startBinding, bindingCount, pBuffers, pOffsets);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001240}
1241
Tony Barbourd1c35722015-04-16 15:59:00 -06001242VK_LAYER_EXPORT void VKAPI vkCmdBindIndexBuffer(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001243{
1244 char str[1024];
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001245 if (!validate_VkIndexType(indexType)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001246 sprintf(str, "Parameter indexType to function CmdBindIndexBuffer has invalid value of %i.", (int)indexType);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001247 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001248 }
1249 nextTable.CmdBindIndexBuffer(cmdBuffer, buffer, offset, indexType);
1250}
1251
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001252VK_LAYER_EXPORT void VKAPI vkCmdDraw(VkCmdBuffer cmdBuffer, uint32_t firstVertex, uint32_t vertexCount, uint32_t firstInstance, uint32_t instanceCount)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001253{
1254
1255 nextTable.CmdDraw(cmdBuffer, firstVertex, vertexCount, firstInstance, instanceCount);
1256}
1257
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001258VK_LAYER_EXPORT void VKAPI vkCmdDrawIndexed(VkCmdBuffer cmdBuffer, uint32_t firstIndex, uint32_t indexCount, int32_t vertexOffset, uint32_t firstInstance, uint32_t instanceCount)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001259{
1260
1261 nextTable.CmdDrawIndexed(cmdBuffer, firstIndex, indexCount, vertexOffset, firstInstance, instanceCount);
1262}
1263
Tony Barbourd1c35722015-04-16 15:59:00 -06001264VK_LAYER_EXPORT void VKAPI vkCmdDrawIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001265{
1266
1267 nextTable.CmdDrawIndirect(cmdBuffer, buffer, offset, count, stride);
1268}
1269
Tony Barbourd1c35722015-04-16 15:59:00 -06001270VK_LAYER_EXPORT void VKAPI vkCmdDrawIndexedIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001271{
1272
1273 nextTable.CmdDrawIndexedIndirect(cmdBuffer, buffer, offset, count, stride);
1274}
1275
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001276VK_LAYER_EXPORT void VKAPI vkCmdDispatch(VkCmdBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001277{
1278
1279 nextTable.CmdDispatch(cmdBuffer, x, y, z);
1280}
1281
Tony Barbourd1c35722015-04-16 15:59:00 -06001282VK_LAYER_EXPORT void VKAPI vkCmdDispatchIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001283{
1284
1285 nextTable.CmdDispatchIndirect(cmdBuffer, buffer, offset);
1286}
1287
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001288VK_LAYER_EXPORT void VKAPI vkCmdCopyBuffer(VkCmdBuffer cmdBuffer, VkBuffer srcBuffer, VkBuffer destBuffer, uint32_t regionCount, const VkBufferCopy* pRegions)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001289{
1290 char str[1024];
1291 uint32_t i;
1292 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001293 if (!vk_validate_vkbuffercopy(&pRegions[i])) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001294 sprintf(str, "Parameter pRegions[%i] to function CmdCopyBuffer contains an invalid value.", i);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001295 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001296 }
1297 }
1298 nextTable.CmdCopyBuffer(cmdBuffer, srcBuffer, destBuffer, regionCount, pRegions);
1299}
1300
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001301VK_LAYER_EXPORT void VKAPI vkCmdCopyImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageCopy* pRegions)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001302{
1303 char str[1024];
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001304 if (!validate_VkImageLayout(srcImageLayout)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001305 sprintf(str, "Parameter srcImageLayout to function CmdCopyImage has invalid value of %i.", (int)srcImageLayout);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001306 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001307 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001308 if (!validate_VkImageLayout(destImageLayout)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001309 sprintf(str, "Parameter destImageLayout to function CmdCopyImage has invalid value of %i.", (int)destImageLayout);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001310 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001311 }
1312 uint32_t i;
1313 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001314 if (!vk_validate_vkimagecopy(&pRegions[i])) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001315 sprintf(str, "Parameter pRegions[%i] to function CmdCopyImage contains an invalid value.", i);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001316 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001317 }
1318 }
1319 nextTable.CmdCopyImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, regionCount, pRegions);
1320}
1321
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001322VK_LAYER_EXPORT void VKAPI vkCmdBlitImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageBlit* pRegions)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001323{
1324 char str[1024];
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001325 if (!validate_VkImageLayout(srcImageLayout)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001326 sprintf(str, "Parameter srcImageLayout to function CmdBlitImage has invalid value of %i.", (int)srcImageLayout);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001327 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001328 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001329 if (!validate_VkImageLayout(destImageLayout)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001330 sprintf(str, "Parameter destImageLayout to function CmdBlitImage has invalid value of %i.", (int)destImageLayout);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001331 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001332 }
1333 uint32_t i;
1334 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001335 if (!vk_validate_vkimageblit(&pRegions[i])) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001336 sprintf(str, "Parameter pRegions[%i] to function CmdBlitImage contains an invalid value.", i);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001337 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001338 }
1339 }
1340 nextTable.CmdBlitImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, regionCount, pRegions);
1341}
1342
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001343VK_LAYER_EXPORT void VKAPI vkCmdCopyBufferToImage(VkCmdBuffer cmdBuffer, VkBuffer srcBuffer, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001344{
1345 char str[1024];
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001346 if (!validate_VkImageLayout(destImageLayout)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001347 sprintf(str, "Parameter destImageLayout to function CmdCopyBufferToImage has invalid value of %i.", (int)destImageLayout);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001348 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001349 }
1350 uint32_t i;
1351 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001352 if (!vk_validate_vkbufferimagecopy(&pRegions[i])) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001353 sprintf(str, "Parameter pRegions[%i] to function CmdCopyBufferToImage contains an invalid value.", i);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001354 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001355 }
1356 }
1357 nextTable.CmdCopyBufferToImage(cmdBuffer, srcBuffer, destImage, destImageLayout, regionCount, pRegions);
1358}
1359
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001360VK_LAYER_EXPORT void VKAPI vkCmdCopyImageToBuffer(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer destBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001361{
1362 char str[1024];
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001363 if (!validate_VkImageLayout(srcImageLayout)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001364 sprintf(str, "Parameter srcImageLayout to function CmdCopyImageToBuffer has invalid value of %i.", (int)srcImageLayout);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001365 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001366 }
1367 uint32_t i;
1368 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001369 if (!vk_validate_vkbufferimagecopy(&pRegions[i])) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001370 sprintf(str, "Parameter pRegions[%i] to function CmdCopyImageToBuffer contains an invalid value.", i);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001371 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001372 }
1373 }
1374 nextTable.CmdCopyImageToBuffer(cmdBuffer, srcImage, srcImageLayout, destBuffer, regionCount, pRegions);
1375}
1376
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001377VK_LAYER_EXPORT void VKAPI vkCmdCloneImageData(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001378{
1379 char str[1024];
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001380 if (!validate_VkImageLayout(srcImageLayout)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001381 sprintf(str, "Parameter srcImageLayout to function CmdCloneImageData has invalid value of %i.", (int)srcImageLayout);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001382 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001383 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001384 if (!validate_VkImageLayout(destImageLayout)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001385 sprintf(str, "Parameter destImageLayout to function CmdCloneImageData has invalid value of %i.", (int)destImageLayout);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001386 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001387 }
1388 nextTable.CmdCloneImageData(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout);
1389}
1390
Tony Barbourd1c35722015-04-16 15:59:00 -06001391VK_LAYER_EXPORT void VKAPI vkCmdUpdateBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const uint32_t* pData)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001392{
1393
1394 nextTable.CmdUpdateBuffer(cmdBuffer, destBuffer, destOffset, dataSize, pData);
1395}
1396
Tony Barbourd1c35722015-04-16 15:59:00 -06001397VK_LAYER_EXPORT void VKAPI vkCmdFillBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001398{
1399
1400 nextTable.CmdFillBuffer(cmdBuffer, destBuffer, destOffset, fillSize, data);
1401}
1402
Courtney Goeltzenleuchterd7a5cff2015-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 Hayesa8b1a8d2015-04-06 13:46:11 -06001404{
1405 char str[1024];
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001406 if (!validate_VkImageLayout(imageLayout)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001407 sprintf(str, "Parameter imageLayout to function CmdClearColorImage has invalid value of %i.", (int)imageLayout);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001408 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001409 }
1410 uint32_t i;
1411 for (i = 0; i < rangeCount; i++) {
Courtney Goeltzenleuchtera6d58802015-04-10 17:06:20 -06001412 if (!vk_validate_vkimagesubresourcerange(&pRanges[i])) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001413 sprintf(str, "Parameter pRanges[%i] to function CmdClearColorImage contains an invalid value.", i);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001414 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001415 }
1416 }
Courtney Goeltzenleuchterd7a5cff2015-04-23 17:49:22 -06001417 nextTable.CmdClearColorImage(cmdBuffer, image, imageLayout, pColor, rangeCount, pRanges);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001418}
1419
Courtney Goeltzenleuchterfb4efc62015-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 Hayesa8b1a8d2015-04-06 13:46:11 -06001421{
1422 char str[1024];
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001423 if (!validate_VkImageLayout(imageLayout)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001424 sprintf(str, "Parameter imageLayout to function CmdClearDepthStencil has invalid value of %i.", (int)imageLayout);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001425 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001426 }
1427 uint32_t i;
1428 for (i = 0; i < rangeCount; i++) {
Courtney Goeltzenleuchtera6d58802015-04-10 17:06:20 -06001429 if (!vk_validate_vkimagesubresourcerange(&pRanges[i])) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001430 sprintf(str, "Parameter pRanges[%i] to function CmdClearDepthStencil contains an invalid value.", i);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001431 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001432 }
1433 }
1434 nextTable.CmdClearDepthStencil(cmdBuffer, image, imageLayout, depth, stencil, rangeCount, pRanges);
1435}
1436
Tony Barbour6865d4a2015-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 Hayesa8b1a8d2015-04-06 13:46:11 -06001438{
1439 char str[1024];
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001440 if (!validate_VkImageLayout(srcImageLayout)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001441 sprintf(str, "Parameter srcImageLayout to function CmdResolveImage has invalid value of %i.", (int)srcImageLayout);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001442 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001443 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001444 if (!validate_VkImageLayout(destImageLayout)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001445 sprintf(str, "Parameter destImageLayout to function CmdResolveImage has invalid value of %i.", (int)destImageLayout);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001446 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001447 }
1448 uint32_t i;
Tony Barbour6865d4a2015-04-13 15:02:52 -06001449 for (i = 0; i < regionCount; i++) {
1450 if (!vk_validate_vkimageresolve(&pRegions[i])) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001451 sprintf(str, "Parameter pRects[%i] to function CmdResolveImage contains an invalid value.", i);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001452 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001453 }
1454 }
Tony Barbour6865d4a2015-04-13 15:02:52 -06001455 nextTable.CmdResolveImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, regionCount, pRegions);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001456}
1457
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001458VK_LAYER_EXPORT void VKAPI vkCmdSetEvent(VkCmdBuffer cmdBuffer, VkEvent event, VkPipeEvent pipeEvent)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001459{
1460 char str[1024];
Courtney Goeltzenleuchtera6d58802015-04-10 17:06:20 -06001461 if (!validate_VkPipeEvent(pipeEvent)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001462 sprintf(str, "Parameter pipeEvent to function CmdSetEvent has invalid value of %i.", (int)pipeEvent);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001463 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001464 }
1465 nextTable.CmdSetEvent(cmdBuffer, event, pipeEvent);
1466}
1467
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001468VK_LAYER_EXPORT void VKAPI vkCmdResetEvent(VkCmdBuffer cmdBuffer, VkEvent event, VkPipeEvent pipeEvent)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001469{
1470 char str[1024];
Courtney Goeltzenleuchtera6d58802015-04-10 17:06:20 -06001471 if (!validate_VkPipeEvent(pipeEvent)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001472 sprintf(str, "Parameter pipeEvent to function CmdResetEvent has invalid value of %i.", (int)pipeEvent);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001473 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001474 }
1475 nextTable.CmdResetEvent(cmdBuffer, event, pipeEvent);
1476}
1477
Tony Barbourd1c35722015-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 Hayesa8b1a8d2015-04-06 13:46:11 -06001479{
Tony Barbourd1c35722015-04-16 15:59:00 -06001480 nextTable.CmdWaitEvents(cmdBuffer, waitEvent, eventCount, pEvents, memBarrierCount, ppMemBarriers);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001481}
1482
Tony Barbourd1c35722015-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 Hayesa8b1a8d2015-04-06 13:46:11 -06001484{
Tony Barbourd1c35722015-04-16 15:59:00 -06001485 nextTable.CmdPipelineBarrier(cmdBuffer, waitEvent, pipeEventCount, pPipeEvents, memBarrierCount, ppMemBarriers);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001486}
1487
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001488VK_LAYER_EXPORT void VKAPI vkCmdBeginQuery(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkFlags flags)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001489{
1490
1491 nextTable.CmdBeginQuery(cmdBuffer, queryPool, slot, flags);
1492}
1493
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001494VK_LAYER_EXPORT void VKAPI vkCmdEndQuery(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001495{
1496
1497 nextTable.CmdEndQuery(cmdBuffer, queryPool, slot);
1498}
1499
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001500VK_LAYER_EXPORT void VKAPI vkCmdResetQueryPool(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001501{
1502
1503 nextTable.CmdResetQueryPool(cmdBuffer, queryPool, startQuery, queryCount);
1504}
1505
Tony Barbourd1c35722015-04-16 15:59:00 -06001506VK_LAYER_EXPORT void VKAPI vkCmdWriteTimestamp(VkCmdBuffer cmdBuffer, VkTimestampType timestampType, VkBuffer destBuffer, VkDeviceSize destOffset)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001507{
1508 char str[1024];
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001509 if (!validate_VkTimestampType(timestampType)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001510 sprintf(str, "Parameter timestampType to function CmdWriteTimestamp has invalid value of %i.", (int)timestampType);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001511 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001512 }
1513 nextTable.CmdWriteTimestamp(cmdBuffer, timestampType, destBuffer, destOffset);
1514}
1515
Jeremy Hayesad367152015-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{
1526 nextTable.CmdCopyQueryPoolResults(cmdBuffer, queryPool, startQuery, queryCount, destBuffer, destOffset, destStride, flags);
1527}
1528
Courtney Goeltzenleuchterfb4efc62015-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 Hayesa8b1a8d2015-04-06 13:46:11 -06001530{
1531 char str[1024];
Courtney Goeltzenleuchtera6d58802015-04-10 17:06:20 -06001532 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001533 sprintf(str, "Parameter pipelineBindPoint to function CmdInitAtomicCounters has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001534 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001535 }
1536 nextTable.CmdInitAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, pData);
1537}
1538
Tony Barbourd1c35722015-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 Hayesa8b1a8d2015-04-06 13:46:11 -06001540{
1541 char str[1024];
Courtney Goeltzenleuchtera6d58802015-04-10 17:06:20 -06001542 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001543 sprintf(str, "Parameter pipelineBindPoint to function CmdLoadAtomicCounters has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001544 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001545 }
1546 nextTable.CmdLoadAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, srcBuffer, srcOffset);
1547}
1548
Tony Barbourd1c35722015-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 Hayesa8b1a8d2015-04-06 13:46:11 -06001550{
1551 char str[1024];
Courtney Goeltzenleuchtera6d58802015-04-10 17:06:20 -06001552 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001553 sprintf(str, "Parameter pipelineBindPoint to function CmdSaveAtomicCounters has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001554 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001555 }
1556 nextTable.CmdSaveAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, destBuffer, destOffset);
1557}
1558
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001559VK_LAYER_EXPORT VkResult VKAPI vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, VkFramebuffer* pFramebuffer)
Jeremy Hayesa8b1a8d2015-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 Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001564 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001565 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001566 else if (!vk_validate_vkframebuffercreateinfo(pCreateInfo)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001567 sprintf(str, "Parameter pCreateInfo to function CreateFramebuffer contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001568 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001569 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001570 VkResult result = nextTable.CreateFramebuffer(device, pCreateInfo, pFramebuffer);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001571 return result;
1572}
1573
1574
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001575void PreCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001576{
1577 if(pCreateInfo == nullptr)
1578 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001579 char const str[] = "vkCreateRenderPass parameter, VkRenderPassCreateInfo* pCreateInfo, is "\
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001580 "nullptr (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001581 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001582 return;
1583 }
1584
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001585 if(pCreateInfo->sType != VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001586 {
Courtney Goeltzenleuchterd8e229c2015-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).";
1589 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001590 return;
1591 }
1592
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001593 if(!vk_validate_vkrect(&pCreateInfo->renderArea))
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001594 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001595 char const str[] = "vkCreateRenderPass parameter, VkRect pCreateInfo->renderArea, is invalid "\
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001596 "(precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001597 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001598 return;
1599 }
1600
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001601 if(!vk_validate_vkextent2d(&pCreateInfo->extent))
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001602 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001603 char const str[] = "vkCreateRenderPass parameter, VkExtent2D pCreateInfo->extent, is invalid "\
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001604 "(precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001605 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001606 return;
1607 }
1608
1609 if(pCreateInfo->pColorFormats == nullptr)
1610 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001611 char const str[] = "vkCreateRenderPass parameter, VkFormat* pCreateInfo->pColorFormats, "\
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001612 "is nullptr (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001613 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001614 return;
1615 }
1616
1617 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1618 {
Courtney Goeltzenleuchtera6d58802015-04-10 17:06:20 -06001619 if(!validate_VkFormat(pCreateInfo->pColorFormats[i]))
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001620 {
1621 std::stringstream ss;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001622 ss << "vkCreateRenderPass parameter, VkFormat pCreateInfo->pColorFormats[" << i <<
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001623 "], is unrecognized (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001624 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001625 continue;
1626 }
1627
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001628 VkFormatProperties properties;
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001629 size_t size = sizeof(properties);
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001630 VkResult result = nextTable.GetFormatInfo(device, pCreateInfo->pColorFormats[i],
Tony Barbourd1c35722015-04-16 15:59:00 -06001631 VK_FORMAT_INFO_TYPE_PROPERTIES, &size, &properties);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001632 if(result != VK_SUCCESS)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001633 {
1634 std::stringstream ss;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001635 ss << "vkCreateRenderPass parameter, VkFormat pCreateInfo->pColorFormats[" << i <<
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001636 "], cannot be validated (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001637 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001638 continue;
1639 }
1640
1641 if((properties.linearTilingFeatures) == 0 && (properties.optimalTilingFeatures == 0))
1642 {
1643 std::stringstream ss;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001644 ss << "vkCreateRenderPass parameter, VkFormat pCreateInfo->pColorFormats[" << i <<
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001645 "], contains unsupported format (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001646 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001647 continue;
1648 }
1649
1650 }
1651
1652 if(pCreateInfo->pColorLayouts == nullptr)
1653 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001654 char const str[] = "vkCreateRenderPass parameter, VkImageLayout* pCreateInfo->pColorLayouts, "\
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001655 "is nullptr (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001656 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001657 return;
1658 }
1659
1660 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1661 {
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001662 if(!validate_VkImageLayout(pCreateInfo->pColorLayouts[i]))
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001663 {
1664 std::stringstream ss;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001665 ss << "vkCreateRenderPass parameter, VkImageLayout pCreateInfo->pColorLayouts[" << i <<
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001666 "], is unrecognized (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001667 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001668 continue;
1669 }
1670 }
1671
1672 if(pCreateInfo->pColorLoadOps == nullptr)
1673 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001674 char const str[] = "vkCreateRenderPass parameter, VkAttachmentLoadOp* pCreateInfo->pColorLoadOps, "\
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001675 "is nullptr (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001676 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001677 return;
1678 }
1679
1680 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1681 {
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001682 if(!validate_VkAttachmentLoadOp(pCreateInfo->pColorLoadOps[i]))
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001683 {
1684 std::stringstream ss;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001685 ss << "vkCreateRenderPass parameter, VkAttachmentLoadOp pCreateInfo->pColorLoadOps[" << i <<
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001686 "], is unrecognized (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001687 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001688 continue;
1689 }
1690 }
1691
1692 if(pCreateInfo->pColorStoreOps == nullptr)
1693 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001694 char const str[] = "vkCreateRenderPass parameter, VkAttachmentStoreOp* pCreateInfo->pColorStoreOps, "\
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001695 "is nullptr (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001696 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001697 return;
1698 }
1699
1700 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1701 {
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001702 if(!validate_VkAttachmentStoreOp(pCreateInfo->pColorStoreOps[i]))
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001703 {
1704 std::stringstream ss;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001705 ss << "vkCreateRenderPass parameter, VkAttachmentStoreOp pCreateInfo->pColorStoreOps[" << i <<
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001706 "], is unrecognized (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001707 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001708 continue;
1709 }
1710 }
1711
1712 if(pCreateInfo->pColorLoadClearValues == nullptr)
1713 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001714 char const str[] = "vkCreateRenderPass parameter, VkClearColor* pCreateInfo->"\
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001715 "pColorLoadClearValues, is nullptr (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001716 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001717 return;
1718 }
Jeremy Hayesb1792dd2015-04-07 09:49:05 -06001719
1720 if(pCreateInfo->pColorStoreOps == nullptr)
1721 {
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001722 char const str[] = "vkCreateRenderPass parameter, VK_ATTACHMENT_STORE_OP* pCreateInfo->pColorStoreOps, "\
Jeremy Hayes090f0ce2015-04-07 13:38:03 -06001723 "is nullptr (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001724 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesb1792dd2015-04-07 09:49:05 -06001725 return;
1726 }
1727
Jeremy Hayesb1792dd2015-04-07 09:49:05 -06001728 if(pCreateInfo->pColorLoadClearValues == nullptr)
1729 {
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001730 char const str[] = "vkCreateRenderPass parameter, VK_CLEAR_COLOR* pCreateInfo->"\
Jeremy Hayes090f0ce2015-04-07 13:38:03 -06001731 "pColorLoadClearValues, is nullptr (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001732 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesb1792dd2015-04-07 09:49:05 -06001733 return;
1734 }
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001735
1736 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1737 {
Courtney Goeltzenleuchtera6d58802015-04-10 17:06:20 -06001738 if(!vk_validate_vkclearcolor(&(pCreateInfo->pColorLoadClearValues[i])))
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001739 {
1740 std::stringstream ss;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001741 ss << "vkCreateRenderPass parameter, VkClearColor pCreateInfo->pColorLoadClearValues[" << i <<
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001742 "], is invalid (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001743 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001744 continue;
1745 }
1746 }
1747
Courtney Goeltzenleuchtera6d58802015-04-10 17:06:20 -06001748 if(!validate_VkFormat(pCreateInfo->depthStencilFormat))
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001749 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001750 char const str[] = "vkCreateRenderPass parameter, VkFormat pCreateInfo->"\
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001751 "depthStencilFormat, is unrecognized (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001752 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001753 return;
1754 }
1755
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001756 VkFormatProperties properties;
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001757 size_t size = sizeof(properties);
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001758 VkResult result = nextTable.GetFormatInfo(device, pCreateInfo->depthStencilFormat,
Tony Barbourd1c35722015-04-16 15:59:00 -06001759 VK_FORMAT_INFO_TYPE_PROPERTIES, &size, &properties);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001760 if(result != VK_SUCCESS)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001761 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001762 char const str[] = "vkCreateRenderPass parameter, VkFormat pCreateInfo->"\
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001763 "depthStencilFormat, cannot be validated (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001764 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001765 return;
1766 }
1767
1768 if((properties.linearTilingFeatures) == 0 && (properties.optimalTilingFeatures == 0))
1769 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001770 char const str[] = "vkCreateRenderPass parameter, VkFormat pCreateInfo->"\
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001771 "depthStencilFormat, contains unsupported format (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001772 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001773 return;
1774 }
1775
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001776 if(!validate_VkImageLayout(pCreateInfo->depthStencilLayout))
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001777 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001778 char const str[] = "vkCreateRenderPass parameter, VkImageLayout pCreateInfo->"\
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001779 "depthStencilLayout, is unrecognized (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001780 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001781 return;
1782 }
1783
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001784 if(!validate_VkAttachmentLoadOp(pCreateInfo->depthLoadOp))
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001785 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001786 char const str[] = "vkCreateRenderPass parameter, VkAttachmentLoadOp pCreateInfo->"\
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001787 "depthLoadOp, is unrecognized (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001788 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001789 return;
1790 }
1791
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001792 if(!validate_VkAttachmentStoreOp(pCreateInfo->depthStoreOp))
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001793 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001794 char const str[] = "vkCreateRenderPass parameter, VkAttachmentStoreOp pCreateInfo->"\
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001795 "depthStoreOp, is unrecognized (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001796 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001797 return;
1798 }
1799
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001800 if(!validate_VkAttachmentLoadOp(pCreateInfo->stencilLoadOp))
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001801 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001802 char const str[] = "vkCreateRenderPass parameter, VkAttachmentLoadOp pCreateInfo->"\
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001803 "stencilLoadOp, is unrecognized (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001804 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001805 return;
1806 }
1807
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001808 if(!validate_VkAttachmentStoreOp(pCreateInfo->stencilStoreOp))
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001809 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001810 char const str[] = "vkCreateRenderPass parameter, VkAttachmentStoreOp pCreateInfo->"\
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001811 "stencilStoreOp, is unrecognized (precondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001812 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001813 return;
1814 }
1815}
1816
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001817void PostCreateRenderPass(VkResult result, VkRenderPass* pRenderPass)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001818{
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001819 if(result != VK_SUCCESS)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001820 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001821 // TODO: Spit out VkResult value.
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001822 char const str[] = "vkCreateRenderPass failed (postcondition).";
1823 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001824 return;
1825 }
1826
1827 if(pRenderPass == nullptr)
1828 {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001829 char const str[] = "vkCreateRenderPass parameter, VkRenderPass* pRenderPass, is nullptr (postcondition).";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001830 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001831 return;
1832 }
1833}
1834
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001835VK_LAYER_EXPORT VkResult VKAPI vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, VkRenderPass* pRenderPass)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001836{
1837 PreCreateRenderPass(device, pCreateInfo);
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001838 VkResult result = nextTable.CreateRenderPass(device, pCreateInfo, pRenderPass);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001839 PostCreateRenderPass(result, pRenderPass);
1840 return result;
1841}
1842
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001843VK_LAYER_EXPORT void VKAPI vkCmdBeginRenderPass(VkCmdBuffer cmdBuffer, const VkRenderPassBegin* pRenderPassBegin)
Jeremy Hayesa8b1a8d2015-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 Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001848 layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001849 }
Courtney Goeltzenleuchterf2ccd5a2015-04-15 00:14:36 -06001850 else if (!vk_validate_vkrenderpassbegin(pRenderPassBegin)) {
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001851 sprintf(str, "Parameter pRenderPassBegin to function CmdBeginRenderPass contains an invalid value.");
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001852 layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001853 }
1854 nextTable.CmdBeginRenderPass(cmdBuffer, pRenderPassBegin);
1855}
1856
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001857VK_LAYER_EXPORT void VKAPI vkCmdEndRenderPass(VkCmdBuffer cmdBuffer, VkRenderPass renderPass)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001858{
1859
1860 nextTable.CmdEndRenderPass(cmdBuffer, renderPass);
1861}
1862
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001863VK_LAYER_EXPORT VkResult VKAPI vkDbgSetValidationLevel(VkDevice device, VkValidationLevel validationLevel)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001864{
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001865 VkResult result = nextTable.DbgSetValidationLevel(device, validationLevel);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001866 return result;
1867}
1868
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001869VK_LAYER_EXPORT VkResult VKAPI vkDbgRegisterMsgCallback(VkInstance instance, VK_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback, void* pUserData)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001870{
1871 // This layer intercepts callbacks
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001872 VK_LAYER_DBG_FUNCTION_NODE *pNewDbgFuncNode = (VK_LAYER_DBG_FUNCTION_NODE*)malloc(sizeof(VK_LAYER_DBG_FUNCTION_NODE));
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001873 if (!pNewDbgFuncNode)
Tony Barbourd1c35722015-04-16 15:59:00 -06001874 return VK_ERROR_OUT_OF_HOST_MEMORY;
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001875 pNewDbgFuncNode->pfnMsgCallback = pfnMsgCallback;
1876 pNewDbgFuncNode->pUserData = pUserData;
1877 pNewDbgFuncNode->pNext = g_pDbgFunctionHead;
1878 g_pDbgFunctionHead = pNewDbgFuncNode;
1879 // force callbacks if DebugAction hasn't been set already other than initial value
1880 if (g_actionIsDefault) {
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001881 g_debugAction = VK_DBG_LAYER_ACTION_CALLBACK;
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001882 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001883 VkResult result = nextTable.DbgRegisterMsgCallback(instance, pfnMsgCallback, pUserData);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001884 return result;
1885}
1886
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001887VK_LAYER_EXPORT VkResult VKAPI vkDbgUnregisterMsgCallback(VkInstance instance, VK_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001888{
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001889 VK_LAYER_DBG_FUNCTION_NODE *pTrav = g_pDbgFunctionHead;
1890 VK_LAYER_DBG_FUNCTION_NODE *pPrev = pTrav;
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001891 while (pTrav) {
1892 if (pTrav->pfnMsgCallback == pfnMsgCallback) {
1893 pPrev->pNext = pTrav->pNext;
1894 if (g_pDbgFunctionHead == pTrav)
1895 g_pDbgFunctionHead = pTrav->pNext;
1896 free(pTrav);
1897 break;
1898 }
1899 pPrev = pTrav;
1900 pTrav = pTrav->pNext;
1901 }
1902 if (g_pDbgFunctionHead == NULL)
1903 {
1904 if (g_actionIsDefault)
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001905 g_debugAction = VK_DBG_LAYER_ACTION_LOG_MSG;
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001906 else
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001907 g_debugAction = (VK_LAYER_DBG_ACTION)(g_debugAction & ~((uint32_t)VK_DBG_LAYER_ACTION_CALLBACK));
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001908 }
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001909 VkResult result = nextTable.DbgUnregisterMsgCallback(instance, pfnMsgCallback);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001910 return result;
1911}
1912
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001913VK_LAYER_EXPORT VkResult VKAPI vkDbgSetMessageFilter(VkDevice device, int32_t msgCode, VK_DBG_MSG_FILTER filter)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001914{
1915
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001916 VkResult result = nextTable.DbgSetMessageFilter(device, msgCode, filter);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001917 return result;
1918}
1919
Mike Stroyanb050c682015-04-17 12:36:38 -06001920VK_LAYER_EXPORT VkResult VKAPI vkDbgSetObjectTag(VkDevice device, VkObject object, size_t tagSize, const void* pTag)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001921{
1922
Mike Stroyanb050c682015-04-17 12:36:38 -06001923 VkResult result = nextTable.DbgSetObjectTag(device, object, tagSize, pTag);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001924 return result;
1925}
1926
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001927VK_LAYER_EXPORT VkResult VKAPI vkDbgSetGlobalOption(VkInstance instance, VK_DBG_GLOBAL_OPTION dbgOption, size_t dataSize, const void* pData)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001928{
1929
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001930 VkResult result = nextTable.DbgSetGlobalOption(instance, dbgOption, dataSize, pData);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001931 return result;
1932}
1933
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001934VK_LAYER_EXPORT VkResult VKAPI vkDbgSetDeviceOption(VkDevice device, VK_DBG_DEVICE_OPTION dbgOption, size_t dataSize, const void* pData)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001935{
1936
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001937 VkResult result = nextTable.DbgSetDeviceOption(device, dbgOption, dataSize, pData);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001938 return result;
1939}
1940
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001941VK_LAYER_EXPORT void VKAPI vkCmdDbgMarkerBegin(VkCmdBuffer cmdBuffer, const char* pMarker)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001942{
1943
1944 nextTable.CmdDbgMarkerBegin(cmdBuffer, pMarker);
1945}
1946
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -06001947VK_LAYER_EXPORT void VKAPI vkCmdDbgMarkerEnd(VkCmdBuffer cmdBuffer)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001948{
1949
1950 nextTable.CmdDbgMarkerEnd(cmdBuffer);
1951}
1952
Chia-I Wuf8693382015-04-16 22:02:10 +08001953VK_LAYER_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(VkDisplayWSI display, VkDisplayInfoTypeWSI infoType, size_t* pDataSize, void* pData)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001954{
Chia-I Wuf8693382015-04-16 22:02:10 +08001955 VkResult result = nextTable.GetDisplayInfoWSI(display, infoType, pDataSize, pData);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001956 return result;
1957}
1958
Chia-I Wuf8693382015-04-16 22:02:10 +08001959VK_LAYER_EXPORT VkResult VKAPI vkCreateSwapChainWSI(VkDevice device, const VkSwapChainCreateInfoWSI* pCreateInfo, VkSwapChainWSI* pSwapChain)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001960{
Chia-I Wuf8693382015-04-16 22:02:10 +08001961 VkResult result = nextTable.CreateSwapChainWSI(device, pCreateInfo, pSwapChain);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001962 return result;
1963}
1964
Chia-I Wuf8693382015-04-16 22:02:10 +08001965VK_LAYER_EXPORT VkResult VKAPI vkDestroySwapChainWSI(VkSwapChainWSI swapChain)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001966{
Chia-I Wuf8693382015-04-16 22:02:10 +08001967 VkResult result = nextTable.DestroySwapChainWSI(swapChain);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001968 return result;
1969}
1970
Chia-I Wuf8693382015-04-16 22:02:10 +08001971VK_LAYER_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(VkSwapChainWSI swapChain, VkSwapChainInfoTypeWSI infoType, size_t* pDataSize, void* pData)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001972{
Chia-I Wuf8693382015-04-16 22:02:10 +08001973 VkResult result = nextTable.GetSwapChainInfoWSI(swapChain, infoType, pDataSize, pData);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001974 return result;
1975}
1976
Chia-I Wuf8693382015-04-16 22:02:10 +08001977VK_LAYER_EXPORT VkResult VKAPI vkQueuePresentWSI(VkQueue queue, const VkPresentInfoWSI* pPresentInfo)
1978{
1979 VkResult result = nextTable.QueuePresentWSI(queue, pPresentInfo);
1980 return result;
1981}
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001982
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001983#include "vk_generic_intercept_proc_helper.h"
Tony Barbourd1c35722015-04-16 15:59:00 -06001984VK_LAYER_EXPORT void* VKAPI vkGetProcAddr(VkPhysicalDevice gpu, const char* funcName)
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001985{
Jon Ashburnbacb0f52015-04-06 10:58:22 -06001986 VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu;
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06001987 void* addr;
1988 if (gpu == NULL)
1989 return NULL;
1990 pCurObj = gpuw;
1991 loader_platform_thread_once(&tabOnce, initParamChecker);
1992
1993 addr = layer_intercept_proc(funcName);
1994 if (addr)
1995 return addr;
1996 else {
1997 if (gpuw->pGPA == NULL)
1998 return NULL;
Tony Barbourd1c35722015-04-16 15:59:00 -06001999 return gpuw->pGPA((VkPhysicalDevice)gpuw->nextObject, funcName);
Jeremy Hayesa8b1a8d2015-04-06 13:46:11 -06002000 }
2001}
2002