PeriDyno 1.0.0
Loading...
Searching...
No Matches
VulkanDebug.h
Go to the documentation of this file.
1#if 0
2#pragma once
3#include "vulkan/vulkan.h"
4
5#include <math.h>
6#include <stdlib.h>
7#include <string>
8#include <cstring>
9#include <fstream>
10#include <assert.h>
11#include <stdio.h>
12#include <vector>
13#include <sstream>
14#ifdef _WIN32
15#include <windows.h>
16#include <fcntl.h>
17#include <io.h>
18#endif
19#ifdef __ANDROID__
20#include "VulkanAndroid.h"
21#endif
22#define GLM_FORCE_RADIANS
23#define GLM_FORCE_DEPTH_ZERO_TO_ONE
24#include <glm/glm.hpp>
25
26namespace vks
27{
28 namespace debug
29 {
30 // Default validation layers
31 extern int validationLayerCount;
32 extern const char *validationLayerNames[];
33
34 // Default debug callback
35 VKAPI_ATTR VkBool32 VKAPI_CALL messageCallback(
36 VkDebugReportFlagsEXT flags,
37 VkDebugReportObjectTypeEXT objType,
38 uint64_t srcObject,
39 size_t location,
40 int32_t msgCode,
41 const char* pLayerPrefix,
42 const char* pMsg,
43 void* pUserData);
44
45 // Load debug function pointers and set debug callback
46 // if callBack is NULL, default message callback will be used
47 void setupDebugging(
48 VkInstance instance,
49 VkDebugReportFlagsEXT flags,
50 VkDebugReportCallbackEXT callBack);
51 // Clear debug callback
52 void freeDebugCallback(VkInstance instance);
53 }
54
55 // Setup and functions for the VK_EXT_debug_marker_extension
56 // Extension spec can be found at https://github.com/KhronosGroup/Vulkan-Docs/blob/1.0-VK_EXT_debug_marker/doc/specs/vulkan/appendices/VK_EXT_debug_marker.txt
57 // Note that the extension will only be present if run from an offline debugging application
58 // The actual check for extension presence and enabling it on the device is done in the example base class
59 // See VulkanExampleBase::createInstance and VulkanExampleBase::createDevice (base/vulkanexamplebase.cpp)
60 namespace debugmarker
61 {
62 // Set to true if function pointer for the debug marker are available
63 extern bool active;
64
65 // Get function pointers for the debug report extensions from the device
66 void setup(VkDevice device);
67
68 // Sets the debug name of an object
69 // All Objects in Vulkan are represented by their 64-bit handles which are passed into this function
70 // along with the object type
71 void setObjectName(VkDevice device, uint64_t object, VkDebugReportObjectTypeEXT objectType, const char *name);
72
73 // Set the tag for an object
74 void setObjectTag(VkDevice device, uint64_t object, VkDebugReportObjectTypeEXT objectType, uint64_t name, size_t tagSize, const void* tag);
75
76 // Start a new debug marker region
77 void beginRegion(VkCommandBuffer cmdbuffer, const char* pMarkerName, glm::vec4 color);
78
79 // Insert a new debug marker into the command buffer
80 void insert(VkCommandBuffer cmdbuffer, std::string markerName, glm::vec4 color);
81
82 // End the current debug marker region
83 void endRegion(VkCommandBuffer cmdBuffer);
84
85 // Object specific naming functions
86 void setCommandBufferName(VkDevice device, VkCommandBuffer cmdBuffer, const char * name);
87 void setQueueName(VkDevice device, VkQueue queue, const char * name);
88 void setImageName(VkDevice device, VkImage image, const char * name);
89 void setSamplerName(VkDevice device, VkSampler sampler, const char * name);
90 void setBufferName(VkDevice device, VkBuffer buffer, const char * name);
91 void setDeviceMemoryName(VkDevice device, VkDeviceMemory memory, const char * name);
92 void setShaderModuleName(VkDevice device, VkShaderModule shaderModule, const char * name);
93 void setPipelineName(VkDevice device, VkPipeline pipeline, const char * name);
94 void setPipelineLayoutName(VkDevice device, VkPipelineLayout pipelineLayout, const char * name);
95 void setRenderPassName(VkDevice device, VkRenderPass renderPass, const char * name);
96 void setFramebufferName(VkDevice device, VkFramebuffer framebuffer, const char * name);
97 void setDescriptorSetLayoutName(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const char * name);
98 void setDescriptorSetName(VkDevice device, VkDescriptorSet descriptorSet, const char * name);
99 void setSemaphoreName(VkDevice device, VkSemaphore semaphore, const char * name);
100 void setFenceName(VkDevice device, VkFence fence, const char * name);
101 void setEventName(VkDevice device, VkEvent _event, const char * name);
102 };
103}
104
105#endif