blob: 1bbf3d8841f925f32aee871852471dbb18bc48cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#version 310 es
precision highp float;
in vec2 texCoord;
uniform highp sampler2DMS tex;
out vec4 fragColor;
void main()
{
ivec2 tc = ivec2(floor(vec2(textureSize(tex)) * texCoord));
vec4 c = texelFetch(tex, tc, 0) + texelFetch(tex, tc, 1) + texelFetch(tex, tc, 2) + texelFetch(tex, tc, 3);
c /= 4.0;
// This discard, while not necessarily ideal for some GPUs, is necessary to
// get correct results with certain layer blend modes for example.
if (c.a == 0.0)
discard;
fragColor = c;
}
|