backends/drm: fix ICC profiles not being applied

The check for a shadow buffer used a variable before it was set to the new value,
and the shaders are broken for some reason, so I reverted them to use the previous
code with only the transfer function parameters added.
This commit is contained in:
Xaver Hugl 2024-08-10 15:06:51 +02:00
parent 992547fd10
commit 96ed79fd62
3 changed files with 9 additions and 3 deletions

View file

@ -97,7 +97,7 @@ std::optional<OutputLayerBeginFrameInfo> EglGbmLayerSurface::startRendering(cons
if (m_surface->targetColorDescription != colorDescription || m_surface->channelFactors != channelFactors || m_surface->iccProfile != iccProfile) {
m_surface->damageJournal.clear();
m_surface->needsShadowBuffer = channelFactors != QVector3D(1, 1, 1) || m_surface->iccProfile || colorDescription.transferFunction().type != TransferFunction::gamma22;
m_surface->needsShadowBuffer = channelFactors != QVector3D(1, 1, 1) || iccProfile || colorDescription.transferFunction().type != TransferFunction::gamma22;
m_surface->targetColorDescription = colorDescription;
m_surface->channelFactors = channelFactors;
m_surface->iccProfile = iccProfile;

View file

@ -38,7 +38,10 @@ vec3 sample1DLut(vec3 input, sampler2D lut, int lutSize) {
void main()
{
vec4 tex = texture2D(src, texcoord0);
tex = sourceEncodingToNitsInDestinationColorspace(tex) / destinationReferenceLuminance;
tex = encodingToNits(tex, sourceNamedTransferFunction, sourceTransferFunctionParams.x, sourceTransferFunctionParams.y);
tex.rgb /= max(tex.a, 0.001);
tex.rgb /= destinationReferenceLuminance;
tex.rgb = (toXYZD50 * vec4(tex.rgb, 1.0)).rgb;
if (Bsize > 0) {
tex.rgb = sample1DLut(tex.rgb, Bsampler, Bsize);
}

View file

@ -41,7 +41,10 @@ vec3 sample1DLut(in vec3 srcColor, in sampler2D lut, in int lutSize) {
void main()
{
vec4 tex = texture(src, texcoord0);
tex = sourceEncodingToNitsInDestinationColorspace(tex) / destinationReferenceLuminance;
tex = encodingToNits(tex, sourceNamedTransferFunction, sourceTransferFunctionParams.x, sourceTransferFunctionParams.y);
tex.rgb /= max(tex.a, 0.001);
tex.rgb /= destinationReferenceLuminance;
tex.rgb = (toXYZD50 * vec4(tex.rgb, 1.0)).rgb;
if (Bsize > 0) {
tex.rgb = sample1DLut(tex.rgb, Bsampler, Bsize);
}