blob: 680c637369c4b16b3a6b84f88700e225d1111344 [file] [log] [blame]
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001/*
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002 * Vulkan
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06003 *
4 * Copyright (C) 2014 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25#include <stdio.h>
26#include <stdlib.h>
27#include <string.h>
28
29#include <iostream>
30#include <string>
31#include <sstream>
Mark Lobodzinski3723c512015-05-26 10:58:40 -050032#include <unordered_map>
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060033
34#include "loader_platform.h"
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060035#include "vkLayer.h"
Jon Ashburnf0615e22015-05-25 14:11:37 -060036#include "vk_debug_marker_layer.h"
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060037#include "layers_config.h"
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060038#include "vk_enum_validate_helper.h"
39#include "vk_struct_validate_helper.h"
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060040//The following is #included again to catch certain OS-specific functions being used:
41#include "loader_platform.h"
42
43#include "layers_msg.h"
Jon Ashburn6f8cd632015-06-01 09:37:38 -060044#include "layers_debug_marker_table.h"
Jon Ashburn5a10d212015-06-01 10:02:09 -060045#include "layers_table.h"
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060046
Jon Ashburnd9564002015-05-07 10:27:37 -060047static LOADER_PLATFORM_THREAD_ONCE_DECLARATION(initOnce);
Jon Ashburn6f8cd632015-06-01 09:37:38 -060048struct devExts {
49 bool debug_marker_enabled;
50};
Jon Ashburn6f8cd632015-06-01 09:37:38 -060051static std::unordered_map<void *, struct devExts> deviceExtMap;
Mark Lobodzinski3723c512015-05-26 10:58:40 -050052
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060053
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060054#include "vk_dispatch_table_helper.h"
Jon Ashburnd9564002015-05-07 10:27:37 -060055
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060056static void initParamChecker(void)
57{
58
59 const char *strOpt;
60 // initialize ParamChecker options
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060061 getLayerOptionEnum("ParamCheckerReportLevel", (uint32_t *) &g_reportFlags);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060062 g_actionIsDefault = getLayerOptionEnum("ParamCheckerDebugAction", (uint32_t *) &g_debugAction);
63
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060064 if (g_debugAction & VK_DBG_LAYER_ACTION_LOG_MSG)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060065 {
66 strOpt = getLayerOption("ParamCheckerLogFilename");
67 if (strOpt)
68 {
69 g_logFile = fopen(strOpt, "w");
70 }
71 if (g_logFile == NULL)
72 g_logFile = stdout;
73 }
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060074}
75
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060076void PreCreateInstance(const VkApplicationInfo* pAppInfo, const VkAllocCallbacks* pAllocCb)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060077{
78 if(pAppInfo == nullptr)
79 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060080 char const str[] = "vkCreateInstance parameter, VkApplicationInfo* pAppInfo, is "\
Mike Stroyan0ae32252015-04-06 15:24:46 -060081 "nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060082 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060083 return;
84 }
85
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060086 if(pAppInfo->sType != VK_STRUCTURE_TYPE_APPLICATION_INFO)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060087 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060088 char const str[] = "vkCreateInstance parameter, VK_STRUCTURE_TYPE_APPLICATION_INFO "\
89 "pAppInfo->sType, is not VK_STRUCTURE_TYPE_APPLICATION_INFO (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060090 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060091 return;
92 }
93
94 // TODO: What else can validated in pAppInfo?
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060095 // TODO: VK_API_VERSION validation.
Jeremy Hayesc6cfa572015-04-06 13:46:11 -060096
97 // It's okay if pAllocCb is a nullptr.
98 if(pAllocCb != nullptr)
99 {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600100 if(!vk_validate_vkalloccallbacks(pAllocCb))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600101 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600102 char const str[] = "vkCreateInstance parameter, VkAllocCallbacks* pAllocCb, "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600103 "contains an invalid value (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600104 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600105 return;
106 }
107 }
108}
109
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600110void PostCreateInstance(VkResult result, const VkInstanceCreateInfo *pCreateInfo, VkInstance* pInstance)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600111{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600112 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600113 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600114 // TODO: Spit out VkResult value.
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600115 char const str[] = "vkCreateInstance failed (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600116 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600117 return;
118 }
119
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600120 enable_debug_report(pCreateInfo->extensionCount, pCreateInfo->pEnabledExtensions);
121
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600122 if(pInstance == nullptr)
123 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600124 char const str[] = "vkCreateInstance parameter, VkInstance* pInstance, is nullptr "\
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600125 "(postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600126 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600127 return;
128 }
Courtney Goeltzenleuchterf4a2eba2015-06-08 14:58:39 -0600129
130 VkLayerInstanceDispatchTable *pTable = instance_dispatch_table(*pInstance);
131 debug_report_init_instance_extension_dispatch_table(
132 pTable,
133 pTable->GetInstanceProcAddr,
134 *pInstance);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600135}
136
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600137VK_LAYER_EXPORT VkResult VKAPI vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, VkInstance* pInstance)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600138{
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600139 loader_platform_thread_once(&initOnce, initParamChecker);
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600140
Jon Ashburn29669a42015-04-04 14:52:07 -0600141 PreCreateInstance(pCreateInfo->pAppInfo, pCreateInfo->pAllocCb);
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500142 VkResult result = instance_dispatch_table(*pInstance)->CreateInstance(pCreateInfo, pInstance);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600143 PostCreateInstance(result, pCreateInfo, pInstance);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600144 return result;
145}
146
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600147VK_LAYER_EXPORT VkResult VKAPI vkDestroyInstance(VkInstance instance)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600148{
Courtney Goeltzenleuchter9f171942015-06-13 21:22:12 -0600149 dispatch_key key = get_dispatch_key(instance);
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500150 VkResult res = instance_dispatch_table(instance)->DestroyInstance(instance);
Courtney Goeltzenleuchter9f171942015-06-13 21:22:12 -0600151 destroy_instance_dispatch_table(key);
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500152 return res;
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600153}
154
Tony Barbour8205d902015-04-16 15:59:00 -0600155VK_LAYER_EXPORT VkResult VKAPI vkGetPhysicalDeviceInfo(VkPhysicalDevice gpu, VkPhysicalDeviceInfoType infoType, size_t* pDataSize, void* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600156{
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600157 char str[1024];
Tony Barbour8205d902015-04-16 15:59:00 -0600158 if (!validate_VkPhysicalDeviceInfoType(infoType)) {
159 sprintf(str, "Parameter infoType to function GetPhysicalDeviceInfo has invalid value of %i.", (int)infoType);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600160 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600161 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500162 VkResult result = instance_dispatch_table(gpu)->GetPhysicalDeviceInfo(gpu, infoType, pDataSize, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600163 return result;
164}
165
Tony Barbour8205d902015-04-16 15:59:00 -0600166void PreCreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo* pCreateInfo)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600167{
168 if(gpu == nullptr)
169 {
Tony Barbour8205d902015-04-16 15:59:00 -0600170 char const str[] = "vkCreateDevice parameter, VkPhysicalDevice gpu, is nullptr "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600171 "(precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600172 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600173 return;
174 }
175
176 if(pCreateInfo == nullptr)
177 {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600178 char const str[] = "vkCreateDevice parameter, VkDeviceCreateInfo* pCreateInfo, is "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600179 "nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600180 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600181 return;
182 }
183
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600184 if(pCreateInfo->sType != VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600185 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600186 char const str[] = "vkCreateDevice parameter, VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO "\
187 "pCreateInfo->sType, is not VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600188 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600189 return;
190 }
191
192 if(pCreateInfo->queueRecordCount == 0)
193 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600194 char const str[] = "vkCreateDevice parameter, uint32_t pCreateInfo->queueRecordCount, is "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600195 "zero (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600196 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600197 return;
198 }
199
200 if(pCreateInfo->pRequestedQueues == nullptr)
201 {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600202 char const str[] = "vkCreateDevice parameter, VkDeviceQueueCreateInfo* pCreateInfo->pRequestedQueues, is "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600203 "nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600204 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600205 return;
206 }
207
208 for(uint32_t i = 0; i < pCreateInfo->queueRecordCount; ++i)
209 {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600210 if(!vk_validate_vkdevicequeuecreateinfo(&(pCreateInfo->pRequestedQueues[i])))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600211 {
212 std::stringstream ss;
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600213 ss << "vkCreateDevice parameter, VkDeviceQueueCreateInfo pCreateInfo->pRequestedQueues[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600214 "], is invalid (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600215 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600216 continue;
217 }
218 }
219
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600220}
221
Jon Ashburnf0615e22015-05-25 14:11:37 -0600222static void createDeviceRegisterExtensions(const VkDeviceCreateInfo* pCreateInfo, VkDevice device)
223{
224 uint32_t i, ext_idx;
Jon Ashburn6f8cd632015-06-01 09:37:38 -0600225 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) device;
226 deviceExtMap[pDisp].debug_marker_enabled = false;
Jon Ashburnf0615e22015-05-25 14:11:37 -0600227 for (i = 0; i < pCreateInfo->extensionCount; i++) {
228 if (strcmp(pCreateInfo->pEnabledExtensions[i].name, DEBUG_MARKER_EXTENSION_NAME) == 0) {
Jon Ashburn6f8cd632015-06-01 09:37:38 -0600229 /* Found a matching extension name, mark it enabled and init dispatch table*/
230 initDebugMarkerTable(device);
231 deviceExtMap[pDisp].debug_marker_enabled = true;
232
Jon Ashburnf0615e22015-05-25 14:11:37 -0600233 }
234
235 }
236}
237
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600238void PostCreateDevice(VkResult result, const VkDeviceCreateInfo *pCreateInfo, VkDevice* pDevice)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600239{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600240 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600241 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600242 // TODO: Spit out VkResult value.
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600243 char const str[] = "vkCreateDevice failed (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600244 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600245 return;
246 }
247
248 if(pDevice == nullptr)
249 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600250 char const str[] = "vkCreateDevice parameter, VkDevice* pDevice, is nullptr (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600251 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600252 return;
253 }
Jon Ashburn6f8cd632015-06-01 09:37:38 -0600254 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) *pDevice;
255 enable_debug_report(pCreateInfo->extensionCount, pCreateInfo->pEnabledExtensions);
256 createDeviceRegisterExtensions(pCreateInfo, *pDevice);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600257}
258
Tony Barbour8205d902015-04-16 15:59:00 -0600259VK_LAYER_EXPORT VkResult VKAPI vkCreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo* pCreateInfo, VkDevice* pDevice)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600260{
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600261 PreCreateDevice(gpu, pCreateInfo);
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500262 VkResult result = instance_dispatch_table(gpu)->CreateDevice(gpu, pCreateInfo, pDevice);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600263 PostCreateDevice(result, pCreateInfo, pDevice);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600264 return result;
265}
266
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600267VK_LAYER_EXPORT VkResult VKAPI vkDestroyDevice(VkDevice device)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600268{
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500269 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) device;
Courtney Goeltzenleuchter9f171942015-06-13 21:22:12 -0600270 dispatch_key key = get_dispatch_key(device);
Jon Ashburn5a10d212015-06-01 10:02:09 -0600271 VkResult result = device_dispatch_table(device)->DestroyDevice(device);
Courtney Goeltzenleuchter9f171942015-06-13 21:22:12 -0600272 destroy_device_dispatch_table(key);
Jon Ashburn6f8cd632015-06-01 09:37:38 -0600273 tableDebugMarkerMap.erase(pDisp);
274 deviceExtMap.erase(pDisp);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600275 return result;
276}
277
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600278#define PARAM_CHECKER_LAYER_EXT_ARRAY_SIZE 2
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600279static const VkExtensionProperties pcExts[PARAM_CHECKER_LAYER_EXT_ARRAY_SIZE] = {
280 {
281 VK_STRUCTURE_TYPE_EXTENSION_PROPERTIES,
282 "ParamChecker",
283 0x10,
284 "Sample layer: ParamChecker",
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600285 },
286 {
287 VK_STRUCTURE_TYPE_EXTENSION_PROPERTIES,
288 "Validation",
289 0x10,
290 "Sample layer: ParamChecker",
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600291 }
Jon Ashburneb2728b2015-04-10 14:33:07 -0600292};
293
294VK_LAYER_EXPORT VkResult VKAPI vkGetGlobalExtensionInfo(
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600295 VkExtensionInfoType infoType,
296 uint32_t extensionIndex,
297 size_t* pDataSize,
298 void* pData)
Jon Ashburneb2728b2015-04-10 14:33:07 -0600299{
Jon Ashburneb2728b2015-04-10 14:33:07 -0600300 /* This entrypoint is NOT going to init it's own dispatch table since loader calls here early */
Jon Ashburneb2728b2015-04-10 14:33:07 -0600301 uint32_t *count;
302
303 if (pDataSize == NULL)
304 return VK_ERROR_INVALID_POINTER;
305
306 switch (infoType) {
307 case VK_EXTENSION_INFO_TYPE_COUNT:
308 *pDataSize = sizeof(uint32_t);
309 if (pData == NULL)
310 return VK_SUCCESS;
311 count = (uint32_t *) pData;
312 *count = PARAM_CHECKER_LAYER_EXT_ARRAY_SIZE;
313 break;
314 case VK_EXTENSION_INFO_TYPE_PROPERTIES:
315 *pDataSize = sizeof(VkExtensionProperties);
316 if (pData == NULL)
317 return VK_SUCCESS;
318 if (extensionIndex >= PARAM_CHECKER_LAYER_EXT_ARRAY_SIZE)
319 return VK_ERROR_INVALID_VALUE;
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600320 memcpy((VkExtensionProperties *) pData, &pcExts[extensionIndex], sizeof(VkExtensionProperties));
Jon Ashburneb2728b2015-04-10 14:33:07 -0600321 break;
322 default:
323 return VK_ERROR_INVALID_VALUE;
324 };
325
326 return VK_SUCCESS;
327}
328
Jon Ashburn0b2ec1d2015-06-15 16:08:39 -0600329#define PARAM_CHECKER_LAYER_DEV_EXT_ARRAY_SIZE 3
330static const VkExtensionProperties pcDevExts[PARAM_CHECKER_LAYER_DEV_EXT_ARRAY_SIZE] = {
331 {
332 VK_STRUCTURE_TYPE_EXTENSION_PROPERTIES,
333 "ParamChecker",
334 0x10,
335 "Sample layer: ParamChecker",
336 },
337 {
338 VK_STRUCTURE_TYPE_EXTENSION_PROPERTIES,
339 "Validation",
340 0x10,
341 "Sample layer: ParamChecker",
342 },
343 {
344 VK_STRUCTURE_TYPE_EXTENSION_PROPERTIES,
345 DEBUG_MARKER_EXTENSION_NAME,
346 0x10,
347 "Sample layer: ParamChecker",
348 }
349};
Jeremy Hayescf469132015-04-17 10:36:53 -0600350VK_LAYER_EXPORT VkResult VKAPI vkGetPhysicalDeviceExtensionInfo(
351 VkPhysicalDevice gpu,
352 VkExtensionInfoType infoType,
353 uint32_t extensionIndex,
354 size_t* pDataSize,
355 void* pData)
356{
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600357 /* This entrypoint is NOT going to init it's own dispatch table since loader calls here early */
358 uint32_t *count;
359
360 if (pDataSize == NULL)
361 return VK_ERROR_INVALID_POINTER;
362
363 switch (infoType) {
364 case VK_EXTENSION_INFO_TYPE_COUNT:
365 *pDataSize = sizeof(uint32_t);
366 if (pData == NULL)
367 return VK_SUCCESS;
368 count = (uint32_t *) pData;
Jon Ashburn0b2ec1d2015-06-15 16:08:39 -0600369 *count = PARAM_CHECKER_LAYER_DEV_EXT_ARRAY_SIZE;
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600370 break;
371 case VK_EXTENSION_INFO_TYPE_PROPERTIES:
372 *pDataSize = sizeof(VkExtensionProperties);
373 if (pData == NULL)
374 return VK_SUCCESS;
Jon Ashburn0b2ec1d2015-06-15 16:08:39 -0600375 if (extensionIndex >= PARAM_CHECKER_LAYER_DEV_EXT_ARRAY_SIZE)
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600376 return VK_ERROR_INVALID_VALUE;
Jon Ashburn0b2ec1d2015-06-15 16:08:39 -0600377 memcpy((VkExtensionProperties *) pData, &pcDevExts[extensionIndex], sizeof(VkExtensionProperties));
Courtney Goeltzenleuchter23b5f8d2015-06-17 20:51:59 -0600378 break;
379 default:
380 return VK_ERROR_INVALID_VALUE;
381 };
382
383 return VK_SUCCESS;
Jeremy Hayescf469132015-04-17 10:36:53 -0600384}
385
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600386VK_LAYER_EXPORT VkResult VKAPI vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex, VkQueue* pQueue)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600387{
388
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500389 VkResult result = device_dispatch_table(device)->GetDeviceQueue(device, queueNodeIndex, queueIndex, pQueue);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600390 return result;
391}
392
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600393VK_LAYER_EXPORT VkResult VKAPI vkQueueSubmit(VkQueue queue, uint32_t cmdBufferCount, const VkCmdBuffer* pCmdBuffers, VkFence fence)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600394{
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500395 VkResult result = device_dispatch_table(queue)->QueueSubmit(queue, cmdBufferCount, pCmdBuffers, fence);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600396 return result;
397}
398
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600399VK_LAYER_EXPORT VkResult VKAPI vkQueueWaitIdle(VkQueue queue)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600400{
401
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500402 VkResult result = device_dispatch_table(queue)->QueueWaitIdle(queue);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600403 return result;
404}
405
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600406VK_LAYER_EXPORT VkResult VKAPI vkDeviceWaitIdle(VkDevice device)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600407{
408
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500409 VkResult result = device_dispatch_table(device)->DeviceWaitIdle(device);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600410 return result;
411}
412
Tony Barbour8205d902015-04-16 15:59:00 -0600413VK_LAYER_EXPORT VkResult VKAPI vkAllocMemory(VkDevice device, const VkMemoryAllocInfo* pAllocInfo, VkDeviceMemory* pMem)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600414{
415 char str[1024];
416 if (!pAllocInfo) {
417 sprintf(str, "Struct ptr parameter pAllocInfo to function AllocMemory is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600418 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600419 } else if (!vk_validate_vkmemoryallocinfo(pAllocInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600420 sprintf(str, "Parameter pAllocInfo to function AllocMemory contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600421 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600422 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500423 VkResult result = device_dispatch_table(device)->AllocMemory(device, pAllocInfo, pMem);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600424 return result;
425}
426
Mike Stroyan230e6252015-04-17 12:36:38 -0600427VK_LAYER_EXPORT VkResult VKAPI vkFreeMemory(VkDevice device, VkDeviceMemory mem)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600428{
429
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500430 VkResult result = device_dispatch_table(device)->FreeMemory(device, mem);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600431 return result;
432}
433
Mike Stroyan230e6252015-04-17 12:36:38 -0600434VK_LAYER_EXPORT VkResult VKAPI vkSetMemoryPriority(VkDevice device, VkDeviceMemory mem, VkMemoryPriority priority)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600435{
436 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600437 if (!validate_VkMemoryPriority(priority)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600438 sprintf(str, "Parameter priority to function SetMemoryPriority has invalid value of %i.", (int)priority);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600439 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600440 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500441 VkResult result = device_dispatch_table(device)->SetMemoryPriority(device, mem, priority);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600442 return result;
443}
444
Mike Stroyan230e6252015-04-17 12:36:38 -0600445VK_LAYER_EXPORT VkResult VKAPI vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset, VkDeviceSize size, VkFlags flags, void** ppData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600446{
447
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500448 VkResult result = device_dispatch_table(device)->MapMemory(device, mem, offset, size, flags, ppData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600449 return result;
450}
451
Mike Stroyan230e6252015-04-17 12:36:38 -0600452VK_LAYER_EXPORT VkResult VKAPI vkUnmapMemory(VkDevice device, VkDeviceMemory mem)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600453{
454
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500455 VkResult result = device_dispatch_table(device)->UnmapMemory(device, mem);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600456 return result;
457}
458
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -0600459VK_LAYER_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
460 VkDevice device,
461 uint32_t memRangeCount,
462 const VkMappedMemoryRange* pMemRanges)
Tony Barbour859ceab2015-04-16 19:23:13 -0600463{
464
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500465 VkResult result = device_dispatch_table(device)->FlushMappedMemoryRanges(device, memRangeCount, pMemRanges);
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -0600466 return result;
467}
468
469VK_LAYER_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
470 VkDevice device,
471 uint32_t memRangeCount,
472 const VkMappedMemoryRange* pMemRanges)
473{
474
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500475 VkResult result = device_dispatch_table(device)->InvalidateMappedMemoryRanges(device, memRangeCount, pMemRanges);
Tony Barbour859ceab2015-04-16 19:23:13 -0600476 return result;
477}
478
Tony Barbour8205d902015-04-16 15:59:00 -0600479VK_LAYER_EXPORT VkResult VKAPI vkPinSystemMemory(VkDevice device, const void* pSysMem, size_t memSize, VkDeviceMemory* pMem)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600480{
481
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500482 VkResult result = device_dispatch_table(device)->PinSystemMemory(device, pSysMem, memSize, pMem);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600483 return result;
484}
485
Tony Barbour8205d902015-04-16 15:59:00 -0600486VK_LAYER_EXPORT VkResult VKAPI vkGetMultiDeviceCompatibility(VkPhysicalDevice gpu0, VkPhysicalDevice gpu1, VkPhysicalDeviceCompatibilityInfo* pInfo)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600487{
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600488
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500489 VkResult result = instance_dispatch_table(gpu0)->GetMultiDeviceCompatibility(gpu0, gpu1, pInfo);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600490 return result;
491}
492
Tony Barbour8205d902015-04-16 15:59:00 -0600493VK_LAYER_EXPORT VkResult VKAPI vkOpenSharedMemory(VkDevice device, const VkMemoryOpenInfo* pOpenInfo, VkDeviceMemory* pMem)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600494{
495 char str[1024];
496 if (!pOpenInfo) {
497 sprintf(str, "Struct ptr parameter pOpenInfo to function OpenSharedMemory is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600498 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600499 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600500 else if (!vk_validate_vkmemoryopeninfo(pOpenInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600501 sprintf(str, "Parameter pOpenInfo to function OpenSharedMemory contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600502 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600503 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500504 VkResult result = device_dispatch_table(device)->OpenSharedMemory(device, pOpenInfo, pMem);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600505 return result;
506}
507
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600508VK_LAYER_EXPORT VkResult VKAPI vkOpenSharedSemaphore(VkDevice device, const VkSemaphoreOpenInfo* pOpenInfo, VkSemaphore* pSemaphore)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600509{
510 char str[1024];
511 if (!pOpenInfo) {
512 sprintf(str, "Struct ptr parameter pOpenInfo to function OpenSharedSemaphore is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600513 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600514 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600515 else if (!vk_validate_vksemaphoreopeninfo(pOpenInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600516 sprintf(str, "Parameter pOpenInfo to function OpenSharedSemaphore contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600517 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600518 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500519 VkResult result = device_dispatch_table(device)->OpenSharedSemaphore(device, pOpenInfo, pSemaphore);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600520 return result;
521}
522
Tony Barbour8205d902015-04-16 15:59:00 -0600523VK_LAYER_EXPORT VkResult VKAPI vkOpenPeerMemory(VkDevice device, const VkPeerMemoryOpenInfo* pOpenInfo, VkDeviceMemory* pMem)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600524{
525 char str[1024];
526 if (!pOpenInfo) {
527 sprintf(str, "Struct ptr parameter pOpenInfo to function OpenPeerMemory is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600528 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600529 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600530 else if (!vk_validate_vkpeermemoryopeninfo(pOpenInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600531 sprintf(str, "Parameter pOpenInfo to function OpenPeerMemory contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600532 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600533 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500534 VkResult result = device_dispatch_table(device)->OpenPeerMemory(device, pOpenInfo, pMem);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600535 return result;
536}
537
Tony Barbour8205d902015-04-16 15:59:00 -0600538VK_LAYER_EXPORT VkResult VKAPI vkOpenPeerImage(VkDevice device, const VkPeerImageOpenInfo* pOpenInfo, VkImage* pImage, VkDeviceMemory* pMem)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600539{
540 char str[1024];
541 if (!pOpenInfo) {
542 sprintf(str, "Struct ptr parameter pOpenInfo to function OpenPeerImage is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600543 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600544 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600545 else if (!vk_validate_vkpeerimageopeninfo(pOpenInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600546 sprintf(str, "Parameter pOpenInfo to function OpenPeerImage contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600547 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600548 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500549 VkResult result = device_dispatch_table(device)->OpenPeerImage(device, pOpenInfo, pImage, pMem);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600550 return result;
551}
552
Mike Stroyan230e6252015-04-17 12:36:38 -0600553VK_LAYER_EXPORT VkResult VKAPI vkDestroyObject(VkDevice device, VkObjectType objType, VkObject object)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600554{
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500555 VkResult result = device_dispatch_table(device)->DestroyObject(device, objType, object);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600556 return result;
557}
558
Mike Stroyan230e6252015-04-17 12:36:38 -0600559VK_LAYER_EXPORT VkResult VKAPI vkGetObjectInfo(VkDevice device, VkObjectType objType, VkObject object, VkObjectInfoType infoType, size_t* pDataSize, void* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600560{
561 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600562 if (!validate_VkObjectInfoType(infoType)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600563 sprintf(str, "Parameter infoType to function GetObjectInfo has invalid value of %i.", (int)infoType);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600564 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600565 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500566 VkResult result = device_dispatch_table(device)->GetObjectInfo(device, objType, object, infoType, pDataSize, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600567 return result;
568}
569
Mark Lobodzinski23182612015-05-29 09:32:35 -0500570VK_LAYER_EXPORT VkResult VKAPI vkBindObjectMemory(VkDevice device, VkObjectType objType, VkObject object, VkDeviceMemory mem, VkDeviceSize offset)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600571{
572
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500573 VkResult result = device_dispatch_table(device)->BindObjectMemory(device, objType, object, mem, offset);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600574 return result;
575}
576
Mark Lobodzinski23182612015-05-29 09:32:35 -0500577VK_LAYER_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(VkQueue queue, VkBuffer buffer, VkDeviceSize rangeOffset, VkDeviceSize rangeSize, VkDeviceMemory mem, VkDeviceSize memOffset)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600578{
579
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500580 VkResult result = device_dispatch_table(queue)->QueueBindSparseBufferMemory(queue, buffer, rangeOffset, rangeSize, mem, memOffset);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600581 return result;
582}
583
Mark Lobodzinski23182612015-05-29 09:32:35 -0500584VK_LAYER_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(VkQueue queue, VkImage image, const VkImageMemoryBindInfo* pBindInfo, VkDeviceMemory mem, VkDeviceSize memOffset)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600585{
586 char str[1024];
Jeremy Hayes47536532015-04-15 15:20:03 -0600587 if (!pBindInfo) {
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -0500588 sprintf(str, "Struct ptr parameter pBindInfo to function QueueBindSparseImageMemory is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600589 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600590 }
Jeremy Hayes47536532015-04-15 15:20:03 -0600591 else if (!vk_validate_vkimagememorybindinfo(pBindInfo)) {
592 sprintf(str, "Parameter pBindInfo to function BindImageMemoryRange contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600593 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600594 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500595 VkResult result = device_dispatch_table(queue)->QueueBindSparseImageMemory(queue, image, pBindInfo, mem, memOffset);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600596 return result;
597}
598
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600599VK_LAYER_EXPORT VkResult VKAPI vkCreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, VkFence* pFence)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600600{
601 char str[1024];
602 if (!pCreateInfo) {
603 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateFence is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600604 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600605 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600606 else if (!vk_validate_vkfencecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600607 sprintf(str, "Parameter pCreateInfo to function CreateFence contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600608 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600609 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500610 VkResult result = device_dispatch_table(device)->CreateFence(device, pCreateInfo, pFence);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600611 return result;
612}
613
Mike Stroyan230e6252015-04-17 12:36:38 -0600614VK_LAYER_EXPORT VkResult VKAPI vkGetFenceStatus(VkDevice device, VkFence fence)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600615{
616
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500617 VkResult result = device_dispatch_table(device)->GetFenceStatus(device, fence);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600618 return result;
619}
620
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600621VK_LAYER_EXPORT VkResult VKAPI vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, bool32_t waitAll, uint64_t timeout)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600622{
623
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500624 VkResult result = device_dispatch_table(device)->WaitForFences(device, fenceCount, pFences, waitAll, timeout);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600625 return result;
626}
627
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600628VK_LAYER_EXPORT VkResult VKAPI vkResetFences(VkDevice device, uint32_t fenceCount, VkFence* pFences)
Mark Lobodzinskiebe814d2015-04-07 16:07:57 -0500629{
630
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500631 VkResult result = device_dispatch_table(device)->ResetFences(device, fenceCount, pFences);
Mark Lobodzinskiebe814d2015-04-07 16:07:57 -0500632 return result;
633}
634
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600635VK_LAYER_EXPORT VkResult VKAPI vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, VkSemaphore* pSemaphore)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600636{
637 char str[1024];
638 if (!pCreateInfo) {
639 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateSemaphore is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600640 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600641 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600642 else if (!vk_validate_vksemaphorecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600643 sprintf(str, "Parameter pCreateInfo to function CreateSemaphore contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600644 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600645 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500646 VkResult result = device_dispatch_table(device)->CreateSemaphore(device, pCreateInfo, pSemaphore);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600647 return result;
648}
649
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600650VK_LAYER_EXPORT VkResult VKAPI vkQueueSignalSemaphore(VkQueue queue, VkSemaphore semaphore)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600651{
652
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500653 VkResult result = device_dispatch_table(queue)->QueueSignalSemaphore(queue, semaphore);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600654 return result;
655}
656
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600657VK_LAYER_EXPORT VkResult VKAPI vkQueueWaitSemaphore(VkQueue queue, VkSemaphore semaphore)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600658{
659
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500660 VkResult result = device_dispatch_table(queue)->QueueWaitSemaphore(queue, semaphore);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600661 return result;
662}
663
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600664VK_LAYER_EXPORT VkResult VKAPI vkCreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, VkEvent* pEvent)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600665{
666 char str[1024];
667 if (!pCreateInfo) {
668 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateEvent is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600669 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600670 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600671 else if (!vk_validate_vkeventcreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600672 sprintf(str, "Parameter pCreateInfo to function CreateEvent contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600673 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600674 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500675 VkResult result = device_dispatch_table(device)->CreateEvent(device, pCreateInfo, pEvent);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600676 return result;
677}
678
Mike Stroyan230e6252015-04-17 12:36:38 -0600679VK_LAYER_EXPORT VkResult VKAPI vkGetEventStatus(VkDevice device, VkEvent event)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600680{
681
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500682 VkResult result = device_dispatch_table(device)->GetEventStatus(device, event);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600683 return result;
684}
685
Mike Stroyan230e6252015-04-17 12:36:38 -0600686VK_LAYER_EXPORT VkResult VKAPI vkSetEvent(VkDevice device, VkEvent event)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600687{
688
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500689 VkResult result = device_dispatch_table(device)->SetEvent(device, event);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600690 return result;
691}
692
Mike Stroyan230e6252015-04-17 12:36:38 -0600693VK_LAYER_EXPORT VkResult VKAPI vkResetEvent(VkDevice device, VkEvent event)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600694{
695
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500696 VkResult result = device_dispatch_table(device)->ResetEvent(device, event);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600697 return result;
698}
699
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600700VK_LAYER_EXPORT VkResult VKAPI vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, VkQueryPool* pQueryPool)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600701{
702 char str[1024];
703 if (!pCreateInfo) {
704 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateQueryPool is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600705 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600706 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600707 else if (!vk_validate_vkquerypoolcreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600708 sprintf(str, "Parameter pCreateInfo to function CreateQueryPool contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600709 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600710 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500711 VkResult result = device_dispatch_table(device)->CreateQueryPool(device, pCreateInfo, pQueryPool);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600712 return result;
713}
714
Mike Stroyan230e6252015-04-17 12:36:38 -0600715VK_LAYER_EXPORT VkResult VKAPI vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, size_t* pDataSize, void* pData, VkQueryResultFlags flags)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600716{
717
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500718 VkResult result = device_dispatch_table(device)->GetQueryPoolResults(device, queryPool, startQuery, queryCount, pDataSize, pData, flags);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600719 return result;
720}
721
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600722VK_LAYER_EXPORT VkResult VKAPI vkGetFormatInfo(VkDevice device, VkFormat format, VkFormatInfoType infoType, size_t* pDataSize, void* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600723{
724 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -0600725 if (!validate_VkFormat(format)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600726 sprintf(str, "Parameter format to function GetFormatInfo has invalid value of %i.", (int)format);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600727 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600728 }
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -0600729 if (!validate_VkFormatInfoType(infoType)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600730 sprintf(str, "Parameter infoType to function GetFormatInfo has invalid value of %i.", (int)infoType);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600731 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600732 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500733 VkResult result = device_dispatch_table(device)->GetFormatInfo(device, format, infoType, pDataSize, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600734 return result;
735}
736
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600737VK_LAYER_EXPORT VkResult VKAPI vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, VkBuffer* pBuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600738{
739 char str[1024];
740 if (!pCreateInfo) {
741 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateBuffer is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600742 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600743 }
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600744 else if (!vk_validate_vkbuffercreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600745 sprintf(str, "Parameter pCreateInfo to function CreateBuffer contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600746 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600747 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500748 VkResult result = device_dispatch_table(device)->CreateBuffer(device, pCreateInfo, pBuffer);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600749 return result;
750}
751
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600752VK_LAYER_EXPORT VkResult VKAPI vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, VkBufferView* pView)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600753{
754 char str[1024];
755 if (!pCreateInfo) {
756 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateBufferView is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600757 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600758 }
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600759 else if (!vk_validate_vkbufferviewcreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600760 sprintf(str, "Parameter pCreateInfo to function CreateBufferView contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600761 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600762 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500763 VkResult result = device_dispatch_table(device)->CreateBufferView(device, pCreateInfo, pView);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600764 return result;
765}
766
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600767void PreCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600768{
769 if(pCreateInfo == nullptr)
770 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600771 char const str[] = "vkCreateImage parameter, VkImageCreateInfo* pCreateInfo, is "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600772 "nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600773 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600774 return;
775 }
776
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600777 if(pCreateInfo->sType != VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600778 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600779 char const str[] = "vkCreateImage parameter, VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO "\
780 "pCreateInfo->sType, is not VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600781 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600782 return;
783 }
784
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600785 if (!validate_VkImageType(pCreateInfo->imageType))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600786 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600787 char const str[] = "vkCreateImage parameter, VkImageType pCreateInfo->imageType, is "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600788 "unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600789 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600790 return;
791 }
792
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -0600793 if (!validate_VkFormat(pCreateInfo->format))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600794 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600795 char const str[] = "vkCreateImage parameter, VkFormat pCreateInfo->format, is "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600796 "unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600797 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600798 return;
799 }
800
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600801 VkFormatProperties properties;
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600802 size_t size = sizeof(properties);
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500803 VkResult result = device_dispatch_table(device)->GetFormatInfo(device, pCreateInfo->format,
Tony Barbour8205d902015-04-16 15:59:00 -0600804 VK_FORMAT_INFO_TYPE_PROPERTIES, &size, &properties);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600805 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600806 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600807 char const str[] = "vkCreateImage parameter, VkFormat pCreateInfo->format, cannot be "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600808 "validated (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600809 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600810 return;
811 }
812
813 if((properties.linearTilingFeatures) == 0 && (properties.optimalTilingFeatures == 0))
814 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600815 char const str[] = "vkCreateImage parameter, VkFormat pCreateInfo->format, contains "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600816 "unsupported format (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600817 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600818 return;
819 }
820
821 // TODO: Can we check device-specific limits?
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600822 if (!vk_validate_vkextent3d(&pCreateInfo->extent))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600823 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600824 char const str[] = "vkCreateImage parameter, VkExtent3D pCreateInfo->extent, is invalid "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600825 "(precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600826 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600827 return;
828 }
829
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600830 if (!validate_VkImageTiling(pCreateInfo->tiling))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600831 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600832 char const str[] = "vkCreateImage parameter, VkImageTiling pCreateInfo->tiling, is "\
Jeremy Hayes6b7060b2015-04-07 09:49:05 -0600833 "unrecoginized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600834 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600835 return;
836 }
837}
838
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600839void PostCreateImage(VkResult result, VkImage* pImage)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600840{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600841 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600842 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600843 // TODO: Spit out VkResult value.
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600844 char const str[] = "vkCreateImage failed (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600845 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600846 return;
847 }
848
849 if(pImage == nullptr)
850 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600851 char const str[] = "vkCreateImage parameter, VkImage* pImage, is nullptr (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600852 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600853 return;
854 }
855}
856
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600857VK_LAYER_EXPORT VkResult VKAPI vkCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, VkImage* pImage)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600858{
859 PreCreateImage(device, pCreateInfo);
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500860 VkResult result = device_dispatch_table(device)->CreateImage(device, pCreateInfo, pImage);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600861 PostCreateImage(result, pImage);
862 return result;
863}
864
Mike Stroyan230e6252015-04-17 12:36:38 -0600865VK_LAYER_EXPORT VkResult VKAPI vkGetImageSubresourceInfo(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceInfoType infoType, size_t* pDataSize, void* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600866{
867 char str[1024];
868 if (!pSubresource) {
869 sprintf(str, "Struct ptr parameter pSubresource to function GetImageSubresourceInfo is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600870 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -0600871 } else if (!vk_validate_vkimagesubresource(pSubresource)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600872 sprintf(str, "Parameter pSubresource to function GetImageSubresourceInfo contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600873 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600874 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600875 if (!validate_VkSubresourceInfoType(infoType)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600876 sprintf(str, "Parameter infoType to function GetImageSubresourceInfo has invalid value of %i.", (int)infoType);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600877 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600878 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500879 VkResult result = device_dispatch_table(device)->GetImageSubresourceInfo(device, image, pSubresource, infoType, pDataSize, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600880 return result;
881}
882
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600883VK_LAYER_EXPORT VkResult VKAPI vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, VkImageView* pView)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600884{
885 char str[1024];
886 if (!pCreateInfo) {
887 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateImageView is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600888 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600889 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600890 else if (!vk_validate_vkimageviewcreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600891 sprintf(str, "Parameter pCreateInfo to function CreateImageView contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600892 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600893 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500894 VkResult result = device_dispatch_table(device)->CreateImageView(device, pCreateInfo, pView);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600895 return result;
896}
897
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600898VK_LAYER_EXPORT VkResult VKAPI vkCreateColorAttachmentView(VkDevice device, const VkColorAttachmentViewCreateInfo* pCreateInfo, VkColorAttachmentView* pView)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600899{
900 char str[1024];
901 if (!pCreateInfo) {
902 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateColorAttachmentView is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600903 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600904 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600905 else if (!vk_validate_vkcolorattachmentviewcreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600906 sprintf(str, "Parameter pCreateInfo to function CreateColorAttachmentView contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600907 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600908 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500909 VkResult result = device_dispatch_table(device)->CreateColorAttachmentView(device, pCreateInfo, pView);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600910 return result;
911}
912
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600913VK_LAYER_EXPORT VkResult VKAPI vkCreateDepthStencilView(VkDevice device, const VkDepthStencilViewCreateInfo* pCreateInfo, VkDepthStencilView* pView)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600914{
915 char str[1024];
916 if (!pCreateInfo) {
917 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDepthStencilView is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600918 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600919 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600920 else if (!vk_validate_vkdepthstencilviewcreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600921 sprintf(str, "Parameter pCreateInfo to function CreateDepthStencilView contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600922 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600923 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500924 VkResult result = device_dispatch_table(device)->CreateDepthStencilView(device, pCreateInfo, pView);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600925 return result;
926}
927
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600928VK_LAYER_EXPORT VkResult VKAPI vkCreateShader(VkDevice device, const VkShaderCreateInfo* pCreateInfo, VkShader* pShader)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600929{
930 char str[1024];
931 if (!pCreateInfo) {
932 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateShader is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600933 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600934 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600935 else if (!vk_validate_vkshadercreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600936 sprintf(str, "Parameter pCreateInfo to function CreateShader contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600937 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600938 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500939 VkResult result = device_dispatch_table(device)->CreateShader(device, pCreateInfo, pShader);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600940 return result;
941}
942
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600943VK_LAYER_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(VkDevice device, const VkGraphicsPipelineCreateInfo* pCreateInfo, VkPipeline* pPipeline)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600944{
945 char str[1024];
946 if (!pCreateInfo) {
947 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateGraphicsPipeline is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600948 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600949 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600950 else if (!vk_validate_vkgraphicspipelinecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600951 sprintf(str, "Parameter pCreateInfo to function CreateGraphicsPipeline contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600952 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600953 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500954 VkResult result = device_dispatch_table(device)->CreateGraphicsPipeline(device, pCreateInfo, pPipeline);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600955 return result;
956}
957
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600958VK_LAYER_EXPORT VkResult VKAPI vkCreateGraphicsPipelineDerivative(VkDevice device, const VkGraphicsPipelineCreateInfo* pCreateInfo, VkPipeline basePipeline, VkPipeline* pPipeline)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600959{
960 char str[1024];
961 if (!pCreateInfo) {
962 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateGraphicsPipelineDerivative is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600963 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600964 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600965 else if (!vk_validate_vkgraphicspipelinecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600966 sprintf(str, "Parameter pCreateInfo to function CreateGraphicsPipelineDerivative contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600967 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600968 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500969 VkResult result = device_dispatch_table(device)->CreateGraphicsPipelineDerivative(device, pCreateInfo, basePipeline, pPipeline);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600970 return result;
971}
972
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600973VK_LAYER_EXPORT VkResult VKAPI vkCreateComputePipeline(VkDevice device, const VkComputePipelineCreateInfo* pCreateInfo, VkPipeline* pPipeline)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600974{
975 char str[1024];
976 if (!pCreateInfo) {
977 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateComputePipeline is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600978 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600979 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -0600980 else if (!vk_validate_vkcomputepipelinecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600981 sprintf(str, "Parameter pCreateInfo to function CreateComputePipeline contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600982 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600983 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500984 VkResult result = device_dispatch_table(device)->CreateComputePipeline(device, pCreateInfo, pPipeline);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600985 return result;
986}
987
Mike Stroyan230e6252015-04-17 12:36:38 -0600988VK_LAYER_EXPORT VkResult VKAPI vkStorePipeline(VkDevice device, VkPipeline pipeline, size_t* pDataSize, void* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600989{
990
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500991 VkResult result = device_dispatch_table(device)->StorePipeline(device, pipeline, pDataSize, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600992 return result;
993}
994
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600995VK_LAYER_EXPORT VkResult VKAPI vkLoadPipeline(VkDevice device, size_t dataSize, const void* pData, VkPipeline* pPipeline)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600996{
997
Mark Lobodzinski3723c512015-05-26 10:58:40 -0500998 VkResult result = device_dispatch_table(device)->LoadPipeline(device, dataSize, pData, pPipeline);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -0600999 return result;
1000}
1001
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001002VK_LAYER_EXPORT VkResult VKAPI vkLoadPipelineDerivative(VkDevice device, size_t dataSize, const void* pData, VkPipeline basePipeline, VkPipeline* pPipeline)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001003{
1004
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001005 VkResult result = device_dispatch_table(device)->LoadPipelineDerivative(device, dataSize, pData, basePipeline, pPipeline);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001006 return result;
1007}
1008
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001009VK_LAYER_EXPORT VkResult VKAPI vkCreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, VkSampler* pSampler)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001010{
1011 char str[1024];
1012 if (!pCreateInfo) {
1013 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateSampler is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001014 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001015 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001016 else if (!vk_validate_vksamplercreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001017 sprintf(str, "Parameter pCreateInfo to function CreateSampler contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001018 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001019 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001020 VkResult result = device_dispatch_table(device)->CreateSampler(device, pCreateInfo, pSampler);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001021 return result;
1022}
1023
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001024VK_LAYER_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayout* pSetLayout)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001025{
1026 char str[1024];
1027 if (!pCreateInfo) {
1028 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDescriptorSetLayout is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001029 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001030 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001031 else if (!vk_validate_vkdescriptorsetlayoutcreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001032 sprintf(str, "Parameter pCreateInfo to function CreateDescriptorSetLayout contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001033 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001034 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001035 VkResult result = device_dispatch_table(device)->CreateDescriptorSetLayout(device, pCreateInfo, pSetLayout);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001036 return result;
1037}
1038
Mark Lobodzinski556f7212015-04-17 14:11:39 -05001039VK_LAYER_EXPORT VkResult VKAPI vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, VkPipelineLayout* pPipelineLayout)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001040{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001041 VkResult result = device_dispatch_table(device)->CreatePipelineLayout(device, pCreateInfo, pPipelineLayout);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001042 return result;
1043}
1044
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001045VK_LAYER_EXPORT VkResult VKAPI vkCreateDescriptorPool(VkDevice device, VkDescriptorPoolUsage poolUsage, uint32_t maxSets, const VkDescriptorPoolCreateInfo* pCreateInfo, VkDescriptorPool* pDescriptorPool)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001046{
1047 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001048 if (!validate_VkDescriptorPoolUsage(poolUsage)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001049 sprintf(str, "Parameter poolUsage to function CreateDescriptorPool has invalid value of %i.", (int)poolUsage);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001050 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001051 }
1052 if (!pCreateInfo) {
1053 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDescriptorPool is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001054 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001055 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001056 else if (!vk_validate_vkdescriptorpoolcreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001057 sprintf(str, "Parameter pCreateInfo to function CreateDescriptorPool contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001058 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001059 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001060 VkResult result = device_dispatch_table(device)->CreateDescriptorPool(device, poolUsage, maxSets, pCreateInfo, pDescriptorPool);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001061 return result;
1062}
1063
Mike Stroyan230e6252015-04-17 12:36:38 -06001064VK_LAYER_EXPORT VkResult VKAPI vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001065{
1066
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001067 VkResult result = device_dispatch_table(device)->ResetDescriptorPool(device, descriptorPool);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001068 return result;
1069}
1070
Mike Stroyan230e6252015-04-17 12:36:38 -06001071VK_LAYER_EXPORT VkResult VKAPI vkAllocDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorSetUsage setUsage, uint32_t count, const VkDescriptorSetLayout* pSetLayouts, VkDescriptorSet* pDescriptorSets, uint32_t* pCount)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001072{
1073 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001074 if (!validate_VkDescriptorSetUsage(setUsage)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001075 sprintf(str, "Parameter setUsage to function AllocDescriptorSets has invalid value of %i.", (int)setUsage);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001076 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001077 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001078 VkResult result = device_dispatch_table(device)->AllocDescriptorSets(device, descriptorPool, setUsage, count, pSetLayouts, pDescriptorSets, pCount);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001079 return result;
1080}
1081
Mike Stroyan230e6252015-04-17 12:36:38 -06001082VK_LAYER_EXPORT void VKAPI vkClearDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001083{
1084
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001085 device_dispatch_table(device)->ClearDescriptorSets(device, descriptorPool, count, pDescriptorSets);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001086}
1087
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08001088VK_LAYER_EXPORT VkResult VKAPI vkUpdateDescriptorSets(VkDevice device, uint32_t writeCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t copyCount, const VkCopyDescriptorSet* pDescriptorCopies)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001089{
1090
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001091 return device_dispatch_table(device)->UpdateDescriptorSets(device, writeCount, pDescriptorWrites, copyCount, pDescriptorCopies);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001092}
1093
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001094VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicViewportState(VkDevice device, const VkDynamicVpStateCreateInfo* pCreateInfo, VkDynamicVpState* pState)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001095{
1096 char str[1024];
1097 if (!pCreateInfo) {
1098 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDynamicViewportState is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001099 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001100 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001101 else if (!vk_validate_vkdynamicvpstatecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001102 sprintf(str, "Parameter pCreateInfo to function CreateDynamicViewportState contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001103 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001104 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001105 VkResult result = device_dispatch_table(device)->CreateDynamicViewportState(device, pCreateInfo, pState);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001106 return result;
1107}
1108
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001109VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicRasterState(VkDevice device, const VkDynamicRsStateCreateInfo* pCreateInfo, VkDynamicRsState* pState)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001110{
1111 char str[1024];
1112 if (!pCreateInfo) {
1113 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDynamicRasterState is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001114 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001115 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001116 else if (!vk_validate_vkdynamicrsstatecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001117 sprintf(str, "Parameter pCreateInfo to function CreateDynamicRasterState contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001118 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001119 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001120 VkResult result = device_dispatch_table(device)->CreateDynamicRasterState(device, pCreateInfo, pState);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001121 return result;
1122}
1123
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001124VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(VkDevice device, const VkDynamicCbStateCreateInfo* pCreateInfo, VkDynamicCbState* pState)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001125{
1126 char str[1024];
1127 if (!pCreateInfo) {
1128 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDynamicColorBlendState is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001129 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001130 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001131 else if (!vk_validate_vkdynamiccbstatecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001132 sprintf(str, "Parameter pCreateInfo to function CreateDynamicColorBlendState contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001133 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001134 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001135 VkResult result = device_dispatch_table(device)->CreateDynamicColorBlendState(device, pCreateInfo, pState);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001136 return result;
1137}
1138
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001139VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(VkDevice device, const VkDynamicDsStateCreateInfo* pCreateInfo, VkDynamicDsState* pState)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001140{
1141 char str[1024];
1142 if (!pCreateInfo) {
1143 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateDynamicDepthStencilState is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001144 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001145 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001146 else if (!vk_validate_vkdynamicdsstatecreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001147 sprintf(str, "Parameter pCreateInfo to function CreateDynamicDepthStencilState contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001148 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001149 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001150 VkResult result = device_dispatch_table(device)->CreateDynamicDepthStencilState(device, pCreateInfo, pState);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001151 return result;
1152}
1153
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001154void PreCreateCommandBuffer(VkDevice device, const VkCmdBufferCreateInfo* pCreateInfo)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001155{
1156 if(device == nullptr)
1157 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001158 char const str[] = "vkCreateCommandBuffer parameter, VkDevice device, is "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001159 "nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001160 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001161 return;
1162 }
1163
1164 if(pCreateInfo == nullptr)
1165 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001166 char const str[] = "vkCreateCommandBuffer parameter, VkCmdBufferCreateInfo* pCreateInfo, is "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001167 "nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001168 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001169 return;
1170 }
1171
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001172 if(pCreateInfo->sType != VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001173 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001174 char const str[] = "vkCreateCommandBuffer parameter, VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO "\
1175 "pCreateInfo->sType, is not VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001176 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001177 return;
1178 }
1179}
1180
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001181void PostCreateCommandBuffer(VkResult result, VkCmdBuffer* pCmdBuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001182{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001183 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001184 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001185 // TODO: Spit out VkResult value.
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001186 char const str[] = "vkCreateCommandBuffer failed (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001187 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001188 return;
1189 }
1190
1191 if(pCmdBuffer == nullptr)
1192 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001193 char const str[] = "vkCreateCommandBuffer parameter, VkCmdBuffer* pCmdBuffer, is nullptr (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001194 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001195 return;
1196 }
1197}
1198
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001199VK_LAYER_EXPORT VkResult VKAPI vkCreateCommandBuffer(VkDevice device,
1200 const VkCmdBufferCreateInfo* pCreateInfo, VkCmdBuffer* pCmdBuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001201{
1202 PreCreateCommandBuffer(device, pCreateInfo);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001203 VkResult result = device_dispatch_table(device)->CreateCommandBuffer(device, pCreateInfo, pCmdBuffer);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001204 PostCreateCommandBuffer(result, pCmdBuffer);
1205 return result;
1206}
1207
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001208VK_LAYER_EXPORT VkResult VKAPI vkBeginCommandBuffer(VkCmdBuffer cmdBuffer, const VkCmdBufferBeginInfo* pBeginInfo)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001209{
1210 char str[1024];
1211 if (!pBeginInfo) {
1212 sprintf(str, "Struct ptr parameter pBeginInfo to function BeginCommandBuffer is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001213 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001214 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001215 else if (!vk_validate_vkcmdbufferbegininfo(pBeginInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001216 sprintf(str, "Parameter pBeginInfo to function BeginCommandBuffer contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001217 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001218 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001219 VkResult result = device_dispatch_table(cmdBuffer)->BeginCommandBuffer(cmdBuffer, pBeginInfo);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001220 return result;
1221}
1222
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001223VK_LAYER_EXPORT VkResult VKAPI vkEndCommandBuffer(VkCmdBuffer cmdBuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001224{
1225
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001226 VkResult result = device_dispatch_table(cmdBuffer)->EndCommandBuffer(cmdBuffer);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001227 return result;
1228}
1229
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001230VK_LAYER_EXPORT VkResult VKAPI vkResetCommandBuffer(VkCmdBuffer cmdBuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001231{
1232
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001233 VkResult result = device_dispatch_table(cmdBuffer)->ResetCommandBuffer(cmdBuffer);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001234 return result;
1235}
1236
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001237VK_LAYER_EXPORT void VKAPI vkCmdBindPipeline(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001238{
1239 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001240 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001241 sprintf(str, "Parameter pipelineBindPoint to function CmdBindPipeline has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001242 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001243 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001244 device_dispatch_table(cmdBuffer)->CmdBindPipeline(cmdBuffer, pipelineBindPoint, pipeline);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001245}
1246
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001247VK_LAYER_EXPORT void VKAPI vkCmdBindDynamicStateObject(VkCmdBuffer cmdBuffer, VkStateBindPoint stateBindPoint, VkDynamicStateObject state)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001248{
1249 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001250 if (!validate_VkStateBindPoint(stateBindPoint)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001251 sprintf(str, "Parameter stateBindPoint to function CmdBindDynamicStateObject has invalid value of %i.", (int)stateBindPoint);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001252 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001253 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001254 device_dispatch_table(cmdBuffer)->CmdBindDynamicStateObject(cmdBuffer, stateBindPoint, state);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001255}
1256
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001257VK_LAYER_EXPORT void VKAPI vkCmdBindDescriptorSets(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, uint32_t firstSet, uint32_t setCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001258{
1259 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001260 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001261 sprintf(str, "Parameter pipelineBindPoint to function CmdBindDescriptorSets has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001262 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001263 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001264 device_dispatch_table(cmdBuffer)->CmdBindDescriptorSets(cmdBuffer, pipelineBindPoint, firstSet, setCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001265}
1266
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001267VK_LAYER_EXPORT void VKAPI vkCmdBindVertexBuffers(
1268 VkCmdBuffer cmdBuffer,
1269 uint32_t startBinding,
1270 uint32_t bindingCount,
1271 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001272 const VkDeviceSize* pOffsets)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001273{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001274 device_dispatch_table(cmdBuffer)->CmdBindVertexBuffers(cmdBuffer, startBinding, bindingCount, pBuffers, pOffsets);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001275}
1276
Tony Barbour8205d902015-04-16 15:59:00 -06001277VK_LAYER_EXPORT void VKAPI vkCmdBindIndexBuffer(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001278{
1279 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001280 if (!validate_VkIndexType(indexType)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001281 sprintf(str, "Parameter indexType to function CmdBindIndexBuffer has invalid value of %i.", (int)indexType);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001282 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001283 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001284 device_dispatch_table(cmdBuffer)->CmdBindIndexBuffer(cmdBuffer, buffer, offset, indexType);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001285}
1286
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001287VK_LAYER_EXPORT void VKAPI vkCmdDraw(VkCmdBuffer cmdBuffer, uint32_t firstVertex, uint32_t vertexCount, uint32_t firstInstance, uint32_t instanceCount)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001288{
1289
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001290 device_dispatch_table(cmdBuffer)->CmdDraw(cmdBuffer, firstVertex, vertexCount, firstInstance, instanceCount);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001291}
1292
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001293VK_LAYER_EXPORT void VKAPI vkCmdDrawIndexed(VkCmdBuffer cmdBuffer, uint32_t firstIndex, uint32_t indexCount, int32_t vertexOffset, uint32_t firstInstance, uint32_t instanceCount)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001294{
1295
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001296 device_dispatch_table(cmdBuffer)->CmdDrawIndexed(cmdBuffer, firstIndex, indexCount, vertexOffset, firstInstance, instanceCount);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001297}
1298
Tony Barbour8205d902015-04-16 15:59:00 -06001299VK_LAYER_EXPORT void VKAPI vkCmdDrawIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001300{
1301
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001302 device_dispatch_table(cmdBuffer)->CmdDrawIndirect(cmdBuffer, buffer, offset, count, stride);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001303}
1304
Tony Barbour8205d902015-04-16 15:59:00 -06001305VK_LAYER_EXPORT void VKAPI vkCmdDrawIndexedIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001306{
1307
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001308 device_dispatch_table(cmdBuffer)->CmdDrawIndexedIndirect(cmdBuffer, buffer, offset, count, stride);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001309}
1310
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001311VK_LAYER_EXPORT void VKAPI vkCmdDispatch(VkCmdBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001312{
1313
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001314 device_dispatch_table(cmdBuffer)->CmdDispatch(cmdBuffer, x, y, z);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001315}
1316
Tony Barbour8205d902015-04-16 15:59:00 -06001317VK_LAYER_EXPORT void VKAPI vkCmdDispatchIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001318{
1319
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001320 device_dispatch_table(cmdBuffer)->CmdDispatchIndirect(cmdBuffer, buffer, offset);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001321}
1322
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001323VK_LAYER_EXPORT void VKAPI vkCmdCopyBuffer(VkCmdBuffer cmdBuffer, VkBuffer srcBuffer, VkBuffer destBuffer, uint32_t regionCount, const VkBufferCopy* pRegions)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001324{
1325 char str[1024];
1326 uint32_t i;
1327 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001328 if (!vk_validate_vkbuffercopy(&pRegions[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001329 sprintf(str, "Parameter pRegions[%i] to function CmdCopyBuffer contains an invalid value.", i);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001330 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001331 }
1332 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001333 device_dispatch_table(cmdBuffer)->CmdCopyBuffer(cmdBuffer, srcBuffer, destBuffer, regionCount, pRegions);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001334}
1335
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001336VK_LAYER_EXPORT void VKAPI vkCmdCopyImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageCopy* pRegions)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001337{
1338 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001339 if (!validate_VkImageLayout(srcImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001340 sprintf(str, "Parameter srcImageLayout to function CmdCopyImage has invalid value of %i.", (int)srcImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001341 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001342 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001343 if (!validate_VkImageLayout(destImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001344 sprintf(str, "Parameter destImageLayout to function CmdCopyImage has invalid value of %i.", (int)destImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001345 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001346 }
1347 uint32_t i;
1348 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001349 if (!vk_validate_vkimagecopy(&pRegions[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001350 sprintf(str, "Parameter pRegions[%i] to function CmdCopyImage contains an invalid value.", i);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001351 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001352 }
1353 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001354 device_dispatch_table(cmdBuffer)->CmdCopyImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, regionCount, pRegions);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001355}
1356
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001357VK_LAYER_EXPORT void VKAPI vkCmdBlitImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkTexFilter filter)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001358{
1359 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001360 if (!validate_VkImageLayout(srcImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001361 sprintf(str, "Parameter srcImageLayout to function CmdBlitImage has invalid value of %i.", (int)srcImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001362 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001363 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001364 if (!validate_VkImageLayout(destImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001365 sprintf(str, "Parameter destImageLayout to function CmdBlitImage has invalid value of %i.", (int)destImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001366 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001367 }
1368 uint32_t i;
1369 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001370 if (!vk_validate_vkimageblit(&pRegions[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001371 sprintf(str, "Parameter pRegions[%i] to function CmdBlitImage contains an invalid value.", i);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001372 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001373 }
1374 }
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001375 //TODO: Add additional check for limitation from header rev 96.
1376 // VK_TEX_FILTER_NEAREST if the format that srcImage was created with is an integer-based format.
1377
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001378 device_dispatch_table(cmdBuffer)->CmdBlitImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, regionCount, pRegions, filter);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001379}
1380
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001381VK_LAYER_EXPORT void VKAPI vkCmdCopyBufferToImage(VkCmdBuffer cmdBuffer, VkBuffer srcBuffer, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001382{
1383 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001384 if (!validate_VkImageLayout(destImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001385 sprintf(str, "Parameter destImageLayout to function CmdCopyBufferToImage has invalid value of %i.", (int)destImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001386 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001387 }
1388 uint32_t i;
1389 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001390 if (!vk_validate_vkbufferimagecopy(&pRegions[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001391 sprintf(str, "Parameter pRegions[%i] to function CmdCopyBufferToImage contains an invalid value.", i);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001392 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001393 }
1394 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001395 device_dispatch_table(cmdBuffer)->CmdCopyBufferToImage(cmdBuffer, srcBuffer, destImage, destImageLayout, regionCount, pRegions);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001396}
1397
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001398VK_LAYER_EXPORT void VKAPI vkCmdCopyImageToBuffer(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer destBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001399{
1400 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001401 if (!validate_VkImageLayout(srcImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001402 sprintf(str, "Parameter srcImageLayout to function CmdCopyImageToBuffer has invalid value of %i.", (int)srcImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001403 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001404 }
1405 uint32_t i;
1406 for (i = 0; i < regionCount; i++) {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001407 if (!vk_validate_vkbufferimagecopy(&pRegions[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001408 sprintf(str, "Parameter pRegions[%i] to function CmdCopyImageToBuffer contains an invalid value.", i);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001409 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001410 }
1411 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001412 device_dispatch_table(cmdBuffer)->CmdCopyImageToBuffer(cmdBuffer, srcImage, srcImageLayout, destBuffer, regionCount, pRegions);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001413}
1414
Tony Barbour8205d902015-04-16 15:59:00 -06001415VK_LAYER_EXPORT void VKAPI vkCmdUpdateBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const uint32_t* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001416{
1417
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001418 device_dispatch_table(cmdBuffer)->CmdUpdateBuffer(cmdBuffer, destBuffer, destOffset, dataSize, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001419}
1420
Tony Barbour8205d902015-04-16 15:59:00 -06001421VK_LAYER_EXPORT void VKAPI vkCmdFillBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001422{
1423
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001424 device_dispatch_table(cmdBuffer)->CmdFillBuffer(cmdBuffer, destBuffer, destOffset, fillSize, data);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001425}
1426
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001427VK_LAYER_EXPORT void VKAPI vkCmdClearColorImage(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColor* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001428{
1429 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001430 if (!validate_VkImageLayout(imageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001431 sprintf(str, "Parameter imageLayout to function CmdClearColorImage has invalid value of %i.", (int)imageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001432 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001433 }
1434 uint32_t i;
1435 for (i = 0; i < rangeCount; i++) {
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001436 if (!vk_validate_vkimagesubresourcerange(&pRanges[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001437 sprintf(str, "Parameter pRanges[%i] to function CmdClearColorImage contains an invalid value.", i);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001438 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001439 }
1440 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001441 device_dispatch_table(cmdBuffer)->CmdClearColorImage(cmdBuffer, image, imageLayout, pColor, rangeCount, pRanges);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001442}
1443
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001444VK_LAYER_EXPORT void VKAPI vkCmdClearDepthStencil(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, float depth, uint32_t stencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001445{
1446 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001447 if (!validate_VkImageLayout(imageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001448 sprintf(str, "Parameter imageLayout to function CmdClearDepthStencil has invalid value of %i.", (int)imageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001449 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001450 }
1451 uint32_t i;
1452 for (i = 0; i < rangeCount; i++) {
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001453 if (!vk_validate_vkimagesubresourcerange(&pRanges[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001454 sprintf(str, "Parameter pRanges[%i] to function CmdClearDepthStencil contains an invalid value.", i);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001455 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001456 }
1457 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001458 device_dispatch_table(cmdBuffer)->CmdClearDepthStencil(cmdBuffer, image, imageLayout, depth, stencil, rangeCount, pRanges);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001459}
1460
Tony Barbour11f74372015-04-13 15:02:52 -06001461VK_LAYER_EXPORT void VKAPI vkCmdResolveImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageResolve* pRegions)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001462{
1463 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001464 if (!validate_VkImageLayout(srcImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001465 sprintf(str, "Parameter srcImageLayout to function CmdResolveImage has invalid value of %i.", (int)srcImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001466 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001467 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001468 if (!validate_VkImageLayout(destImageLayout)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001469 sprintf(str, "Parameter destImageLayout to function CmdResolveImage has invalid value of %i.", (int)destImageLayout);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001470 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001471 }
1472 uint32_t i;
Tony Barbour11f74372015-04-13 15:02:52 -06001473 for (i = 0; i < regionCount; i++) {
1474 if (!vk_validate_vkimageresolve(&pRegions[i])) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001475 sprintf(str, "Parameter pRects[%i] to function CmdResolveImage contains an invalid value.", i);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001476 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001477 }
1478 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001479 device_dispatch_table(cmdBuffer)->CmdResolveImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, regionCount, pRegions);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001480}
1481
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001482VK_LAYER_EXPORT void VKAPI vkCmdSetEvent(VkCmdBuffer cmdBuffer, VkEvent event, VkPipeEvent pipeEvent)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001483{
1484 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001485 if (!validate_VkPipeEvent(pipeEvent)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001486 sprintf(str, "Parameter pipeEvent to function CmdSetEvent has invalid value of %i.", (int)pipeEvent);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001487 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001488 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001489 device_dispatch_table(cmdBuffer)->CmdSetEvent(cmdBuffer, event, pipeEvent);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001490}
1491
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001492VK_LAYER_EXPORT void VKAPI vkCmdResetEvent(VkCmdBuffer cmdBuffer, VkEvent event, VkPipeEvent pipeEvent)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001493{
1494 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001495 if (!validate_VkPipeEvent(pipeEvent)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001496 sprintf(str, "Parameter pipeEvent to function CmdResetEvent has invalid value of %i.", (int)pipeEvent);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001497 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001498 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001499 device_dispatch_table(cmdBuffer)->CmdResetEvent(cmdBuffer, event, pipeEvent);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001500}
1501
Tony Barbour8205d902015-04-16 15:59:00 -06001502VK_LAYER_EXPORT void VKAPI vkCmdWaitEvents(VkCmdBuffer cmdBuffer, VkWaitEvent waitEvent, uint32_t eventCount, const VkEvent* pEvents, uint32_t memBarrierCount, const void** ppMemBarriers)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001503{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001504 device_dispatch_table(cmdBuffer)->CmdWaitEvents(cmdBuffer, waitEvent, eventCount, pEvents, memBarrierCount, ppMemBarriers);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001505}
1506
Tony Barbour8205d902015-04-16 15:59:00 -06001507VK_LAYER_EXPORT void VKAPI vkCmdPipelineBarrier(VkCmdBuffer cmdBuffer, VkWaitEvent waitEvent, uint32_t pipeEventCount, const VkPipeEvent* pPipeEvents, uint32_t memBarrierCount, const void** ppMemBarriers)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001508{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001509 device_dispatch_table(cmdBuffer)->CmdPipelineBarrier(cmdBuffer, waitEvent, pipeEventCount, pPipeEvents, memBarrierCount, ppMemBarriers);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001510}
1511
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001512VK_LAYER_EXPORT void VKAPI vkCmdBeginQuery(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkFlags flags)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001513{
1514
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001515 device_dispatch_table(cmdBuffer)->CmdBeginQuery(cmdBuffer, queryPool, slot, flags);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001516}
1517
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001518VK_LAYER_EXPORT void VKAPI vkCmdEndQuery(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001519{
1520
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001521 device_dispatch_table(cmdBuffer)->CmdEndQuery(cmdBuffer, queryPool, slot);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001522}
1523
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001524VK_LAYER_EXPORT void VKAPI vkCmdResetQueryPool(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001525{
1526
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001527 device_dispatch_table(cmdBuffer)->CmdResetQueryPool(cmdBuffer, queryPool, startQuery, queryCount);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001528}
1529
Tony Barbour8205d902015-04-16 15:59:00 -06001530VK_LAYER_EXPORT void VKAPI vkCmdWriteTimestamp(VkCmdBuffer cmdBuffer, VkTimestampType timestampType, VkBuffer destBuffer, VkDeviceSize destOffset)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001531{
1532 char str[1024];
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001533 if (!validate_VkTimestampType(timestampType)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001534 sprintf(str, "Parameter timestampType to function CmdWriteTimestamp has invalid value of %i.", (int)timestampType);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001535 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001536 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001537 device_dispatch_table(cmdBuffer)->CmdWriteTimestamp(cmdBuffer, timestampType, destBuffer, destOffset);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001538}
1539
Jeremy Hayescf469132015-04-17 10:36:53 -06001540VK_LAYER_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1541 VkCmdBuffer cmdBuffer,
1542 VkQueryPool queryPool,
1543 uint32_t startQuery,
1544 uint32_t queryCount,
1545 VkBuffer destBuffer,
1546 VkDeviceSize destOffset,
1547 VkDeviceSize destStride,
1548 VkQueryResultFlags flags)
1549{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001550 device_dispatch_table(cmdBuffer)->CmdCopyQueryPoolResults(cmdBuffer, queryPool, startQuery, queryCount, destBuffer, destOffset, destStride, flags);
Jeremy Hayescf469132015-04-17 10:36:53 -06001551}
1552
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001553VK_LAYER_EXPORT void VKAPI vkCmdInitAtomicCounters(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, uint32_t startCounter, uint32_t counterCount, const uint32_t* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001554{
1555 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001556 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001557 sprintf(str, "Parameter pipelineBindPoint to function CmdInitAtomicCounters has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001558 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001559 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001560 device_dispatch_table(cmdBuffer)->CmdInitAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001561}
1562
Tony Barbour8205d902015-04-16 15:59:00 -06001563VK_LAYER_EXPORT void VKAPI vkCmdLoadAtomicCounters(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, uint32_t startCounter, uint32_t counterCount, VkBuffer srcBuffer, VkDeviceSize srcOffset)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001564{
1565 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001566 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001567 sprintf(str, "Parameter pipelineBindPoint to function CmdLoadAtomicCounters has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001568 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001569 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001570 device_dispatch_table(cmdBuffer)->CmdLoadAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, srcBuffer, srcOffset);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001571}
1572
Tony Barbour8205d902015-04-16 15:59:00 -06001573VK_LAYER_EXPORT void VKAPI vkCmdSaveAtomicCounters(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, uint32_t startCounter, uint32_t counterCount, VkBuffer destBuffer, VkDeviceSize destOffset)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001574{
1575 char str[1024];
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001576 if (!validate_VkPipelineBindPoint(pipelineBindPoint)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001577 sprintf(str, "Parameter pipelineBindPoint to function CmdSaveAtomicCounters has invalid value of %i.", (int)pipelineBindPoint);
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001578 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001579 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001580 device_dispatch_table(cmdBuffer)->CmdSaveAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, destBuffer, destOffset);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001581}
1582
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001583VK_LAYER_EXPORT VkResult VKAPI vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, VkFramebuffer* pFramebuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001584{
1585 char str[1024];
1586 if (!pCreateInfo) {
1587 sprintf(str, "Struct ptr parameter pCreateInfo to function CreateFramebuffer is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001588 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001589 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001590 else if (!vk_validate_vkframebuffercreateinfo(pCreateInfo)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001591 sprintf(str, "Parameter pCreateInfo to function CreateFramebuffer contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001592 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001593 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001594 VkResult result = device_dispatch_table(device)->CreateFramebuffer(device, pCreateInfo, pFramebuffer);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001595 return result;
1596}
1597
1598
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001599void PreCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001600{
1601 if(pCreateInfo == nullptr)
1602 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001603 char const str[] = "vkCreateRenderPass parameter, VkRenderPassCreateInfo* pCreateInfo, is "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001604 "nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001605 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001606 return;
1607 }
1608
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001609 if(pCreateInfo->sType != VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001610 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001611 char const str[] = "vkCreateRenderPass parameter, VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO "\
1612 "pCreateInfo->sType, is not VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001613 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001614 return;
1615 }
1616
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001617 if(!vk_validate_vkrect(&pCreateInfo->renderArea))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001618 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001619 char const str[] = "vkCreateRenderPass parameter, VkRect pCreateInfo->renderArea, is invalid "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001620 "(precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001621 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001622 return;
1623 }
1624
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001625 if(!vk_validate_vkextent2d(&pCreateInfo->extent))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001626 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001627 char const str[] = "vkCreateRenderPass parameter, VkExtent2D pCreateInfo->extent, is invalid "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001628 "(precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001629 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001630 return;
1631 }
1632
1633 if(pCreateInfo->pColorFormats == nullptr)
1634 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001635 char const str[] = "vkCreateRenderPass parameter, VkFormat* pCreateInfo->pColorFormats, "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001636 "is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001637 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001638 return;
1639 }
1640
1641 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1642 {
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001643 if(!validate_VkFormat(pCreateInfo->pColorFormats[i]))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001644 {
1645 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001646 ss << "vkCreateRenderPass parameter, VkFormat pCreateInfo->pColorFormats[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001647 "], is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001648 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001649 continue;
1650 }
1651
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001652 VkFormatProperties properties;
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001653 size_t size = sizeof(properties);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001654 VkResult result = device_dispatch_table(device)->GetFormatInfo(device, pCreateInfo->pColorFormats[i],
Tony Barbour8205d902015-04-16 15:59:00 -06001655 VK_FORMAT_INFO_TYPE_PROPERTIES, &size, &properties);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001656 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001657 {
1658 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001659 ss << "vkCreateRenderPass parameter, VkFormat pCreateInfo->pColorFormats[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001660 "], cannot be validated (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001661 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001662 continue;
1663 }
1664
1665 if((properties.linearTilingFeatures) == 0 && (properties.optimalTilingFeatures == 0))
1666 {
1667 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001668 ss << "vkCreateRenderPass parameter, VkFormat pCreateInfo->pColorFormats[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001669 "], contains unsupported format (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001670 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001671 continue;
1672 }
1673
1674 }
1675
1676 if(pCreateInfo->pColorLayouts == nullptr)
1677 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001678 char const str[] = "vkCreateRenderPass parameter, VkImageLayout* pCreateInfo->pColorLayouts, "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001679 "is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001680 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001681 return;
1682 }
1683
1684 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1685 {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001686 if(!validate_VkImageLayout(pCreateInfo->pColorLayouts[i]))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001687 {
1688 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001689 ss << "vkCreateRenderPass parameter, VkImageLayout pCreateInfo->pColorLayouts[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001690 "], is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001691 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001692 continue;
1693 }
1694 }
1695
1696 if(pCreateInfo->pColorLoadOps == nullptr)
1697 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001698 char const str[] = "vkCreateRenderPass parameter, VkAttachmentLoadOp* pCreateInfo->pColorLoadOps, "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001699 "is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001700 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001701 return;
1702 }
1703
1704 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1705 {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001706 if(!validate_VkAttachmentLoadOp(pCreateInfo->pColorLoadOps[i]))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001707 {
1708 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001709 ss << "vkCreateRenderPass parameter, VkAttachmentLoadOp pCreateInfo->pColorLoadOps[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001710 "], is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001711 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001712 continue;
1713 }
1714 }
1715
1716 if(pCreateInfo->pColorStoreOps == nullptr)
1717 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001718 char const str[] = "vkCreateRenderPass parameter, VkAttachmentStoreOp* pCreateInfo->pColorStoreOps, "\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001719 "is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001720 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001721 return;
1722 }
1723
1724 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1725 {
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001726 if(!validate_VkAttachmentStoreOp(pCreateInfo->pColorStoreOps[i]))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001727 {
1728 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001729 ss << "vkCreateRenderPass parameter, VkAttachmentStoreOp pCreateInfo->pColorStoreOps[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001730 "], is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001731 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001732 continue;
1733 }
1734 }
1735
1736 if(pCreateInfo->pColorLoadClearValues == nullptr)
1737 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001738 char const str[] = "vkCreateRenderPass parameter, VkClearColor* pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001739 "pColorLoadClearValues, is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001740 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001741 return;
1742 }
Jeremy Hayes6b7060b2015-04-07 09:49:05 -06001743
1744 if(pCreateInfo->pColorStoreOps == nullptr)
1745 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001746 char const str[] = "vkCreateRenderPass parameter, VK_ATTACHMENT_STORE_OP* pCreateInfo->pColorStoreOps, "\
Jeremy Hayes9bafb9f2015-04-07 13:38:03 -06001747 "is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001748 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayes6b7060b2015-04-07 09:49:05 -06001749 return;
1750 }
1751
Jeremy Hayes6b7060b2015-04-07 09:49:05 -06001752 if(pCreateInfo->pColorLoadClearValues == nullptr)
1753 {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001754 char const str[] = "vkCreateRenderPass parameter, VK_CLEAR_COLOR* pCreateInfo->"\
Jeremy Hayes9bafb9f2015-04-07 13:38:03 -06001755 "pColorLoadClearValues, is nullptr (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001756 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayes6b7060b2015-04-07 09:49:05 -06001757 return;
1758 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001759
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001760 for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
1761 {
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001762 if(!vk_validate_vkclearcolor(&(pCreateInfo->pColorLoadClearValues[i])))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001763 {
1764 std::stringstream ss;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001765 ss << "vkCreateRenderPass parameter, VkClearColor pCreateInfo->pColorLoadClearValues[" << i <<
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001766 "], is invalid (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001767 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str());
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001768 continue;
1769 }
1770 }
1771
Courtney Goeltzenleuchter33318172015-04-10 17:06:20 -06001772 if(!validate_VkFormat(pCreateInfo->depthStencilFormat))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001773 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001774 char const str[] = "vkCreateRenderPass parameter, VkFormat pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001775 "depthStencilFormat, is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001776 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001777 return;
1778 }
1779
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001780 VkFormatProperties properties;
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001781 size_t size = sizeof(properties);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001782 VkResult result = device_dispatch_table(device)->GetFormatInfo(device, pCreateInfo->depthStencilFormat,
Tony Barbour8205d902015-04-16 15:59:00 -06001783 VK_FORMAT_INFO_TYPE_PROPERTIES, &size, &properties);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001784 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001785 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001786 char const str[] = "vkCreateRenderPass parameter, VkFormat pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001787 "depthStencilFormat, cannot be validated (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001788 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001789 return;
1790 }
1791
1792 if((properties.linearTilingFeatures) == 0 && (properties.optimalTilingFeatures == 0))
1793 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001794 char const str[] = "vkCreateRenderPass parameter, VkFormat pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001795 "depthStencilFormat, contains unsupported format (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001796 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001797 return;
1798 }
1799
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001800 if(!validate_VkImageLayout(pCreateInfo->depthStencilLayout))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001801 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001802 char const str[] = "vkCreateRenderPass parameter, VkImageLayout pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001803 "depthStencilLayout, is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001804 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001805 return;
1806 }
1807
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001808 if(!validate_VkAttachmentLoadOp(pCreateInfo->depthLoadOp))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001809 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001810 char const str[] = "vkCreateRenderPass parameter, VkAttachmentLoadOp pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001811 "depthLoadOp, is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001812 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001813 return;
1814 }
1815
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001816 if(!validate_VkAttachmentStoreOp(pCreateInfo->depthStoreOp))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001817 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001818 char const str[] = "vkCreateRenderPass parameter, VkAttachmentStoreOp pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001819 "depthStoreOp, is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001820 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001821 return;
1822 }
1823
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001824 if(!validate_VkAttachmentLoadOp(pCreateInfo->stencilLoadOp))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001825 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001826 char const str[] = "vkCreateRenderPass parameter, VkAttachmentLoadOp pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001827 "stencilLoadOp, is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001828 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001829 return;
1830 }
1831
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001832 if(!validate_VkAttachmentStoreOp(pCreateInfo->stencilStoreOp))
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001833 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001834 char const str[] = "vkCreateRenderPass parameter, VkAttachmentStoreOp pCreateInfo->"\
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001835 "stencilStoreOp, is unrecognized (precondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001836 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001837 return;
1838 }
1839}
1840
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001841void PostCreateRenderPass(VkResult result, VkRenderPass* pRenderPass)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001842{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001843 if(result != VK_SUCCESS)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001844 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001845 // TODO: Spit out VkResult value.
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001846 char const str[] = "vkCreateRenderPass failed (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001847 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001848 return;
1849 }
1850
1851 if(pRenderPass == nullptr)
1852 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001853 char const str[] = "vkCreateRenderPass parameter, VkRenderPass* pRenderPass, is nullptr (postcondition).";
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001854 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001855 return;
1856 }
1857}
1858
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001859VK_LAYER_EXPORT VkResult VKAPI vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, VkRenderPass* pRenderPass)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001860{
1861 PreCreateRenderPass(device, pCreateInfo);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001862 VkResult result = device_dispatch_table(device)->CreateRenderPass(device, pCreateInfo, pRenderPass);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001863 PostCreateRenderPass(result, pRenderPass);
1864 return result;
1865}
1866
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001867VK_LAYER_EXPORT void VKAPI vkCmdBeginRenderPass(VkCmdBuffer cmdBuffer, const VkRenderPassBegin* pRenderPassBegin)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001868{
1869 char str[1024];
1870 if (!pRenderPassBegin) {
1871 sprintf(str, "Struct ptr parameter pRenderPassBegin to function CmdBeginRenderPass is NULL.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001872 layerCbMsg(VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001873 }
Courtney Goeltzenleuchterdfd1b2a2015-04-15 00:14:36 -06001874 else if (!vk_validate_vkrenderpassbegin(pRenderPassBegin)) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001875 sprintf(str, "Parameter pRenderPassBegin to function CmdBeginRenderPass contains an invalid value.");
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001876 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001877 }
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001878 device_dispatch_table(cmdBuffer)->CmdBeginRenderPass(cmdBuffer, pRenderPassBegin);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001879}
1880
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001881VK_LAYER_EXPORT void VKAPI vkCmdEndRenderPass(VkCmdBuffer cmdBuffer, VkRenderPass renderPass)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001882{
1883
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001884 device_dispatch_table(cmdBuffer)->CmdEndRenderPass(cmdBuffer, renderPass);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001885}
1886
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001887VK_LAYER_EXPORT VkResult VKAPI vkDbgCreateMsgCallback(
1888 VkInstance instance,
1889 VkFlags msgFlags,
1890 const PFN_vkDbgMsgCallback pfnMsgCallback,
1891 void* pUserData,
1892 VkDbgMsgCallback* pMsgCallback)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001893{
Jon Ashburn5a10d212015-06-01 10:02:09 -06001894 VkLayerInstanceDispatchTable *pTable = instance_dispatch_table(instance);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001895 return layer_create_msg_callback(instance, pTable, msgFlags, pfnMsgCallback, pUserData, pMsgCallback);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001896}
1897
Courtney Goeltzenleuchter09f85042015-06-01 14:45:27 -06001898VK_LAYER_EXPORT VkResult VKAPI vkDbgDestroyMsgCallback(
1899 VkInstance instance,
1900 VkDbgMsgCallback msgCallback)
1901{
Courtney Goeltzenleuchter9f171942015-06-13 21:22:12 -06001902 VkLayerInstanceDispatchTable *pTable = instance_dispatch_table(instance);
Courtney Goeltzenleuchter09f85042015-06-01 14:45:27 -06001903 return layer_destroy_msg_callback(instance, pTable, msgCallback);
1904}
1905
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001906VK_LAYER_EXPORT void VKAPI vkCmdDbgMarkerBegin(VkCmdBuffer cmdBuffer, const char* pMarker)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001907{
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001908 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) cmdBuffer;
1909 if (!deviceExtMap[pDisp].debug_marker_enabled) {
Jon Ashburnf0615e22015-05-25 14:11:37 -06001910 char const str[] = "Attempt to use CmdDbgMarkerBegin but extension disabled!";
1911 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001912 return;
Jon Ashburnf0615e22015-05-25 14:11:37 -06001913 }
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001914 debug_marker_dispatch_table(cmdBuffer)->CmdDbgMarkerBegin(cmdBuffer, pMarker);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001915}
1916
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001917VK_LAYER_EXPORT void VKAPI vkCmdDbgMarkerEnd(VkCmdBuffer cmdBuffer)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001918{
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001919 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) cmdBuffer;
1920 if (!deviceExtMap[pDisp].debug_marker_enabled) {
Jon Ashburnf0615e22015-05-25 14:11:37 -06001921 char const str[] = "Attempt to use CmdDbgMarkerEnd but extension disabled!";
1922 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001923 return;
Jon Ashburnf0615e22015-05-25 14:11:37 -06001924 }
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001925 debug_marker_dispatch_table(cmdBuffer)->CmdDbgMarkerEnd(cmdBuffer);
Jon Ashburnf0615e22015-05-25 14:11:37 -06001926}
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001927
Jon Ashburnf0615e22015-05-25 14:11:37 -06001928VkResult VKAPI vkDbgSetObjectTag(VkDevice device, VkObjectType objType, VkObject object, size_t tagSize, const void* pTag)
1929{
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001930 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) device;
1931 if (!deviceExtMap[pDisp].debug_marker_enabled) {
Jon Ashburnf0615e22015-05-25 14:11:37 -06001932 char const str[] = "Attempt to use DbgSetObjectTag but extension disabled!";
1933 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001934 return VK_ERROR_UNAVAILABLE;
Jon Ashburnf0615e22015-05-25 14:11:37 -06001935 }
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001936 debug_marker_dispatch_table(device)->DbgSetObjectTag(device, objType, object, tagSize, pTag);
Jon Ashburnf0615e22015-05-25 14:11:37 -06001937}
1938
1939VkResult VKAPI vkDbgSetObjectName(VkDevice device, VkObjectType objType, VkObject object, size_t nameSize, const char* pName)
1940{
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001941 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) device;
1942 if (!deviceExtMap[pDisp].debug_marker_enabled) {
Jon Ashburnf0615e22015-05-25 14:11:37 -06001943 char const str[] = "Attempt to use DbgSetObjectName but extension disabled!";
1944 layerCbMsg(VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, 1, "PARAMCHECK", str);
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001945 return VK_ERROR_UNAVAILABLE;
Jon Ashburnf0615e22015-05-25 14:11:37 -06001946 }
Jon Ashburn6f8cd632015-06-01 09:37:38 -06001947 debug_marker_dispatch_table(device)->DbgSetObjectName(device, objType, object, nameSize, pName);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001948}
1949
Chia-I Wu5b66aa52015-04-16 22:02:10 +08001950VK_LAYER_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(VkDisplayWSI display, VkDisplayInfoTypeWSI infoType, size_t* pDataSize, void* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001951{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001952 VkResult result = instance_dispatch_table(display)->GetDisplayInfoWSI(display, infoType, pDataSize, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001953 return result;
1954}
1955
Chia-I Wu5b66aa52015-04-16 22:02:10 +08001956VK_LAYER_EXPORT VkResult VKAPI vkCreateSwapChainWSI(VkDevice device, const VkSwapChainCreateInfoWSI* pCreateInfo, VkSwapChainWSI* pSwapChain)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001957{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001958 VkResult result = device_dispatch_table(device)->CreateSwapChainWSI(device, pCreateInfo, pSwapChain);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001959 return result;
1960}
1961
Chia-I Wu5b66aa52015-04-16 22:02:10 +08001962VK_LAYER_EXPORT VkResult VKAPI vkDestroySwapChainWSI(VkSwapChainWSI swapChain)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001963{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001964 VkResult result = device_dispatch_table(swapChain)->DestroySwapChainWSI(swapChain);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001965 return result;
1966}
1967
Chia-I Wu5b66aa52015-04-16 22:02:10 +08001968VK_LAYER_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(VkSwapChainWSI swapChain, VkSwapChainInfoTypeWSI infoType, size_t* pDataSize, void* pData)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001969{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001970 VkResult result = device_dispatch_table(swapChain)->GetSwapChainInfoWSI(swapChain, infoType, pDataSize, pData);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001971 return result;
1972}
1973
Chia-I Wu5b66aa52015-04-16 22:02:10 +08001974VK_LAYER_EXPORT VkResult VKAPI vkQueuePresentWSI(VkQueue queue, const VkPresentInfoWSI* pPresentInfo)
1975{
Mark Lobodzinski3723c512015-05-26 10:58:40 -05001976 VkResult result = device_dispatch_table(queue)->QueuePresentWSI(queue, pPresentInfo);
Chia-I Wu5b66aa52015-04-16 22:02:10 +08001977 return result;
1978}
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06001979
Jon Ashburn79b78ac2015-05-05 14:22:52 -06001980static inline void* layer_intercept_proc(const char *name)
1981{
1982 if (!name || name[0] != 'v' || name[1] != 'k')
1983 return NULL;
1984
1985 name += 2;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06001986 if (!strcmp(name, "DestroyDevice"))
1987 return (void*) vkDestroyDevice;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06001988 if (!strcmp(name, "GetDeviceQueue"))
1989 return (void*) vkGetDeviceQueue;
1990 if (!strcmp(name, "QueueSubmit"))
1991 return (void*) vkQueueSubmit;
1992 if (!strcmp(name, "QueueWaitIdle"))
1993 return (void*) vkQueueWaitIdle;
1994 if (!strcmp(name, "DeviceWaitIdle"))
1995 return (void*) vkDeviceWaitIdle;
1996 if (!strcmp(name, "AllocMemory"))
1997 return (void*) vkAllocMemory;
1998 if (!strcmp(name, "FreeMemory"))
1999 return (void*) vkFreeMemory;
2000 if (!strcmp(name, "SetMemoryPriority"))
2001 return (void*) vkSetMemoryPriority;
2002 if (!strcmp(name, "MapMemory"))
2003 return (void*) vkMapMemory;
2004 if (!strcmp(name, "UnmapMemory"))
2005 return (void*) vkUnmapMemory;
2006 if (!strcmp(name, "FlushMappedMemoryRanges"))
2007 return (void*) vkFlushMappedMemoryRanges;
2008 if (!strcmp(name, "InvalidateMappedMemoryRanges"))
2009 return (void*) vkInvalidateMappedMemoryRanges;
2010 if (!strcmp(name, "PinSystemMemory"))
2011 return (void*) vkPinSystemMemory;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002012 if (!strcmp(name, "OpenSharedMemory"))
2013 return (void*) vkOpenSharedMemory;
2014 if (!strcmp(name, "OpenSharedSemaphore"))
2015 return (void*) vkOpenSharedSemaphore;
2016 if (!strcmp(name, "OpenPeerMemory"))
2017 return (void*) vkOpenPeerMemory;
2018 if (!strcmp(name, "OpenPeerImage"))
2019 return (void*) vkOpenPeerImage;
2020 if (!strcmp(name, "DestroyObject"))
2021 return (void*) vkDestroyObject;
2022 if (!strcmp(name, "GetObjectInfo"))
2023 return (void*) vkGetObjectInfo;
2024 if (!strcmp(name, "CreateFence"))
2025 return (void*) vkCreateFence;
2026 if (!strcmp(name, "ResetFences"))
2027 return (void*) vkResetFences;
2028 if (!strcmp(name, "GetFenceStatus"))
2029 return (void*) vkGetFenceStatus;
2030 if (!strcmp(name, "WaitForFences"))
2031 return (void*) vkWaitForFences;
2032 if (!strcmp(name, "CreateSemaphore"))
2033 return (void*) vkCreateSemaphore;
2034 if (!strcmp(name, "QueueSignalSemaphore"))
2035 return (void*) vkQueueSignalSemaphore;
2036 if (!strcmp(name, "QueueWaitSemaphore"))
2037 return (void*) vkQueueWaitSemaphore;
2038 if (!strcmp(name, "CreateEvent"))
2039 return (void*) vkCreateEvent;
2040 if (!strcmp(name, "GetEventStatus"))
2041 return (void*) vkGetEventStatus;
2042 if (!strcmp(name, "SetEvent"))
2043 return (void*) vkSetEvent;
2044 if (!strcmp(name, "ResetEvent"))
2045 return (void*) vkResetEvent;
2046 if (!strcmp(name, "CreateQueryPool"))
2047 return (void*) vkCreateQueryPool;
2048 if (!strcmp(name, "GetQueryPoolResults"))
2049 return (void*) vkGetQueryPoolResults;
2050 if (!strcmp(name, "GetFormatInfo"))
2051 return (void*) vkGetFormatInfo;
2052 if (!strcmp(name, "CreateBuffer"))
2053 return (void*) vkCreateBuffer;
2054 if (!strcmp(name, "CreateBufferView"))
2055 return (void*) vkCreateBufferView;
2056 if (!strcmp(name, "CreateImage"))
2057 return (void*) vkCreateImage;
2058 if (!strcmp(name, "GetImageSubresourceInfo"))
2059 return (void*) vkGetImageSubresourceInfo;
2060 if (!strcmp(name, "CreateImageView"))
2061 return (void*) vkCreateImageView;
2062 if (!strcmp(name, "CreateColorAttachmentView"))
2063 return (void*) vkCreateColorAttachmentView;
2064 if (!strcmp(name, "CreateDepthStencilView"))
2065 return (void*) vkCreateDepthStencilView;
2066 if (!strcmp(name, "CreateShader"))
2067 return (void*) vkCreateShader;
2068 if (!strcmp(name, "CreateGraphicsPipeline"))
2069 return (void*) vkCreateGraphicsPipeline;
2070 if (!strcmp(name, "CreateGraphicsPipelineDerivative"))
2071 return (void*) vkCreateGraphicsPipelineDerivative;
2072 if (!strcmp(name, "CreateComputePipeline"))
2073 return (void*) vkCreateComputePipeline;
2074 if (!strcmp(name, "StorePipeline"))
2075 return (void*) vkStorePipeline;
2076 if (!strcmp(name, "LoadPipeline"))
2077 return (void*) vkLoadPipeline;
2078 if (!strcmp(name, "LoadPipelineDerivative"))
2079 return (void*) vkLoadPipelineDerivative;
2080 if (!strcmp(name, "CreatePipelineLayout"))
2081 return (void*) vkCreatePipelineLayout;
2082 if (!strcmp(name, "CreateSampler"))
2083 return (void*) vkCreateSampler;
2084 if (!strcmp(name, "CreateDescriptorSetLayout"))
2085 return (void*) vkCreateDescriptorSetLayout;
2086 if (!strcmp(name, "CreateDescriptorPool"))
2087 return (void*) vkCreateDescriptorPool;
2088 if (!strcmp(name, "ResetDescriptorPool"))
2089 return (void*) vkResetDescriptorPool;
2090 if (!strcmp(name, "AllocDescriptorSets"))
2091 return (void*) vkAllocDescriptorSets;
2092 if (!strcmp(name, "ClearDescriptorSets"))
2093 return (void*) vkClearDescriptorSets;
2094 if (!strcmp(name, "CreateDynamicViewportState"))
2095 return (void*) vkCreateDynamicViewportState;
2096 if (!strcmp(name, "CreateDynamicRasterState"))
2097 return (void*) vkCreateDynamicRasterState;
2098 if (!strcmp(name, "CreateDynamicColorBlendState"))
2099 return (void*) vkCreateDynamicColorBlendState;
2100 if (!strcmp(name, "CreateDynamicDepthStencilState"))
2101 return (void*) vkCreateDynamicDepthStencilState;
2102 if (!strcmp(name, "CreateCommandBuffer"))
2103 return (void*) vkCreateCommandBuffer;
2104 if (!strcmp(name, "BeginCommandBuffer"))
2105 return (void*) vkBeginCommandBuffer;
2106 if (!strcmp(name, "EndCommandBuffer"))
2107 return (void*) vkEndCommandBuffer;
2108 if (!strcmp(name, "ResetCommandBuffer"))
2109 return (void*) vkResetCommandBuffer;
2110 if (!strcmp(name, "CmdBindPipeline"))
2111 return (void*) vkCmdBindPipeline;
2112 if (!strcmp(name, "CmdBindDynamicStateObject"))
2113 return (void*) vkCmdBindDynamicStateObject;
2114 if (!strcmp(name, "CmdBindDescriptorSets"))
2115 return (void*) vkCmdBindDescriptorSets;
2116 if (!strcmp(name, "CmdBindVertexBuffers"))
2117 return (void*) vkCmdBindVertexBuffers;
2118 if (!strcmp(name, "CmdBindIndexBuffer"))
2119 return (void*) vkCmdBindIndexBuffer;
2120 if (!strcmp(name, "CmdDraw"))
2121 return (void*) vkCmdDraw;
2122 if (!strcmp(name, "CmdDrawIndexed"))
2123 return (void*) vkCmdDrawIndexed;
2124 if (!strcmp(name, "CmdDrawIndirect"))
2125 return (void*) vkCmdDrawIndirect;
2126 if (!strcmp(name, "CmdDrawIndexedIndirect"))
2127 return (void*) vkCmdDrawIndexedIndirect;
2128 if (!strcmp(name, "CmdDispatch"))
2129 return (void*) vkCmdDispatch;
2130 if (!strcmp(name, "CmdDispatchIndirect"))
2131 return (void*) vkCmdDispatchIndirect;
2132 if (!strcmp(name, "CmdCopyBuffer"))
2133 return (void*) vkCmdCopyBuffer;
2134 if (!strcmp(name, "CmdCopyImage"))
2135 return (void*) vkCmdCopyImage;
2136 if (!strcmp(name, "CmdBlitImage"))
2137 return (void*) vkCmdBlitImage;
2138 if (!strcmp(name, "CmdCopyBufferToImage"))
2139 return (void*) vkCmdCopyBufferToImage;
2140 if (!strcmp(name, "CmdCopyImageToBuffer"))
2141 return (void*) vkCmdCopyImageToBuffer;
2142 if (!strcmp(name, "CmdUpdateBuffer"))
2143 return (void*) vkCmdUpdateBuffer;
2144 if (!strcmp(name, "CmdFillBuffer"))
2145 return (void*) vkCmdFillBuffer;
2146 if (!strcmp(name, "CmdClearColorImage"))
2147 return (void*) vkCmdClearColorImage;
2148 if (!strcmp(name, "CmdClearDepthStencil"))
2149 return (void*) vkCmdClearDepthStencil;
2150 if (!strcmp(name, "CmdResolveImage"))
2151 return (void*) vkCmdResolveImage;
2152 if (!strcmp(name, "CmdSetEvent"))
2153 return (void*) vkCmdSetEvent;
2154 if (!strcmp(name, "CmdResetEvent"))
2155 return (void*) vkCmdResetEvent;
2156 if (!strcmp(name, "CmdWaitEvents"))
2157 return (void*) vkCmdWaitEvents;
2158 if (!strcmp(name, "CmdPipelineBarrier"))
2159 return (void*) vkCmdPipelineBarrier;
2160 if (!strcmp(name, "CmdBeginQuery"))
2161 return (void*) vkCmdBeginQuery;
2162 if (!strcmp(name, "CmdEndQuery"))
2163 return (void*) vkCmdEndQuery;
2164 if (!strcmp(name, "CmdResetQueryPool"))
2165 return (void*) vkCmdResetQueryPool;
2166 if (!strcmp(name, "CmdWriteTimestamp"))
2167 return (void*) vkCmdWriteTimestamp;
2168 if (!strcmp(name, "CmdCopyQueryPoolResults"))
2169 return (void*) vkCmdCopyQueryPoolResults;
2170 if (!strcmp(name, "CmdInitAtomicCounters"))
2171 return (void*) vkCmdInitAtomicCounters;
2172 if (!strcmp(name, "CmdLoadAtomicCounters"))
2173 return (void*) vkCmdLoadAtomicCounters;
2174 if (!strcmp(name, "CmdSaveAtomicCounters"))
2175 return (void*) vkCmdSaveAtomicCounters;
2176 if (!strcmp(name, "CreateFramebuffer"))
2177 return (void*) vkCreateFramebuffer;
2178 if (!strcmp(name, "CreateRenderPass"))
2179 return (void*) vkCreateRenderPass;
2180 if (!strcmp(name, "CmdBeginRenderPass"))
2181 return (void*) vkCmdBeginRenderPass;
2182 if (!strcmp(name, "CmdEndRenderPass"))
2183 return (void*) vkCmdEndRenderPass;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002184 if (!strcmp(name, "GetDisplayInfoWSI"))
2185 return (void*) vkGetDisplayInfoWSI;
2186 if (!strcmp(name, "CreateSwapChainWSI"))
2187 return (void*) vkCreateSwapChainWSI;
2188 if (!strcmp(name, "DestroySwapChainWSI"))
2189 return (void*) vkDestroySwapChainWSI;
2190 if (!strcmp(name, "GetSwapChainInfoWSI"))
2191 return (void*) vkGetSwapChainInfoWSI;
2192 if (!strcmp(name, "QueuePresentWSI"))
2193 return (void*) vkQueuePresentWSI;
2194
2195 return NULL;
2196}
2197
2198static inline void* layer_intercept_instance_proc(const char *name)
2199{
2200 if (!name || name[0] != 'v' || name[1] != 'k')
2201 return NULL;
2202
2203 name += 2;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002204 if (!strcmp(name, "CreateInstance"))
2205 return (void*) vkCreateInstance;
2206 if (!strcmp(name, "DestroyInstance"))
2207 return (void*) vkDestroyInstance;
2208 if (!strcmp(name, "GetPhysicalDeviceInfo"))
2209 return (void*) vkGetPhysicalDeviceInfo;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002210 if (!strcmp(name, "CreateDevice"))
2211 return (void*) vkCreateDevice;
2212 if (!strcmp(name, "GetGlobalExtensionInfo"))
2213 return (void*) vkGetGlobalExtensionInfo;
2214 if (!strcmp(name, "GetPhysicalDeviceExtensionInfo"))
2215 return (void*) vkGetPhysicalDeviceExtensionInfo;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002216 if (!strcmp(name, "GetMultiDeviceCompatibility"))
2217 return (void*) vkGetMultiDeviceCompatibility;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002218
2219 return NULL;
2220}
2221
Jon Ashburn1245cec2015-05-18 13:20:15 -06002222VK_LAYER_EXPORT void* VKAPI vkGetDeviceProcAddr(VkDevice device, const char* funcName)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002223{
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002224 void* addr;
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002225 if (device == NULL) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002226 return NULL;
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002227 }
2228
Jon Ashburnd9564002015-05-07 10:27:37 -06002229 loader_platform_thread_once(&initOnce, initParamChecker);
Jon Ashburn4f2575f2015-05-28 16:25:02 -06002230
2231 /* loader uses this to force layer initialization; device object is wrapped */
2232 if (!strcmp(funcName, "vkGetDeviceProcAddr")) {
2233 initDeviceTable((const VkBaseLayerObject *) device);
2234 return (void*) vkGetDeviceProcAddr;
2235 }
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002236
2237 addr = layer_intercept_proc(funcName);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002238 if (addr) {
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002239 return addr;
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002240 }
Jon Ashburn6f8cd632015-06-01 09:37:38 -06002241
2242 VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) device;
2243 if (!deviceExtMap[pDisp].debug_marker_enabled)
2244 {
2245 if (!strcmp(funcName, "CmdDbgMarkerBegin"))
2246 return (void*) vkCmdDbgMarkerBegin;
2247 if (!strcmp(funcName, "CmdDbgMarkerEnd"))
2248 return (void*) vkCmdDbgMarkerEnd;
2249 if (!strcmp(funcName, "DbgSetObjectTag"))
2250 return (void*) vkDbgSetObjectTag;
2251 if (!strcmp(funcName, "DbgSetObjectName"))
2252 return (void*) vkDbgSetObjectName;
2253 }
2254 {
Jon Ashburn5a10d212015-06-01 10:02:09 -06002255 VkLayerDispatchTable* pTable = device_dispatch_table(device);
Jon Ashburn4f2575f2015-05-28 16:25:02 -06002256 if (pTable->GetDeviceProcAddr == NULL)
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002257 return NULL;
Jon Ashburn4f2575f2015-05-28 16:25:02 -06002258 return pTable->GetDeviceProcAddr(device, funcName);
Jeremy Hayesc6cfa572015-04-06 13:46:11 -06002259 }
2260}
2261
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002262VK_LAYER_EXPORT void* VKAPI vkGetInstanceProcAddr(VkInstance instance, const char* funcName)
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002263{
Courtney Goeltzenleuchter09f85042015-06-01 14:45:27 -06002264 void *fptr;
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002265 void* addr;
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002266 if (instance == NULL) {
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002267 return NULL;
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002268 }
2269
Jon Ashburnd9564002015-05-07 10:27:37 -06002270 loader_platform_thread_once(&initOnce, initParamChecker);
Jon Ashburn4f2575f2015-05-28 16:25:02 -06002271
2272 /* loader uses this to force layer initialization; instance object is wrapped */
2273 if (!strcmp(funcName, "vkGetInstanceProcAddr")) {
2274 initInstanceTable((const VkBaseLayerObject *) instance);
2275 return (void*) vkGetInstanceProcAddr;
2276 }
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002277
2278 addr = layer_intercept_instance_proc(funcName);
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002279 if (addr) {
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002280 return addr;
Mark Lobodzinski3723c512015-05-26 10:58:40 -05002281 }
Courtney Goeltzenleuchter09f85042015-06-01 14:45:27 -06002282
2283 fptr = msg_callback_get_proc_addr(funcName);
2284 if (fptr)
2285 return fptr;
2286
Jon Ashburn5a10d212015-06-01 10:02:09 -06002287 VkLayerInstanceDispatchTable* pTable = instance_dispatch_table(instance);
2288 if (pTable->GetInstanceProcAddr == NULL)
2289 return NULL;
2290 return pTable->GetInstanceProcAddr(instance, funcName);
Jon Ashburn79b78ac2015-05-05 14:22:52 -06002291}