config: add opengl:force_introspection

fixes #4819
This commit is contained in:
Vaxry 2024-02-23 21:21:24 +00:00
parent ca59bd5739
commit bfb1e876a8
2 changed files with 8 additions and 4 deletions

View file

@ -499,6 +499,7 @@ CConfigManager::CConfigManager() {
m_pConfig->addConfigValue("xwayland:force_zero_scaling", {0L}); m_pConfig->addConfigValue("xwayland:force_zero_scaling", {0L});
m_pConfig->addConfigValue("opengl:nvidia_anti_flicker", {1L}); m_pConfig->addConfigValue("opengl:nvidia_anti_flicker", {1L});
m_pConfig->addConfigValue("opengl:force_introspection", {2L});
m_pConfig->addConfigValue("autogenerated", {0L}); m_pConfig->addConfigValue("autogenerated", {0L});

View file

@ -200,6 +200,8 @@ bool CHyprOpenGLImpl::passRequiresIntrospection(CMonitor* pMonitor) {
void CHyprOpenGLImpl::begin(CMonitor* pMonitor, const CRegion& damage_, CFramebuffer* fb, std::optional<CRegion> finalDamage) { void CHyprOpenGLImpl::begin(CMonitor* pMonitor, const CRegion& damage_, CFramebuffer* fb, std::optional<CRegion> finalDamage) {
m_RenderData.pMonitor = pMonitor; m_RenderData.pMonitor = pMonitor;
static auto* const PFORCEINTROSPECTION = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("opengl:force_introspection");
#ifndef GLES2 #ifndef GLES2
const GLenum RESETSTATUS = glGetGraphicsResetStatus(); const GLenum RESETSTATUS = glGetGraphicsResetStatus();
@ -260,11 +262,12 @@ void CHyprOpenGLImpl::begin(CMonitor* pMonitor, const CRegion& damage_, CFramebu
applyScreenShader(*PSHADER); applyScreenShader(*PSHADER);
} }
const auto PRBO = g_pHyprRenderer->getCurrentRBO(); const auto PRBO = g_pHyprRenderer->getCurrentRBO();
const bool FBPROPERSIZE = !fb || fb->m_vSize == pMonitor->vecPixelSize; 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) || if (USERFORCEDINTROSPECTION || m_RenderData.forceIntrospection || !FBPROPERSIZE || m_sFinalScreenShader.program > 0 ||
passRequiresIntrospection(pMonitor)) { (PRBO && pMonitor->vecPixelSize != PRBO->getFB()->m_vSize) || passRequiresIntrospection(pMonitor)) {
// we have to offload // we have to offload
// bind the offload Hypr Framebuffer // bind the offload Hypr Framebuffer
m_RenderData.pCurrentMonData->offloadFB.bind(); m_RenderData.pCurrentMonData->offloadFB.bind();