Monado OpenXR Runtime
Loading...
Searching...
No Matches
vk_print.h
Go to the documentation of this file.
1// Copyright 2019-2024, Collabora, Ltd.
2// Copyright 2025-2026, NVIDIA CORPORATION.
3// Copyright 2026, Beyley Cardellio
4// SPDX-License-Identifier: BSL-1.0
5/*!
6 * @file
7 * @brief Printing helper code.
8 *
9 * @author Jakob Bornecrantz <jakob@collabora.com>
10 * @author Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
11 * @author Moshi Turner <moshiturner@protonmail.com>
12 * @author Korcan Hussein <korcan.hussein@collabora.com>
13 * @author Christoph Haag <christoph.haag@collabora.com>
14 * @author Beyley Cardellio <ep1cm1n10n123@gmail.com>
15 * @ingroup aux_vk
16 */
17
18#pragma once
19
20#include "xrt/xrt_compiler.h"
22
23#include "util/u_logging.h"
24
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30struct vk_bundle;
31
32/*
33 *
34 * Printing helpers.
35 *
36 */
37
38/*!
39 * Print the result of a function, info level if ret == `VK_SUCCESS` and error
40 * level otherwise. Also prints file and line.
41 *
42 * @ingroup aux_vk
43 */
44void
46 struct vk_bundle *vk, const char *file, int line, const char *calling_func, VkResult ret, const char *called_func);
47
48/*!
49 * Print device information to the logger at the given logging level,
50 * if the vk_bundle has that level enabled.
51 *
52 * @ingroup aux_vk
53 */
54void
56 enum u_logging_level log_level,
57 const VkPhysicalDeviceProperties *pdp,
58 uint32_t gpu_index,
59 const char *title);
60
61/*!
62 * Print device information about the device that bundle manages at the given
63 * logging level if the vk_bundle has that level enabled.
64 *
65 * @ingroup aux_vk
66 */
67void
68vk_print_opened_device_info(struct vk_bundle *vk, enum u_logging_level log_level);
69
70/*!
71 * Print device features to the logger at the given logging level, if the
72 * vk_bundle has that level enabled.
73 */
74void
75vk_print_features_info(struct vk_bundle *vk, enum u_logging_level log_level);
76
77/*!
78 * Print external handle features to the logger at the given logging level,
79 * if the vk_bundle has that level enabled.
80 */
81void
83
84/*!
85 * Print a @p VkSwapchainCreateInfoKHR, used to log during creation.
86 */
87void
88vk_print_swapchain_create_info(struct vk_bundle *vk, VkSwapchainCreateInfoKHR *i, enum u_logging_level log_level);
89
90#ifdef VK_KHR_display
91/*!
92 * Print a @p VkDisplaySurfaceCreateInfoKHR, used to log during creation.
93 */
94void
95vk_print_display_surface_create_info(struct vk_bundle *vk,
96 VkDisplaySurfaceCreateInfoKHR *i,
97 enum u_logging_level log_level);
98#endif
99
100/*!
101 * Print queue info to the logger at the given logging level,
102 * if the vk_bundle has that level enabled.
103 */
104void
105vk_print_queues_info(const struct vk_bundle *vk, enum u_logging_level log_level);
106
107
108/*
109 *
110 * String helper functions.
111 *
112 */
113
114XRT_CHECK_RESULT const char *
115vk_result_string(VkResult code);
116
117XRT_CHECK_RESULT const char *
118vk_object_type_string(VkObjectType type);
119
120XRT_CHECK_RESULT const char *
121vk_physical_device_type_string(VkPhysicalDeviceType device_type);
122
123XRT_CHECK_RESULT const char *
124vk_format_string(VkFormat code);
125
126XRT_CHECK_RESULT const char *
127vk_sharing_mode_string(VkSharingMode code);
128
129XRT_CHECK_RESULT const char *
130vk_present_mode_string(VkPresentModeKHR code);
131
132XRT_CHECK_RESULT const char *
133vk_color_space_string(VkColorSpaceKHR code);
134
135XRT_CHECK_RESULT const char *
136vk_power_state_string(VkDisplayPowerStateEXT code);
137
138XRT_CHECK_RESULT const char *
139vk_format_string(VkFormat code);
140
141
142#ifdef __cplusplus
143}
144#endif
u_logging_level
Logging level enum.
Definition u_logging.h:45
void vk_print_device_info(struct vk_bundle *vk, enum u_logging_level log_level, const VkPhysicalDeviceProperties *pdp, uint32_t gpu_index, const char *title)
Print device information to the logger at the given logging level, if the vk_bundle has that level en...
Definition vk_print.c:105
void vk_print_opened_device_info(struct vk_bundle *vk, enum u_logging_level log_level)
Print device information about the device that bundle manages at the given logging level if the vk_bu...
Definition vk_print.c:133
void vk_print_result(struct vk_bundle *vk, const char *file, int line, const char *calling_func, VkResult ret, const char *called_func)
Print the result of a function, info level if ret == VK_SUCCESS and error level otherwise.
Definition vk_print.c:79
A bundle of Vulkan functions and objects, used by both Compositor and Compositor client code.
Definition vk_helpers.h:81
Basic logging functionality.
void vk_print_external_handles_info(struct vk_bundle *vk, enum u_logging_level log_level)
Print external handle features to the logger at the given logging level, if the vk_bundle has that le...
Definition vk_print.c:157
void vk_print_queues_info(const struct vk_bundle *vk, enum u_logging_level log_level)
Print queue info to the logger at the given logging level, if the vk_bundle has that level enabled.
Definition vk_print.c:312
void vk_print_swapchain_create_info(struct vk_bundle *vk, VkSwapchainCreateInfoKHR *i, enum u_logging_level log_level)
Print a VkSwapchainCreateInfoKHR, used to log during creation.
Definition vk_print.c:258
void vk_print_features_info(struct vk_bundle *vk, enum u_logging_level log_level)
Print device features to the logger at the given logging level, if the vk_bundle has that level enabl...
Definition vk_print.c:142
Header holding common defines.
Include all of the Vulkan headers in one place, and cope with any "messy" includes implied by it.