summaryrefslogtreecommitdiff
path: root/src/render/OpenGL.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2025-08-02 16:21:01 +0200
committerVaxry <vaxry@vaxry.net>2025-08-02 16:21:08 +0200
commit824438949e60ad6d6fefdfa37f0af8fbe0849934 (patch)
tree73702b7470bf138cd6a284f042d70fe0091f8d8a /src/render/OpenGL.cpp
parentf1f1161c179374f7f703f7a17b1680205904cc90 (diff)
renderer: apply default luma for reverting back to srgb
fixes #11315
Diffstat (limited to 'src/render/OpenGL.cpp')
-rw-r--r--src/render/OpenGL.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index 420e997e..65cd4c65 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -1593,9 +1593,9 @@ void CHyprOpenGLImpl::renderTextureInternal(SP<CTexture> tex, const CBox& box, c
tex->setTexParameter(GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}
- const auto imageDescription = m_renderData.surface.valid() && m_renderData.surface->m_colorManagement.valid() ?
- m_renderData.surface->m_colorManagement->imageDescription() :
- (data.cmBackToSRGB ? data.cmBackToSRGBSource->m_imageDescription : SImageDescription{});
+ auto imageDescription = m_renderData.surface.valid() && m_renderData.surface->m_colorManagement.valid() ?
+ m_renderData.surface->m_colorManagement->imageDescription() :
+ (data.cmBackToSRGB ? data.cmBackToSRGBSource->m_imageDescription : SImageDescription{});
const bool skipCM = !*PENABLECM || !m_cmSupported /* CM unsupported or disabled */
|| (imageDescription == m_renderData.pMonitor->m_imageDescription && !data.cmBackToSRGB) /* Source and target have the same image description */
@@ -1610,9 +1610,12 @@ void CHyprOpenGLImpl::renderTextureInternal(SP<CTexture> tex, const CBox& box, c
if (shader == &m_shaders->m_shCM) {
shader->setUniformInt(SHADER_TEX_TYPE, texType);
- if (data.cmBackToSRGB)
+ if (data.cmBackToSRGB) {
+ // revert luma changes to avoid black screenshots.
+ // this will likely not be 1:1, and might cause screenshots to be too bright, but it's better than pitch black.
+ imageDescription.luminances = {};
passCMUniforms(*shader, imageDescription, NColorManagement::SImageDescription{}, true, -1, -1);
- else
+ } else
passCMUniforms(*shader, imageDescription);
}