1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-31 23:52:20 +01:00

[dxvk] Add debug regions for render passes

This commit is contained in:
Philip Rebohle 2025-01-08 14:18:28 +01:00 committed by Philip Rebohle
parent d9b5f09239
commit 1b9ea8c6e3
2 changed files with 52 additions and 0 deletions

View File

@ -2487,6 +2487,52 @@ namespace dxvk {
} }
void DxvkContext::beginRenderPassDebugRegion() {
bool hasColorAttachments = false;
bool hasDepthAttachment = m_state.om.renderTargets.depth.view != nullptr;
for (uint32_t i = 0; i < MaxNumRenderTargets; i++)
hasColorAttachments |= m_state.om.renderTargets.color[i].view != nullptr;
std::stringstream label;
if (hasColorAttachments)
label << "Color";
else if (hasDepthAttachment)
label << "Depth";
else
label << "Render";
label << " pass " << uint32_t(++m_renderPassIndex) << " (";
hasColorAttachments = false;
for (uint32_t i = 0; i < MaxNumRenderTargets; i++) {
if (m_state.om.renderTargets.color[i].view) {
const char* imageName = m_state.om.renderTargets.color[i].view->image()->info().debugName;
label << (hasColorAttachments ? ", " : "") << i << ": " << (imageName ? imageName : "unknown");
hasColorAttachments = true;
}
}
if (m_state.om.renderTargets.depth.view) {
if (hasColorAttachments)
label << ", ";
const char* imageName = m_state.om.renderTargets.depth.view->image()->info().debugName;
label << "DS:" << (imageName ? imageName : "unknown");
}
if (!hasColorAttachments && !hasDepthAttachment)
label << "No attachments";
label << ")";
beginInternalDebugRegion(vk::makeLabel(0xf0e6dc, label.str().c_str()));
}
void DxvkContext::beginDebugLabel(const VkDebugUtilsLabelEXT& label) { void DxvkContext::beginDebugLabel(const VkDebugUtilsLabelEXT& label) {
if (m_features.test(DxvkContextFeature::DebugUtils)) { if (m_features.test(DxvkContextFeature::DebugUtils)) {
endInternalDebugRegion(); endInternalDebugRegion();
@ -4483,6 +4529,9 @@ namespace dxvk {
DxvkContextFlag::GpRenderPassSuspended, DxvkContextFlag::GpRenderPassSuspended,
DxvkContextFlag::GpIndependentSets); DxvkContextFlag::GpIndependentSets);
if (unlikely(m_features.test(DxvkContextFeature::DebugUtils)))
beginRenderPassDebugRegion();
this->renderPassBindFramebuffer( this->renderPassBindFramebuffer(
m_state.om.framebufferInfo, m_state.om.framebufferInfo,
m_state.om.renderPassOps); m_state.om.renderPassOps);
@ -4520,6 +4569,7 @@ namespace dxvk {
this->transitionRenderTargetLayouts(false); this->transitionRenderTargetLayouts(false);
flushBarriers(); flushBarriers();
endInternalDebugRegion();
} else if (!suspend) { } else if (!suspend) {
// We may end a previously suspended render pass // We may end a previously suspended render pass
if (m_flags.test(DxvkContextFlag::GpRenderPassSuspended)) { if (m_flags.test(DxvkContextFlag::GpRenderPassSuspended)) {

View File

@ -1938,6 +1938,8 @@ namespace dxvk {
return pred(DxvkAccess::Read); return pred(DxvkAccess::Read);
} }
void beginRenderPassDebugRegion();
void beginInternalDebugRegion( void beginInternalDebugRegion(
const VkDebugUtilsLabelEXT& label); const VkDebugUtilsLabelEXT& label);