diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2025-07-31 16:23:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-31 16:23:09 +0200 |
| commit | a907ecd4ff736a3a09410532b405a437eb48033c (patch) | |
| tree | 6e7ed001c06f224245ecf9c5e0c8206d6acd408f /src/render/pass | |
| parent | 3e35797b18d35baae82657bb0438af88156e273f (diff) | |
opengl: improve render fn arg clarity (#11286)
Diffstat (limited to 'src/render/pass')
| -rw-r--r-- | src/render/pass/BorderPassElement.cpp | 8 | ||||
| -rw-r--r-- | src/render/pass/Pass.cpp | 18 | ||||
| -rw-r--r-- | src/render/pass/RectPassElement.cpp | 5 | ||||
| -rw-r--r-- | src/render/pass/SurfacePassElement.cpp | 32 | ||||
| -rw-r--r-- | src/render/pass/TexPassElement.cpp | 7 |
5 files changed, 52 insertions, 18 deletions
diff --git a/src/render/pass/BorderPassElement.cpp b/src/render/pass/BorderPassElement.cpp index 1024f021..13063290 100644 --- a/src/render/pass/BorderPassElement.cpp +++ b/src/render/pass/BorderPassElement.cpp @@ -7,9 +7,13 @@ CBorderPassElement::CBorderPassElement(const CBorderPassElement::SBorderData& da void CBorderPassElement::draw(const CRegion& damage) { 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); + g_pHyprOpenGL->renderBorder( + m_data.box, m_data.grad1, m_data.grad2, m_data.lerp, + {.round = m_data.round, .roundingPower = m_data.roundingPower, .borderSize = m_data.borderSize, .a = m_data.a, .outerRound = m_data.outerRound}); else - g_pHyprOpenGL->renderBorder(m_data.box, m_data.grad1, m_data.round, m_data.roundingPower, m_data.borderSize, m_data.a, m_data.outerRound); + g_pHyprOpenGL->renderBorder( + m_data.box, m_data.grad1, + {.round = m_data.round, .roundingPower = m_data.roundingPower, .borderSize = m_data.borderSize, .a = m_data.a, .outerRound = m_data.outerRound}); } bool CBorderPassElement::needsLiveBlur() { diff --git a/src/render/pass/Pass.cpp b/src/render/pass/Pass.cpp index 4ad1d444..8e075d4c 100644 --- a/src/render/pass/Pass.cpp +++ b/src/render/pass/Pass.cpp @@ -199,9 +199,9 @@ CRegion CRenderPass::render(const CRegion& damage_) { void CRenderPass::renderDebugData() { 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->renderRect(box, Colors::RED.modifyA(0.1F), {.damage = &rg}); } - g_pHyprOpenGL->renderRectWithDamage(box, Colors::GREEN.modifyA(0.1F), m_totalLiveBlurRegion); + g_pHyprOpenGL->renderRect(box, Colors::GREEN.modifyA(0.1F), {.damage = &m_totalLiveBlurRegion}); std::unordered_map<CWLSurfaceResource*, float> offsets; @@ -224,7 +224,9 @@ void CRenderPass::renderDebugData() { 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}); + static const auto FULL_REGION = CRegion{0, 0, INT32_MAX, INT32_MAX}; + + g_pHyprOpenGL->renderRect(box, color, {.damage = &FULL_REGION}); if (offsets.contains(surface.get())) box.translate(Vector2D{0.F, offsets[surface.get()]}); @@ -232,8 +234,8 @@ void CRenderPass::renderDebugData() { offsets[surface.get()] = 0; 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); + g_pHyprOpenGL->renderRect(box, CHyprColor{0.F, 0.F, 0.F, 0.2F}, {.damage = &FULL_REGION, .round = std::min(5.0, box.size().y)}); + g_pHyprOpenGL->renderTexture(texture, box, {}); offsets[surface.get()] += texture->m_size.y; }; @@ -253,7 +255,7 @@ void CRenderPass::renderDebugData() { 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); - g_pHyprOpenGL->renderRectWithDamage(box, CHyprColor{0.8F, 0.8F, 0.2F, 0.4F}, region); + g_pHyprOpenGL->renderRect(box, CHyprColor{0.8F, 0.8F, 0.2F, 0.4F}, {.damage = ®ion}); } } } @@ -266,7 +268,7 @@ void CRenderPass::renderDebugData() { if (tex) { 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); + g_pHyprOpenGL->renderTexture(tex, box, {}); } std::string passStructure; @@ -284,7 +286,7 @@ void CRenderPass::renderDebugData() { if (tex) { 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); + g_pHyprOpenGL->renderTexture(tex, box, {}); } } diff --git a/src/render/pass/RectPassElement.cpp b/src/render/pass/RectPassElement.cpp index 22f3bb11..6c60741e 100644 --- a/src/render/pass/RectPassElement.cpp +++ b/src/render/pass/RectPassElement.cpp @@ -13,9 +13,10 @@ void CRectPassElement::draw(const CRegion& damage) { g_pHyprOpenGL->m_renderData.clipBox = m_data.clipBox; 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); + g_pHyprOpenGL->renderRect(m_data.box, m_data.color, {.damage = &damage, .round = m_data.round, .roundingPower = m_data.roundingPower}); else - g_pHyprOpenGL->renderRectWithBlur(m_data.box, m_data.color, m_data.round, m_data.roundingPower, m_data.blurA, m_data.xray); + g_pHyprOpenGL->renderRect(m_data.box, m_data.color, + {.round = m_data.round, .roundingPower = m_data.roundingPower, .blur = true, .blurA = m_data.blurA, .xray = m_data.xray}); g_pHyprOpenGL->m_renderData.clipBox = {}; } diff --git a/src/render/pass/SurfacePassElement.cpp b/src/render/pass/SurfacePassElement.cpp index 87c7016d..1d3d5bda 100644 --- a/src/render/pass/SurfacePassElement.cpp +++ b/src/render/pass/SurfacePassElement.cpp @@ -116,14 +116,38 @@ void CSurfacePassElement::draw(const CRegion& damage) { // to what we do for misaligned surfaces (blur the entire thing and then render shit without blur) if (m_data.surfaceCounter == 0 && !m_data.popup) { if (BLUR) - g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, windowBox, ALPHA, m_data.surface, rounding, roundingPower, m_data.blockBlurOptimization, m_data.fadeAlpha, OVERALL_ALPHA); + g_pHyprOpenGL->renderTexture(TEXTURE, windowBox, + { + .surface = m_data.surface, + .a = ALPHA, + .blur = true, + .blurA = m_data.fadeAlpha, + .overallA = OVERALL_ALPHA, + .round = rounding, + .roundingPower = roundingPower, + .allowCustomUV = true, + .blockBlurOptimization = m_data.blockBlurOptimization, + }); else - g_pHyprOpenGL->renderTexture(TEXTURE, windowBox, ALPHA * OVERALL_ALPHA, rounding, roundingPower, false, true); + g_pHyprOpenGL->renderTexture(TEXTURE, windowBox, + {.a = ALPHA * OVERALL_ALPHA, .round = rounding, .roundingPower = roundingPower, .discardActive = false, .allowCustomUV = true}); } else { if (BLUR && m_data.popup) - g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, windowBox, ALPHA, m_data.surface, rounding, roundingPower, true, m_data.fadeAlpha, OVERALL_ALPHA); + g_pHyprOpenGL->renderTexture(TEXTURE, windowBox, + { + .surface = m_data.surface, + .a = ALPHA, + .blur = true, + .blurA = m_data.fadeAlpha, + .overallA = OVERALL_ALPHA, + .round = rounding, + .roundingPower = roundingPower, + .allowCustomUV = true, + .blockBlurOptimization = true, + }); else - g_pHyprOpenGL->renderTexture(TEXTURE, windowBox, ALPHA * OVERALL_ALPHA, rounding, roundingPower, false, true); + g_pHyprOpenGL->renderTexture(TEXTURE, windowBox, + {.a = ALPHA * OVERALL_ALPHA, .round = rounding, .roundingPower = roundingPower, .discardActive = false, .allowCustomUV = true}); } if (!g_pHyprRenderer->m_bBlockSurfaceFeedback) diff --git a/src/render/pass/TexPassElement.cpp b/src/render/pass/TexPassElement.cpp index dbf40308..4702c0e4 100644 --- a/src/render/pass/TexPassElement.cpp +++ b/src/render/pass/TexPassElement.cpp @@ -37,9 +37,12 @@ void CTexPassElement::draw(const CRegion& damage) { } if (m_data.blur) - g_pHyprOpenGL->renderTextureWithBlur(m_data.tex, m_data.box, m_data.a, nullptr, m_data.round, m_data.roundingPower, false, m_data.blurA, 1.F); + g_pHyprOpenGL->renderTexture( + m_data.tex, m_data.box, + {.a = m_data.a, .blur = true, .blurA = m_data.blurA, .overallA = 1.F, .round = m_data.round, .roundingPower = m_data.roundingPower, .blockBlurOptimization = false}); else - 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); + g_pHyprOpenGL->renderTexture(m_data.tex, m_data.box, + {.damage = m_data.damage.empty() ? &damage : &m_data.damage, .a = m_data.a, .round = m_data.round, .roundingPower = m_data.roundingPower}); } bool CTexPassElement::needsLiveBlur() { |
