From c1e09f65c9c621113625c32491ac3f59275b3b2c Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Fri, 12 Jan 2024 22:12:40 +0100 Subject: [PATCH] opengl/glshader: use gamma 2.2 for sRGB render targets The sRGB global colordescription uses gamma 2.2, so this function also has to do it, or the shader will end up doing a colorspace conversion where there shouldn't be one. This also meams that HDR content will be wrongly encoded, but fixing that while also dealing with sRGB content correctly requires a lot more invasive changes, in KWin and in the screenshot and screencast APIs. BUG: 478967 --- src/opengl/glshader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/glshader.cpp b/src/opengl/glshader.cpp index d76ff54dc3..85a9488ad5 100644 --- a/src/opengl/glshader.cpp +++ b/src/opengl/glshader.cpp @@ -463,7 +463,7 @@ bool GLShader::setColorspaceUniformsToSRGB(const ColorDescription &src) { return setUniform(GLShader::MatrixUniform::ColorimetryTransformation, src.colorimetry().toOther(src.sdrColorimetry())) && setUniform(GLShader::IntUniform::SourceNamedTransferFunction, int(src.transferFunction())) - && setUniform(GLShader::IntUniform::DestinationNamedTransferFunction, int(NamedTransferFunction::sRGB)) + && setUniform(GLShader::IntUniform::DestinationNamedTransferFunction, int(NamedTransferFunction::gamma22)) && setUniform(FloatUniform::SdrBrightness, src.sdrBrightness()) && setUniform(FloatUniform::MaxHdrBrightness, src.sdrBrightness()); }