debug: add debug:pass for debugging the render pass

This commit is contained in:
Vaxry 2024-12-22 17:20:33 +00:00
parent e536b02248
commit 1830296df3
3 changed files with 31 additions and 2 deletions

View file

@ -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});

View file

@ -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;
}

View file

@ -18,6 +18,8 @@ class CRenderPass {
private:
CRegion damage;
CRegion occludedRegion;
CRegion totalLiveBlurRegion;
struct SPassElementData {
CRegion elementDamage;