opengl/glshader: set all color management uniforms, even if some calls fail

A driver might optimize out a uniform, in which case setting it will fail. That does not however mean
that the rest can be ignored too or that the shader won't work because of that
This commit is contained in:
Xaver Hugl 2024-08-13 17:10:22 +02:00
parent 7bdab9c4d2
commit cd371d8618
2 changed files with 10 additions and 10 deletions

View file

@ -469,15 +469,15 @@ QMatrix4x4 GLShader::getUniformMatrix4x4(const char *name)
}
}
bool GLShader::setColorspaceUniforms(const ColorDescription &src, const ColorDescription &dst, RenderingIntent intent)
void GLShader::setColorspaceUniforms(const ColorDescription &src, const ColorDescription &dst, RenderingIntent intent)
{
return setUniform(Mat4Uniform::ColorimetryTransformation, src.toOther(dst, intent))
&& setUniform(IntUniform::SourceNamedTransferFunction, src.transferFunction().type)
&& setUniform(Vec2Uniform::SourceTransferFunctionParams, QVector2D(src.transferFunction().minLuminance, src.transferFunction().maxLuminance - src.transferFunction().minLuminance))
&& setUniform(FloatUniform::SourceReferenceLuminance, src.referenceLuminance())
&& setUniform(IntUniform::DestinationNamedTransferFunction, dst.transferFunction().type)
&& setUniform(Vec2Uniform::DestinationTransferFunctionParams, QVector2D(dst.transferFunction().minLuminance, dst.transferFunction().maxLuminance - dst.transferFunction().minLuminance))
&& setUniform(FloatUniform::DestinationReferenceLuminance, dst.referenceLuminance())
&& setUniform(FloatUniform::MaxDestinationLuminance, dst.maxHdrLuminance().value_or(10'000));
setUniform(Mat4Uniform::ColorimetryTransformation, src.toOther(dst, intent));
setUniform(IntUniform::SourceNamedTransferFunction, src.transferFunction().type);
setUniform(Vec2Uniform::SourceTransferFunctionParams, QVector2D(src.transferFunction().minLuminance, src.transferFunction().maxLuminance - src.transferFunction().minLuminance));
setUniform(FloatUniform::SourceReferenceLuminance, src.referenceLuminance());
setUniform(IntUniform::DestinationNamedTransferFunction, dst.transferFunction().type);
setUniform(Vec2Uniform::DestinationTransferFunctionParams, QVector2D(dst.transferFunction().minLuminance, dst.transferFunction().maxLuminance - dst.transferFunction().minLuminance));
setUniform(FloatUniform::DestinationReferenceLuminance, dst.referenceLuminance());
setUniform(FloatUniform::MaxDestinationLuminance, dst.maxHdrLuminance().value_or(10'000));
}
}

View file

@ -138,7 +138,7 @@ public:
bool setUniform(ColorUniform uniform, const QVector4D &value);
bool setUniform(ColorUniform uniform, const QColor &value);
bool setColorspaceUniforms(const ColorDescription &src, const ColorDescription &dst, RenderingIntent intent);
void setColorspaceUniforms(const ColorDescription &src, const ColorDescription &dst, RenderingIntent intent);
protected:
GLShader(unsigned int flags = NoFlags);