#version 150 //GL 3.2

#include <hostdefs>
#line 4

#if NSPP == 1
	uniform sampler2D tex;
#else
	uniform sampler2DMS tex;
#endif

out vec4 frag_color;

void main()
{
	ivec2 pixel_coord = ivec2(gl_FragCoord.xy);

	#if NSPP == 1

		frag_color = texelFetch( tex, pixel_coord, 0 );

	#else

		vec4 shaded = vec4(0.0);
		for ( int k=0; k<int(NSPP); ++k )
		{
			shaded += texelFetch( tex, pixel_coord, k );
		}
		shaded *= 1.0/NSPP;

		frag_color = shaded;

	#endif
}
