Add GPU debug labels for render passes
This commit is contained in:
@@ -587,6 +587,11 @@ void KRDevice::setDebugLabel(const VkCommandBuffer& commandBuffer, const char* d
|
||||
setDebugLabel((uint64_t)commandBuffer, VK_OBJECT_TYPE_COMMAND_BUFFER, debugLabel);
|
||||
}
|
||||
|
||||
void KRDevice::setDebugLabel(const VkRenderPass& renderPass, const char* debugLabel)
|
||||
{
|
||||
setDebugLabel((uint64_t)renderPass, VK_OBJECT_TYPE_RENDER_PASS, debugLabel);
|
||||
}
|
||||
|
||||
void KRDevice::setDebugLabel(const VkDevice& device, const char* debugLabel)
|
||||
{
|
||||
setDebugLabel((uint64_t)device, VK_OBJECT_TYPE_DEVICE, debugLabel);
|
||||
|
||||
@@ -56,6 +56,7 @@ public:
|
||||
void setDebugLabel(const VkBuffer& buffer, const char* debugLabel);
|
||||
void setDebugLabel(const VkQueue& queue, const char* debugLabel);
|
||||
void setDebugLabel(const VkCommandBuffer& commandBuffer, const char* debugLabel);
|
||||
void setDebugLabel(const VkRenderPass& renderPass, const char* debugLabel);
|
||||
void setDebugLabel(const VkDevice& device, const char* debugLabel);
|
||||
#endif // KRENGINE_DEBUG_GPU_LABELS
|
||||
|
||||
|
||||
@@ -133,6 +133,7 @@ void KRRenderGraph::addRenderPass(KRDevice& device, const RenderPassInfo& info)
|
||||
|
||||
KRRenderPass *pass = new KRRenderPass(getContext());
|
||||
pass->create(device, info, renderPassInfo);
|
||||
|
||||
m_renderPasses.push_back(pass);
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,10 @@ KrResult KRRenderGraphBlackFrame::initialize(KRSurface &surface)
|
||||
info.depthAttachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
info.finalPass = true;
|
||||
info.type = RenderPassType::RENDER_PASS_BLACK_FRAME;
|
||||
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
strncpy(info.debugLabel, "Black Frame", KRENGINE_DEBUG_GPU_LABEL_MAX_LEN);
|
||||
#endif
|
||||
addRenderPass(*surface.getDevice(), info);
|
||||
|
||||
return KR_SUCCESS;
|
||||
|
||||
@@ -71,6 +71,9 @@ KrResult KRRenderGraphDeferred::initialize(KRSurface &surface)
|
||||
info.finalPass = false;
|
||||
|
||||
info.type = RenderPassType::RENDER_PASS_PRESTREAM;
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
strncpy(info.debugLabel, "PreStream", KRENGINE_DEBUG_GPU_LABEL_MAX_LEN);
|
||||
#endif
|
||||
addRenderPass(*surface.getDevice(), info);
|
||||
|
||||
for (int shadow_index = 0; shadow_index < shadow_buffer_count; shadow_index++) {
|
||||
@@ -80,6 +83,9 @@ KrResult KRRenderGraphDeferred::initialize(KRSurface &surface)
|
||||
info.depthAttachment.clearVaue.depthStencil.depth = 1.0f;
|
||||
info.depthAttachment.clearVaue.depthStencil.stencil = 0;
|
||||
info.type = RenderPassType::RENDER_PASS_SHADOWMAP;
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
snprintf(info.debugLabel, KRENGINE_DEBUG_GPU_LABEL_MAX_LEN, "Shadow Map %i", shadow_index);
|
||||
#endif
|
||||
addRenderPass(*surface.getDevice(), info);
|
||||
}
|
||||
|
||||
@@ -100,6 +106,9 @@ KrResult KRRenderGraphDeferred::initialize(KRSurface &surface)
|
||||
info.colorAttachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
info.colorAttachments[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
info.type = RenderPassType::RENDER_PASS_DEFERRED_GBUFFER;
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
strncpy(info.debugLabel, "Deferred GBuffer", KRENGINE_DEBUG_GPU_LABEL_MAX_LEN);
|
||||
#endif
|
||||
addRenderPass(*surface.getDevice(), info);
|
||||
|
||||
// ----====---- Opaque Geometry, Deferred rendering Pass 2 ----====----
|
||||
@@ -115,12 +124,18 @@ KrResult KRRenderGraphDeferred::initialize(KRSurface &surface)
|
||||
info.colorAttachments[1].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
info.colorAttachments[1].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
info.type = RenderPassType::RENDER_PASS_DEFERRED_LIGHTS;
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
strncpy(info.debugLabel, "Deferred Lights", KRENGINE_DEBUG_GPU_LABEL_MAX_LEN);
|
||||
#endif
|
||||
addRenderPass(*surface.getDevice(), info);
|
||||
|
||||
// ----====---- Opaque Geometry, Deferred rendering Pass 3 ----====----
|
||||
info.colorAttachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
info.colorAttachments[1].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
|
||||
info.type = RenderPassType::RENDER_PASS_DEFERRED_OPAQUE;
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
strncpy(info.debugLabel, "Deferred Opaque", KRENGINE_DEBUG_GPU_LABEL_MAX_LEN);
|
||||
#endif
|
||||
addRenderPass(*surface.getDevice(), info);
|
||||
|
||||
info.colorAttachments[1] = {};
|
||||
@@ -141,13 +156,22 @@ KrResult KRRenderGraphDeferred::initialize(KRSurface &surface)
|
||||
info.colorAttachments[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
|
||||
info.type = RenderPassType::RENDER_PASS_FORWARD_TRANSPARENT;
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
strncpy(info.debugLabel, "Forward Transparent", KRENGINE_DEBUG_GPU_LABEL_MAX_LEN);
|
||||
#endif
|
||||
addRenderPass(*surface.getDevice(), info);
|
||||
|
||||
info.type = RenderPassType::RENDER_PASS_DEBUG_OVERLAYS;
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
strncpy(info.debugLabel, "Debug Overlays", KRENGINE_DEBUG_GPU_LABEL_MAX_LEN);
|
||||
#endif
|
||||
addRenderPass(*surface.getDevice(), info);
|
||||
|
||||
info.finalPass = true;
|
||||
info.type = RenderPassType::RENDER_PASS_POST_COMPOSITE;
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
strncpy(info.debugLabel, "Post Composite", KRENGINE_DEBUG_GPU_LABEL_MAX_LEN);
|
||||
#endif
|
||||
addRenderPass(*surface.getDevice(), info);
|
||||
|
||||
return KR_SUCCESS;
|
||||
|
||||
@@ -70,6 +70,9 @@ KrResult KRRenderGraphForward::initialize(KRSurface &surface)
|
||||
info.finalPass = false;
|
||||
|
||||
info.type = RenderPassType::RENDER_PASS_PRESTREAM;
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
strncpy(info.debugLabel, "PreStream", KRENGINE_DEBUG_GPU_LABEL_MAX_LEN);
|
||||
#endif
|
||||
addRenderPass(*surface.getDevice(), info);
|
||||
|
||||
for (int shadow_index = 0; shadow_index < shadow_buffer_count; shadow_index++) {
|
||||
@@ -79,6 +82,9 @@ KrResult KRRenderGraphForward::initialize(KRSurface &surface)
|
||||
info.depthAttachment.clearVaue.depthStencil.depth = 1.0f;
|
||||
info.depthAttachment.clearVaue.depthStencil.stencil = 0;
|
||||
info.type = RenderPassType::RENDER_PASS_SHADOWMAP;
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
snprintf(info.debugLabel, KRENGINE_DEBUG_GPU_LABEL_MAX_LEN, "Shadow Map %i", shadow_index);
|
||||
#endif
|
||||
addRenderPass(*surface.getDevice(), info);
|
||||
}
|
||||
|
||||
@@ -98,6 +104,9 @@ KrResult KRRenderGraphForward::initialize(KRSurface &surface)
|
||||
info.colorAttachments[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
|
||||
info.type = RenderPassType::RENDER_PASS_FORWARD_OPAQUE;
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
strncpy(info.debugLabel, "Forward Opaque", KRENGINE_DEBUG_GPU_LABEL_MAX_LEN);
|
||||
#endif
|
||||
addRenderPass(*surface.getDevice(), info);
|
||||
|
||||
// ----====---- Transparent Geometry, Forward Rendering ----====----
|
||||
@@ -116,13 +125,22 @@ KrResult KRRenderGraphForward::initialize(KRSurface &surface)
|
||||
info.colorAttachments[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
|
||||
info.type = RenderPassType::RENDER_PASS_FORWARD_TRANSPARENT;
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
strncpy(info.debugLabel, "Forward Transparent", KRENGINE_DEBUG_GPU_LABEL_MAX_LEN);
|
||||
#endif
|
||||
addRenderPass(*surface.getDevice(), info);
|
||||
|
||||
info.type = RenderPassType::RENDER_PASS_DEBUG_OVERLAYS;
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
strncpy(info.debugLabel, "Debug Overlays", KRENGINE_DEBUG_GPU_LABEL_MAX_LEN);
|
||||
#endif
|
||||
addRenderPass(*surface.getDevice(), info);
|
||||
|
||||
info.finalPass = true;
|
||||
info.type = RenderPassType::RENDER_PASS_POST_COMPOSITE;
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
strncpy(info.debugLabel, "Post Composite", KRENGINE_DEBUG_GPU_LABEL_MAX_LEN);
|
||||
#endif
|
||||
addRenderPass(*surface.getDevice(), info);
|
||||
|
||||
return KR_SUCCESS;
|
||||
|
||||
@@ -56,6 +56,10 @@ void KRRenderPass::create(KRDevice& device, const RenderPassInfo& info, const Vk
|
||||
if (vkCreateRenderPass(device.m_logicalDevice, &createInfo, nullptr, &m_renderPass) != VK_SUCCESS) {
|
||||
// failed! TODO - Error handling
|
||||
}
|
||||
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
device.setDebugLabel(m_renderPass, info.debugLabel);
|
||||
#endif
|
||||
}
|
||||
|
||||
void KRRenderPass::destroy(KRDevice& device)
|
||||
|
||||
@@ -68,6 +68,9 @@ struct RenderPassInfo
|
||||
RenderPassType type;
|
||||
RenderPassAttachmentInfo colorAttachments[RENDER_PASS_ATTACHMENT_MAX_COUNT];
|
||||
RenderPassAttachmentInfo depthAttachment;
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
char debugLabel[KRENGINE_DEBUG_GPU_LABEL_MAX_LEN];
|
||||
#endif
|
||||
|
||||
bool finalPass;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user