The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

a/vk: Add function to name object

+74
+1
src/xrt/auxiliary/vk/CMakeLists.txt
··· 9 9 vk_cmd_pool.c 10 10 vk_cmd_pool.h 11 11 vk_compositor_flags.c 12 + vk_debug.c 12 13 vk_documentation.h 13 14 vk_function_loaders.c 14 15 vk_helpers.c
+38
src/xrt/auxiliary/vk/vk_debug.c
··· 1 + // Copyright 2023, Collabora, Ltd. 2 + // SPDX-License-Identifier: BSL-1.0 3 + /*! 4 + * @file 5 + * @brief Debug helper code. 6 + * @author Jakob Bornecrantz <jakob@collabora.com> 7 + * @ingroup aux_vk 8 + */ 9 + 10 + #include "vk/vk_helpers.h" 11 + 12 + 13 + #ifdef VK_EXT_debug_marker 14 + 15 + void 16 + vk_name_object(struct vk_bundle *vk, VkDebugReportObjectTypeEXT object_type, uint64_t object, const char *name) 17 + { 18 + if (!vk->has_EXT_debug_marker) { 19 + return; 20 + } 21 + 22 + if (object == 0) { 23 + U_LOG_W("Called with null object!"); 24 + return; 25 + } 26 + 27 + VkDebugMarkerObjectNameInfoEXT name_info = { 28 + .sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT, 29 + .pNext = NULL, 30 + .objectType = object_type, 31 + .object = object, 32 + .pObjectName = name, 33 + }; 34 + 35 + vk->vkDebugMarkerSetObjectNameEXT(vk->device, &name_info); 36 + } 37 + 38 + #endif
+35
src/xrt/auxiliary/vk/vk_helpers.h
··· 534 534 535 535 /* 536 536 * 537 + * Debug helper functions, in the vk_debug.c file. 538 + * 539 + */ 540 + 541 + #if defined(VK_EXT_debug_marker) || defined(XRT_DOXYGEN) 542 + 543 + /*! 544 + * Uses VK_EXT_debug_marker to name objects for easier debugging. 545 + * 546 + * @ingroup aux_vk 547 + */ 548 + void 549 + vk_name_object(struct vk_bundle *vk, VkDebugReportObjectTypeEXT object_type, uint64_t object, const char *name); 550 + 551 + /*! 552 + * Small helper for @ref vk_name_object that makes use of pre-process to avoid 553 + * writing out long type names. 554 + * 555 + * @ingroup aux_vk 556 + */ 557 + #define VK_NAME_OBJECT(vk, TYPE, obj, name) \ 558 + if (vk->has_EXT_debug_marker) { \ 559 + vk_name_object(vk, VK_DEBUG_REPORT_OBJECT_TYPE_##TYPE##_EXT, (uint64_t)obj, name); \ 560 + } 561 + 562 + #else 563 + 564 + #define VK_NAME_OBJECT(vk, TYPE, obj name) \ 565 + do { \ 566 + } while (false) 567 + 568 + #endif 569 + 570 + /* 571 + * 537 572 * Printing helpers, in the vk_print.c file. 538 573 * 539 574 */