uniform sampler2D _MainTex;

// presence of inout parameters with discard used inside
// the function, and the variables not being trivially the same
// type (vec4 vs vec3), can cause the actually unused
// texture sample to be left in.
void surf (vec2 uv, inout vec3 oo)
{
    if (uv.x < 0.0)
        discard;
    oo = texture2D(_MainTex, uv).xyz;
}

void main()
{
    vec3 oo;
    surf(gl_TexCoord[0].xy, oo);

    gl_FragData[0] = vec4(0.5);
}
