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