mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 09:25: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);
|
||||
} else {
|
||||
g_pHyprOpenGL->blend(false);
|
||||
if (*PRENDERTEX /* inverted cfg flag */)
|
||||
g_pHyprOpenGL->clear(CColor(17.0 / 255.0, 17.0 / 255.0, 17.0 / 255.0, 1.0));
|
||||
else
|
||||
g_pHyprOpenGL->clearWithTex(); // will apply the hypr "wallpaper"
|
||||
if (!canSkipBackBufferClear(pMonitor)) {
|
||||
if (*PRENDERTEX /* inverted cfg flag */)
|
||||
g_pHyprOpenGL->clear(CColor(17.0 / 255.0, 17.0 / 255.0, 17.0 / 255.0, 1.0));
|
||||
else
|
||||
g_pHyprOpenGL->clearWithTex(); // will apply the hypr "wallpaper"
|
||||
}
|
||||
g_pHyprOpenGL->blend(true);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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
|
||||
void renderLockscreen(CMonitor* pMonitor, timespec* now);
|
||||
void setOccludedForBackLayers(CRegion& region, CWorkspace* pWorkspace);
|
||||
bool canSkipBackBufferClear(CMonitor* pMonitor);
|
||||
|
||||
bool m_bWindowRequestedCursorHide = false;
|
||||
bool m_bBlockSurfaceFeedback = false;
|
||||
|
|
Loading…
Reference in a new issue