]> git.sesse.net Git - nageru/blob - futatabi/splat.frag
Log a warning when we kill a client that is not keeping up.
[nageru] / futatabi / splat.frag
1 #version 450 core
2
3 in vec2 image_pos;
4 flat in vec2 flow, I_0_check_offset, I_1_check_offset;
5 out vec2 out_flow;
6
7 uniform sampler2DArray gray_tex;
8
9 void main()
10 {
11         out_flow = flow;
12
13         // TODO: Check if we are sampling out-of-image.
14         float I_0 = texture(gray_tex, vec3(image_pos + I_0_check_offset, 0)).r;
15         float I_1 = texture(gray_tex, vec3(image_pos + I_1_check_offset, 1)).r;
16         float diff = abs(I_1 - I_0);
17         gl_FragDepth = 0.125 * diff.x;  // Make sure we stay well under the 1.0 maximum.
18 }