Replaced template for debug marker with functions (would not build with Android NDK and clang)
This commit is contained in:
parent
ae8f38d099
commit
86d286b46e
2 changed files with 234 additions and 172 deletions
|
|
@ -1,5 +1,4 @@
|
|||
#pragma once
|
||||
|
||||
#include "vulkan/vulkan.h"
|
||||
|
||||
#include <math.h>
|
||||
|
|
@ -45,51 +44,67 @@ namespace vkDebug
|
|||
// Clear debug callback
|
||||
void freeDebugCallback(VkInstance instance);
|
||||
|
||||
// Set up the debug marker function pointers
|
||||
void setupDebugMarkers(VkDevice device);
|
||||
|
||||
// insert a debug label into the command buffer, with or
|
||||
// without a color
|
||||
void insertDebugMarker(
|
||||
VkCommandBuffer cmdbuffer,
|
||||
const char* pMarkerName,
|
||||
float color[4]);
|
||||
void insertDebugMarker(
|
||||
VkCommandBuffer cmdbuffer,
|
||||
const char* pMarkerName);
|
||||
|
||||
// helper class for pushing and popping a debug region
|
||||
// around some section of code.
|
||||
struct DebugMarkerRegion
|
||||
// Functions for the VK_EXT_debug_report extensions
|
||||
namespace debugReport
|
||||
{
|
||||
DebugMarkerRegion(VkCommandBuffer cmdbuffer,
|
||||
// Set up the debug marker function pointers
|
||||
void setupDebugMarkers(VkDevice device);
|
||||
|
||||
// Functions for naming different Vulkan object types
|
||||
// General
|
||||
void setObjectName(VkDevice device, uint64_t object, VkDebugReportObjectTypeEXT objectType, const char *name);
|
||||
// Dedicated object type
|
||||
void setCommandBufferName(VkDevice device, VkCommandBuffer cmdBuffer, const char *name);
|
||||
void setQueueName(VkDevice device, VkQueue queue, const char *name);
|
||||
void setImageName(VkDevice device, VkImage image, const char *name);
|
||||
void setSamplerName(VkDevice device, VkSampler sampler, const char *name);
|
||||
void setBufferName(VkDevice device, VkBuffer buffer, const char *name);
|
||||
void setDeviceMemoryName(VkDevice device, VkDeviceMemory memory, const char *name);
|
||||
void setShaderModuleName(VkDevice device, VkShaderModule shaderModule, const char *name);
|
||||
void setPipelineName(VkDevice device, VkPipeline pipeline, const char *name);
|
||||
void setPipelineLayoutName(VkDevice device, VkPipelineLayout pipelineLayout, const char *name);
|
||||
void setRenderPassName(VkDevice device, VkRenderPass renderPass, const char *name);
|
||||
void setFramebufferName(VkDevice device, VkFramebuffer framebuffer, const char *name);
|
||||
void setDescriptorSetLayoutName(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const char *name);
|
||||
void setDescriptorSetName(VkDevice device, VkDescriptorSet descriptorSet, const char *name);
|
||||
void setSemaphoreName(VkDevice device, VkSemaphore semaphore, const char *name);
|
||||
void setFenceName(VkDevice device, VkFence fence, const char *name);
|
||||
void setEventName(VkDevice device, VkEvent _event, const char *name);
|
||||
|
||||
/*
|
||||
|
||||
OBJECT_TYPE(DESCRIPTOR_POOL, VkDescriptorPool);
|
||||
|
||||
OBJECT_TYPE(COMMAND_POOL, VkCommandPool);
|
||||
|
||||
OBJECT_TYPE(QUERY_POOL, VkQueryPool);
|
||||
|
||||
OBJECT_TYPE(BUFFER_VIEW, VkBufferView);
|
||||
OBJECT_TYPE(IMAGE_VIEW, VkImageView);
|
||||
OBJECT_TYPE(PIPELINE_CACHE, VkPipelineCache);
|
||||
*/
|
||||
|
||||
// insert a debug label into the command buffer, with or
|
||||
// without a color
|
||||
void insertDebugMarker(
|
||||
VkCommandBuffer cmdbuffer,
|
||||
const char* pMarkerName,
|
||||
float color[4]);
|
||||
DebugMarkerRegion(VkCommandBuffer cmdbuffer,
|
||||
void insertDebugMarker(
|
||||
VkCommandBuffer cmdbuffer,
|
||||
const char* pMarkerName);
|
||||
~DebugMarkerRegion();
|
||||
|
||||
VkCommandBuffer cmd;
|
||||
};
|
||||
// Helper class for pushing and popping a debug region around some section of code.
|
||||
struct DebugMarkerRegion
|
||||
{
|
||||
DebugMarkerRegion(VkCommandBuffer cmdbuffer,
|
||||
const char* pMarkerName,
|
||||
float color[4]);
|
||||
DebugMarkerRegion(VkCommandBuffer cmdbuffer,
|
||||
const char* pMarkerName);
|
||||
~DebugMarkerRegion();
|
||||
|
||||
// associate a friendly name with an object
|
||||
void SetObjectName(
|
||||
VkDevice device,
|
||||
VkDebugReportObjectTypeEXT objectType,
|
||||
uint64_t object,
|
||||
const char* pObjectName);
|
||||
|
||||
// specialised in vulkandebug.cpp for each object type
|
||||
template<typename VulkanType>
|
||||
VkDebugReportObjectTypeEXT GetObjectTypeEnum(VulkanType object);
|
||||
|
||||
// templated helper function for SetObjectName
|
||||
template<typename VulkanType>
|
||||
void SetObjectName(
|
||||
VkDevice device,
|
||||
VulkanType object,
|
||||
const char* pObjectName)
|
||||
{
|
||||
SetObjectName(device, GetObjectTypeEnum(object), (uint64_t)object, pObjectName);
|
||||
VkCommandBuffer cmd;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue