backends/drm: Pass the correct arguments to encodingToNits in the ICC shader

wilder/Plasma/6.2
Patrik Fábián 2 years ago committed by Xaver Hugl
parent a16d98f4eb
commit b84a6af8d3
  1. 5
      src/backends/drm/icc.frag
  2. 5
      src/backends/drm/icc_core.frag

@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: 2023 Xaver Hugl <xaver.hugl@gmail.com>
// SPDX-License-Identifier: GPL-2.0-or-later
#include "colormanagement.glsl"
precision highp float;
precision highp sampler2D;
precision highp sampler3D;
@ -25,6 +26,8 @@ uniform sampler3D Csampler;
uniform int Asize;
uniform sampler2D Asampler;
uniform float referenceLuminance;
vec3 sample1DLut(vec3 input, sampler2D lut, int lutSize) {
float lutOffset = 0.5 / float(lutSize);
float lutScale = 1.0 - lutOffset * 2.0;
@ -37,7 +40,7 @@ vec3 sample1DLut(vec3 input, sampler2D lut, int lutSize) {
void main()
{
vec4 tex = texture2D(src, texcoord0);
tex = encodingToNits(tex, sourceNamedTransferFunction);
tex = encodingToNits(tex, sourceNamedTransferFunction, referenceLuminance);
tex.rgb /= max(tex.a, 0.001);
tex.rgb /= referenceLuminance;
tex.rgb = (toXYZD50 * vec4(tex.rgb, 1.0)).rgb;

@ -2,6 +2,7 @@
// SPDX-FileCopyrightText: 2023 Xaver Hugl <xaver.hugl@gmail.com>
// SPDX-License-Identifier: GPL-2.0-or-later
#include "colormanagement.glsl"
precision highp float;
precision highp sampler2D;
precision highp sampler3D;
@ -28,6 +29,8 @@ uniform sampler3D Csampler;
uniform int Asize;
uniform sampler2D Asampler;
uniform float referenceLuminance;
vec3 sample1DLut(in vec3 srcColor, in sampler2D lut, in int lutSize) {
float lutOffset = 0.5 / float(lutSize);
float lutScale = 1.0 - lutOffset * 2.0;
@ -40,7 +43,7 @@ vec3 sample1DLut(in vec3 srcColor, in sampler2D lut, in int lutSize) {
void main()
{
vec4 tex = texture(src, texcoord0);
tex = encodingToNits(tex, sourceNamedTransferFunction);
tex = encodingToNits(tex, sourceNamedTransferFunction,referenceLuminance);
tex.rgb /= max(tex.a, 0.001);
tex.rgb /= referenceLuminance;
tex.rgb = (toXYZD50 * vec4(tex.rgb, 1.0)).rgb;

Loading…
Cancel
Save