From bfb1e876a87d80256f7c29d24cbda704c5eefaa1 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Fri, 23 Feb 2024 21:21:24 +0000 Subject: [PATCH] config: add opengl:force_introspection fixes #4819 --- src/config/ConfigManager.cpp | 1 + src/render/OpenGL.cpp | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 56e0c55d..fb7d565e 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -499,6 +499,7 @@ CConfigManager::CConfigManager() { m_pConfig->addConfigValue("xwayland:force_zero_scaling", {0L}); m_pConfig->addConfigValue("opengl:nvidia_anti_flicker", {1L}); + m_pConfig->addConfigValue("opengl:force_introspection", {2L}); m_pConfig->addConfigValue("autogenerated", {0L}); diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 94a5d123..1a53ec39 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -200,6 +200,8 @@ bool CHyprOpenGLImpl::passRequiresIntrospection(CMonitor* pMonitor) { void CHyprOpenGLImpl::begin(CMonitor* pMonitor, const CRegion& damage_, CFramebuffer* fb, std::optional finalDamage) { m_RenderData.pMonitor = pMonitor; + static auto* const PFORCEINTROSPECTION = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("opengl:force_introspection"); + #ifndef GLES2 const GLenum RESETSTATUS = glGetGraphicsResetStatus(); @@ -260,11 +262,12 @@ void CHyprOpenGLImpl::begin(CMonitor* pMonitor, const CRegion& damage_, CFramebu applyScreenShader(*PSHADER); } - const auto PRBO = g_pHyprRenderer->getCurrentRBO(); - const bool FBPROPERSIZE = !fb || fb->m_vSize == pMonitor->vecPixelSize; + const auto PRBO = g_pHyprRenderer->getCurrentRBO(); + const bool FBPROPERSIZE = !fb || fb->m_vSize == pMonitor->vecPixelSize; + const bool USERFORCEDINTROSPECTION = **PFORCEINTROSPECTION == 1 ? true : (**PFORCEINTROSPECTION == 2 ? g_pHyprRenderer->isNvidia() : false); // 0 - no, 1 - yes, 2 - nvidia only - if (m_RenderData.forceIntrospection || !FBPROPERSIZE || m_sFinalScreenShader.program > 0 || (PRBO && pMonitor->vecPixelSize != PRBO->getFB()->m_vSize) || - passRequiresIntrospection(pMonitor)) { + if (USERFORCEDINTROSPECTION || m_RenderData.forceIntrospection || !FBPROPERSIZE || m_sFinalScreenShader.program > 0 || + (PRBO && pMonitor->vecPixelSize != PRBO->getFB()->m_vSize) || passRequiresIntrospection(pMonitor)) { // we have to offload // bind the offload Hypr Framebuffer m_RenderData.pCurrentMonData->offloadFB.bind();