uniform float timer;

#define TEX_WIDTH 857.0
#define TEX_HEIGHT 480.0
#define BAYER_SIZE 4

vec4 Process(vec4 color) {
	int bayer[BAYER_SIZE * BAYER_SIZE] = int[](
		0, 8, 2, 10,
		12, 4, 14, 6,
		3, 11, 1, 9,
		15, 7, 13, 5
	);

    vec2 texCoord = gl_TexCoord[0].st;
	vec2 texSize = vec2(TEX_WIDTH, TEX_HEIGHT);
	
	float bayer_f = float(BAYER_SIZE);
	vec2 bayer_coords = mod(round(texCoord * texSize), vec2(bayer_f));
	int index = int(bayer_coords.x + bayer_coords.y * BAYER_SIZE);
	float dither = bayer[index] / (bayer_f * bayer_f - 1.0);
    
    vec4 texColour = getTexel(texCoord);
	texColour.rgb *= color.rgb;
    return texColour * step(dither, color.a);
}