Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 1 | /* |
Jon Ashburn | 23d36b1 | 2016-02-02 17:47:28 -0700 | [diff] [blame] | 2 | * Copyright (c) 2015-2016 The Khronos Group Inc. |
| 3 | * Copyright (c) 2015-2016 Valve Corporation |
| 4 | * Copyright (c) 2015-2016 LunarG, Inc. |
| 5 | * Copyright (C) 2015-2016 Google Inc. |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 6 | * |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | * you may not use this file except in compliance with the License. |
| 9 | * You may obtain a copy of the License at |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 10 | * |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 12 | * |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 13 | * Unless required by applicable law or agreed to in writing, software |
| 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | * See the License for the specific language governing permissions and |
| 17 | * limitations under the License. |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 18 | * |
Courtney Goeltzenleuchter | 0555952 | 2015-10-30 11:14:30 -0600 | [diff] [blame] | 19 | * Author: Courtney Goeltzenleuchter <courtney@LunarG.com> |
Jon Ashburn | 23d36b1 | 2016-02-02 17:47:28 -0700 | [diff] [blame] | 20 | * Author: Jon Ashburn <jon@LunarG.com> |
Courtney Goeltzenleuchter | 0555952 | 2015-10-30 11:14:30 -0600 | [diff] [blame] | 21 | * |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 22 | */ |
| 23 | |
Courtney Goeltzenleuchter | 7f5aafc | 2015-07-05 11:28:29 -0600 | [diff] [blame] | 24 | #define _GNU_SOURCE |
Courtney Goeltzenleuchter | 7dcc6a7 | 2015-06-11 16:01:11 -0600 | [diff] [blame] | 25 | #include <stdio.h> |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 26 | #include <string.h> |
| 27 | #include <stdlib.h> |
Courtney Goeltzenleuchter | 7dcc6a7 | 2015-06-11 16:01:11 -0600 | [diff] [blame] | 28 | #include <inttypes.h> |
Tony Barbour | 1d825c7 | 2015-06-18 16:29:32 -0600 | [diff] [blame] | 29 | #ifndef WIN32 |
Courtney Goeltzenleuchter | 03663d0 | 2015-07-22 11:01:53 -0600 | [diff] [blame] | 30 | #include <signal.h> |
| 31 | #else |
Tony Barbour | 1d825c7 | 2015-06-18 16:29:32 -0600 | [diff] [blame] | 32 | #endif |
Jon Ashburn | 480a50a | 2015-08-28 14:58:46 -0700 | [diff] [blame] | 33 | #include "vk_loader_platform.h" |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 34 | #include "debug_report.h" |
David Pinedo | 9316d3b | 2015-11-06 12:54:48 -0700 | [diff] [blame] | 35 | #include "vulkan/vk_layer.h" |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 36 | |
Jon Ashburn | 23d36b1 | 2016-02-02 17:47:28 -0700 | [diff] [blame] | 37 | typedef void(VKAPI_PTR *PFN_stringCallback)(char *message); |
Courtney Goeltzenleuchter | 7dcc6a7 | 2015-06-11 16:01:11 -0600 | [diff] [blame] | 38 | |
Jon Ashburn | 5c042ea | 2015-08-04 11:14:18 -0600 | [diff] [blame] | 39 | static const VkExtensionProperties debug_report_extension_info = { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 40 | .extensionName = VK_EXT_DEBUG_REPORT_EXTENSION_NAME, .specVersion = VK_EXT_DEBUG_REPORT_SPEC_VERSION, |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 41 | }; |
| 42 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 43 | void debug_report_add_instance_extensions(const struct loader_instance *inst, struct loader_extension_list *ext_list) { |
Jon Ashburn | e39a4f8 | 2015-08-28 13:38:21 -0600 | [diff] [blame] | 44 | loader_add_to_ext_list(inst, ext_list, 1, &debug_report_extension_info); |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 45 | } |
| 46 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 47 | void debug_report_create_instance(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo) { |
Mark Young | 35159af | 2016-09-07 08:50:32 -0600 | [diff] [blame] | 48 | ptr_instance->enabled_known_extensions.ext_debug_report = 0; |
Courtney Goeltzenleuchter | 110fdf9 | 2015-06-29 15:39:26 -0600 | [diff] [blame] | 49 | |
Jon Ashburn | f19916e | 2016-01-11 13:12:43 -0700 | [diff] [blame] | 50 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 51 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_DEBUG_REPORT_EXTENSION_NAME) == 0) { |
Mark Young | 35159af | 2016-09-07 08:50:32 -0600 | [diff] [blame] | 52 | ptr_instance->enabled_known_extensions.ext_debug_report = 1; |
Courtney Goeltzenleuchter | 110fdf9 | 2015-06-29 15:39:26 -0600 | [diff] [blame] | 53 | return; |
| 54 | } |
| 55 | } |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 56 | } |
| 57 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 58 | VkResult util_CreateDebugReportCallback(struct loader_instance *inst, VkDebugReportCallbackCreateInfoEXT *pCreateInfo, |
| 59 | const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT callback) { |
Mark Young | 7e4da97 | 2016-08-25 14:54:58 -0600 | [diff] [blame] | 60 | VkLayerDbgFunctionNode *pNewDbgFuncNode = NULL; |
| 61 | |
Mark Young | 0ad8313 | 2016-06-30 13:02:42 -0600 | [diff] [blame] | 62 | #if (DEBUG_DISABLE_APP_ALLOCATORS == 1) |
| 63 | { |
| 64 | #else |
Courtney Goeltzenleuchter | 8288727 | 2015-12-02 15:29:33 -0700 | [diff] [blame] | 65 | if (pAllocator != NULL) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 66 | pNewDbgFuncNode = (VkLayerDbgFunctionNode *)pAllocator->pfnAllocation(pAllocator->pUserData, sizeof(VkLayerDbgFunctionNode), |
| 67 | sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); |
Courtney Goeltzenleuchter | 8288727 | 2015-12-02 15:29:33 -0700 | [diff] [blame] | 68 | } else { |
Mark Young | 0ad8313 | 2016-06-30 13:02:42 -0600 | [diff] [blame] | 69 | #endif |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 70 | pNewDbgFuncNode = (VkLayerDbgFunctionNode *)loader_instance_heap_alloc(inst, sizeof(VkLayerDbgFunctionNode), |
| 71 | VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); |
Courtney Goeltzenleuchter | 8288727 | 2015-12-02 15:29:33 -0700 | [diff] [blame] | 72 | } |
Mark Young | 7e4da97 | 2016-08-25 14:54:58 -0600 | [diff] [blame] | 73 | if (!pNewDbgFuncNode) { |
Courtney Goeltzenleuchter | 8288727 | 2015-12-02 15:29:33 -0700 | [diff] [blame] | 74 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
Mark Young | 7e4da97 | 2016-08-25 14:54:58 -0600 | [diff] [blame] | 75 | } |
| 76 | memset(pNewDbgFuncNode, 0, sizeof(VkLayerDbgFunctionNode)); |
Courtney Goeltzenleuchter | 8288727 | 2015-12-02 15:29:33 -0700 | [diff] [blame] | 77 | |
| 78 | pNewDbgFuncNode->msgCallback = callback; |
| 79 | pNewDbgFuncNode->pfnMsgCallback = pCreateInfo->pfnCallback; |
| 80 | pNewDbgFuncNode->msgFlags = pCreateInfo->flags; |
| 81 | pNewDbgFuncNode->pUserData = pCreateInfo->pUserData; |
| 82 | pNewDbgFuncNode->pNext = inst->DbgFunctionHead; |
| 83 | inst->DbgFunctionHead = pNewDbgFuncNode; |
| 84 | |
| 85 | return VK_SUCCESS; |
| 86 | } |
| 87 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 88 | static VKAPI_ATTR VkResult VKAPI_CALL |
| 89 | debug_report_CreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, |
| 90 | const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pCallback) { |
Jon Ashburn | e0e6457 | 2015-09-30 12:56:42 -0600 | [diff] [blame] | 91 | struct loader_instance *inst = loader_get_instance(instance); |
Jon Ashburn | 6301a0f | 2015-05-29 13:15:39 -0600 | [diff] [blame] | 92 | loader_platform_thread_lock_mutex(&loader_lock); |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 93 | VkResult result = inst->disp->layer_inst_disp.CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pCallback); |
Jon Ashburn | 6301a0f | 2015-05-29 13:15:39 -0600 | [diff] [blame] | 94 | loader_platform_thread_unlock_mutex(&loader_lock); |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 95 | return result; |
| 96 | } |
| 97 | |
Courtney Goeltzenleuchter | 822e8d7 | 2015-11-30 15:28:25 -0700 | [diff] [blame] | 98 | // Utility function to handle reporting |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 99 | VkBool32 util_DebugReportMessage(const struct loader_instance *inst, VkFlags msgFlags, VkDebugReportObjectTypeEXT objectType, |
| 100 | uint64_t srcObject, size_t location, int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { |
Courtney Goeltzenleuchter | 822e8d7 | 2015-11-30 15:28:25 -0700 | [diff] [blame] | 101 | VkBool32 bail = false; |
| 102 | VkLayerDbgFunctionNode *pTrav = inst->DbgFunctionHead; |
| 103 | while (pTrav) { |
| 104 | if (pTrav->msgFlags & msgFlags) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 105 | if (pTrav->pfnMsgCallback(msgFlags, objectType, srcObject, location, msgCode, pLayerPrefix, pMsg, pTrav->pUserData)) { |
Courtney Goeltzenleuchter | 822e8d7 | 2015-11-30 15:28:25 -0700 | [diff] [blame] | 106 | bail = true; |
| 107 | } |
| 108 | } |
| 109 | pTrav = pTrav->pNext; |
| 110 | } |
| 111 | |
| 112 | return bail; |
| 113 | } |
| 114 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 115 | void util_DestroyDebugReportCallback(struct loader_instance *inst, VkDebugReportCallbackEXT callback, |
Jon Ashburn | 23d36b1 | 2016-02-02 17:47:28 -0700 | [diff] [blame] | 116 | const VkAllocationCallbacks *pAllocator) { |
Courtney Goeltzenleuchter | 8288727 | 2015-12-02 15:29:33 -0700 | [diff] [blame] | 117 | VkLayerDbgFunctionNode *pTrav = inst->DbgFunctionHead; |
| 118 | VkLayerDbgFunctionNode *pPrev = pTrav; |
| 119 | |
| 120 | while (pTrav) { |
| 121 | if (pTrav->msgCallback == callback) { |
| 122 | pPrev->pNext = pTrav->pNext; |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 123 | if (inst->DbgFunctionHead == pTrav) inst->DbgFunctionHead = pTrav->pNext; |
Mark Young | 0ad8313 | 2016-06-30 13:02:42 -0600 | [diff] [blame] | 124 | #if (DEBUG_DISABLE_APP_ALLOCATORS == 1) |
| 125 | { |
| 126 | #else |
Courtney Goeltzenleuchter | 8288727 | 2015-12-02 15:29:33 -0700 | [diff] [blame] | 127 | if (pAllocator != NULL) { |
| 128 | pAllocator->pfnFree(pAllocator->pUserData, pTrav); |
| 129 | } else { |
Mark Young | 0ad8313 | 2016-06-30 13:02:42 -0600 | [diff] [blame] | 130 | #endif |
| 131 | loader_instance_heap_free(inst, pTrav); |
Courtney Goeltzenleuchter | 8288727 | 2015-12-02 15:29:33 -0700 | [diff] [blame] | 132 | } |
| 133 | break; |
| 134 | } |
| 135 | pPrev = pTrav; |
| 136 | pTrav = pTrav->pNext; |
| 137 | } |
| 138 | } |
Courtney Goeltzenleuchter | 822e8d7 | 2015-11-30 15:28:25 -0700 | [diff] [blame] | 139 | |
Ian Elliott | ad6300f | 2016-03-31 10:48:19 -0600 | [diff] [blame] | 140 | // This utility (used by vkInstanceCreateInfo(), looks at a pNext chain. It |
| 141 | // counts any VkDebugReportCallbackCreateInfoEXT structs that it finds. It |
| 142 | // then allocates array that can hold that many structs, as well as that many |
| 143 | // VkDebugReportCallbackEXT handles. It then copies each |
| 144 | // VkDebugReportCallbackCreateInfoEXT, and initializes each handle. |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 145 | VkResult util_CopyDebugReportCreateInfos(const void *pChain, const VkAllocationCallbacks *pAllocator, uint32_t *num_callbacks, |
| 146 | VkDebugReportCallbackCreateInfoEXT **infos, VkDebugReportCallbackEXT **callbacks) { |
Ian Elliott | ad6300f | 2016-03-31 10:48:19 -0600 | [diff] [blame] | 147 | uint32_t n = *num_callbacks = 0; |
Mark Young | 0ad8313 | 2016-06-30 13:02:42 -0600 | [diff] [blame] | 148 | VkDebugReportCallbackCreateInfoEXT *pInfos = NULL; |
| 149 | VkDebugReportCallbackEXT *pCallbacks = NULL; |
Ian Elliott | ad6300f | 2016-03-31 10:48:19 -0600 | [diff] [blame] | 150 | |
| 151 | // NOTE: The loader is not using pAllocator, and so this function doesn't |
| 152 | // either. |
| 153 | |
| 154 | const void *pNext = pChain; |
| 155 | while (pNext) { |
| 156 | // 1st, count the number VkDebugReportCallbackCreateInfoEXT: |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 157 | if (((VkDebugReportCallbackCreateInfoEXT *)pNext)->sType == VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT) { |
Ian Elliott | ad6300f | 2016-03-31 10:48:19 -0600 | [diff] [blame] | 158 | n++; |
| 159 | } |
| 160 | pNext = (void *)((VkDebugReportCallbackCreateInfoEXT *)pNext)->pNext; |
| 161 | } |
| 162 | if (n == 0) { |
| 163 | return VK_SUCCESS; |
| 164 | } |
| 165 | |
Mark Young | 0ad8313 | 2016-06-30 13:02:42 -0600 | [diff] [blame] | 166 | // 2nd, allocate memory for each VkDebugReportCallbackCreateInfoEXT: |
| 167 | #if (DEBUG_DISABLE_APP_ALLOCATORS == 1) |
| 168 | { |
| 169 | #else |
| 170 | if (pAllocator != NULL) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 171 | pInfos = *infos = ((VkDebugReportCallbackCreateInfoEXT *)pAllocator->pfnAllocation( |
| 172 | pAllocator->pUserData, n * sizeof(VkDebugReportCallbackCreateInfoEXT), sizeof(void *), |
| 173 | VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); |
Mark Young | 0ad8313 | 2016-06-30 13:02:42 -0600 | [diff] [blame] | 174 | } else { |
| 175 | #endif |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 176 | pInfos = *infos = ((VkDebugReportCallbackCreateInfoEXT *)malloc(n * sizeof(VkDebugReportCallbackCreateInfoEXT))); |
Mark Young | 0ad8313 | 2016-06-30 13:02:42 -0600 | [diff] [blame] | 177 | } |
Ian Elliott | ad6300f | 2016-03-31 10:48:19 -0600 | [diff] [blame] | 178 | if (!pInfos) { |
| 179 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 180 | } |
Mark Young | 0ad8313 | 2016-06-30 13:02:42 -0600 | [diff] [blame] | 181 | // 3rd, allocate memory for a unique handle for each callback: |
| 182 | #if (DEBUG_DISABLE_APP_ALLOCATORS == 1) |
| 183 | { |
| 184 | #else |
| 185 | if (pAllocator != NULL) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 186 | pCallbacks = *callbacks = ((VkDebugReportCallbackEXT *)pAllocator->pfnAllocation( |
| 187 | pAllocator->pUserData, n * sizeof(VkDebugReportCallbackEXT), sizeof(void *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); |
Mark Young | 0fea692 | 2016-11-21 16:20:06 -0700 | [diff] [blame] | 188 | if (!pCallbacks) { |
| 189 | pAllocator->pfnFree(pAllocator->pUserData, pInfos); |
| 190 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 191 | } |
Mark Young | 0ad8313 | 2016-06-30 13:02:42 -0600 | [diff] [blame] | 192 | } else { |
| 193 | #endif |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 194 | pCallbacks = *callbacks = ((VkDebugReportCallbackEXT *)malloc(n * sizeof(VkDebugReportCallbackEXT))); |
Mark Young | 0fea692 | 2016-11-21 16:20:06 -0700 | [diff] [blame] | 195 | if (!pCallbacks) { |
| 196 | free(pInfos); |
| 197 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 198 | } |
Ian Elliott | ad6300f | 2016-03-31 10:48:19 -0600 | [diff] [blame] | 199 | } |
| 200 | // 4th, copy each VkDebugReportCallbackCreateInfoEXT for use by |
| 201 | // vkDestroyInstance, and assign a unique handle to each callback (just |
| 202 | // use the address of the copied VkDebugReportCallbackCreateInfoEXT): |
| 203 | pNext = pChain; |
| 204 | while (pNext) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 205 | if (((VkInstanceCreateInfo *)pNext)->sType == VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT) { |
Jon Ashburn | cc407a2 | 2016-04-15 09:25:03 -0600 | [diff] [blame] | 206 | memcpy(pInfos, pNext, sizeof(VkDebugReportCallbackCreateInfoEXT)); |
Karl Schultz | 9497129 | 2016-11-19 09:02:27 -0700 | [diff] [blame] | 207 | *pCallbacks++ = (VkDebugReportCallbackEXT)(uintptr_t)pInfos++; |
Ian Elliott | ad6300f | 2016-03-31 10:48:19 -0600 | [diff] [blame] | 208 | } |
| 209 | pNext = (void *)((VkInstanceCreateInfo *)pNext)->pNext; |
| 210 | } |
| 211 | |
| 212 | *num_callbacks = n; |
| 213 | return VK_SUCCESS; |
| 214 | } |
| 215 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 216 | void util_FreeDebugReportCreateInfos(const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackCreateInfoEXT *infos, |
Jon Ashburn | cc407a2 | 2016-04-15 09:25:03 -0600 | [diff] [blame] | 217 | VkDebugReportCallbackEXT *callbacks) { |
Mark Young | 0fea692 | 2016-11-21 16:20:06 -0700 | [diff] [blame] | 218 | #if (DEBUG_DISABLE_APP_ALLOCATORS == 1) |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 219 | { |
Mark Young | 0fea692 | 2016-11-21 16:20:06 -0700 | [diff] [blame] | 220 | #else |
| 221 | if (pAllocator != NULL) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 222 | pAllocator->pfnFree(pAllocator->pUserData, infos); |
| 223 | pAllocator->pfnFree(pAllocator->pUserData, callbacks); |
Mark Young | 0fea692 | 2016-11-21 16:20:06 -0700 | [diff] [blame] | 224 | } else { |
| 225 | #endif |
| 226 | free(infos); |
| 227 | free(callbacks); |
| 228 | } |
Ian Elliott | ad6300f | 2016-03-31 10:48:19 -0600 | [diff] [blame] | 229 | } |
| 230 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 231 | VkResult util_CreateDebugReportCallbacks(struct loader_instance *inst, const VkAllocationCallbacks *pAllocator, |
| 232 | uint32_t num_callbacks, VkDebugReportCallbackCreateInfoEXT *infos, |
| 233 | VkDebugReportCallbackEXT *callbacks) { |
Jamie Madill | 2b6b8d5 | 2016-04-04 15:09:51 -0400 | [diff] [blame] | 234 | VkResult rtn = VK_SUCCESS; |
Jon Ashburn | cc407a2 | 2016-04-15 09:25:03 -0600 | [diff] [blame] | 235 | for (uint32_t i = 0; i < num_callbacks; i++) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 236 | rtn = util_CreateDebugReportCallback(inst, &infos[i], pAllocator, callbacks[i]); |
Ian Elliott | ad6300f | 2016-03-31 10:48:19 -0600 | [diff] [blame] | 237 | if (rtn != VK_SUCCESS) { |
Jon Ashburn | cc407a2 | 2016-04-15 09:25:03 -0600 | [diff] [blame] | 238 | for (uint32_t j = 0; j < i; j++) { |
| 239 | util_DestroyDebugReportCallback(inst, callbacks[j], pAllocator); |
Ian Elliott | ad6300f | 2016-03-31 10:48:19 -0600 | [diff] [blame] | 240 | } |
| 241 | return rtn; |
| 242 | } |
| 243 | } |
| 244 | return rtn; |
| 245 | } |
| 246 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 247 | void util_DestroyDebugReportCallbacks(struct loader_instance *inst, const VkAllocationCallbacks *pAllocator, uint32_t num_callbacks, |
Jon Ashburn | cc407a2 | 2016-04-15 09:25:03 -0600 | [diff] [blame] | 248 | VkDebugReportCallbackEXT *callbacks) { |
| 249 | for (uint32_t i = 0; i < num_callbacks; i++) { |
| 250 | util_DestroyDebugReportCallback(inst, callbacks[i], pAllocator); |
Ian Elliott | ad6300f | 2016-03-31 10:48:19 -0600 | [diff] [blame] | 251 | } |
| 252 | } |
| 253 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 254 | static VKAPI_ATTR void VKAPI_CALL debug_report_DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, |
| 255 | const VkAllocationCallbacks *pAllocator) { |
Jon Ashburn | e0e6457 | 2015-09-30 12:56:42 -0600 | [diff] [blame] | 256 | struct loader_instance *inst = loader_get_instance(instance); |
Jon Ashburn | 6301a0f | 2015-05-29 13:15:39 -0600 | [diff] [blame] | 257 | loader_platform_thread_lock_mutex(&loader_lock); |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 258 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 259 | inst->disp->layer_inst_disp.DestroyDebugReportCallbackEXT(instance, callback, pAllocator); |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 260 | |
Courtney Goeltzenleuchter | 8288727 | 2015-12-02 15:29:33 -0700 | [diff] [blame] | 261 | util_DestroyDebugReportCallback(inst, callback, pAllocator); |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 262 | |
Jon Ashburn | 6301a0f | 2015-05-29 13:15:39 -0600 | [diff] [blame] | 263 | loader_platform_thread_unlock_mutex(&loader_lock); |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 264 | } |
| 265 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 266 | static VKAPI_ATTR void VKAPI_CALL debug_report_DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, |
| 267 | VkDebugReportObjectTypeEXT objType, uint64_t object, |
| 268 | size_t location, int32_t msgCode, const char *pLayerPrefix, |
| 269 | const char *pMsg) { |
Courtney Goeltzenleuchter | 822e8d7 | 2015-11-30 15:28:25 -0700 | [diff] [blame] | 270 | struct loader_instance *inst = loader_get_instance(instance); |
| 271 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 272 | inst->disp->layer_inst_disp.DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); |
Courtney Goeltzenleuchter | 822e8d7 | 2015-11-30 15:28:25 -0700 | [diff] [blame] | 273 | } |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 274 | |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 275 | // This is the instance chain terminator function |
| 276 | // for CreateDebugReportCallback |
| 277 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallbackEXT(VkInstance instance, |
| 278 | const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, |
| 279 | const VkAllocationCallbacks *pAllocator, |
| 280 | VkDebugReportCallbackEXT *pCallback) { |
Mark Young | 9b0636f | 2016-10-13 10:51:14 -0600 | [diff] [blame] | 281 | VkDebugReportCallbackEXT *icd_info = NULL; |
Mark Young | 0153e0b | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 282 | const struct loader_icd_term *icd_term; |
Jon Ashburn | 23d36b1 | 2016-02-02 17:47:28 -0700 | [diff] [blame] | 283 | struct loader_instance *inst = (struct loader_instance *)instance; |
Karl Schultz | 2558bd3 | 2016-02-24 14:39:39 -0700 | [diff] [blame] | 284 | VkResult res = VK_SUCCESS; |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 285 | uint32_t storage_idx; |
Mark Young | 7e4da97 | 2016-08-25 14:54:58 -0600 | [diff] [blame] | 286 | VkLayerDbgFunctionNode *pNewDbgFuncNode = NULL; |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 287 | |
Mark Young | 0ad8313 | 2016-06-30 13:02:42 -0600 | [diff] [blame] | 288 | #if (DEBUG_DISABLE_APP_ALLOCATORS == 1) |
| 289 | { |
| 290 | #else |
| 291 | if (pAllocator != NULL) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 292 | icd_info = ((VkDebugReportCallbackEXT *)pAllocator->pfnAllocation(pAllocator->pUserData, |
| 293 | inst->total_icd_count * sizeof(VkDebugReportCallbackEXT), |
| 294 | sizeof(void *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); |
Karl Schultz | e2ef9e6 | 2017-01-13 14:01:35 -0700 | [diff] [blame] | 295 | if (icd_info) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 296 | memset(icd_info, 0, inst->total_icd_count * sizeof(VkDebugReportCallbackEXT)); |
Karl Schultz | e2ef9e6 | 2017-01-13 14:01:35 -0700 | [diff] [blame] | 297 | } |
Mark Young | 0ad8313 | 2016-06-30 13:02:42 -0600 | [diff] [blame] | 298 | } else { |
| 299 | #endif |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 300 | icd_info = calloc(sizeof(VkDebugReportCallbackEXT), inst->total_icd_count); |
Mark Young | 0ad8313 | 2016-06-30 13:02:42 -0600 | [diff] [blame] | 301 | } |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 302 | if (!icd_info) { |
Mark Young | 9b0636f | 2016-10-13 10:51:14 -0600 | [diff] [blame] | 303 | res = VK_ERROR_OUT_OF_HOST_MEMORY; |
| 304 | goto out; |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | storage_idx = 0; |
Mark Young | 0153e0b | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 308 | for (icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 309 | if (!icd_term->dispatch.CreateDebugReportCallbackEXT) { |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 310 | continue; |
| 311 | } |
| 312 | |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 313 | res = icd_term->dispatch.CreateDebugReportCallbackEXT(icd_term->instance, pCreateInfo, pAllocator, &icd_info[storage_idx]); |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 314 | |
| 315 | if (res != VK_SUCCESS) { |
Mark Young | 9b0636f | 2016-10-13 10:51:14 -0600 | [diff] [blame] | 316 | goto out; |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 317 | } |
| 318 | storage_idx++; |
| 319 | } |
| 320 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 321 | // Setup the debug report callback in the terminator since a layer may want |
| 322 | // to grab the information itself (RenderDoc) and then return back to the |
| 323 | // user callback a sub-set of the messages. |
Mark Young | 7e4da97 | 2016-08-25 14:54:58 -0600 | [diff] [blame] | 324 | #if (DEBUG_DISABLE_APP_ALLOCATORS == 0) |
| 325 | if (pAllocator != NULL) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 326 | pNewDbgFuncNode = (VkLayerDbgFunctionNode *)pAllocator->pfnAllocation(pAllocator->pUserData, sizeof(VkLayerDbgFunctionNode), |
| 327 | sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); |
Mark Young | 7e4da97 | 2016-08-25 14:54:58 -0600 | [diff] [blame] | 328 | } else { |
| 329 | #else |
| 330 | { |
| 331 | #endif |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 332 | pNewDbgFuncNode = (VkLayerDbgFunctionNode *)loader_instance_heap_alloc(inst, sizeof(VkLayerDbgFunctionNode), |
| 333 | VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); |
Mark Young | 7e4da97 | 2016-08-25 14:54:58 -0600 | [diff] [blame] | 334 | } |
| 335 | if (!pNewDbgFuncNode) { |
Mark Young | 9b0636f | 2016-10-13 10:51:14 -0600 | [diff] [blame] | 336 | res = VK_ERROR_OUT_OF_HOST_MEMORY; |
| 337 | goto out; |
Mark Young | 7e4da97 | 2016-08-25 14:54:58 -0600 | [diff] [blame] | 338 | } |
| 339 | memset(pNewDbgFuncNode, 0, sizeof(VkLayerDbgFunctionNode)); |
| 340 | |
Mark Young | 7e4da97 | 2016-08-25 14:54:58 -0600 | [diff] [blame] | 341 | pNewDbgFuncNode->pfnMsgCallback = pCreateInfo->pfnCallback; |
| 342 | pNewDbgFuncNode->msgFlags = pCreateInfo->flags; |
| 343 | pNewDbgFuncNode->pUserData = pCreateInfo->pUserData; |
| 344 | pNewDbgFuncNode->pNext = inst->DbgFunctionHead; |
| 345 | inst->DbgFunctionHead = pNewDbgFuncNode; |
| 346 | |
Mark Young | 9b0636f | 2016-10-13 10:51:14 -0600 | [diff] [blame] | 347 | *(VkDebugReportCallbackEXT **)pCallback = icd_info; |
| 348 | pNewDbgFuncNode->msgCallback = *pCallback; |
| 349 | |
| 350 | out: |
| 351 | |
| 352 | // Roll back on errors |
Mark Young | d82497d | 2016-10-14 14:18:56 -0600 | [diff] [blame] | 353 | if (VK_SUCCESS != res) { |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 354 | storage_idx = 0; |
Mark Young | 0153e0b | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 355 | for (icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 356 | if (NULL == icd_term->dispatch.DestroyDebugReportCallbackEXT) { |
Mark Young | a26d47c | 2016-05-04 16:44:10 -0600 | [diff] [blame] | 357 | continue; |
| 358 | } |
| 359 | |
Karl Schultz | e2ef9e6 | 2017-01-13 14:01:35 -0700 | [diff] [blame] | 360 | if (icd_info && icd_info[storage_idx]) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 361 | icd_term->dispatch.DestroyDebugReportCallbackEXT(icd_term->instance, icd_info[storage_idx], pAllocator); |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 362 | } |
| 363 | storage_idx++; |
| 364 | } |
| 365 | |
Mark Young | 9b0636f | 2016-10-13 10:51:14 -0600 | [diff] [blame] | 366 | #if (DEBUG_DISABLE_APP_ALLOCATORS == 1) |
| 367 | { |
| 368 | #else |
| 369 | if (pAllocator != NULL) { |
| 370 | if (NULL != pNewDbgFuncNode) { |
| 371 | pAllocator->pfnFree(pAllocator->pUserData, pNewDbgFuncNode); |
| 372 | } |
| 373 | if (NULL != icd_info) { |
| 374 | pAllocator->pfnFree(pAllocator->pUserData, icd_info); |
| 375 | } |
| 376 | } else { |
| 377 | #endif |
| 378 | if (NULL != pNewDbgFuncNode) { |
| 379 | free(pNewDbgFuncNode); |
| 380 | } |
| 381 | if (NULL != icd_info) { |
| 382 | free(icd_info); |
| 383 | } |
| 384 | } |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 385 | } |
| 386 | |
Mark Young | d82497d | 2016-10-14 14:18:56 -0600 | [diff] [blame] | 387 | return res; |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 388 | } |
| 389 | |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 390 | // This is the instance chain terminator function for DestroyDebugReportCallback |
| 391 | VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, |
| 392 | const VkAllocationCallbacks *pAllocator) { |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 393 | uint32_t storage_idx; |
Courtney Goeltzenleuchter | 7415d5a | 2015-12-09 15:48:16 -0700 | [diff] [blame] | 394 | VkDebugReportCallbackEXT *icd_info; |
Mark Young | 0153e0b | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 395 | const struct loader_icd_term *icd_term; |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 396 | |
Jon Ashburn | 23d36b1 | 2016-02-02 17:47:28 -0700 | [diff] [blame] | 397 | struct loader_instance *inst = (struct loader_instance *)instance; |
| 398 | icd_info = *(VkDebugReportCallbackEXT **)&callback; |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 399 | storage_idx = 0; |
Mark Young | 0153e0b | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 400 | for (icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 401 | if (NULL == icd_term->dispatch.DestroyDebugReportCallbackEXT) { |
Mark Young | a26d47c | 2016-05-04 16:44:10 -0600 | [diff] [blame] | 402 | continue; |
| 403 | } |
| 404 | |
Chia-I Wu | e2fc552 | 2015-10-26 20:04:44 +0800 | [diff] [blame] | 405 | if (icd_info[storage_idx]) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 406 | icd_term->dispatch.DestroyDebugReportCallbackEXT(icd_term->instance, icd_info[storage_idx], pAllocator); |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 407 | } |
| 408 | storage_idx++; |
| 409 | } |
Mark Young | 0fea692 | 2016-11-21 16:20:06 -0700 | [diff] [blame] | 410 | |
| 411 | #if (DEBUG_DISABLE_APP_ALLOCATORS == 1) |
| 412 | { |
| 413 | #else |
| 414 | if (pAllocator != NULL) { |
| 415 | pAllocator->pfnFree(pAllocator->pUserData, icd_info); |
| 416 | } else { |
| 417 | #endif |
| 418 | free(icd_info); |
| 419 | } |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 420 | } |
| 421 | |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 422 | // This is the instance chain terminator function for DebugReportMessage |
| 423 | VKAPI_ATTR void VKAPI_CALL terminator_DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, |
| 424 | VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, |
| 425 | int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { |
Mark Young | 0153e0b | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 426 | const struct loader_icd_term *icd_term; |
Courtney Goeltzenleuchter | 8288727 | 2015-12-02 15:29:33 -0700 | [diff] [blame] | 427 | |
Jon Ashburn | 23d36b1 | 2016-02-02 17:47:28 -0700 | [diff] [blame] | 428 | struct loader_instance *inst = (struct loader_instance *)instance; |
Courtney Goeltzenleuchter | 822e8d7 | 2015-11-30 15:28:25 -0700 | [diff] [blame] | 429 | |
Courtney Goeltzenleuchter | 8288727 | 2015-12-02 15:29:33 -0700 | [diff] [blame] | 430 | loader_platform_thread_lock_mutex(&loader_lock); |
Mark Young | 0153e0b | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 431 | for (icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 432 | if (icd_term->dispatch.DebugReportMessageEXT != NULL) { |
| 433 | icd_term->dispatch.DebugReportMessageEXT(icd_term->instance, flags, objType, object, location, msgCode, pLayerPrefix, |
| 434 | pMsg); |
Courtney Goeltzenleuchter | 822e8d7 | 2015-11-30 15:28:25 -0700 | [diff] [blame] | 435 | } |
| 436 | } |
| 437 | |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 438 | // Now that all ICDs have seen the message, call the necessary callbacks. Ignoring "bail" return value |
| 439 | // as there is nothing to bail from at this point. |
Courtney Goeltzenleuchter | 8288727 | 2015-12-02 15:29:33 -0700 | [diff] [blame] | 440 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 441 | util_DebugReportMessage(inst, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); |
Courtney Goeltzenleuchter | 8288727 | 2015-12-02 15:29:33 -0700 | [diff] [blame] | 442 | |
| 443 | loader_platform_thread_unlock_mutex(&loader_lock); |
Courtney Goeltzenleuchter | 822e8d7 | 2015-11-30 15:28:25 -0700 | [diff] [blame] | 444 | } |
| 445 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 446 | bool debug_report_instance_gpa(struct loader_instance *ptr_instance, const char *name, void **addr) { |
Jon Ashburn | 8a39efc | 2015-11-06 11:02:40 -0700 | [diff] [blame] | 447 | // debug_report is currently advertised to be supported by the loader, |
| 448 | // so always return the entry points if name matches and it's enabled |
Jon Ashburn | f7a48db | 2015-10-01 12:03:17 -0600 | [diff] [blame] | 449 | *addr = NULL; |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 450 | |
Courtney Goeltzenleuchter | 7415d5a | 2015-12-09 15:48:16 -0700 | [diff] [blame] | 451 | if (!strcmp("vkCreateDebugReportCallbackEXT", name)) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 452 | *addr = (ptr_instance->enabled_known_extensions.ext_debug_report == 1) ? (void *)debug_report_CreateDebugReportCallbackEXT |
| 453 | : NULL; |
Jon Ashburn | f7a48db | 2015-10-01 12:03:17 -0600 | [diff] [blame] | 454 | return true; |
| 455 | } |
Courtney Goeltzenleuchter | 7415d5a | 2015-12-09 15:48:16 -0700 | [diff] [blame] | 456 | if (!strcmp("vkDestroyDebugReportCallbackEXT", name)) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 457 | *addr = (ptr_instance->enabled_known_extensions.ext_debug_report == 1) ? (void *)debug_report_DestroyDebugReportCallbackEXT |
| 458 | : NULL; |
Jon Ashburn | f7a48db | 2015-10-01 12:03:17 -0600 | [diff] [blame] | 459 | return true; |
| 460 | } |
Courtney Goeltzenleuchter | 7415d5a | 2015-12-09 15:48:16 -0700 | [diff] [blame] | 461 | if (!strcmp("vkDebugReportMessageEXT", name)) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 462 | *addr = (ptr_instance->enabled_known_extensions.ext_debug_report == 1) ? (void *)debug_report_DebugReportMessageEXT : NULL; |
Courtney Goeltzenleuchter | 822e8d7 | 2015-11-30 15:28:25 -0700 | [diff] [blame] | 463 | return true; |
| 464 | } |
Jon Ashburn | f7a48db | 2015-10-01 12:03:17 -0600 | [diff] [blame] | 465 | return false; |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 466 | } |