summaryrefslogtreecommitdiff
path: root/src/render/OpenGL.cpp
diff options
context:
space:
mode:
authorvaxerski <vaxry@vaxry.net>2025-03-18 11:30:01 +0000
committervaxerski <vaxry@vaxry.net>2025-03-18 11:30:08 +0000
commitcca0f48b74e87f86244f5773c42d9ade84683f3b (patch)
tree675a7eb1a9c2964733546b2f68fb94a840de943f /src/render/OpenGL.cpp
parent60edb376f29d89859072d90e9e4d8660a07caf88 (diff)
renderer: add an option to disable cm and auto-skip cm if not necessary
fixes #9641 adds render:cm_enabled default true
Diffstat (limited to 'src/render/OpenGL.cpp')
-rw-r--r--src/render/OpenGL.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index 137e4a8f..e2f72fff 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -1320,8 +1320,9 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, const CB
CBox newBox = box;
m_RenderData.renderModif.applyToBox(newBox);
- static auto PDT = CConfigValue<Hyprlang::INT>("debug:damage_tracking");
- static auto PPASS = CConfigValue<Hyprlang::INT>("render:cm_fs_passthrough");
+ static const auto PDT = CConfigValue<Hyprlang::INT>("debug:damage_tracking");
+ static const auto PPASS = CConfigValue<Hyprlang::INT>("render:cm_fs_passthrough");
+ static const auto PENABLECM = CConfigValue<Hyprlang::INT>("render:cm_enabled");
// get the needed transform for this texture
const bool TRANSFORMS_MATCH = wlTransformToHyprutils(m_RenderData.pMonitor->transform) == tex->m_eTransform; // FIXME: combine them properly!!!
@@ -1378,8 +1379,12 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, const CB
glTexParameteri(tex->m_iTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}
- const bool skipCM = !m_RenderData.surface /* No surface - no point in CM */
- || !m_bCMSupported /* CM unsupported - hw failed to compile the shader probably */
+ const bool SURFACE_HAS_CM = m_RenderData.surface && m_RenderData.surface->colorManagement && m_RenderData.surface->colorManagement->hasImageDescription();
+
+ const bool skipCM = !*PENABLECM /* CM disabled by the user */
+ || !m_RenderData.surface /* No surface - no point in CM */
+ || !m_bCMSupported /* CM unsupported - hw failed to compile the shader probably */
+ || (!SURFACE_HAS_CM && m_RenderData.pMonitor->imageDescription == SImageDescription{}) /* Surface doesn't have CM and monitor isn't CM'd */
|| (*PPASS && m_RenderData.pMonitor->activeWorkspace && m_RenderData.pMonitor->activeWorkspace->m_bHasFullscreenWindow &&
m_RenderData.pMonitor->activeWorkspace->m_efFullscreenMode == FSMODE_FULLSCREEN) /* Fullscreen window with pass cm enabled */;
@@ -1391,7 +1396,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, const CB
glUseProgram(shader->program);
glUniform1i(shader->texType, texType);
const auto imageDescription =
- m_RenderData.surface.valid() && m_RenderData.surface->colorManagement.valid() ? m_RenderData.surface->colorManagement->imageDescription() : SImageDescription{};
+ m_RenderData.surface && m_RenderData.surface->colorManagement ? m_RenderData.surface->colorManagement->imageDescription() : SImageDescription{};
glUniform1i(shader->sourceTF, imageDescription.transferFunction);
glUniform1i(shader->targetTF, m_RenderData.pMonitor->imageDescription.transferFunction);
const auto sourcePrimaries =