mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-27 04:54:15 +01:00
[dxvk] Improve handling of nested debug regions
This commit is contained in:
parent
b03d457ffb
commit
636669e1a5
@ -2869,27 +2869,20 @@ namespace dxvk {
|
|||||||
|
|
||||||
label << ")";
|
label << ")";
|
||||||
|
|
||||||
beginInternalDebugRegion(vk::makeLabel(0xf0e6dc, label.str().c_str()));
|
pushDebugRegion(vk::makeLabel(0xf0e6dc, label.str().c_str()),
|
||||||
|
util::DxvkDebugLabelType::InternalRenderPass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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();
|
pushDebugRegion(label, util::DxvkDebugLabelType::External);
|
||||||
|
|
||||||
m_cmd->cmdBeginDebugUtilsLabel(DxvkCmdBuffer::ExecBuffer, label);
|
|
||||||
m_debugLabelStack.emplace_back(label);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::endDebugLabel() {
|
void DxvkContext::endDebugLabel() {
|
||||||
if (m_features.test(DxvkContextFeature::DebugUtils)) {
|
if (m_features.test(DxvkContextFeature::DebugUtils))
|
||||||
if (!m_debugLabelStack.empty()) {
|
popDebugRegion(util::DxvkDebugLabelType::External);
|
||||||
m_cmd->cmdEndDebugUtilsLabel(DxvkCmdBuffer::ExecBuffer);
|
|
||||||
m_debugLabelStack.pop_back();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5208,7 +5201,9 @@ namespace dxvk {
|
|||||||
|
|
||||||
flushBarriers();
|
flushBarriers();
|
||||||
flushResolves();
|
flushResolves();
|
||||||
endInternalDebugRegion();
|
|
||||||
|
if (unlikely(m_features.test(DxvkContextFeature::DebugUtils)))
|
||||||
|
popDebugRegion(util::DxvkDebugLabelType::InternalRenderPass);
|
||||||
} 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)) {
|
||||||
@ -8170,23 +8165,34 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::beginInternalDebugRegion(const VkDebugUtilsLabelEXT& label) {
|
void DxvkContext::pushDebugRegion(const VkDebugUtilsLabelEXT& label, util::DxvkDebugLabelType type) {
|
||||||
if (m_features.test(DxvkContextFeature::DebugUtils)) {
|
m_cmd->cmdBeginDebugUtilsLabel(DxvkCmdBuffer::ExecBuffer, label);
|
||||||
// If the app provides us with debug regions, don't add any
|
m_debugLabelStack.emplace_back(label, type);
|
||||||
// internal ones to avoid potential issues with scoping.
|
|
||||||
if (m_debugLabelStack.empty()) {
|
|
||||||
m_cmd->cmdBeginDebugUtilsLabel(DxvkCmdBuffer::ExecBuffer, label);
|
|
||||||
m_debugLabelInternalActive = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::endInternalDebugRegion() {
|
void DxvkContext::popDebugRegion(util::DxvkDebugLabelType type) {
|
||||||
if (m_debugLabelInternalActive) {
|
// Find last active region of the given type
|
||||||
m_debugLabelInternalActive = false;
|
size_t index = m_debugLabelStack.size();
|
||||||
|
|
||||||
|
while (index && m_debugLabelStack[index - 1u].type() != type)
|
||||||
|
index -= 1u;
|
||||||
|
|
||||||
|
if (!index)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// End all debug regions inside the scope we want to end, as
|
||||||
|
// well as the debug region of the requested type itself
|
||||||
|
for (size_t i = index; i <= m_debugLabelStack.size(); i++)
|
||||||
m_cmd->cmdEndDebugUtilsLabel(DxvkCmdBuffer::ExecBuffer);
|
m_cmd->cmdEndDebugUtilsLabel(DxvkCmdBuffer::ExecBuffer);
|
||||||
|
|
||||||
|
// Re-emit nested debug regions and erase the region we ended
|
||||||
|
for (size_t i = index; i < m_debugLabelStack.size(); i++) {
|
||||||
|
m_cmd->cmdBeginDebugUtilsLabel(DxvkCmdBuffer::ExecBuffer, m_debugLabelStack[i].get());
|
||||||
|
m_debugLabelStack[i - 1u] = m_debugLabelStack[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_debugLabelStack.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1453,7 +1453,6 @@ namespace dxvk {
|
|||||||
std::vector<VkImageMemoryBarrier2> m_imageLayoutTransitions;
|
std::vector<VkImageMemoryBarrier2> m_imageLayoutTransitions;
|
||||||
|
|
||||||
std::vector<util::DxvkDebugLabel> m_debugLabelStack;
|
std::vector<util::DxvkDebugLabel> m_debugLabelStack;
|
||||||
bool m_debugLabelInternalActive = false;
|
|
||||||
|
|
||||||
Rc<DxvkLatencyTracker> m_latencyTracker;
|
Rc<DxvkLatencyTracker> m_latencyTracker;
|
||||||
uint64_t m_latencyFrameId = 0u;
|
uint64_t m_latencyFrameId = 0u;
|
||||||
@ -2072,10 +2071,12 @@ namespace dxvk {
|
|||||||
|
|
||||||
void beginRenderPassDebugRegion();
|
void beginRenderPassDebugRegion();
|
||||||
|
|
||||||
void beginInternalDebugRegion(
|
void pushDebugRegion(
|
||||||
const VkDebugUtilsLabelEXT& label);
|
const VkDebugUtilsLabelEXT& label,
|
||||||
|
util::DxvkDebugLabelType type);
|
||||||
|
|
||||||
void endInternalDebugRegion();
|
void popDebugRegion(
|
||||||
|
util::DxvkDebugLabelType type);
|
||||||
|
|
||||||
void beginActiveDebugRegions();
|
void beginActiveDebugRegions();
|
||||||
|
|
||||||
|
@ -4,6 +4,14 @@
|
|||||||
|
|
||||||
namespace dxvk::util {
|
namespace dxvk::util {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Debug utils label type
|
||||||
|
*/
|
||||||
|
enum class DxvkDebugLabelType : uint32_t {
|
||||||
|
External, ///< App-provided scope
|
||||||
|
InternalRenderPass, ///< Internal render pass markers
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Debug label wrapper
|
* \brief Debug label wrapper
|
||||||
*
|
*
|
||||||
@ -16,12 +24,16 @@ namespace dxvk::util {
|
|||||||
|
|
||||||
DxvkDebugLabel() = default;
|
DxvkDebugLabel() = default;
|
||||||
|
|
||||||
DxvkDebugLabel(const VkDebugUtilsLabelEXT& label)
|
DxvkDebugLabel(const VkDebugUtilsLabelEXT& label, DxvkDebugLabelType type)
|
||||||
: m_text(label.pLabelName ? label.pLabelName : "") {
|
: m_text(label.pLabelName ? label.pLabelName : ""), m_type(type) {
|
||||||
for (uint32_t i = 0; i < m_color.size(); i++)
|
for (uint32_t i = 0; i < m_color.size(); i++)
|
||||||
m_color[i] = label.color[i];
|
m_color[i] = label.color[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DxvkDebugLabelType type() const {
|
||||||
|
return m_type;
|
||||||
|
}
|
||||||
|
|
||||||
VkDebugUtilsLabelEXT get() const {
|
VkDebugUtilsLabelEXT get() const {
|
||||||
VkDebugUtilsLabelEXT label = { VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT };
|
VkDebugUtilsLabelEXT label = { VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT };
|
||||||
label.pLabelName = m_text.c_str();
|
label.pLabelName = m_text.c_str();
|
||||||
@ -34,6 +46,7 @@ namespace dxvk::util {
|
|||||||
|
|
||||||
std::string m_text;
|
std::string m_text;
|
||||||
std::array<float, 4> m_color = { };
|
std::array<float, 4> m_color = { };
|
||||||
|
DxvkDebugLabelType m_type;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user