scene/itemrendereropengl: don't do colorspace conversions if not needed

There was a check for this in the shader before, but it got lost. It's better
to completely compile it out of the shader anyways
This commit is contained in:
Xaver Hugl 2023-05-28 18:05:39 +02:00
parent 242fce56b6
commit e6d2607fe3

View file

@ -281,7 +281,10 @@ void ItemRendererOpenGL::renderItem(const RenderTarget &renderTarget, const Rend
return;
}
ShaderTraits shaderTraits = ShaderTrait::MapTexture | ShaderTrait::TransformColorspace;
ShaderTraits shaderTraits = ShaderTrait::MapTexture;
if (renderTarget.colorDescription() != ColorDescription::sRGB) {
shaderTraits |= ShaderTrait::TransformColorspace;
}
if (data.brightness() != 1.0) {
shaderTraits |= ShaderTrait::Modulate;
@ -327,7 +330,9 @@ void ItemRendererOpenGL::renderItem(const RenderTarget &renderTarget, const Rend
shader->setUniform(GLShader::Saturation, data.saturation());
shader->setUniform(GLShader::Vec3Uniform::PrimaryBrightness, QVector3D(toXYZ(1, 0), toXYZ(1, 1), toXYZ(1, 2)));
}
shader->setColorspaceUniformsFromSRGB(renderTarget.colorDescription());
if (shaderTraits & ShaderTrait::TransformColorspace) {
shader->setColorspaceUniformsFromSRGB(renderTarget.colorDescription());
}
if (renderContext.hardwareClipping) {
glEnable(GL_SCISSOR_TEST);