pass: mark crucial elements as undiscardable

This commit is contained in:
Vaxry 2025-01-01 21:35:42 +01:00
parent 7f177fa1cf
commit 9f3c9ac01a
9 changed files with 23 additions and 3 deletions

View file

@ -45,4 +45,8 @@ bool CFramebufferElement::needsLiveBlur() {
bool CFramebufferElement::needsPrecomputeBlur() {
return false;
}
}
bool CFramebufferElement::undiscardable() {
return true;
}

View file

@ -14,6 +14,7 @@ class CFramebufferElement : public IPassElement {
virtual void draw(const CRegion& damage);
virtual bool needsLiveBlur();
virtual bool needsPrecomputeBlur();
virtual bool undiscardable();
virtual const char* passName() {
return "CFramebufferElement";

View file

@ -35,14 +35,14 @@ void CRenderPass::simplify() {
CRegion newDamage = damage.copy().intersect(CBox{{}, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize});
for (auto& el : m_vPassElements | std::views::reverse) {
if (newDamage.empty()) {
if (newDamage.empty() && !el->element->undiscardable()) {
el->discard = true;
continue;
}
el->elementDamage = newDamage;
auto bb1 = el->element->boundingBox();
if (!bb1)
if (!bb1 || newDamage.empty())
continue;
auto bb = bb1->scale(g_pHyprOpenGL->m_RenderData.pMonitor->scale);

View file

@ -15,3 +15,7 @@ bool IPassElement::disableSimplification() {
void IPassElement::discard() {
;
}
bool IPassElement::undiscardable() {
return false;
}

View file

@ -12,6 +12,7 @@ class IPassElement {
virtual bool needsPrecomputeBlur() = 0;
virtual const char* passName() = 0;
virtual void discard();
virtual bool undiscardable();
virtual std::optional<CBox> boundingBox();
virtual CRegion opaqueRegion();
virtual bool disableSimplification();

View file

@ -18,3 +18,7 @@ bool CPreBlurElement::needsPrecomputeBlur() {
bool CPreBlurElement::disableSimplification() {
return true;
}
bool CPreBlurElement::undiscardable() {
return true;
}

View file

@ -10,6 +10,7 @@ class CPreBlurElement : public IPassElement {
virtual bool needsLiveBlur();
virtual bool needsPrecomputeBlur();
virtual bool disableSimplification();
virtual bool undiscardable();
virtual const char* passName() {
return "CPreBlurElement";

View file

@ -17,3 +17,7 @@ bool CRendererHintsPassElement::needsLiveBlur() {
bool CRendererHintsPassElement::needsPrecomputeBlur() {
return false;
}
bool CRendererHintsPassElement::undiscardable() {
return true;
}

View file

@ -15,6 +15,7 @@ class CRendererHintsPassElement : public IPassElement {
virtual void draw(const CRegion& damage);
virtual bool needsLiveBlur();
virtual bool needsPrecomputeBlur();
virtual bool undiscardable();
virtual const char* passName() {
return "CRendererHintsPassElement";