blob: 0bbe5823d25c7a2fd6768f1c3ee74c69ef6721ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#version 330 core
in vec2 texCoord;
uniform sampler2DMS tex;
out vec4 fragColor;
void main()
{
ivec2 tc = ivec2(floor(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;
}
|