render: refactor class member vars (#10292)

* render: refactor class member vars

* render: fix clang format
This commit is contained in:
davc0n 2025-05-05 23:44:49 +02:00 committed by GitHub
parent c7eb141098
commit 997fefbc11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
63 changed files with 1307 additions and 1321 deletions

View file

@ -1,15 +1,15 @@
#include "BorderPassElement.hpp"
#include "../OpenGL.hpp"
CBorderPassElement::CBorderPassElement(const CBorderPassElement::SBorderData& data_) : data(data_) {
CBorderPassElement::CBorderPassElement(const CBorderPassElement::SBorderData& data_) : m_data(data_) {
;
}
void CBorderPassElement::draw(const CRegion& damage) {
if (data.hasGrad2)
g_pHyprOpenGL->renderBorder(data.box, data.grad1, data.grad2, data.lerp, data.round, data.roundingPower, data.borderSize, data.a, data.outerRound);
if (m_data.hasGrad2)
g_pHyprOpenGL->renderBorder(m_data.box, m_data.grad1, m_data.grad2, m_data.lerp, m_data.round, m_data.roundingPower, m_data.borderSize, m_data.a, m_data.outerRound);
else
g_pHyprOpenGL->renderBorder(data.box, data.grad1, data.round, data.roundingPower, data.borderSize, data.a, data.outerRound);
g_pHyprOpenGL->renderBorder(m_data.box, m_data.grad1, m_data.round, m_data.roundingPower, m_data.borderSize, m_data.a, m_data.outerRound);
}
bool CBorderPassElement::needsLiveBlur() {

View file

@ -27,5 +27,5 @@ class CBorderPassElement : public IPassElement {
}
private:
SBorderData data;
SBorderData m_data;
};

View file

@ -1,12 +1,12 @@
#include "ClearPassElement.hpp"
#include "../OpenGL.hpp"
CClearPassElement::CClearPassElement(const CClearPassElement::SClearData& data_) : data(data_) {
CClearPassElement::CClearPassElement(const CClearPassElement::SClearData& data_) : m_data(data_) {
;
}
void CClearPassElement::draw(const CRegion& damage) {
g_pHyprOpenGL->clear(data.color);
g_pHyprOpenGL->clear(m_data.color);
}
bool CClearPassElement::needsLiveBlur() {

View file

@ -21,5 +21,5 @@ class CClearPassElement : public IPassElement {
}
private:
SClearData data;
SClearData m_data;
};

View file

@ -1,18 +1,18 @@
#include "FramebufferElement.hpp"
#include "../OpenGL.hpp"
CFramebufferElement::CFramebufferElement(const CFramebufferElement::SFramebufferElementData& data_) : data(data_) {
CFramebufferElement::CFramebufferElement(const CFramebufferElement::SFramebufferElementData& data_) : m_data(data_) {
;
}
void CFramebufferElement::draw(const CRegion& damage) {
CFramebuffer* fb = nullptr;
if (data.main) {
switch (data.framebufferID) {
case FB_MONITOR_RENDER_MAIN: fb = g_pHyprOpenGL->m_RenderData.mainFB; break;
case FB_MONITOR_RENDER_CURRENT: fb = g_pHyprOpenGL->m_RenderData.currentFB; break;
case FB_MONITOR_RENDER_OUT: fb = g_pHyprOpenGL->m_RenderData.outFB; break;
if (m_data.main) {
switch (m_data.framebufferID) {
case FB_MONITOR_RENDER_MAIN: fb = g_pHyprOpenGL->m_renderData.mainFB; break;
case FB_MONITOR_RENDER_CURRENT: fb = g_pHyprOpenGL->m_renderData.currentFB; break;
case FB_MONITOR_RENDER_OUT: fb = g_pHyprOpenGL->m_renderData.outFB; break;
}
if (!fb) {
@ -21,13 +21,13 @@ void CFramebufferElement::draw(const CRegion& damage) {
}
} else {
switch (data.framebufferID) {
case FB_MONITOR_RENDER_EXTRA_OFFLOAD: fb = &g_pHyprOpenGL->m_RenderData.pCurrentMonData->offloadFB; break;
case FB_MONITOR_RENDER_EXTRA_MIRROR: fb = &g_pHyprOpenGL->m_RenderData.pCurrentMonData->mirrorFB; break;
case FB_MONITOR_RENDER_EXTRA_MIRROR_SWAP: fb = &g_pHyprOpenGL->m_RenderData.pCurrentMonData->mirrorSwapFB; break;
case FB_MONITOR_RENDER_EXTRA_OFF_MAIN: fb = &g_pHyprOpenGL->m_RenderData.pCurrentMonData->offMainFB; break;
case FB_MONITOR_RENDER_EXTRA_MONITOR_MIRROR: fb = &g_pHyprOpenGL->m_RenderData.pCurrentMonData->monitorMirrorFB; break;
case FB_MONITOR_RENDER_EXTRA_BLUR: fb = &g_pHyprOpenGL->m_RenderData.pCurrentMonData->blurFB; break;
switch (m_data.framebufferID) {
case FB_MONITOR_RENDER_EXTRA_OFFLOAD: fb = &g_pHyprOpenGL->m_renderData.pCurrentMonData->offloadFB; break;
case FB_MONITOR_RENDER_EXTRA_MIRROR: fb = &g_pHyprOpenGL->m_renderData.pCurrentMonData->mirrorFB; break;
case FB_MONITOR_RENDER_EXTRA_MIRROR_SWAP: fb = &g_pHyprOpenGL->m_renderData.pCurrentMonData->mirrorSwapFB; break;
case FB_MONITOR_RENDER_EXTRA_OFF_MAIN: fb = &g_pHyprOpenGL->m_renderData.pCurrentMonData->offMainFB; break;
case FB_MONITOR_RENDER_EXTRA_MONITOR_MIRROR: fb = &g_pHyprOpenGL->m_renderData.pCurrentMonData->monitorMirrorFB; break;
case FB_MONITOR_RENDER_EXTRA_BLUR: fb = &g_pHyprOpenGL->m_renderData.pCurrentMonData->blurFB; break;
}
if (!fb) {

View file

@ -21,5 +21,5 @@ class CFramebufferElement : public IPassElement {
}
private:
SFramebufferElementData data;
SFramebufferElementData m_data;
};

View file

@ -15,11 +15,11 @@ bool CRenderPass::empty() const {
}
bool CRenderPass::single() const {
return m_vPassElements.size() == 1;
return m_passElements.size() == 1;
}
void CRenderPass::add(SP<IPassElement> el) {
m_vPassElements.emplace_back(makeShared<SPassElementData>(CRegion{}, el));
m_passElements.emplace_back(makeShared<SPassElementData>(CRegion{}, el));
}
void CRenderPass::simplify() {
@ -28,10 +28,10 @@ void CRenderPass::simplify() {
// 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
const auto WILLBLUR = std::ranges::any_of(m_vPassElements, [](const auto& el) { return el->element->needsLiveBlur(); });
const auto WILLBLUR = std::ranges::any_of(m_passElements, [](const auto& el) { return el->element->needsLiveBlur(); });
CRegion newDamage = damage.copy().intersect(CBox{{}, g_pHyprOpenGL->m_RenderData.pMonitor->m_transformedSize});
for (auto& el : m_vPassElements | std::views::reverse) {
CRegion newDamage = m_damage.copy().intersect(CBox{{}, g_pHyprOpenGL->m_renderData.pMonitor->m_transformedSize});
for (auto& el : m_passElements | std::views::reverse) {
if (newDamage.empty() && !el->element->undiscardable()) {
el->discard = true;
@ -43,7 +43,7 @@ void CRenderPass::simplify() {
if (!bb1 || newDamage.empty())
continue;
auto bb = bb1->scale(g_pHyprOpenGL->m_RenderData.pMonitor->m_scale);
auto bb = bb1->scale(g_pHyprOpenGL->m_renderData.pMonitor->m_scale);
// drop if empty
if (CRegion copy = newDamage.copy(); copy.intersect(bb).empty()) {
@ -54,13 +54,13 @@ void CRenderPass::simplify() {
auto opaque = el->element->opaqueRegion();
if (!opaque.empty()) {
opaque.scale(g_pHyprOpenGL->m_RenderData.pMonitor->m_scale);
opaque.scale(g_pHyprOpenGL->m_renderData.pMonitor->m_scale);
// if this intersects the liveBlur region, allow live blur to operate correctly.
// do not occlude a border near it.
if (WILLBLUR) {
CRegion liveBlurRegion;
for (auto& el2 : m_vPassElements) {
for (auto& el2 : m_passElements) {
// if we reach self, no problem, we can break.
// if the blur is above us, we don't care, it will work fine.
if (el2 == el)
@ -76,7 +76,7 @@ void CRenderPass::simplify() {
}
// expand the region: this area needs to be proper to blur it right.
liveBlurRegion.scale(g_pHyprOpenGL->m_RenderData.pMonitor->m_scale).expand(oneBlurRadius() * 2.F);
liveBlurRegion.scale(g_pHyprOpenGL->m_renderData.pMonitor->m_scale).expand(oneBlurRadius() * 2.F);
if (auto infringement = opaque.copy().intersect(liveBlurRegion); !infringement.empty()) {
// eh, this is not the correct solution, but it will do...
@ -86,57 +86,57 @@ void CRenderPass::simplify() {
}
newDamage.subtract(opaque);
if (*PDEBUGPASS)
occludedRegions.emplace_back(opaque);
m_occludedRegions.emplace_back(opaque);
}
}
if (*PDEBUGPASS) {
for (auto& el2 : m_vPassElements) {
for (auto& el2 : m_passElements) {
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->copy().scale(g_pHyprOpenGL->m_RenderData.pMonitor->m_scale));
m_totalLiveBlurRegion.add(BB->copy().scale(g_pHyprOpenGL->m_renderData.pMonitor->m_scale));
}
}
}
void CRenderPass::clear() {
m_vPassElements.clear();
m_passElements.clear();
}
CRegion CRenderPass::render(const CRegion& damage_) {
static auto PDEBUGPASS = CConfigValue<Hyprlang::INT>("debug:pass");
const auto WILLBLUR = std::ranges::any_of(m_vPassElements, [](const auto& el) { return el->element->needsLiveBlur(); });
const auto WILLBLUR = std::ranges::any_of(m_passElements, [](const auto& el) { return el->element->needsLiveBlur(); });
damage = *PDEBUGPASS ? CRegion{CBox{{}, {INT32_MAX, INT32_MAX}}} : damage_.copy();
m_damage = *PDEBUGPASS ? CRegion{CBox{{}, {INT32_MAX, INT32_MAX}}} : damage_.copy();
if (*PDEBUGPASS) {
occludedRegions.clear();
totalLiveBlurRegion = CRegion{};
m_occludedRegions.clear();
m_totalLiveBlurRegion = CRegion{};
}
if (damage.empty()) {
g_pHyprOpenGL->m_RenderData.damage = damage;
g_pHyprOpenGL->m_RenderData.finalDamage = damage;
return damage;
if (m_damage.empty()) {
g_pHyprOpenGL->m_renderData.damage = m_damage;
g_pHyprOpenGL->m_renderData.finalDamage = m_damage;
return m_damage;
}
if (!*PDEBUGPASS && debugData.present)
debugData = {false};
else if (*PDEBUGPASS && !debugData.present) {
debugData.present = true;
debugData.keyboardFocusText = g_pHyprOpenGL->renderText("keyboard", Colors::WHITE, 12);
debugData.pointerFocusText = g_pHyprOpenGL->renderText("pointer", Colors::WHITE, 12);
debugData.lastWindowText = g_pHyprOpenGL->renderText("lastWindow", Colors::WHITE, 12);
if (!*PDEBUGPASS && m_debugData.present)
m_debugData = {false};
else if (*PDEBUGPASS && !m_debugData.present) {
m_debugData.present = true;
m_debugData.keyboardFocusText = g_pHyprOpenGL->renderText("keyboard", Colors::WHITE, 12);
m_debugData.pointerFocusText = g_pHyprOpenGL->renderText("pointer", Colors::WHITE, 12);
m_debugData.lastWindowText = g_pHyprOpenGL->renderText("lastWindow", Colors::WHITE, 12);
}
if (WILLBLUR && !*PDEBUGPASS) {
// combine blur regions into one that will be expanded
CRegion blurRegion;
for (auto& el : m_vPassElements) {
for (auto& el : m_passElements) {
if (!el->element->needsLiveBlur())
continue;
@ -146,40 +146,40 @@ CRegion CRenderPass::render(const CRegion& damage_) {
blurRegion.add(*BB);
}
blurRegion.scale(g_pHyprOpenGL->m_RenderData.pMonitor->m_scale);
blurRegion.scale(g_pHyprOpenGL->m_renderData.pMonitor->m_scale);
blurRegion.intersect(damage).expand(oneBlurRadius());
blurRegion.intersect(m_damage).expand(oneBlurRadius());
g_pHyprOpenGL->m_RenderData.finalDamage = blurRegion.copy().add(damage);
g_pHyprOpenGL->m_renderData.finalDamage = blurRegion.copy().add(m_damage);
// FIXME: why does this break on * 1.F ?
// used to work when we expand all the damage... I think? Well, before pass.
// moving a window over blur shows the edges being wonk.
blurRegion.expand(oneBlurRadius() * 1.5F);
damage = blurRegion.copy().add(damage);
m_damage = blurRegion.copy().add(m_damage);
} else
g_pHyprOpenGL->m_RenderData.finalDamage = damage;
g_pHyprOpenGL->m_renderData.finalDamage = m_damage;
if (std::ranges::any_of(m_vPassElements, [](const auto& el) { return el->element->disableSimplification(); })) {
for (auto& el : m_vPassElements) {
el->elementDamage = damage;
if (std::ranges::any_of(m_passElements, [](const auto& el) { return el->element->disableSimplification(); })) {
for (auto& el : m_passElements) {
el->elementDamage = m_damage;
}
} else
simplify();
g_pHyprOpenGL->m_RenderData.pCurrentMonData->blurFBShouldRender = std::ranges::any_of(m_vPassElements, [](const auto& el) { return el->element->needsPrecomputeBlur(); });
g_pHyprOpenGL->m_renderData.pCurrentMonData->blurFBShouldRender = std::ranges::any_of(m_passElements, [](const auto& el) { return el->element->needsPrecomputeBlur(); });
if (m_vPassElements.empty())
if (m_passElements.empty())
return {};
for (auto& el : m_vPassElements) {
for (auto& el : m_passElements) {
if (el->discard) {
el->element->discard();
continue;
}
g_pHyprOpenGL->m_RenderData.damage = el->elementDamage;
g_pHyprOpenGL->m_renderData.damage = el->elementDamage;
el->element->draw(el->elementDamage);
}
@ -192,16 +192,16 @@ CRegion CRenderPass::render(const CRegion& damage_) {
});
}
g_pHyprOpenGL->m_RenderData.damage = damage;
return damage;
g_pHyprOpenGL->m_renderData.damage = m_damage;
return m_damage;
}
void CRenderPass::renderDebugData() {
CBox box = {{}, g_pHyprOpenGL->m_RenderData.pMonitor->m_transformedSize};
for (const auto& rg : occludedRegions) {
CBox box = {{}, g_pHyprOpenGL->m_renderData.pMonitor->m_transformedSize};
for (const auto& rg : m_occludedRegions) {
g_pHyprOpenGL->renderRectWithDamage(box, Colors::RED.modifyA(0.1F), rg);
}
g_pHyprOpenGL->renderRectWithDamage(box, Colors::GREEN.modifyA(0.1F), totalLiveBlurRegion);
g_pHyprOpenGL->renderRectWithDamage(box, Colors::GREEN.modifyA(0.1F), m_totalLiveBlurRegion);
std::unordered_map<CWLSurfaceResource*, float> offsets;
@ -219,9 +219,9 @@ void CRenderPass::renderDebugData() {
if (!bb.has_value())
return;
CBox box = bb->copy().translate(-g_pHyprOpenGL->m_RenderData.pMonitor->m_position).scale(g_pHyprOpenGL->m_RenderData.pMonitor->m_scale);
CBox box = bb->copy().translate(-g_pHyprOpenGL->m_renderData.pMonitor->m_position).scale(g_pHyprOpenGL->m_renderData.pMonitor->m_scale);
if (box.intersection(CBox{{}, g_pHyprOpenGL->m_RenderData.pMonitor->m_size}).empty())
if (box.intersection(CBox{{}, g_pHyprOpenGL->m_renderData.pMonitor->m_size}).empty())
return;
g_pHyprOpenGL->renderRectWithDamage(box, color, CRegion{0, 0, INT32_MAX, INT32_MAX});
@ -231,17 +231,17 @@ void CRenderPass::renderDebugData() {
else
offsets[surface.get()] = 0;
box = {box.pos(), texture->m_vSize};
box = {box.pos(), texture->m_size};
g_pHyprOpenGL->renderRectWithDamage(box, CHyprColor{0.F, 0.F, 0.F, 0.2F}, CRegion{0, 0, INT32_MAX, INT32_MAX}, std::min(5.0, box.size().y));
g_pHyprOpenGL->renderTexture(texture, box, 1.F);
offsets[surface.get()] += texture->m_vSize.y;
offsets[surface.get()] += texture->m_size.y;
};
renderHLSurface(debugData.keyboardFocusText, g_pSeatManager->m_state.keyboardFocus.lock(), Colors::PURPLE.modifyA(0.1F));
renderHLSurface(debugData.pointerFocusText, g_pSeatManager->m_state.pointerFocus.lock(), Colors::ORANGE.modifyA(0.1F));
renderHLSurface(m_debugData.keyboardFocusText, g_pSeatManager->m_state.keyboardFocus.lock(), Colors::PURPLE.modifyA(0.1F));
renderHLSurface(m_debugData.pointerFocusText, g_pSeatManager->m_state.pointerFocus.lock(), Colors::ORANGE.modifyA(0.1F));
if (g_pCompositor->m_lastWindow)
renderHLSurface(debugData.lastWindowText, g_pCompositor->m_lastWindow->m_wlSurface->resource(), Colors::LIGHT_BLUE.modifyA(0.1F));
renderHLSurface(m_debugData.lastWindowText, g_pCompositor->m_lastWindow->m_wlSurface->resource(), Colors::LIGHT_BLUE.modifyA(0.1F));
if (g_pSeatManager->m_state.pointerFocus) {
if (g_pSeatManager->m_state.pointerFocus->m_current.input.intersect(CBox{{}, g_pSeatManager->m_state.pointerFocus->m_current.size}).getExtents().size() !=
@ -251,28 +251,28 @@ void CRenderPass::renderDebugData() {
auto BOX = hlSurface->getSurfaceBoxGlobal();
if (BOX) {
auto region = g_pSeatManager->m_state.pointerFocus->m_current.input.copy()
.scale(g_pHyprOpenGL->m_RenderData.pMonitor->m_scale)
.translate(BOX->pos() - g_pHyprOpenGL->m_RenderData.pMonitor->m_position);
.scale(g_pHyprOpenGL->m_renderData.pMonitor->m_scale)
.translate(BOX->pos() - g_pHyprOpenGL->m_renderData.pMonitor->m_position);
g_pHyprOpenGL->renderRectWithDamage(box, CHyprColor{0.8F, 0.8F, 0.2F, 0.4F}, region);
}
}
}
}
const auto DISCARDED_ELEMENTS = std::count_if(m_vPassElements.begin(), m_vPassElements.end(), [](const auto& e) { return e->discard; });
auto tex = g_pHyprOpenGL->renderText(std::format("occlusion layers: {}\npass elements: {} ({} discarded)\nviewport: {:X0}", occludedRegions.size(), m_vPassElements.size(),
DISCARDED_ELEMENTS, g_pHyprOpenGL->m_RenderData.pMonitor->m_pixelSize),
const auto DISCARDED_ELEMENTS = std::count_if(m_passElements.begin(), m_passElements.end(), [](const auto& e) { return e->discard; });
auto tex = g_pHyprOpenGL->renderText(std::format("occlusion layers: {}\npass elements: {} ({} discarded)\nviewport: {:X0}", m_occludedRegions.size(), m_passElements.size(),
DISCARDED_ELEMENTS, g_pHyprOpenGL->m_renderData.pMonitor->m_pixelSize),
Colors::WHITE, 12);
if (tex) {
box = CBox{{0.F, g_pHyprOpenGL->m_RenderData.pMonitor->m_size.y - tex->m_vSize.y}, tex->m_vSize}.scale(g_pHyprOpenGL->m_RenderData.pMonitor->m_scale);
box = CBox{{0.F, g_pHyprOpenGL->m_renderData.pMonitor->m_size.y - tex->m_size.y}, tex->m_size}.scale(g_pHyprOpenGL->m_renderData.pMonitor->m_scale);
g_pHyprOpenGL->renderTexture(tex, box, 1.F);
}
std::string passStructure;
auto yn = [](const bool val) -> const char* { return val ? "yes" : "no"; };
auto tick = [](const bool val) -> const char* { return val ? "" : ""; };
for (const auto& el : m_vPassElements | std::views::reverse) {
for (const auto& el : m_passElements | std::views::reverse) {
passStructure += std::format("{} {} (bb: {} op: {})\n", tick(!el->discard), el->element->passName(), yn(el->element->boundingBox().has_value()),
yn(!el->element->opaqueRegion().empty()));
}
@ -282,8 +282,8 @@ void CRenderPass::renderDebugData() {
tex = g_pHyprOpenGL->renderText(passStructure, Colors::WHITE, 12);
if (tex) {
box = CBox{{g_pHyprOpenGL->m_RenderData.pMonitor->m_size.x - tex->m_vSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->m_size.y - tex->m_vSize.y}, tex->m_vSize}.scale(
g_pHyprOpenGL->m_RenderData.pMonitor->m_scale);
box = CBox{{g_pHyprOpenGL->m_renderData.pMonitor->m_size.x - tex->m_size.x, g_pHyprOpenGL->m_renderData.pMonitor->m_size.y - tex->m_size.y}, tex->m_size}.scale(
g_pHyprOpenGL->m_renderData.pMonitor->m_scale);
g_pHyprOpenGL->renderTexture(tex, box, 1.F);
}
}
@ -296,5 +296,5 @@ float CRenderPass::oneBlurRadius() {
}
void CRenderPass::removeAllOfType(const std::string& type) {
std::erase_if(m_vPassElements, [&type](const auto& e) { return e->element->passName() == type; });
std::erase_if(m_passElements, [&type](const auto& e) { return e->element->passName() == type; });
}

View file

@ -18,9 +18,9 @@ class CRenderPass {
CRegion render(const CRegion& damage_);
private:
CRegion damage;
std::vector<CRegion> occludedRegions;
CRegion totalLiveBlurRegion;
CRegion m_damage;
std::vector<CRegion> m_occludedRegions;
CRegion m_totalLiveBlurRegion;
struct SPassElementData {
CRegion elementDamage;
@ -28,9 +28,7 @@ class CRenderPass {
bool discard = false;
};
std::vector<SP<SPassElementData>> m_vPassElements;
SP<IPassElement> currentPassInfo = nullptr;
std::vector<SP<SPassElementData>> m_passElements;
void simplify();
float oneBlurRadius();
@ -39,7 +37,7 @@ class CRenderPass {
struct {
bool present = false;
SP<CTexture> keyboardFocusText, pointerFocusText, lastWindowText;
} debugData;
} m_debugData;
friend class CHyprOpenGLImpl;
};

View file

@ -1,45 +1,45 @@
#include "RectPassElement.hpp"
#include "../OpenGL.hpp"
CRectPassElement::CRectPassElement(const CRectPassElement::SRectData& data_) : data(data_) {
CRectPassElement::CRectPassElement(const CRectPassElement::SRectData& data_) : m_data(data_) {
;
}
void CRectPassElement::draw(const CRegion& damage) {
if (data.box.w <= 0 || data.box.h <= 0)
if (m_data.box.w <= 0 || m_data.box.h <= 0)
return;
if (!data.clipBox.empty())
g_pHyprOpenGL->m_RenderData.clipBox = data.clipBox;
if (!m_data.clipBox.empty())
g_pHyprOpenGL->m_renderData.clipBox = m_data.clipBox;
if (data.color.a == 1.F || !data.blur)
g_pHyprOpenGL->renderRectWithDamage(data.box, data.color, damage, data.round, data.roundingPower);
if (m_data.color.a == 1.F || !m_data.blur)
g_pHyprOpenGL->renderRectWithDamage(m_data.box, m_data.color, damage, m_data.round, m_data.roundingPower);
else
g_pHyprOpenGL->renderRectWithBlur(data.box, data.color, data.round, data.roundingPower, data.blurA, data.xray);
g_pHyprOpenGL->renderRectWithBlur(m_data.box, m_data.color, m_data.round, m_data.roundingPower, m_data.blurA, m_data.xray);
g_pHyprOpenGL->m_RenderData.clipBox = {};
g_pHyprOpenGL->m_renderData.clipBox = {};
}
bool CRectPassElement::needsLiveBlur() {
return data.color.a < 1.F && !data.xray && data.blur;
return m_data.color.a < 1.F && !m_data.xray && m_data.blur;
}
bool CRectPassElement::needsPrecomputeBlur() {
return data.color.a < 1.F && data.xray && data.blur;
return m_data.color.a < 1.F && m_data.xray && m_data.blur;
}
std::optional<CBox> CRectPassElement::boundingBox() {
return data.box.copy().scale(1.F / g_pHyprOpenGL->m_RenderData.pMonitor->m_scale).round();
return m_data.box.copy().scale(1.F / g_pHyprOpenGL->m_renderData.pMonitor->m_scale).round();
}
CRegion CRectPassElement::opaqueRegion() {
if (data.color.a < 1.F)
if (m_data.color.a < 1.F)
return CRegion{};
CRegion rg = boundingBox()->expand(-data.round);
CRegion rg = boundingBox()->expand(-m_data.round);
if (!data.clipBox.empty())
rg.intersect(data.clipBox);
if (!m_data.clipBox.empty())
rg.intersect(m_data.clipBox);
return rg;
}

View file

@ -27,5 +27,5 @@ class CRectPassElement : public IPassElement {
}
private:
SRectData data;
SRectData m_data;
};

View file

@ -1,13 +1,13 @@
#include "RendererHintsPassElement.hpp"
#include "../OpenGL.hpp"
CRendererHintsPassElement::CRendererHintsPassElement(const CRendererHintsPassElement::SData& data_) : data(data_) {
CRendererHintsPassElement::CRendererHintsPassElement(const CRendererHintsPassElement::SData& data_) : m_data(data_) {
;
}
void CRendererHintsPassElement::draw(const CRegion& damage) {
if (data.renderModif.has_value())
g_pHyprOpenGL->m_RenderData.renderModif = *data.renderModif;
if (m_data.renderModif.has_value())
g_pHyprOpenGL->m_renderData.renderModif = *m_data.renderModif;
}
bool CRendererHintsPassElement::needsLiveBlur() {

View file

@ -22,5 +22,5 @@ class CRendererHintsPassElement : public IPassElement {
}
private:
SData data;
SData m_data;
};

View file

@ -2,12 +2,12 @@
#include "../OpenGL.hpp"
#include "../decorations/CHyprDropShadowDecoration.hpp"
CShadowPassElement::CShadowPassElement(const CShadowPassElement::SShadowData& data_) : data(data_) {
CShadowPassElement::CShadowPassElement(const CShadowPassElement::SShadowData& data_) : m_data(data_) {
;
}
void CShadowPassElement::draw(const CRegion& damage) {
data.deco->render(g_pHyprOpenGL->m_RenderData.pMonitor.lock(), data.a);
m_data.deco->render(g_pHyprOpenGL->m_renderData.pMonitor.lock(), m_data.a);
}
bool CShadowPassElement::needsLiveBlur() {

View file

@ -22,5 +22,5 @@ class CShadowPassElement : public IPassElement {
}
private:
SShadowData data;
SShadowData m_data;
};

View file

@ -12,59 +12,59 @@
#include <hyprutils/utils/ScopeGuard.hpp>
using namespace Hyprutils::Utils;
CSurfacePassElement::CSurfacePassElement(const CSurfacePassElement::SRenderData& data_) : data(data_) {
CSurfacePassElement::CSurfacePassElement(const CSurfacePassElement::SRenderData& data_) : m_data(data_) {
;
}
void CSurfacePassElement::draw(const CRegion& damage) {
g_pHyprOpenGL->m_RenderData.currentWindow = data.pWindow;
g_pHyprOpenGL->m_RenderData.surface = data.surface;
g_pHyprOpenGL->m_RenderData.currentLS = data.pLS;
g_pHyprOpenGL->m_RenderData.clipBox = data.clipBox;
g_pHyprOpenGL->m_RenderData.discardMode = data.discardMode;
g_pHyprOpenGL->m_RenderData.discardOpacity = data.discardOpacity;
g_pHyprOpenGL->m_RenderData.useNearestNeighbor = data.useNearestNeighbor;
g_pHyprOpenGL->m_bEndFrame = data.flipEndFrame;
g_pHyprOpenGL->m_renderData.currentWindow = m_data.pWindow;
g_pHyprOpenGL->m_renderData.surface = m_data.surface;
g_pHyprOpenGL->m_renderData.currentLS = m_data.pLS;
g_pHyprOpenGL->m_renderData.clipBox = m_data.clipBox;
g_pHyprOpenGL->m_renderData.discardMode = m_data.discardMode;
g_pHyprOpenGL->m_renderData.discardOpacity = m_data.discardOpacity;
g_pHyprOpenGL->m_renderData.useNearestNeighbor = m_data.useNearestNeighbor;
g_pHyprOpenGL->m_endFrame = m_data.flipEndFrame;
CScopeGuard x = {[]() {
g_pHyprOpenGL->m_RenderData.primarySurfaceUVTopLeft = Vector2D(-1, -1);
g_pHyprOpenGL->m_RenderData.primarySurfaceUVBottomRight = Vector2D(-1, -1);
g_pHyprOpenGL->m_RenderData.useNearestNeighbor = false;
g_pHyprOpenGL->m_RenderData.clipBox = {};
g_pHyprOpenGL->m_RenderData.clipRegion = {};
g_pHyprOpenGL->m_RenderData.discardMode = 0;
g_pHyprOpenGL->m_RenderData.discardOpacity = 0;
g_pHyprOpenGL->m_RenderData.useNearestNeighbor = false;
g_pHyprOpenGL->m_bEndFrame = false;
g_pHyprOpenGL->m_RenderData.currentWindow.reset();
g_pHyprOpenGL->m_RenderData.surface.reset();
g_pHyprOpenGL->m_RenderData.currentLS.reset();
g_pHyprOpenGL->m_renderData.primarySurfaceUVTopLeft = Vector2D(-1, -1);
g_pHyprOpenGL->m_renderData.primarySurfaceUVBottomRight = Vector2D(-1, -1);
g_pHyprOpenGL->m_renderData.useNearestNeighbor = false;
g_pHyprOpenGL->m_renderData.clipBox = {};
g_pHyprOpenGL->m_renderData.clipRegion = {};
g_pHyprOpenGL->m_renderData.discardMode = 0;
g_pHyprOpenGL->m_renderData.discardOpacity = 0;
g_pHyprOpenGL->m_renderData.useNearestNeighbor = false;
g_pHyprOpenGL->m_endFrame = false;
g_pHyprOpenGL->m_renderData.currentWindow.reset();
g_pHyprOpenGL->m_renderData.surface.reset();
g_pHyprOpenGL->m_renderData.currentLS.reset();
}};
if (!data.texture)
if (!m_data.texture)
return;
const auto& TEXTURE = data.texture;
const auto& TEXTURE = m_data.texture;
// this is bad, probably has been logged elsewhere. Means the texture failed
// uploading to the GPU.
if (!TEXTURE->m_iTexID)
if (!TEXTURE->m_texID)
return;
const auto INTERACTIVERESIZEINPROGRESS = data.pWindow && g_pInputManager->m_currentlyDraggedWindow && g_pInputManager->m_dragMode == MBIND_RESIZE;
const auto INTERACTIVERESIZEINPROGRESS = m_data.pWindow && g_pInputManager->m_currentlyDraggedWindow && g_pInputManager->m_dragMode == MBIND_RESIZE;
TRACY_GPU_ZONE("RenderSurface");
auto PSURFACE = CWLSurface::fromResource(data.surface);
auto PSURFACE = CWLSurface::fromResource(m_data.surface);
const float ALPHA = data.alpha * data.fadeAlpha * (PSURFACE ? PSURFACE->m_alphaModifier : 1.F);
const float ALPHA = m_data.alpha * m_data.fadeAlpha * (PSURFACE ? PSURFACE->m_alphaModifier : 1.F);
const float OVERALL_ALPHA = PSURFACE ? PSURFACE->m_overallOpacity : 1.F;
const bool BLUR = data.blur && (!TEXTURE->m_bOpaque || ALPHA < 1.F || OVERALL_ALPHA < 1.F);
const bool BLUR = m_data.blur && (!TEXTURE->m_opaque || ALPHA < 1.F || OVERALL_ALPHA < 1.F);
auto windowBox = getTexBox();
const auto PROJSIZEUNSCALED = windowBox.size();
windowBox.scale(data.pMonitor->m_scale);
windowBox.scale(m_data.pMonitor->m_scale);
windowBox.round();
if (windowBox.width <= 1 || windowBox.height <= 1) {
@ -72,17 +72,17 @@ void CSurfacePassElement::draw(const CRegion& damage) {
return;
}
const bool MISALIGNEDFSV1 = std::floor(data.pMonitor->m_scale) != data.pMonitor->m_scale /* Fractional */ && data.surface->m_current.scale == 1 /* fs protocol */ &&
windowBox.size() != data.surface->m_current.bufferSize /* misaligned */ && DELTALESSTHAN(windowBox.width, data.surface->m_current.bufferSize.x, 3) &&
DELTALESSTHAN(windowBox.height, data.surface->m_current.bufferSize.y, 3) /* off by one-or-two */ &&
(!data.pWindow || (!data.pWindow->m_realSize->isBeingAnimated() && !INTERACTIVERESIZEINPROGRESS)) /* not window or not animated/resizing */;
const bool MISALIGNEDFSV1 = std::floor(m_data.pMonitor->m_scale) != m_data.pMonitor->m_scale /* Fractional */ && m_data.surface->m_current.scale == 1 /* fs protocol */ &&
windowBox.size() != m_data.surface->m_current.bufferSize /* misaligned */ && DELTALESSTHAN(windowBox.width, m_data.surface->m_current.bufferSize.x, 3) &&
DELTALESSTHAN(windowBox.height, m_data.surface->m_current.bufferSize.y, 3) /* off by one-or-two */ &&
(!m_data.pWindow || (!m_data.pWindow->m_realSize->isBeingAnimated() && !INTERACTIVERESIZEINPROGRESS)) /* not window or not animated/resizing */;
if (data.surface->m_colorManagement.valid())
if (m_data.surface->m_colorManagement.valid())
Debug::log(TRACE, "FIXME: rendering surface with color management enabled, should apply necessary transformations");
g_pHyprRenderer->calculateUVForSurface(data.pWindow, data.surface, data.pMonitor->m_self.lock(), data.mainSurface, windowBox.size(), PROJSIZEUNSCALED, MISALIGNEDFSV1);
g_pHyprRenderer->calculateUVForSurface(m_data.pWindow, m_data.surface, m_data.pMonitor->m_self.lock(), m_data.mainSurface, windowBox.size(), PROJSIZEUNSCALED, MISALIGNEDFSV1);
auto cancelRender = false;
g_pHyprOpenGL->m_RenderData.clipRegion = visibleRegion(cancelRender);
g_pHyprOpenGL->m_renderData.clipRegion = visibleRegion(cancelRender);
if (cancelRender)
return;
@ -91,19 +91,19 @@ void CSurfacePassElement::draw(const CRegion& damage) {
// as long as the window is not animated. During those it'd look weird.
// UV will fixup it as well
if (MISALIGNEDFSV1)
g_pHyprOpenGL->m_RenderData.useNearestNeighbor = true;
g_pHyprOpenGL->m_renderData.useNearestNeighbor = true;
float rounding = data.rounding;
float roundingPower = data.roundingPower;
float rounding = m_data.rounding;
float roundingPower = m_data.roundingPower;
rounding -= 1; // to fix a border issue
if (data.dontRound) {
if (m_data.dontRound) {
rounding = 0;
roundingPower = 2.0f;
}
const bool WINDOWOPAQUE = data.pWindow && data.pWindow->m_wlSurface->resource() == data.surface ? data.pWindow->opaque() : false;
const bool WINDOWOPAQUE = m_data.pWindow && m_data.pWindow->m_wlSurface->resource() == m_data.surface ? m_data.pWindow->opaque() : false;
const bool CANDISABLEBLEND = ALPHA >= 1.f && OVERALL_ALPHA >= 1.f && rounding == 0 && WINDOWOPAQUE;
if (CANDISABLEBLEND)
@ -114,38 +114,38 @@ void CSurfacePassElement::draw(const CRegion& damage) {
// FIXME: This is wrong and will bug the blur out as shit if the first surface
// is a subsurface that does NOT cover the entire frame. In such cases, we probably should fall back
// to what we do for misaligned surfaces (blur the entire thing and then render shit without blur)
if (data.surfaceCounter == 0 && !data.popup) {
if (m_data.surfaceCounter == 0 && !m_data.popup) {
if (BLUR)
g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, windowBox, ALPHA, data.surface, rounding, roundingPower, data.blockBlurOptimization, data.fadeAlpha, OVERALL_ALPHA);
g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, windowBox, ALPHA, m_data.surface, rounding, roundingPower, m_data.blockBlurOptimization, m_data.fadeAlpha, OVERALL_ALPHA);
else
g_pHyprOpenGL->renderTexture(TEXTURE, windowBox, ALPHA * OVERALL_ALPHA, rounding, roundingPower, false, true);
} else {
if (BLUR && data.popup)
g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, windowBox, ALPHA, data.surface, rounding, roundingPower, true, data.fadeAlpha, OVERALL_ALPHA);
if (BLUR && m_data.popup)
g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, windowBox, ALPHA, m_data.surface, rounding, roundingPower, true, m_data.fadeAlpha, OVERALL_ALPHA);
else
g_pHyprOpenGL->renderTexture(TEXTURE, windowBox, ALPHA * OVERALL_ALPHA, rounding, roundingPower, false, true);
}
if (!g_pHyprRenderer->m_bBlockSurfaceFeedback)
data.surface->presentFeedback(data.when, data.pMonitor->m_self.lock());
m_data.surface->presentFeedback(m_data.when, m_data.pMonitor->m_self.lock());
// add async (dmabuf) buffers to usedBuffers so we can handle release later
// sync (shm) buffers will be released in commitState, so no need to track them here
if (data.surface->m_current.buffer && !data.surface->m_current.buffer->isSynchronous())
g_pHyprRenderer->usedAsyncBuffers.emplace_back(data.surface->m_current.buffer);
if (m_data.surface->m_current.buffer && !m_data.surface->m_current.buffer->isSynchronous())
g_pHyprRenderer->m_usedAsyncBuffers.emplace_back(m_data.surface->m_current.buffer);
g_pHyprOpenGL->blend(true);
}
CBox CSurfacePassElement::getTexBox() {
const double outputX = -data.pMonitor->m_position.x, outputY = -data.pMonitor->m_position.y;
const double outputX = -m_data.pMonitor->m_position.x, outputY = -m_data.pMonitor->m_position.y;
const auto INTERACTIVERESIZEINPROGRESS = data.pWindow && g_pInputManager->m_currentlyDraggedWindow && g_pInputManager->m_dragMode == MBIND_RESIZE;
auto PSURFACE = CWLSurface::fromResource(data.surface);
const auto INTERACTIVERESIZEINPROGRESS = m_data.pWindow && g_pInputManager->m_currentlyDraggedWindow && g_pInputManager->m_dragMode == MBIND_RESIZE;
auto PSURFACE = CWLSurface::fromResource(m_data.surface);
CBox windowBox;
if (data.surface && data.mainSurface) {
windowBox = {(int)outputX + data.pos.x + data.localPos.x, (int)outputY + data.pos.y + data.localPos.y, data.w, data.h};
if (m_data.surface && m_data.mainSurface) {
windowBox = {(int)outputX + m_data.pos.x + m_data.localPos.x, (int)outputY + m_data.pos.y + m_data.localPos.y, m_data.w, m_data.h};
// however, if surface buffer w / h < box, we need to adjust them
const auto PWINDOW = PSURFACE ? PSURFACE->getWindow() : nullptr;
@ -167,49 +167,49 @@ CBox CSurfacePassElement::getTexBox() {
}
} else { // here we clamp to 2, these might be some tiny specks
windowBox = {(int)outputX + data.pos.x + data.localPos.x, (int)outputY + data.pos.y + data.localPos.y, std::max((float)data.surface->m_current.size.x, 2.F),
std::max((float)data.surface->m_current.size.y, 2.F)};
if (data.pWindow && data.pWindow->m_realSize->isBeingAnimated() && data.surface && !data.mainSurface && data.squishOversized /* subsurface */) {
windowBox = {(int)outputX + m_data.pos.x + m_data.localPos.x, (int)outputY + m_data.pos.y + m_data.localPos.y, std::max((float)m_data.surface->m_current.size.x, 2.F),
std::max((float)m_data.surface->m_current.size.y, 2.F)};
if (m_data.pWindow && m_data.pWindow->m_realSize->isBeingAnimated() && m_data.surface && !m_data.mainSurface && m_data.squishOversized /* subsurface */) {
// adjust subsurfaces to the window
windowBox.width = (windowBox.width / data.pWindow->m_reportedSize.x) * data.pWindow->m_realSize->value().x;
windowBox.height = (windowBox.height / data.pWindow->m_reportedSize.y) * data.pWindow->m_realSize->value().y;
windowBox.width = (windowBox.width / m_data.pWindow->m_reportedSize.x) * m_data.pWindow->m_realSize->value().x;
windowBox.height = (windowBox.height / m_data.pWindow->m_reportedSize.y) * m_data.pWindow->m_realSize->value().y;
}
}
if (data.squishOversized) {
if (data.localPos.x + windowBox.width > data.w)
windowBox.width = data.w - data.localPos.x;
if (data.localPos.y + windowBox.height > data.h)
windowBox.height = data.h - data.localPos.y;
if (m_data.squishOversized) {
if (m_data.localPos.x + windowBox.width > m_data.w)
windowBox.width = m_data.w - m_data.localPos.x;
if (m_data.localPos.y + windowBox.height > m_data.h)
windowBox.height = m_data.h - m_data.localPos.y;
}
return windowBox;
}
bool CSurfacePassElement::needsLiveBlur() {
auto PSURFACE = CWLSurface::fromResource(data.surface);
auto PSURFACE = CWLSurface::fromResource(m_data.surface);
const float ALPHA = data.alpha * data.fadeAlpha * (PSURFACE ? PSURFACE->m_alphaModifier * PSURFACE->m_overallOpacity : 1.F);
const bool BLUR = data.blur && (!data.texture || !data.texture->m_bOpaque || ALPHA < 1.F);
const float ALPHA = m_data.alpha * m_data.fadeAlpha * (PSURFACE ? PSURFACE->m_alphaModifier * PSURFACE->m_overallOpacity : 1.F);
const bool BLUR = m_data.blur && (!m_data.texture || !m_data.texture->m_opaque || ALPHA < 1.F);
if (!data.pLS && !data.pWindow)
if (!m_data.pLS && !m_data.pWindow)
return BLUR;
const bool NEWOPTIM = g_pHyprOpenGL->shouldUseNewBlurOptimizations(data.pLS, data.pWindow);
const bool NEWOPTIM = g_pHyprOpenGL->shouldUseNewBlurOptimizations(m_data.pLS, m_data.pWindow);
return BLUR && !NEWOPTIM;
}
bool CSurfacePassElement::needsPrecomputeBlur() {
auto PSURFACE = CWLSurface::fromResource(data.surface);
auto PSURFACE = CWLSurface::fromResource(m_data.surface);
const float ALPHA = data.alpha * data.fadeAlpha * (PSURFACE ? PSURFACE->m_alphaModifier * PSURFACE->m_overallOpacity : 1.F);
const bool BLUR = data.blur && (!data.texture || !data.texture->m_bOpaque || ALPHA < 1.F);
const float ALPHA = m_data.alpha * m_data.fadeAlpha * (PSURFACE ? PSURFACE->m_alphaModifier * PSURFACE->m_overallOpacity : 1.F);
const bool BLUR = m_data.blur && (!m_data.texture || !m_data.texture->m_opaque || ALPHA < 1.F);
if (!data.pLS && !data.pWindow)
if (!m_data.pLS && !m_data.pWindow)
return BLUR;
const bool NEWOPTIM = g_pHyprOpenGL->shouldUseNewBlurOptimizations(data.pLS, data.pWindow);
const bool NEWOPTIM = g_pHyprOpenGL->shouldUseNewBlurOptimizations(m_data.pLS, m_data.pWindow);
return BLUR && NEWOPTIM;
}
@ -219,29 +219,29 @@ std::optional<CBox> CSurfacePassElement::boundingBox() {
}
CRegion CSurfacePassElement::opaqueRegion() {
auto PSURFACE = CWLSurface::fromResource(data.surface);
auto PSURFACE = CWLSurface::fromResource(m_data.surface);
const float ALPHA = data.alpha * data.fadeAlpha * (PSURFACE ? PSURFACE->m_alphaModifier * PSURFACE->m_overallOpacity : 1.F);
const float ALPHA = m_data.alpha * m_data.fadeAlpha * (PSURFACE ? PSURFACE->m_alphaModifier * PSURFACE->m_overallOpacity : 1.F);
if (ALPHA < 1.F)
return {};
if (data.surface && data.surface->m_current.size == Vector2D{data.w, data.h}) {
CRegion opaqueSurf = data.surface->m_current.opaque.copy().intersect(CBox{{}, {data.w, data.h}});
if (m_data.surface && m_data.surface->m_current.size == Vector2D{m_data.w, m_data.h}) {
CRegion opaqueSurf = m_data.surface->m_current.opaque.copy().intersect(CBox{{}, {m_data.w, m_data.h}});
const auto texBox = getTexBox();
opaqueSurf.scale(texBox.size() / Vector2D{data.w, data.h});
return opaqueSurf.translate(data.pos + data.localPos - data.pMonitor->m_position).expand(-data.rounding);
opaqueSurf.scale(texBox.size() / Vector2D{m_data.w, m_data.h});
return opaqueSurf.translate(m_data.pos + m_data.localPos - m_data.pMonitor->m_position).expand(-m_data.rounding);
}
return data.texture && data.texture->m_bOpaque ? boundingBox()->expand(-data.rounding) : CRegion{};
return m_data.texture && m_data.texture->m_opaque ? boundingBox()->expand(-m_data.rounding) : CRegion{};
}
CRegion CSurfacePassElement::visibleRegion(bool& cancel) {
auto PSURFACE = CWLSurface::fromResource(data.surface);
auto PSURFACE = CWLSurface::fromResource(m_data.surface);
if (!PSURFACE)
return {};
const auto& bufferSize = data.surface->m_current.bufferSize;
const auto& bufferSize = m_data.surface->m_current.bufferSize;
auto visibleRegion = PSURFACE->m_visibleRegion.copy();
if (visibleRegion.empty())
@ -257,8 +257,8 @@ CRegion CSurfacePassElement::visibleRegion(bool& cancel) {
// deal with any rounding errors that might come from scaling
visibleRegion.expand(1);
auto uvTL = g_pHyprOpenGL->m_RenderData.primarySurfaceUVTopLeft;
auto uvBR = g_pHyprOpenGL->m_RenderData.primarySurfaceUVBottomRight;
auto uvTL = g_pHyprOpenGL->m_renderData.primarySurfaceUVTopLeft;
auto uvBR = g_pHyprOpenGL->m_renderData.primarySurfaceUVBottomRight;
if (uvTL == Vector2D(-1, -1))
uvTL = Vector2D(0, 0);
@ -269,11 +269,11 @@ CRegion CSurfacePassElement::visibleRegion(bool& cancel) {
visibleRegion.translate(-uvTL * bufferSize);
auto texBox = getTexBox();
texBox.scale(data.pMonitor->m_scale);
texBox.scale(m_data.pMonitor->m_scale);
texBox.round();
visibleRegion.scale((Vector2D(1, 1) / (uvBR - uvTL)) * (texBox.size() / bufferSize));
visibleRegion.translate((data.pos + data.localPos) * data.pMonitor->m_scale - data.pMonitor->m_position);
visibleRegion.translate((m_data.pos + m_data.localPos) * m_data.pMonitor->m_scale - m_data.pMonitor->m_position);
return visibleRegion;
}
@ -281,6 +281,6 @@ CRegion CSurfacePassElement::visibleRegion(bool& cancel) {
void CSurfacePassElement::discard() {
if (!g_pHyprRenderer->m_bBlockSurfaceFeedback) {
Debug::log(TRACE, "discard for invisible surface");
data.surface->presentFeedback(data.when, data.pMonitor->m_self.lock(), true);
m_data.surface->presentFeedback(m_data.when, m_data.pMonitor->m_self.lock(), true);
}
}

View file

@ -65,7 +65,7 @@ class CSurfacePassElement : public IPassElement {
}
private:
SRenderData data;
SRenderData m_data;
CBox getTexBox();
};

View file

@ -4,27 +4,27 @@
#include <hyprutils/utils/ScopeGuard.hpp>
using namespace Hyprutils::Utils;
CTexPassElement::CTexPassElement(const CTexPassElement::SRenderData& data_) : data(data_) {
CTexPassElement::CTexPassElement(const CTexPassElement::SRenderData& data_) : m_data(data_) {
;
}
void CTexPassElement::draw(const CRegion& damage) {
g_pHyprOpenGL->m_bEndFrame = data.flipEndFrame;
g_pHyprOpenGL->m_endFrame = m_data.flipEndFrame;
CScopeGuard x = {[]() {
//
g_pHyprOpenGL->m_bEndFrame = false;
g_pHyprOpenGL->m_RenderData.clipBox = {};
g_pHyprOpenGL->m_endFrame = false;
g_pHyprOpenGL->m_renderData.clipBox = {};
}};
if (!data.clipBox.empty())
g_pHyprOpenGL->m_RenderData.clipBox = data.clipBox;
if (!m_data.clipBox.empty())
g_pHyprOpenGL->m_renderData.clipBox = m_data.clipBox;
if (data.replaceProjection)
g_pHyprOpenGL->m_RenderData.monitorProjection = *data.replaceProjection;
g_pHyprOpenGL->renderTextureInternalWithDamage(data.tex, data.box, data.a, data.damage.empty() ? damage : data.damage, data.round, data.roundingPower);
if (data.replaceProjection)
g_pHyprOpenGL->m_RenderData.monitorProjection = g_pHyprOpenGL->m_RenderData.pMonitor->m_projMatrix;
if (m_data.replaceProjection)
g_pHyprOpenGL->m_renderData.monitorProjection = *m_data.replaceProjection;
g_pHyprOpenGL->renderTextureInternalWithDamage(m_data.tex, m_data.box, m_data.a, m_data.damage.empty() ? damage : m_data.damage, m_data.round, m_data.roundingPower);
if (m_data.replaceProjection)
g_pHyprOpenGL->m_renderData.monitorProjection = g_pHyprOpenGL->m_renderData.pMonitor->m_projMatrix;
}
bool CTexPassElement::needsLiveBlur() {
@ -36,7 +36,7 @@ bool CTexPassElement::needsPrecomputeBlur() {
}
std::optional<CBox> CTexPassElement::boundingBox() {
return data.box.copy().scale(1.F / g_pHyprOpenGL->m_RenderData.pMonitor->m_scale).round();
return m_data.box.copy().scale(1.F / g_pHyprOpenGL->m_renderData.pMonitor->m_scale).round();
}
CRegion CTexPassElement::opaqueRegion() {

View file

@ -35,5 +35,5 @@ class CTexPassElement : public IPassElement {
}
private:
SRenderData data;
SRenderData m_data;
};

View file

@ -1,19 +1,19 @@
#include "TextureMatteElement.hpp"
#include "../OpenGL.hpp"
CTextureMatteElement::CTextureMatteElement(const CTextureMatteElement::STextureMatteData& data_) : data(data_) {
CTextureMatteElement::CTextureMatteElement(const CTextureMatteElement::STextureMatteData& data_) : m_data(data_) {
;
}
void CTextureMatteElement::draw(const CRegion& damage) {
if (data.disableTransformAndModify) {
if (m_data.disableTransformAndModify) {
g_pHyprOpenGL->setMonitorTransformEnabled(true);
g_pHyprOpenGL->setRenderModifEnabled(false);
g_pHyprOpenGL->renderTextureMatte(data.tex, data.box, *data.fb);
g_pHyprOpenGL->renderTextureMatte(m_data.tex, m_data.box, *m_data.fb);
g_pHyprOpenGL->setRenderModifEnabled(true);
g_pHyprOpenGL->setMonitorTransformEnabled(false);
} else
g_pHyprOpenGL->renderTextureMatte(data.tex, data.box, *data.fb);
g_pHyprOpenGL->renderTextureMatte(m_data.tex, m_data.box, *m_data.fb);
}
bool CTextureMatteElement::needsLiveBlur() {

View file

@ -25,5 +25,5 @@ class CTextureMatteElement : public IPassElement {
}
private:
STextureMatteData data;
STextureMatteData m_data;
};