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
This commit is contained in:
Xaver Hugl 2024-01-12 22:12:40 +01:00
parent 20bee00681
commit c1e09f65c9

View file

@ -463,7 +463,7 @@ bool GLShader::setColorspaceUniformsToSRGB(const ColorDescription &src)
{ {
return setUniform(GLShader::MatrixUniform::ColorimetryTransformation, src.colorimetry().toOther(src.sdrColorimetry())) return setUniform(GLShader::MatrixUniform::ColorimetryTransformation, src.colorimetry().toOther(src.sdrColorimetry()))
&& setUniform(GLShader::IntUniform::SourceNamedTransferFunction, int(src.transferFunction())) && 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::SdrBrightness, src.sdrBrightness())
&& setUniform(FloatUniform::MaxHdrBrightness, src.sdrBrightness()); && setUniform(FloatUniform::MaxHdrBrightness, src.sdrBrightness());
} }