Added GPU debug markers for render passes

This commit is contained in:
2025-04-09 23:03:16 -07:00
parent 698f890500
commit ddfe080078
2 changed files with 17 additions and 1 deletions

View File

@@ -557,6 +557,7 @@ void KRDevice::getQueueFamiliesForSharing(uint32_t* queueFamilyIndices, uint32_t
}
#if KRENGINE_DEBUG_GPU_LABELS
void KRDevice::setDebugLabel(uint64_t objectHandle, VkObjectType objectType, const char* debugLabel)
{
VkDebugUtilsObjectNameInfoEXT debugInfo{};

View File

@@ -72,6 +72,19 @@ void KRRenderPass::destroy(KRDevice& device)
void KRRenderPass::begin(VkCommandBuffer& commandBuffer, KRSurface& surface)
{
#if KRENGINE_DEBUG_GPU_LABELS
VkDebugUtilsLabelEXT debugLabel{};
debugLabel.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
debugLabel.color[0] = 0.0f;
debugLabel.color[1] = 0.0f;
debugLabel.color[2] = 0.0f;
debugLabel.color[3] = 0.0f;
debugLabel.pNext = nullptr;
debugLabel.pLabelName = m_info.debugLabel;
vkCmdBeginDebugUtilsLabelEXT(commandBuffer, &debugLabel);
#endif
int attachmentCount = 0;
std::array<VkClearValue, RENDER_PASS_ATTACHMENT_MAX_COUNT> clearValues{};
if (m_info.depthAttachment.id != 0) {
@@ -100,9 +113,11 @@ void KRRenderPass::begin(VkCommandBuffer& commandBuffer, KRSurface& surface)
void KRRenderPass::end(VkCommandBuffer& commandBuffer)
{
vkCmdEndRenderPass(commandBuffer);
#if KRENGINE_DEBUG_GPU_LABELS
vkCmdEndDebugUtilsLabelEXT(commandBuffer);
#endif
}
RenderPassType KRRenderPass::getType() const
{
return m_info.type;