aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-12-22 17:20:33 +0000
committerVaxry <[email protected]>2024-12-22 17:20:33 +0000
commit1830296df3515222bf0f03b90822e3b23e74b775 (patch)
treee8f7d0fede88147f8fefc5ed6ef55b75f25aa140 /src
parente536b02248f370971716b744968776f6880528be (diff)
downloadHyprland-1830296df3515222bf0f03b90822e3b23e74b775.tar.gz
Hyprland-1830296df3515222bf0f03b90822e3b23e74b775.zip
debug: add debug:pass for debugging the render pass
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigManager.cpp1
-rw-r--r--src/render/pass/Pass.cpp30
-rw-r--r--src/render/pass/Pass.hpp2
3 files changed, 31 insertions, 2 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 9b6e29e4..f9ad54aa 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -413,6 +413,7 @@ CConfigManager::CConfigManager() {
m_pConfig->addConfigValue("debug:log_damage", Hyprlang::INT{0});
m_pConfig->addConfigValue("debug:overlay", Hyprlang::INT{0});
m_pConfig->addConfigValue("debug:damage_blink", Hyprlang::INT{0});
+ m_pConfig->addConfigValue("debug:pass", Hyprlang::INT{0});
m_pConfig->addConfigValue("debug:disable_logs", Hyprlang::INT{1});
m_pConfig->addConfigValue("debug:disable_time", Hyprlang::INT{1});
m_pConfig->addConfigValue("debug:enable_stdout_logs", Hyprlang::INT{0});
diff --git a/src/render/pass/Pass.cpp b/src/render/pass/Pass.cpp
index 31385acb..b6256c44 100644
--- a/src/render/pass/Pass.cpp
+++ b/src/render/pass/Pass.cpp
@@ -21,6 +21,8 @@ void CRenderPass::add(SP<IPassElement> el) {
}
void CRenderPass::simplify() {
+ static auto PDEBUGPASS = CConfigValue<Hyprlang::INT>("debug:pass");
+
// TODO: use precompute blur for instances where there is nothing in between
// if there is live blur, we need to NOT occlude any area where it will be influenced
@@ -78,6 +80,20 @@ void CRenderPass::simplify() {
}
}
newDamage.subtract(opaque);
+ if (*PDEBUGPASS)
+ occludedRegion.add(opaque);
+ }
+ }
+
+ if (*PDEBUGPASS) {
+ for (auto& el2 : m_vPassElements) {
+ if (!el2->element->needsLiveBlur())
+ continue;
+
+ const auto BB = el2->element->boundingBox();
+ RASSERT(BB, "No bounding box for an element with live blur is illegal");
+
+ totalLiveBlurRegion.add(*BB);
}
}
}
@@ -87,9 +103,13 @@ void CRenderPass::clear() {
}
CRegion CRenderPass::render(const CRegion& damage_) {
- const auto WILLBLUR = std::ranges::any_of(m_vPassElements, [](const auto& el) { return el->element->needsLiveBlur(); });
+ static auto PDEBUGPASS = CConfigValue<Hyprlang::INT>("debug:pass");
- damage = damage_.copy();
+ const auto WILLBLUR = std::ranges::any_of(m_vPassElements, [](const auto& el) { return el->element->needsLiveBlur(); });
+
+ damage = *PDEBUGPASS ? CRegion{CBox{{}, {INT32_MAX, INT32_MAX}}} : damage_.copy();
+ occludedRegion = CRegion{};
+ totalLiveBlurRegion = CRegion{};
if (damage.empty()) {
g_pHyprOpenGL->m_RenderData.damage = damage;
@@ -145,6 +165,12 @@ CRegion CRenderPass::render(const CRegion& damage_) {
el->element->draw(el->elementDamage);
}
+ if (*PDEBUGPASS) {
+ CBox monbox = {{}, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize};
+ g_pHyprOpenGL->renderRectWithDamage(&monbox, CHyprColor{1.F, 0.1F, 0.1F, 0.5F}, occludedRegion);
+ g_pHyprOpenGL->renderRectWithDamage(&monbox, CHyprColor{0.1F, 1.F, 0.1F, 0.5F}, totalLiveBlurRegion);
+ }
+
g_pHyprOpenGL->m_RenderData.damage = damage;
return damage;
}
diff --git a/src/render/pass/Pass.hpp b/src/render/pass/Pass.hpp
index 7f332c19..6fe6938f 100644
--- a/src/render/pass/Pass.hpp
+++ b/src/render/pass/Pass.hpp
@@ -18,6 +18,8 @@ class CRenderPass {
private:
CRegion damage;
+ CRegion occludedRegion;
+ CRegion totalLiveBlurRegion;
struct SPassElementData {
CRegion elementDamage;