1// Copyright (c) 2015 Sergio Gonzalez. All rights reserved.
2// License: https://github.com/serge-rgb/milton#license
3
4#if HAS_TEXTURE_MULTISAMPLE
5    uniform sampler2DMS u_canvas;
6#else
7    uniform sampler2D u_canvas;
8#endif
9uniform vec2      u_screen_size;
10
11
12void
13main()
14{
15    vec4 g_eraser_magic = vec4(0,1,0,1);
16
17    //vec2 coord = gl_FragCoord.xy/ u_screen_size;
18    vec2 coord = vec2(gl_FragCoord.x, u_screen_size.y-gl_FragCoord.y) / u_screen_size;
19
20#if HAS_TEXTURE_MULTISAMPLE
21    vec4 color = texelFetch(u_canvas, ivec2(gl_FragCoord.xy), 0);
22#else
23    vec4 color = texture(u_canvas, coord);
24#endif
25
26    if ( color == g_eraser_magic ) {
27        discard;
28    }
29    out_color = vec4(color);
30}
31