Debian Codegraph @

tests/manual/nodetypes_ng/shadow_pass2.frag

raw
1 #version 440
2
3 layout(location = 0) in vec2 qt_TexCoord0;
4 layout(location = 0) out vec4 fragColor;
5
6 layout(binding = 1) uniform sampler2D source;
7 layout(binding = 2) uniform sampler2D shadow;
8
9 layout(std140, binding = 0) uniform buf {
10 // The built-in vertex shader assumes the first 68 bytes are matrix and
11 // opacity so have them there even though the matrix is not used here.
12 mat4 qt_Matrix;
13 float qt_Opacity;
14 vec2 delta;
15 float darkness;
16 } ubuf;
17
18 void main()
19 {
20 vec4 fg = texture(source, qt_TexCoord0);
21 vec4 bg = texture(shadow, qt_TexCoord0 + ubuf.delta);
22 fragColor = (fg + vec4(0., 0., 0., ubuf.darkness * bg.a) * (1. - fg.a)) * ubuf.qt_Opacity;
23 }