summaryrefslogtreecommitdiff
path: root/src/compositor/shaders/surface_y_uv.frag
blob: 107c30009d2de8ee07a4846de6c5f05f37d7a1dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#version 440

layout(location = 0) in vec2 v_texcoord;
layout(location = 0) out vec4 fragColor;

layout(std140, binding = 0) uniform buf {
    mat4 qt_Matrix;
    float qt_Opacity;
};

layout(binding = 1) uniform sampler2D tex0;
layout(binding = 2) uniform sampler2D tex1;

void main()
{
    float y = 1.16438356 * (texture(tex0, v_texcoord).x - 0.0625);
    float u = texture(tex1, v_texcoord).r - 0.5;
    float v = texture(tex1, v_texcoord).g - 0.5;
    y *= qt_Opacity;
    u *= qt_Opacity;
    v *= qt_Opacity;
    fragColor.r = y + 1.59602678 * v;
    fragColor.g = y - 0.39176229 * u - 0.81296764 * v;
    fragColor.b = y + 2.01723214 * u;
    fragColor.a = qt_Opacity;
}