internal: clean up dead snapshot code

This commit is contained in:
Vaxry
2025-06-15 11:51:27 +02:00
parent 472b52bc06
commit 57d20a1bf6
4 changed files with 6 additions and 51 deletions

View File

@@ -221,7 +221,7 @@ void CLayerSurface::onUnmap() {
m_realSize->warp(); m_realSize->warp();
// make a snapshot and start fade // make a snapshot and start fade
g_pHyprRenderer->makeLayerSnapshot(m_self.lock()); g_pHyprRenderer->makeSnapshot(m_self.lock());
startAnimation(false); startAnimation(false);

View File

@@ -755,7 +755,7 @@ void Events::listener_unmapWindow(void* owner, void* data) {
// Allow the renderer to catch the last frame. // Allow the renderer to catch the last frame.
if (g_pHyprRenderer->shouldRenderWindow(PWINDOW)) if (g_pHyprRenderer->shouldRenderWindow(PWINDOW))
g_pHyprRenderer->makeWindowSnapshot(PWINDOW); g_pHyprRenderer->makeSnapshot(PWINDOW);
// swallowing // swallowing
if (valid(PWINDOW->m_swallowed)) { if (valid(PWINDOW->m_swallowed)) {

View File

@@ -2381,51 +2381,7 @@ void CHyprRenderer::addWindowToRenderUnfocused(PHLWINDOW window) {
m_renderUnfocusedTimer->updateTimeout(std::chrono::milliseconds(1000 / *PFPS)); m_renderUnfocusedTimer->updateTimeout(std::chrono::milliseconds(1000 / *PFPS));
} }
void CHyprRenderer::makeRawWindowSnapshot(PHLWINDOW pWindow, CFramebuffer* pFramebuffer) { void CHyprRenderer::makeSnapshot(PHLWINDOW pWindow) {
// we trust the window is valid.
const auto PMONITOR = pWindow->m_monitor.lock();
if (!PMONITOR || !PMONITOR->m_output || PMONITOR->m_pixelSize.x <= 0 || PMONITOR->m_pixelSize.y <= 0)
return;
// we need to "damage" the entire monitor
// so that we render the entire window
// this is temporary, doesnt mess with the actual damage
CRegion fakeDamage{0, 0, (int)PMONITOR->m_transformedSize.x, (int)PMONITOR->m_transformedSize.y};
makeEGLCurrent();
pFramebuffer->alloc(PMONITOR->m_pixelSize.x, PMONITOR->m_pixelSize.y, DRM_FORMAT_ABGR8888);
pFramebuffer->addStencil(g_pHyprOpenGL->m_renderData.pCurrentMonData->stencilTex);
beginRender(PMONITOR, fakeDamage, RENDER_MODE_FULL_FAKE, nullptr, pFramebuffer);
g_pHyprOpenGL->clear(CHyprColor(0, 0, 0, 0)); // JIC
// this is a hack but it works :P
// we need to disable blur or else we will get a black background, as the shader
// will try to copy the bg to apply blur.
// this isn't entirely correct, but like, oh well.
// small todo: maybe make this correct? :P
static auto* const PBLUR = (Hyprlang::INT* const*)(g_pConfigManager->getConfigValuePtr("decoration:blur:enabled"));
const auto BLURVAL = **PBLUR;
**PBLUR = 0;
// TODO: how can we make this the size of the window? setting it to window's size makes the entire screen render with the wrong res forever more. odd.
glViewport(0, 0, PMONITOR->m_pixelSize.x, PMONITOR->m_pixelSize.y);
g_pHyprOpenGL->m_renderData.currentFB = pFramebuffer;
g_pHyprOpenGL->clear(CHyprColor(0, 0, 0, 0)); // JIC
renderWindow(pWindow, PMONITOR, Time::steadyNow(), false, RENDER_PASS_ALL, true);
**PBLUR = BLURVAL;
endRender();
}
void CHyprRenderer::makeWindowSnapshot(PHLWINDOW pWindow) {
// we trust the window is valid. // we trust the window is valid.
const auto PMONITOR = pWindow->m_monitor.lock(); const auto PMONITOR = pWindow->m_monitor.lock();
@@ -2461,7 +2417,7 @@ void CHyprRenderer::makeWindowSnapshot(PHLWINDOW pWindow) {
m_bRenderingSnapshot = false; m_bRenderingSnapshot = false;
} }
void CHyprRenderer::makeLayerSnapshot(PHLLS pLayer) { void CHyprRenderer::makeSnapshot(PHLLS pLayer) {
// we trust the window is valid. // we trust the window is valid.
const auto PMONITOR = pLayer->m_monitor.lock(); const auto PMONITOR = pLayer->m_monitor.lock();

View File

@@ -83,9 +83,8 @@ class CHyprRenderer {
void unsetEGL(); void unsetEGL();
SExplicitSyncSettings getExplicitSyncSettings(SP<Aquamarine::IOutput> output); SExplicitSyncSettings getExplicitSyncSettings(SP<Aquamarine::IOutput> output);
void addWindowToRenderUnfocused(PHLWINDOW window); void addWindowToRenderUnfocused(PHLWINDOW window);
void makeWindowSnapshot(PHLWINDOW); void makeSnapshot(PHLWINDOW);
void makeRawWindowSnapshot(PHLWINDOW, CFramebuffer*); void makeSnapshot(PHLLS);
void makeLayerSnapshot(PHLLS);
void renderSnapshot(PHLWINDOW); void renderSnapshot(PHLWINDOW);
void renderSnapshot(PHLLS); void renderSnapshot(PHLLS);