/src/vulkan-loader/loader/debug_utils.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2015-2021 The Khronos Group Inc. |
3 | | * Copyright (c) 2015-2021 Valve Corporation |
4 | | * Copyright (c) 2015-2021 LunarG, Inc. |
5 | | * Copyright (C) 2015-2016 Google Inc. |
6 | | * |
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 |
10 | | * |
11 | | * http://www.apache.org/licenses/LICENSE-2.0 |
12 | | * |
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. |
18 | | * |
19 | | * Author: Courtney Goeltzenleuchter <courtney@LunarG.com> |
20 | | * Author: Jon Ashburn <jon@LunarG.com> |
21 | | * Author: Mark Young <marky@lunarg.com> |
22 | | * Author: Charles Giessen <charles@lunarg.com> |
23 | | * |
24 | | */ |
25 | | |
26 | | #include <inttypes.h> |
27 | | #include <stdio.h> |
28 | | #include <stdlib.h> |
29 | | #include <string.h> |
30 | | |
31 | | #include "vk_object_types.h" |
32 | | |
33 | | #include "allocation.h" |
34 | | #include "debug_utils.h" |
35 | | #include "log.h" |
36 | | #include "loader.h" |
37 | | #include "vk_loader_platform.h" |
38 | | |
39 | | // VK_EXT_debug_report related items |
40 | | |
41 | | VkResult util_CreateDebugUtilsMessenger(struct loader_instance *inst, const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo, |
42 | 0 | const VkAllocationCallbacks *pAllocator, VkDebugUtilsMessengerEXT messenger) { |
43 | 0 | VkLayerDbgFunctionNode *new_dbg_function_node = NULL; |
44 | |
|
45 | 0 | new_dbg_function_node = (VkLayerDbgFunctionNode *)loader_calloc_with_instance_fallback( |
46 | 0 | pAllocator, inst, sizeof(VkLayerDbgFunctionNode), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); |
47 | |
|
48 | 0 | if (!new_dbg_function_node) { |
49 | 0 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
50 | 0 | } |
51 | | |
52 | 0 | new_dbg_function_node->is_messenger = true; |
53 | 0 | new_dbg_function_node->messenger.messenger = messenger; |
54 | 0 | new_dbg_function_node->messenger.pfnUserCallback = pCreateInfo->pfnUserCallback; |
55 | 0 | new_dbg_function_node->messenger.messageSeverity = pCreateInfo->messageSeverity; |
56 | 0 | new_dbg_function_node->messenger.messageType = pCreateInfo->messageType; |
57 | 0 | new_dbg_function_node->pUserData = pCreateInfo->pUserData; |
58 | 0 | new_dbg_function_node->pNext = inst->instance_only_dbg_function_head; |
59 | 0 | inst->instance_only_dbg_function_head = new_dbg_function_node; |
60 | 0 | inst->current_dbg_function_head = inst->instance_only_dbg_function_head; |
61 | |
|
62 | 0 | return VK_SUCCESS; |
63 | 0 | } |
64 | | |
65 | | VKAPI_ATTR VkResult VKAPI_CALL debug_utils_CreateDebugUtilsMessengerEXT(VkInstance instance, |
66 | | const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo, |
67 | | const VkAllocationCallbacks *pAllocator, |
68 | 0 | VkDebugUtilsMessengerEXT *pMessenger) { |
69 | 0 | struct loader_instance *inst = loader_get_instance(instance); |
70 | 0 | loader_platform_thread_lock_mutex(&loader_lock); |
71 | 0 | VkResult result = inst->disp->layer_inst_disp.CreateDebugUtilsMessengerEXT(inst->instance, pCreateInfo, pAllocator, pMessenger); |
72 | 0 | loader_platform_thread_unlock_mutex(&loader_lock); |
73 | 0 | return result; |
74 | 0 | } |
75 | | |
76 | | VkBool32 util_SubmitDebugUtilsMessageEXT(const struct loader_instance *inst, VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, |
77 | | VkDebugUtilsMessageTypeFlagsEXT messageTypes, |
78 | 1.52M | const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData) { |
79 | 1.52M | VkBool32 bail = false; |
80 | | |
81 | 1.52M | if (NULL != pCallbackData) { |
82 | 1.52M | VkLayerDbgFunctionNode *pTrav = inst->current_dbg_function_head; |
83 | 1.52M | VkDebugReportObjectTypeEXT object_type = VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT; |
84 | 1.52M | VkDebugReportFlagsEXT object_flags = 0; |
85 | 1.52M | uint64_t object_handle = 0; |
86 | | |
87 | 1.52M | debug_utils_AnnotFlagsToReportFlags(messageSeverity, messageTypes, &object_flags); |
88 | 1.52M | if (0 < pCallbackData->objectCount) { |
89 | 1.52M | debug_utils_AnnotObjectToDebugReportObject(pCallbackData->pObjects, &object_type, &object_handle); |
90 | 1.52M | } |
91 | 1.52M | while (pTrav) { |
92 | 0 | if (pTrav->is_messenger && (pTrav->messenger.messageSeverity & messageSeverity) && |
93 | 0 | (pTrav->messenger.messageType & messageTypes)) { |
94 | 0 | if (pTrav->messenger.pfnUserCallback(messageSeverity, messageTypes, pCallbackData, pTrav->pUserData)) { |
95 | 0 | bail = true; |
96 | 0 | } |
97 | 0 | } |
98 | 0 | if (!pTrav->is_messenger && pTrav->report.msgFlags & object_flags) { |
99 | 0 | if (pTrav->report.pfnMsgCallback(object_flags, object_type, object_handle, 0, pCallbackData->messageIdNumber, |
100 | 0 | pCallbackData->pMessageIdName, pCallbackData->pMessage, pTrav->pUserData)) { |
101 | 0 | bail = true; |
102 | 0 | } |
103 | 0 | } |
104 | 0 | pTrav = pTrav->pNext; |
105 | 0 | } |
106 | 1.52M | } |
107 | | |
108 | 1.52M | return bail; |
109 | 1.52M | } |
110 | | |
111 | | void util_DestroyDebugUtilsMessenger(struct loader_instance *inst, VkDebugUtilsMessengerEXT messenger, |
112 | 0 | const VkAllocationCallbacks *pAllocator) { |
113 | 0 | VkLayerDbgFunctionNode *pTrav = inst->current_dbg_function_head; |
114 | 0 | VkLayerDbgFunctionNode *pPrev = pTrav; |
115 | |
|
116 | 0 | while (pTrav) { |
117 | 0 | if (pTrav->is_messenger && pTrav->messenger.messenger == messenger) { |
118 | 0 | pPrev->pNext = pTrav->pNext; |
119 | 0 | if (inst->current_dbg_function_head == pTrav) inst->current_dbg_function_head = pTrav->pNext; |
120 | 0 | if (inst->instance_only_dbg_function_head == pTrav) inst->instance_only_dbg_function_head = pTrav->pNext; |
121 | 0 | loader_free_with_instance_fallback(pAllocator, inst, pTrav); |
122 | 0 | break; |
123 | 0 | } |
124 | 0 | pPrev = pTrav; |
125 | 0 | pTrav = pTrav->pNext; |
126 | 0 | } |
127 | 0 | } |
128 | | |
129 | | VkResult util_CreateDebugUtilsMessengers(struct loader_instance *inst, const void *pChain, |
130 | 8.10k | const VkAllocationCallbacks *pAllocator) { |
131 | 8.10k | const void *pNext = pChain; |
132 | 8.10k | while (pNext) { |
133 | 0 | VkBaseInStructure in_structure = {0}; |
134 | 0 | memcpy(&in_structure, pNext, sizeof(VkBaseInStructure)); |
135 | 0 | if (in_structure.sType == VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT) { |
136 | | // Assign a unique handle to each messenger (just use the address of the VkDebugUtilsMessengerCreateInfoEXT) |
137 | | // This is only being used this way due to it being for an 'anonymous' callback during instance creation |
138 | 0 | VkDebugUtilsMessengerEXT messenger_handle = (VkDebugUtilsMessengerEXT)(uintptr_t)pNext; |
139 | 0 | VkResult ret = util_CreateDebugUtilsMessenger(inst, (const VkDebugUtilsMessengerCreateInfoEXT *)pNext, pAllocator, |
140 | 0 | messenger_handle); |
141 | 0 | if (ret != VK_SUCCESS) { |
142 | 0 | return ret; |
143 | 0 | } |
144 | 0 | } |
145 | 0 | pNext = in_structure.pNext; |
146 | 0 | } |
147 | 8.10k | return VK_SUCCESS; |
148 | 8.10k | } |
149 | | |
150 | | VKAPI_ATTR void VKAPI_CALL debug_utils_SubmitDebugUtilsMessageEXT(VkInstance instance, |
151 | | VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, |
152 | | VkDebugUtilsMessageTypeFlagsEXT messageTypes, |
153 | 0 | const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData) { |
154 | 0 | struct loader_instance *inst = loader_get_instance(instance); |
155 | |
|
156 | 0 | inst->disp->layer_inst_disp.SubmitDebugUtilsMessageEXT(inst->instance, messageSeverity, messageTypes, pCallbackData); |
157 | 0 | } |
158 | | |
159 | | VKAPI_ATTR void VKAPI_CALL debug_utils_DestroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT messenger, |
160 | 0 | const VkAllocationCallbacks *pAllocator) { |
161 | 0 | struct loader_instance *inst = loader_get_instance(instance); |
162 | 0 | loader_platform_thread_lock_mutex(&loader_lock); |
163 | |
|
164 | 0 | inst->disp->layer_inst_disp.DestroyDebugUtilsMessengerEXT(inst->instance, messenger, pAllocator); |
165 | |
|
166 | 0 | loader_platform_thread_unlock_mutex(&loader_lock); |
167 | 0 | } |
168 | | |
169 | | // This is the instance chain terminator function for CreateDebugUtilsMessenger |
170 | | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugUtilsMessengerEXT(VkInstance instance, |
171 | | const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo, |
172 | | const VkAllocationCallbacks *pAllocator, |
173 | 0 | VkDebugUtilsMessengerEXT *pMessenger) { |
174 | 0 | struct loader_instance *inst = (struct loader_instance *)instance; |
175 | 0 | VkResult res = VK_SUCCESS; |
176 | 0 | VkLayerDbgFunctionNode *new_dbg_func_node = NULL; |
177 | 0 | uint32_t next_index = 0; |
178 | 0 | bool index_reserved = false; |
179 | |
|
180 | 0 | uint32_t *pNextIndex = loader_instance_heap_alloc(inst, sizeof(uint32_t), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); |
181 | 0 | if (NULL == pNextIndex) { |
182 | 0 | res = VK_ERROR_OUT_OF_HOST_MEMORY; |
183 | 0 | goto out; |
184 | 0 | } |
185 | | |
186 | 0 | res = loader_get_next_available_entry(inst, &inst->debug_utils_messengers_list, &next_index, pAllocator); |
187 | 0 | if (res != VK_SUCCESS) { |
188 | 0 | goto out; |
189 | 0 | } |
190 | 0 | index_reserved = true; |
191 | |
|
192 | 0 | for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term != NULL; icd_term = icd_term->next) { |
193 | 0 | if (icd_term->debug_utils_messenger_list.list == NULL) { |
194 | 0 | res = loader_init_generic_list(inst, (struct loader_generic_list *)&icd_term->debug_utils_messenger_list, |
195 | 0 | sizeof(VkDebugUtilsMessengerEXT)); |
196 | 0 | if (res != VK_SUCCESS) { |
197 | 0 | goto out; |
198 | 0 | } |
199 | 0 | } else if (icd_term->debug_utils_messenger_list.capacity <= next_index * sizeof(VkDebugUtilsMessengerEXT)) { |
200 | 0 | res = loader_resize_generic_list(inst, (struct loader_generic_list *)&icd_term->debug_utils_messenger_list); |
201 | 0 | if (res != VK_SUCCESS) { |
202 | 0 | goto out; |
203 | 0 | } |
204 | 0 | } |
205 | | |
206 | 0 | if (icd_term->dispatch.CreateDebugUtilsMessengerEXT) { |
207 | 0 | res = icd_term->dispatch.CreateDebugUtilsMessengerEXT(icd_term->instance, pCreateInfo, pAllocator, |
208 | 0 | &icd_term->debug_utils_messenger_list.list[next_index]); |
209 | |
|
210 | 0 | if (res != VK_SUCCESS) { |
211 | 0 | goto out; |
212 | 0 | } |
213 | 0 | } |
214 | 0 | } |
215 | | |
216 | | // Setup the debug report callback in the terminator since a layer may want |
217 | | // to grab the information itself (RenderDoc) and then return back to the |
218 | | // user callback a sub-set of the messages. |
219 | 0 | new_dbg_func_node = (VkLayerDbgFunctionNode *)loader_calloc_with_instance_fallback( |
220 | 0 | pAllocator, inst, sizeof(VkLayerDbgFunctionNode), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); |
221 | 0 | if (!new_dbg_func_node) { |
222 | 0 | res = VK_ERROR_OUT_OF_HOST_MEMORY; |
223 | 0 | goto out; |
224 | 0 | } |
225 | | |
226 | 0 | new_dbg_func_node->is_messenger = true; |
227 | 0 | new_dbg_func_node->messenger.pfnUserCallback = pCreateInfo->pfnUserCallback; |
228 | 0 | new_dbg_func_node->messenger.messageSeverity = pCreateInfo->messageSeverity; |
229 | 0 | new_dbg_func_node->messenger.messageType = pCreateInfo->messageType; |
230 | 0 | new_dbg_func_node->pUserData = pCreateInfo->pUserData; |
231 | 0 | new_dbg_func_node->pNext = inst->current_dbg_function_head; |
232 | 0 | inst->current_dbg_function_head = new_dbg_func_node; |
233 | 0 | *pNextIndex = next_index; |
234 | 0 | *pMessenger = (VkDebugUtilsMessengerEXT)(uintptr_t)pNextIndex; |
235 | 0 | new_dbg_func_node->messenger.messenger = *pMessenger; |
236 | |
|
237 | 0 | out: |
238 | | |
239 | | // Roll back on errors |
240 | 0 | if (VK_SUCCESS != res) { |
241 | 0 | if (index_reserved) { |
242 | 0 | for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) { |
243 | 0 | if (icd_term->debug_utils_messenger_list.list && |
244 | 0 | icd_term->debug_utils_messenger_list.capacity > next_index * sizeof(VkDebugUtilsMessengerEXT) && |
245 | 0 | icd_term->debug_utils_messenger_list.list[next_index] && |
246 | 0 | NULL != icd_term->dispatch.DestroyDebugUtilsMessengerEXT) { |
247 | 0 | icd_term->dispatch.DestroyDebugUtilsMessengerEXT( |
248 | 0 | icd_term->instance, icd_term->debug_utils_messenger_list.list[next_index], pAllocator); |
249 | 0 | } |
250 | 0 | } |
251 | 0 | } |
252 | 0 | if (index_reserved && inst->debug_utils_messengers_list.list && |
253 | 0 | inst->debug_utils_messengers_list.capacity > next_index * sizeof(struct loader_used_object_status)) { |
254 | 0 | inst->debug_utils_messengers_list.list[next_index].status = VK_FALSE; |
255 | 0 | if (NULL != pAllocator) { |
256 | 0 | inst->debug_utils_messengers_list.list[next_index].allocation_callbacks = *pAllocator; |
257 | 0 | } |
258 | 0 | } |
259 | 0 | loader_free_with_instance_fallback(pAllocator, inst, new_dbg_func_node); |
260 | 0 | loader_free_with_instance_fallback(pAllocator, inst, pNextIndex); |
261 | 0 | } |
262 | |
|
263 | 0 | return res; |
264 | 0 | } |
265 | | |
266 | | // This is the instance chain terminator function for DestroyDebugUtilsMessenger |
267 | | VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT messenger, |
268 | 0 | const VkAllocationCallbacks *pAllocator) { |
269 | 0 | struct loader_instance *inst = (struct loader_instance *)instance; |
270 | 0 | uint32_t *debug_messenger_index = (uint32_t *)(uintptr_t)messenger; |
271 | | // Make sure that messenger actually points to anything |
272 | 0 | if (NULL == debug_messenger_index) { |
273 | 0 | return; |
274 | 0 | } |
275 | | |
276 | 0 | for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) { |
277 | 0 | if (icd_term->debug_utils_messenger_list.list && |
278 | 0 | icd_term->debug_utils_messenger_list.capacity > *debug_messenger_index * sizeof(VkDebugUtilsMessengerEXT) && |
279 | 0 | icd_term->debug_utils_messenger_list.list[*debug_messenger_index] && |
280 | 0 | NULL != icd_term->dispatch.DestroyDebugUtilsMessengerEXT) { |
281 | 0 | icd_term->dispatch.DestroyDebugUtilsMessengerEXT( |
282 | 0 | icd_term->instance, icd_term->debug_utils_messenger_list.list[*debug_messenger_index], pAllocator); |
283 | 0 | } |
284 | 0 | } |
285 | |
|
286 | 0 | util_DestroyDebugUtilsMessenger(inst, messenger, pAllocator); |
287 | 0 | if (inst->debug_utils_messengers_list.list && |
288 | 0 | inst->debug_utils_messengers_list.capacity > (*debug_messenger_index) * sizeof(struct loader_used_object_status)) { |
289 | 0 | inst->debug_utils_messengers_list.list[*debug_messenger_index].status = VK_FALSE; |
290 | 0 | if (NULL != pAllocator) { |
291 | 0 | inst->debug_utils_messengers_list.list[*debug_messenger_index].allocation_callbacks = *pAllocator; |
292 | 0 | } |
293 | 0 | } |
294 | |
|
295 | 0 | loader_free_with_instance_fallback(pAllocator, inst, debug_messenger_index); |
296 | 0 | } |
297 | | |
298 | | // This is the instance chain terminator function for SubmitDebugUtilsMessageEXT |
299 | | VKAPI_ATTR void VKAPI_CALL terminator_SubmitDebugUtilsMessageEXT(VkInstance instance, |
300 | | VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, |
301 | | VkDebugUtilsMessageTypeFlagsEXT messageTypes, |
302 | 0 | const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData) { |
303 | 0 | loader_platform_thread_lock_mutex(&loader_lock); |
304 | | // NOTE: Just make the callback ourselves because there could be one or more ICDs that support this extension |
305 | | // and each one will trigger the callback to the user. This would result in multiple callback triggers |
306 | | // per message. Instead, if we get a messaged up to here, then just trigger the message ourselves and |
307 | | // return. This would still allow the ICDs to trigger their own messages, but won't get any external ones. |
308 | 0 | struct loader_instance *inst = (struct loader_instance *)instance; |
309 | 0 | util_SubmitDebugUtilsMessageEXT(inst, messageSeverity, messageTypes, pCallbackData); |
310 | 0 | loader_platform_thread_unlock_mutex(&loader_lock); |
311 | 0 | } |
312 | | |
313 | | // VK_EXT_debug_report related items |
314 | | |
315 | | VkResult util_CreateDebugReportCallback(struct loader_instance *inst, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, |
316 | 0 | const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT callback) { |
317 | 0 | VkLayerDbgFunctionNode *new_dbg_func_node = NULL; |
318 | |
|
319 | 0 | new_dbg_func_node = (VkLayerDbgFunctionNode *)loader_calloc_with_instance_fallback( |
320 | 0 | pAllocator, inst, sizeof(VkLayerDbgFunctionNode), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); |
321 | 0 | if (!new_dbg_func_node) { |
322 | 0 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
323 | 0 | } |
324 | | |
325 | 0 | new_dbg_func_node->is_messenger = false; |
326 | 0 | new_dbg_func_node->report.msgCallback = callback; |
327 | 0 | new_dbg_func_node->report.pfnMsgCallback = pCreateInfo->pfnCallback; |
328 | 0 | new_dbg_func_node->report.msgFlags = pCreateInfo->flags; |
329 | 0 | new_dbg_func_node->pUserData = pCreateInfo->pUserData; |
330 | 0 | new_dbg_func_node->pNext = inst->instance_only_dbg_function_head; |
331 | 0 | inst->instance_only_dbg_function_head = new_dbg_func_node; |
332 | 0 | inst->current_dbg_function_head = inst->instance_only_dbg_function_head; |
333 | |
|
334 | 0 | return VK_SUCCESS; |
335 | 0 | } |
336 | | |
337 | | VKAPI_ATTR VkResult VKAPI_CALL debug_utils_CreateDebugReportCallbackEXT(VkInstance instance, |
338 | | const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, |
339 | | const VkAllocationCallbacks *pAllocator, |
340 | 0 | VkDebugReportCallbackEXT *pCallback) { |
341 | 0 | struct loader_instance *inst = loader_get_instance(instance); |
342 | 0 | loader_platform_thread_lock_mutex(&loader_lock); |
343 | 0 | VkResult result = inst->disp->layer_inst_disp.CreateDebugReportCallbackEXT(inst->instance, pCreateInfo, pAllocator, pCallback); |
344 | 0 | loader_platform_thread_unlock_mutex(&loader_lock); |
345 | 0 | return result; |
346 | 0 | } |
347 | | |
348 | | // Utility function to handle reporting |
349 | | VkBool32 util_DebugReportMessage(const struct loader_instance *inst, VkFlags msgFlags, VkDebugReportObjectTypeEXT objectType, |
350 | 0 | uint64_t srcObject, size_t location, int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { |
351 | 0 | VkBool32 bail = false; |
352 | 0 | VkLayerDbgFunctionNode *pTrav = inst->current_dbg_function_head; |
353 | 0 | VkDebugUtilsMessageSeverityFlagBitsEXT severity; |
354 | 0 | VkDebugUtilsMessageTypeFlagsEXT types; |
355 | 0 | VkDebugUtilsMessengerCallbackDataEXT callback_data; |
356 | 0 | VkDebugUtilsObjectNameInfoEXT object_name; |
357 | |
|
358 | 0 | debug_utils_ReportFlagsToAnnotFlags(msgFlags, false, &severity, &types); |
359 | 0 | debug_utils_ReportObjectToAnnotObject(objectType, srcObject, &object_name); |
360 | |
|
361 | 0 | callback_data.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_EXT; |
362 | 0 | callback_data.pNext = NULL; |
363 | 0 | callback_data.flags = 0; |
364 | 0 | callback_data.pMessageIdName = pLayerPrefix; |
365 | 0 | callback_data.messageIdNumber = msgCode; |
366 | 0 | callback_data.pMessage = pMsg; |
367 | 0 | callback_data.cmdBufLabelCount = 0; |
368 | 0 | callback_data.pCmdBufLabels = NULL; |
369 | 0 | callback_data.queueLabelCount = 0; |
370 | 0 | callback_data.pQueueLabels = NULL; |
371 | 0 | callback_data.objectCount = 1; |
372 | 0 | callback_data.pObjects = &object_name; |
373 | |
|
374 | 0 | while (pTrav) { |
375 | 0 | if (!pTrav->is_messenger && pTrav->report.msgFlags & msgFlags) { |
376 | 0 | if (pTrav->report.pfnMsgCallback(msgFlags, objectType, srcObject, location, msgCode, pLayerPrefix, pMsg, |
377 | 0 | pTrav->pUserData)) { |
378 | 0 | bail = true; |
379 | 0 | } |
380 | 0 | } |
381 | 0 | if (pTrav->is_messenger && (pTrav->messenger.messageSeverity & severity) && (pTrav->messenger.messageType & types)) { |
382 | 0 | if (pTrav->messenger.pfnUserCallback(severity, types, &callback_data, pTrav->pUserData)) { |
383 | 0 | bail = true; |
384 | 0 | } |
385 | 0 | } |
386 | |
|
387 | 0 | pTrav = pTrav->pNext; |
388 | 0 | } |
389 | |
|
390 | 0 | return bail; |
391 | 0 | } |
392 | | |
393 | | void util_DestroyDebugReportCallback(struct loader_instance *inst, VkDebugReportCallbackEXT callback, |
394 | 0 | const VkAllocationCallbacks *pAllocator) { |
395 | 0 | VkLayerDbgFunctionNode *pTrav = inst->current_dbg_function_head; |
396 | 0 | VkLayerDbgFunctionNode *pPrev = pTrav; |
397 | |
|
398 | 0 | while (pTrav) { |
399 | 0 | if (!pTrav->is_messenger && pTrav->report.msgCallback == callback) { |
400 | 0 | pPrev->pNext = pTrav->pNext; |
401 | 0 | if (inst->current_dbg_function_head == pTrav) inst->current_dbg_function_head = pTrav->pNext; |
402 | 0 | if (inst->instance_only_dbg_function_head == pTrav) inst->instance_only_dbg_function_head = pTrav->pNext; |
403 | 0 | if (inst->current_dbg_function_head == pTrav) inst->current_dbg_function_head = pTrav->pNext; |
404 | 0 | loader_free_with_instance_fallback(pAllocator, inst, pTrav); |
405 | 0 | break; |
406 | 0 | } |
407 | 0 | pPrev = pTrav; |
408 | 0 | pTrav = pTrav->pNext; |
409 | 0 | } |
410 | 0 | } |
411 | | |
412 | | VkResult util_CreateDebugReportCallbacks(struct loader_instance *inst, const void *pChain, |
413 | 8.10k | const VkAllocationCallbacks *pAllocator) { |
414 | 8.10k | const void *pNext = pChain; |
415 | 8.10k | while (pNext) { |
416 | 0 | VkBaseInStructure in_structure = {0}; |
417 | 0 | memcpy(&in_structure, pNext, sizeof(VkBaseInStructure)); |
418 | 0 | if (in_structure.sType == VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT) { |
419 | | // Assign a unique handle to each callback (just use the address of the VkDebugReportCallbackCreateInfoEXT): |
420 | | // This is only being used this way due to it being for an 'anonymous' callback during instance creation |
421 | 0 | VkDebugReportCallbackEXT report_handle = (VkDebugReportCallbackEXT)(uintptr_t)pNext; |
422 | 0 | VkResult ret = |
423 | 0 | util_CreateDebugReportCallback(inst, (const VkDebugReportCallbackCreateInfoEXT *)pNext, pAllocator, report_handle); |
424 | 0 | if (ret != VK_SUCCESS) { |
425 | 0 | return ret; |
426 | 0 | } |
427 | 0 | } |
428 | 0 | pNext = in_structure.pNext; |
429 | 0 | } |
430 | 8.10k | return VK_SUCCESS; |
431 | 8.10k | } |
432 | | |
433 | | VKAPI_ATTR void VKAPI_CALL debug_utils_DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, |
434 | 0 | const VkAllocationCallbacks *pAllocator) { |
435 | 0 | struct loader_instance *inst = loader_get_instance(instance); |
436 | 0 | loader_platform_thread_lock_mutex(&loader_lock); |
437 | |
|
438 | 0 | inst->disp->layer_inst_disp.DestroyDebugReportCallbackEXT(inst->instance, callback, pAllocator); |
439 | |
|
440 | 0 | loader_platform_thread_unlock_mutex(&loader_lock); |
441 | 0 | } |
442 | | |
443 | | VKAPI_ATTR void VKAPI_CALL debug_utils_DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, |
444 | | VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, |
445 | 0 | int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { |
446 | 0 | struct loader_instance *inst = loader_get_instance(instance); |
447 | |
|
448 | 0 | inst->disp->layer_inst_disp.DebugReportMessageEXT(inst->instance, flags, objType, object, location, msgCode, pLayerPrefix, |
449 | 0 | pMsg); |
450 | 0 | } |
451 | | |
452 | | // This is the instance chain terminator function |
453 | | // for CreateDebugReportCallback |
454 | | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallbackEXT(VkInstance instance, |
455 | | const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, |
456 | | const VkAllocationCallbacks *pAllocator, |
457 | 0 | VkDebugReportCallbackEXT *pCallback) { |
458 | 0 | struct loader_instance *inst = (struct loader_instance *)instance; |
459 | 0 | VkResult res = VK_SUCCESS; |
460 | 0 | VkLayerDbgFunctionNode *new_dbg_func_node = NULL; |
461 | 0 | uint32_t next_index = 0; |
462 | 0 | bool index_reserved = false; |
463 | |
|
464 | 0 | uint32_t *pNextIndex = loader_instance_heap_alloc(inst, sizeof(uint32_t), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); |
465 | 0 | if (NULL == pNextIndex) { |
466 | 0 | res = VK_ERROR_OUT_OF_HOST_MEMORY; |
467 | 0 | goto out; |
468 | 0 | } |
469 | | |
470 | 0 | res = loader_get_next_available_entry(inst, &inst->debug_report_callbacks_list, &next_index, pAllocator); |
471 | 0 | if (res != VK_SUCCESS) { |
472 | 0 | goto out; |
473 | 0 | } |
474 | 0 | index_reserved = true; |
475 | |
|
476 | 0 | for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term != NULL; icd_term = icd_term->next) { |
477 | 0 | if (icd_term->debug_report_callback_list.list == NULL) { |
478 | 0 | res = loader_init_generic_list(inst, (struct loader_generic_list *)&icd_term->debug_report_callback_list, |
479 | 0 | sizeof(VkDebugUtilsMessengerEXT)); |
480 | 0 | if (res != VK_SUCCESS) { |
481 | 0 | goto out; |
482 | 0 | } |
483 | 0 | } else if (icd_term->debug_report_callback_list.capacity <= next_index * sizeof(VkDebugReportCallbackEXT)) { |
484 | 0 | res = loader_resize_generic_list(inst, (struct loader_generic_list *)&icd_term->debug_report_callback_list); |
485 | 0 | if (res != VK_SUCCESS) { |
486 | 0 | goto out; |
487 | 0 | } |
488 | 0 | } |
489 | | |
490 | 0 | if (icd_term->dispatch.CreateDebugReportCallbackEXT) { |
491 | 0 | res = icd_term->dispatch.CreateDebugReportCallbackEXT(icd_term->instance, pCreateInfo, pAllocator, |
492 | 0 | &icd_term->debug_report_callback_list.list[next_index]); |
493 | |
|
494 | 0 | if (res != VK_SUCCESS) { |
495 | 0 | goto out; |
496 | 0 | } |
497 | 0 | } |
498 | 0 | } |
499 | | |
500 | | // Setup the debug report callback in the terminator since a layer may want |
501 | | // to grab the information itself (RenderDoc) and then return back to the |
502 | | // user callback a sub-set of the messages. |
503 | 0 | new_dbg_func_node = (VkLayerDbgFunctionNode *)loader_calloc_with_instance_fallback( |
504 | 0 | pAllocator, inst, sizeof(VkLayerDbgFunctionNode), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); |
505 | |
|
506 | 0 | if (!new_dbg_func_node) { |
507 | 0 | res = VK_ERROR_OUT_OF_HOST_MEMORY; |
508 | 0 | goto out; |
509 | 0 | } |
510 | | |
511 | 0 | new_dbg_func_node->is_messenger = false; |
512 | 0 | new_dbg_func_node->report.pfnMsgCallback = pCreateInfo->pfnCallback; |
513 | 0 | new_dbg_func_node->report.msgFlags = pCreateInfo->flags; |
514 | 0 | new_dbg_func_node->pUserData = pCreateInfo->pUserData; |
515 | 0 | new_dbg_func_node->pNext = inst->current_dbg_function_head; |
516 | 0 | inst->current_dbg_function_head = new_dbg_func_node; |
517 | 0 | *pNextIndex = next_index; |
518 | 0 | *pCallback = (VkDebugReportCallbackEXT)(uintptr_t)pNextIndex; |
519 | 0 | new_dbg_func_node->report.msgCallback = *pCallback; |
520 | |
|
521 | 0 | out: |
522 | | |
523 | | // Roll back on errors |
524 | 0 | if (VK_SUCCESS != res) { |
525 | 0 | if (index_reserved) { |
526 | 0 | for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) { |
527 | 0 | if (icd_term->debug_report_callback_list.list && |
528 | 0 | icd_term->debug_report_callback_list.capacity > next_index * sizeof(VkDebugReportCallbackEXT) && |
529 | 0 | icd_term->debug_report_callback_list.list[next_index] && |
530 | 0 | NULL != icd_term->dispatch.DestroyDebugReportCallbackEXT) { |
531 | 0 | icd_term->dispatch.DestroyDebugReportCallbackEXT( |
532 | 0 | icd_term->instance, icd_term->debug_report_callback_list.list[next_index], pAllocator); |
533 | 0 | } |
534 | 0 | } |
535 | 0 | } |
536 | 0 | if (index_reserved && inst->debug_report_callbacks_list.list && |
537 | 0 | inst->debug_report_callbacks_list.capacity > next_index * sizeof(struct loader_used_object_status)) { |
538 | 0 | inst->debug_report_callbacks_list.list[next_index].status = VK_FALSE; |
539 | 0 | if (NULL != pAllocator) { |
540 | 0 | inst->debug_report_callbacks_list.list[next_index].allocation_callbacks = *pAllocator; |
541 | 0 | } |
542 | 0 | } |
543 | 0 | loader_free_with_instance_fallback(pAllocator, inst, new_dbg_func_node); |
544 | 0 | loader_free_with_instance_fallback(pAllocator, inst, pNextIndex); |
545 | 0 | } |
546 | |
|
547 | 0 | return res; |
548 | 0 | } |
549 | | |
550 | | // This is the instance chain terminator function for DestroyDebugReportCallback |
551 | | VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, |
552 | 0 | const VkAllocationCallbacks *pAllocator) { |
553 | 0 | struct loader_instance *inst = (struct loader_instance *)instance; |
554 | 0 | uint32_t *debug_report_index = (uint32_t *)(uintptr_t)callback; |
555 | | // Make sure that callback actually points to anything |
556 | 0 | if (NULL == debug_report_index) { |
557 | 0 | return; |
558 | 0 | } |
559 | 0 | for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) { |
560 | 0 | if (icd_term->debug_report_callback_list.list && |
561 | 0 | icd_term->debug_report_callback_list.capacity > *debug_report_index * sizeof(VkDebugReportCallbackEXT) && |
562 | 0 | icd_term->debug_report_callback_list.list[*debug_report_index] && |
563 | 0 | NULL != icd_term->dispatch.DestroyDebugReportCallbackEXT) { |
564 | 0 | icd_term->dispatch.DestroyDebugReportCallbackEXT( |
565 | 0 | icd_term->instance, icd_term->debug_report_callback_list.list[*debug_report_index], pAllocator); |
566 | 0 | } |
567 | 0 | } |
568 | |
|
569 | 0 | util_DestroyDebugReportCallback(inst, callback, pAllocator); |
570 | 0 | if (inst->debug_report_callbacks_list.list && |
571 | 0 | inst->debug_report_callbacks_list.capacity > (*debug_report_index) * sizeof(struct loader_used_object_status)) { |
572 | 0 | inst->debug_report_callbacks_list.list[*debug_report_index].status = VK_FALSE; |
573 | 0 | if (NULL != pAllocator) { |
574 | 0 | inst->debug_report_callbacks_list.list[*debug_report_index].allocation_callbacks = *pAllocator; |
575 | 0 | } |
576 | 0 | } |
577 | 0 | loader_free_with_instance_fallback(pAllocator, inst, debug_report_index); |
578 | 0 | } |
579 | | |
580 | | // This is the instance chain terminator function for DebugReportMessage |
581 | | VKAPI_ATTR void VKAPI_CALL terminator_DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, |
582 | | VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, |
583 | 0 | int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { |
584 | 0 | const struct loader_icd_term *icd_term; |
585 | |
|
586 | 0 | struct loader_instance *inst = (struct loader_instance *)instance; |
587 | |
|
588 | 0 | loader_platform_thread_lock_mutex(&loader_lock); |
589 | 0 | for (icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) { |
590 | 0 | if (icd_term->dispatch.DebugReportMessageEXT != NULL) { |
591 | 0 | icd_term->dispatch.DebugReportMessageEXT(icd_term->instance, flags, objType, object, location, msgCode, pLayerPrefix, |
592 | 0 | pMsg); |
593 | 0 | } |
594 | 0 | } |
595 | | |
596 | | // Now that all ICDs have seen the message, call the necessary callbacks. Ignoring "bail" return value |
597 | | // as there is nothing to bail from at this point. |
598 | |
|
599 | 0 | util_DebugReportMessage(inst, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); |
600 | |
|
601 | 0 | loader_platform_thread_unlock_mutex(&loader_lock); |
602 | 0 | } |
603 | | |
604 | | // General utilities |
605 | | |
606 | | const VkExtensionProperties debug_utils_extension_info[] = { |
607 | | {VK_EXT_DEBUG_REPORT_EXTENSION_NAME, VK_EXT_DEBUG_REPORT_SPEC_VERSION}, |
608 | | {VK_EXT_DEBUG_UTILS_EXTENSION_NAME, VK_EXT_DEBUG_UTILS_SPEC_VERSION}, |
609 | | }; |
610 | | |
611 | 8.10k | void destroy_debug_callbacks_chain(struct loader_instance *inst, const VkAllocationCallbacks *pAllocator) { |
612 | 8.10k | VkLayerDbgFunctionNode *pTrav = inst->current_dbg_function_head; |
613 | 8.10k | VkLayerDbgFunctionNode *pNext = NULL; |
614 | 8.10k | while (pTrav) { |
615 | 0 | pNext = pTrav->pNext; |
616 | 0 | loader_free_with_instance_fallback(pAllocator, inst, pTrav); |
617 | 0 | pTrav = pNext; |
618 | 0 | } |
619 | 8.10k | inst->current_dbg_function_head = NULL; |
620 | 8.10k | } |
621 | | |
622 | 0 | VkResult add_debug_extensions_to_ext_list(const struct loader_instance *inst, struct loader_extension_list *ext_list) { |
623 | 0 | return loader_add_to_ext_list(inst, ext_list, sizeof(debug_utils_extension_info) / sizeof(VkExtensionProperties), |
624 | 0 | debug_utils_extension_info); |
625 | 0 | } |
626 | | |
627 | 0 | bool debug_extensions_InstanceGpa(struct loader_instance *ptr_instance, const char *name, void **addr) { |
628 | 0 | bool ret_type = false; |
629 | |
|
630 | 0 | *addr = NULL; |
631 | |
|
632 | 0 | if (!strcmp("vkCreateDebugReportCallbackEXT", name)) { |
633 | 0 | *addr = ptr_instance->enabled_extensions.ext_debug_report == 1 ? (void *)debug_utils_CreateDebugReportCallbackEXT : NULL; |
634 | 0 | ret_type = true; |
635 | 0 | } else if (!strcmp("vkDestroyDebugReportCallbackEXT", name)) { |
636 | 0 | *addr = ptr_instance->enabled_extensions.ext_debug_report == 1 ? (void *)debug_utils_DestroyDebugReportCallbackEXT : NULL; |
637 | 0 | ret_type = true; |
638 | 0 | } else if (!strcmp("vkDebugReportMessageEXT", name)) { |
639 | 0 | *addr = ptr_instance->enabled_extensions.ext_debug_report == 1 ? (void *)debug_utils_DebugReportMessageEXT : NULL; |
640 | 0 | return true; |
641 | 0 | } |
642 | 0 | if (!strcmp("vkCreateDebugUtilsMessengerEXT", name)) { |
643 | 0 | *addr = ptr_instance->enabled_extensions.ext_debug_utils == 1 ? (void *)debug_utils_CreateDebugUtilsMessengerEXT : NULL; |
644 | 0 | ret_type = true; |
645 | 0 | } else if (!strcmp("vkDestroyDebugUtilsMessengerEXT", name)) { |
646 | 0 | *addr = ptr_instance->enabled_extensions.ext_debug_utils == 1 ? (void *)debug_utils_DestroyDebugUtilsMessengerEXT : NULL; |
647 | 0 | ret_type = true; |
648 | 0 | } else if (!strcmp("vkSubmitDebugUtilsMessageEXT", name)) { |
649 | 0 | *addr = ptr_instance->enabled_extensions.ext_debug_utils == 1 ? (void *)debug_utils_SubmitDebugUtilsMessageEXT : NULL; |
650 | 0 | ret_type = true; |
651 | 0 | } |
652 | |
|
653 | 0 | return ret_type; |
654 | 0 | } |
655 | | |
656 | | bool debug_utils_ReportFlagsToAnnotFlags(VkDebugReportFlagsEXT dr_flags, bool default_flag_is_spec, |
657 | | VkDebugUtilsMessageSeverityFlagBitsEXT *da_severity, |
658 | 0 | VkDebugUtilsMessageTypeFlagsEXT *da_type) { |
659 | 0 | bool type_set = false; |
660 | 0 | if (NULL == da_severity || NULL == da_type) { |
661 | 0 | return false; |
662 | 0 | } |
663 | 0 | *da_type = 0; |
664 | 0 | *da_severity = 0; |
665 | |
|
666 | 0 | if ((dr_flags & VK_DEBUG_REPORT_INFORMATION_BIT_EXT) != 0) { |
667 | 0 | *da_severity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT; |
668 | 0 | *da_type |= VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT; |
669 | 0 | type_set = true; |
670 | 0 | } else if ((dr_flags & (VK_DEBUG_REPORT_WARNING_BIT_EXT | VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT)) != 0) { |
671 | 0 | *da_severity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT; |
672 | 0 | } else if ((dr_flags & VK_DEBUG_REPORT_ERROR_BIT_EXT) != 0) { |
673 | 0 | *da_severity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT; |
674 | 0 | } else if ((dr_flags & VK_DEBUG_REPORT_DEBUG_BIT_EXT) != 0) { |
675 | 0 | *da_severity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT; |
676 | 0 | *da_type |= VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT; |
677 | 0 | type_set = true; |
678 | 0 | } |
679 | |
|
680 | 0 | if ((dr_flags & VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT) != 0) { |
681 | 0 | *da_type |= VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT; |
682 | 0 | } else if (!type_set) { |
683 | 0 | if (default_flag_is_spec) { |
684 | 0 | *da_type |= VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT; |
685 | 0 | } else { |
686 | 0 | *da_type |= VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT; |
687 | 0 | } |
688 | 0 | } |
689 | |
|
690 | 0 | return true; |
691 | 0 | } |
692 | | |
693 | | bool debug_utils_AnnotFlagsToReportFlags(VkDebugUtilsMessageSeverityFlagBitsEXT da_severity, |
694 | 1.52M | VkDebugUtilsMessageTypeFlagsEXT da_type, VkDebugReportFlagsEXT *dr_flags) { |
695 | 1.52M | if (NULL == dr_flags) { |
696 | 0 | return false; |
697 | 0 | } |
698 | | |
699 | 1.52M | *dr_flags = 0; |
700 | | |
701 | 1.52M | if ((da_severity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) != 0) { |
702 | 56.3k | *dr_flags |= VK_DEBUG_REPORT_ERROR_BIT_EXT; |
703 | 1.46M | } else if ((da_severity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT) != 0) { |
704 | 626k | if ((da_type & VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT) != 0) { |
705 | 0 | *dr_flags |= VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT; |
706 | 626k | } else { |
707 | 626k | *dr_flags |= VK_DEBUG_REPORT_WARNING_BIT_EXT; |
708 | 626k | } |
709 | 841k | } else if ((da_severity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT) != 0) { |
710 | 592k | *dr_flags |= VK_DEBUG_REPORT_INFORMATION_BIT_EXT; |
711 | 592k | } else if ((da_severity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT) != 0) { |
712 | 249k | *dr_flags |= VK_DEBUG_REPORT_DEBUG_BIT_EXT; |
713 | 249k | } |
714 | | |
715 | 1.52M | return true; |
716 | 1.52M | } |
717 | | |
718 | | bool debug_utils_ReportObjectToAnnotObject(VkDebugReportObjectTypeEXT dr_object_type, uint64_t object_handle, |
719 | 0 | VkDebugUtilsObjectNameInfoEXT *da_object_name_info) { |
720 | 0 | if (NULL == da_object_name_info) { |
721 | 0 | return false; |
722 | 0 | } |
723 | 0 | da_object_name_info->sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; |
724 | 0 | da_object_name_info->pNext = NULL; |
725 | 0 | da_object_name_info->objectHandle = (uint64_t)(uintptr_t)object_handle; |
726 | 0 | da_object_name_info->pObjectName = NULL; |
727 | 0 | da_object_name_info->objectType = convertDebugReportObjectToCoreObject(dr_object_type); |
728 | 0 | return true; |
729 | 0 | } |
730 | | |
731 | | bool debug_utils_AnnotObjectToDebugReportObject(const VkDebugUtilsObjectNameInfoEXT *da_object_name_info, |
732 | 1.52M | VkDebugReportObjectTypeEXT *dr_object_type, uint64_t *dr_object_handle) { |
733 | 1.52M | if (NULL == da_object_name_info || NULL == dr_object_type || NULL == dr_object_handle) { |
734 | 0 | return false; |
735 | 0 | } |
736 | 1.52M | *dr_object_type = convertCoreObjectToDebugReportObject(da_object_name_info->objectType); |
737 | 1.52M | *dr_object_handle = da_object_name_info->objectHandle; |
738 | | return true; |
739 | 1.52M | } |