From d605e475118fd66e625a5a23c687cd01a34b302c Mon Sep 17 00:00:00 2001 From: Vaxry Date: Wed, 3 Apr 2024 21:35:16 +0100 Subject: [PATCH] renderer: block screen shader on screencopy --- src/protocols/Screencopy.cpp | 2 ++ src/protocols/ToplevelExport.cpp | 2 ++ src/render/OpenGL.cpp | 3 ++- src/render/OpenGL.hpp | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/protocols/Screencopy.cpp b/src/protocols/Screencopy.cpp index 9807cc55..476df0b8 100644 --- a/src/protocols/Screencopy.cpp +++ b/src/protocols/Screencopy.cpp @@ -504,6 +504,7 @@ bool CScreencopyProtocolManager::copyFrameShm(SScreencopyFrame* frame, timespec* return false; } + g_pHyprOpenGL->m_RenderData.blockScreenShader = true; g_pHyprRenderer->endRender(); g_pHyprRenderer->makeEGLCurrent(); @@ -551,6 +552,7 @@ bool CScreencopyProtocolManager::copyFrameDmabuf(SScreencopyFrame* frame) { g_pHyprOpenGL->setRenderModifEnabled(true); g_pHyprOpenGL->setMonitorTransformEnabled(false); + g_pHyprOpenGL->m_RenderData.blockScreenShader = true; g_pHyprRenderer->endRender(); wlr_texture_destroy(sourceTex); diff --git a/src/protocols/ToplevelExport.cpp b/src/protocols/ToplevelExport.cpp index e3273f7a..e2006afb 100644 --- a/src/protocols/ToplevelExport.cpp +++ b/src/protocols/ToplevelExport.cpp @@ -402,6 +402,7 @@ bool CToplevelExportProtocolManager::copyFrameShm(SScreencopyFrame* frame, times return false; } + g_pHyprOpenGL->m_RenderData.blockScreenShader = true; g_pHyprRenderer->endRender(); g_pHyprRenderer->makeEGLCurrent(); @@ -441,6 +442,7 @@ bool CToplevelExportProtocolManager::copyFrameDmabuf(SScreencopyFrame* frame, ti if (frame->overlayCursor) g_pHyprRenderer->renderSoftwareCursors(PMONITOR, fakeDamage, g_pInputManager->getMouseCoordsInternal() - frame->pWindow->m_vRealPosition.value()); + g_pHyprOpenGL->m_RenderData.blockScreenShader = true; g_pHyprRenderer->endRender(); return true; } diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 8be8e54e..9e3fb47b 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -365,7 +365,7 @@ void CHyprOpenGLImpl::end() { } m_bEndFrame = true; - m_bApplyFinalShader = true; + m_bApplyFinalShader = !m_RenderData.blockScreenShader; if (m_RenderData.mouseZoomUseMouse) m_RenderData.useNearestNeighbor = true; @@ -388,6 +388,7 @@ void CHyprOpenGLImpl::end() { m_RenderData.mouseZoomFactor = 1.f; m_RenderData.mouseZoomUseMouse = true; m_RenderData.forceIntrospection = false; + m_RenderData.blockScreenShader = false; m_RenderData.currentFB = nullptr; m_RenderData.mainFB = nullptr; m_RenderData.outFB = nullptr; diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp index 6af2a00f..08a1583d 100644 --- a/src/render/OpenGL.hpp +++ b/src/render/OpenGL.hpp @@ -112,6 +112,7 @@ struct SCurrentRenderData { bool mouseZoomUseMouse = true; // true by default bool useNearestNeighbor = false; bool forceIntrospection = false; // cleaned in ::end() + bool blockScreenShader = false; Vector2D primarySurfaceUVTopLeft = Vector2D(-1, -1); Vector2D primarySurfaceUVBottomRight = Vector2D(-1, -1);