From e6d2607fe3d2ff0fd32717c8f3fedce75adfbab3 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Sun, 28 May 2023 18:05:39 +0200 Subject: [PATCH] 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 --- src/scene/itemrenderer_opengl.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/scene/itemrenderer_opengl.cpp b/src/scene/itemrenderer_opengl.cpp index e36bf05ae8..7a69c57544 100644 --- a/src/scene/itemrenderer_opengl.cpp +++ b/src/scene/itemrenderer_opengl.cpp @@ -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);