mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 15:05:59 +01:00
renderer: add canSkipBackBufferClear
This commit is contained in:
parent
547305c7ed
commit
948855a984
2 changed files with 23 additions and 4 deletions
|
@ -995,10 +995,12 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
|
||||||
EMIT_HOOK_EVENT("render", RENDER_POST_MIRROR);
|
EMIT_HOOK_EVENT("render", RENDER_POST_MIRROR);
|
||||||
} else {
|
} else {
|
||||||
g_pHyprOpenGL->blend(false);
|
g_pHyprOpenGL->blend(false);
|
||||||
if (*PRENDERTEX /* inverted cfg flag */)
|
if (!canSkipBackBufferClear(pMonitor)) {
|
||||||
g_pHyprOpenGL->clear(CColor(17.0 / 255.0, 17.0 / 255.0, 17.0 / 255.0, 1.0));
|
if (*PRENDERTEX /* inverted cfg flag */)
|
||||||
else
|
g_pHyprOpenGL->clear(CColor(17.0 / 255.0, 17.0 / 255.0, 17.0 / 255.0, 1.0));
|
||||||
g_pHyprOpenGL->clearWithTex(); // will apply the hypr "wallpaper"
|
else
|
||||||
|
g_pHyprOpenGL->clearWithTex(); // will apply the hypr "wallpaper"
|
||||||
|
}
|
||||||
g_pHyprOpenGL->blend(true);
|
g_pHyprOpenGL->blend(true);
|
||||||
|
|
||||||
wlr_box renderBox = {0, 0, (int)pMonitor->vecPixelSize.x, (int)pMonitor->vecPixelSize.y};
|
wlr_box renderBox = {0, 0, (int)pMonitor->vecPixelSize.x, (int)pMonitor->vecPixelSize.y};
|
||||||
|
@ -2000,3 +2002,19 @@ void CHyprRenderer::setOccludedForBackLayers(CRegion& region, CWorkspace* pWorks
|
||||||
|
|
||||||
region.subtract(rg);
|
region.subtract(rg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CHyprRenderer::canSkipBackBufferClear(CMonitor* pMonitor) {
|
||||||
|
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]) {
|
||||||
|
if (!ls->layerSurface)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!ls->layerSurface->surface->opaque || !(ls->alpha.fl() >= 1.f))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (ls->geometry.x == pMonitor->vecPosition.x && ls->geometry.y == pMonitor->vecPosition.y && ls->geometry.width == pMonitor->vecSize.x &&
|
||||||
|
ls->geometry.height == pMonitor->vecSize.y)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ class CHyprRenderer {
|
||||||
std::tuple<float, float, float> getRenderTimes(CMonitor* pMonitor); // avg max min
|
std::tuple<float, float, float> getRenderTimes(CMonitor* pMonitor); // avg max min
|
||||||
void renderLockscreen(CMonitor* pMonitor, timespec* now);
|
void renderLockscreen(CMonitor* pMonitor, timespec* now);
|
||||||
void setOccludedForBackLayers(CRegion& region, CWorkspace* pWorkspace);
|
void setOccludedForBackLayers(CRegion& region, CWorkspace* pWorkspace);
|
||||||
|
bool canSkipBackBufferClear(CMonitor* pMonitor);
|
||||||
|
|
||||||
bool m_bWindowRequestedCursorHide = false;
|
bool m_bWindowRequestedCursorHide = false;
|
||||||
bool m_bBlockSurfaceFeedback = false;
|
bool m_bBlockSurfaceFeedback = false;
|
||||||
|
|
Loading…
Reference in a new issue