Skip to content

Commit

Permalink
pass: mark crucial elements as undiscardable
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Jan 1, 2025
1 parent 7f177fa commit 9f3c9ac
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/render/pass/FramebufferElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,8 @@ bool CFramebufferElement::needsLiveBlur() {

bool CFramebufferElement::needsPrecomputeBlur() {
return false;
}
}

bool CFramebufferElement::undiscardable() {
return true;
}
1 change: 1 addition & 0 deletions src/render/pass/FramebufferElement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions src/render/pass/Pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/render/pass/PassElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ bool IPassElement::disableSimplification() {
void IPassElement::discard() {
;
}

bool IPassElement::undiscardable() {
return false;
}
1 change: 1 addition & 0 deletions src/render/pass/PassElement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions src/render/pass/PreBlurElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ bool CPreBlurElement::needsPrecomputeBlur() {
bool CPreBlurElement::disableSimplification() {
return true;
}

bool CPreBlurElement::undiscardable() {
return true;
}
1 change: 1 addition & 0 deletions src/render/pass/PreBlurElement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 4 additions & 0 deletions src/render/pass/RendererHintsPassElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ bool CRendererHintsPassElement::needsLiveBlur() {
bool CRendererHintsPassElement::needsPrecomputeBlur() {
return false;
}

bool CRendererHintsPassElement::undiscardable() {
return true;
}
1 change: 1 addition & 0 deletions src/render/pass/RendererHintsPassElement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 9f3c9ac

Please sign in to comment.