texture vd_srctexture;
float4 vd_texsize;

sampler src = sampler_state {
	Texture = <vd_srctexture>;
	AddressU = clamp;
	AddressV = clamp;
	MinFilter = Linear;
	MagFilter = Linear;
	MipFilter = None;
};

void VS(
	float4 pos : POSITION,
	float2 t0 : TEXCOORD0,
	out float4 oPos : POSITION,
	out float2 oT0 : TEXCOORD0
)
{
	oPos = pos;
	oT0 = t0;
}

float4 PS(
	float2 t0 : TEXCOORD0
) : COLOR0
{
	float4 p0 = tex2D(src, t0);

	static const float3 lumacoeff = {0.30, 0.59, 0.11};

	return dot(p0.xyz, lumacoeff);
}

technique {
	pass {
		VertexShader = compile vs_1_1 VS();
		PixelShader = compile ps_1_1 PS();
	}
}
