Debian Codegraph @

Sources/nCine/Graphics/RHI/Vulkan/VulkanDebug.h

raw
1 #pragma once
2
3 #include <cstdint>
4
5 #include <Containers/StringView.h>
6
7 using namespace Death::Containers;
8
9 namespace nCine::RHI
10 {
11 class IRhiCapabilities;
12 }
13
14 namespace nCine::RHI::Vulkan
15 {
16 /**
17 @brief Debug-output and object-labelling stub of the Vulkan backend
18
19 The backend has no device-side debug facility wired up, so every entry point is a no-op. The class
20 exists to satisfy the `RHI::Debug` contract alias (debug groups, message insertion and object labels
21 used by the render pipeline). These could later route to `VK_EXT_debug_utils` labels / object names
22 when the validation layer or a debugger is present.
23 */
24 class VulkanDebug
25 {
26 public:
27 /** @brief Object types that can be labelled (values are irrelevant for the Vulkan backend) */
28 enum class LabelTypes
29 {
30 Buffer,
31 Shader,
32 Program,
33 VertexArray,
34 Query,
35 ProgramPipeline,
36 TransformFeedback,
37 Sampler,
38 Texture,
39 RenderBuffer,
40 FrameBuffer
41 };
42
43 /**
44 @brief RAII scope for a debug message group (a no-op for the Vulkan backend)
45 */
46 class ScopedGroup
47 {
48 public:
49 explicit ScopedGroup(StringView message) {
50 static_cast<void>(message);
51 }
52 };
53
54 static void Init(const IRhiCapabilities& caps) {
55 static_cast<void>(caps);
56 }
57 static inline void Reset() {}
58
59 static inline bool IsAvailable() {
60 return false;
61 }
62
63 static void PushGroup(StringView message) {
64 static_cast<void>(message);
65 }
66 static void PopGroup() {}
67 static void MessageInsert(StringView message) {
68 static_cast<void>(message);
69 }
70
71 static void SetObjectLabel(LabelTypes identifier, std::uint32_t name, StringView label) {
72 static_cast<void>(identifier);
73 static_cast<void>(name);
74 static_cast<void>(label);
75 }
76 static void GetObjectLabel(LabelTypes identifier, std::uint32_t name, std::int32_t bufSize, std::int32_t* length, char* label) {
77 static_cast<void>(identifier);
78 static_cast<void>(name);
79 static_cast<void>(bufSize);
80 if (length != nullptr) {
81 *length = 0;
82 }
83 if (label != nullptr && bufSize > 0) {
84 label[0] = '\0';
85 }
86 }
87
88 static inline std::int32_t GetMaxLabelLength() {
89 return 0;
90 }
91 };
92 }