backends/drm: apply the ICC profile without premultiplication

As a side effect, this ensures that when alpha is zero, rgb is zero as well.
This is needed because the ICC profile may contain transformations where zero
brightness gets mapped to a non-zero value.

BUG: 479380
This commit is contained in:
Xaver Hugl 2024-01-16 19:39:29 +01:00
parent ed339de953
commit 6ab8f179a7
2 changed files with 4 additions and 0 deletions

View file

@ -37,6 +37,7 @@ vec3 sample1DLut(vec3 input, sampler2D lut, int lutSize) {
void main()
{
vec4 tex = texture2D(src, texcoord0);
tex.rgb /= max(tex.a, 0.001);
tex.rgb /= sdrBrightness;
tex.rgb = matrix1 * tex.rgb;
if (Bsize > 0) {
@ -54,5 +55,6 @@ void main()
if (Asize > 0) {
tex.rgb = sample1DLut(tex.rgb, Asampler, Asize);
}
tex.rgb *= tex.a;
gl_FragColor = tex;
}

View file

@ -40,6 +40,7 @@ vec3 sample1DLut(in vec3 srcColor, in sampler2D lut, in int lutSize) {
void main()
{
vec4 tex = texture(src, texcoord0);
tex.rgb /= max(tex.a, 0.001);
tex.rgb /= sdrBrightness;
tex.rgb = matrix1 * tex.rgb;
if (Bsize > 0) {
@ -57,5 +58,6 @@ void main()
if (Asize > 0) {
tex.rgb = sample1DLut(tex.rgb, Asampler, Asize);
}
tex.rgb *= tex.a;
fragColor = tex;
}