
/*
    IMPORTANT NOTE:
    
    Do not use "tex2Dlod" instruction in FXAA pixel shader for Mac OSX OpenGL.
    
    Details:
        The nVidia FXAA code variation for shader model 3 uses the "tex2Dlod"
        instruction which can be significantly faster than the generic
        "tex2D" instruction when doing lots of sampling from a high
        resolution screen buffer. Presumably it is faster because the GPU
        does not need to spend effort calculating partial derivatives for
        mipmapping and anisotropic texturing.

        The Cg cross compiler to GLSL version 120 and below will convert
        HLSL "tex2Dlod" instructions into GLSL "texture2DLod" calls.
        These instructions are not strictly permitted in fragment programs
        under those versions of GLSL (they are vertex program only instructions).

        Trying to bind a fragment program with these instructions under a
        strict OpenGL implementation will fail even if the hardware
        supports the operation. This started happening when LOL moved to
        the Mac OSX 10.7 SDK.

        It is possible to use these instructions if extensions which permit
        their use are explicitly enabled in the shader, e.g., one of:
            ARB_shader_texture_lod
            EXT_gpu_shader4
        
        In the future we could consider prepending the necessary extension
        enable line to the output of the cross compile step to allow these
        instructions to be used.
        
        Cross compiling to GLSL version 130 also allows the feature, but that
        may not be feasible as I think that requires a core 3 profile
        which doesn't allow legacy on Mac OSX.
*/      
#if IS_OPENGL
    #define FXAA_TEX2DLOD_OK 0
#else
    #define FXAA_TEX2DLOD_OK 1
#endif

#define FXAA_HLSL_3 1
#include "FXAA.hls"

sampler tex : register (s0);

float2 fxaaQualityRcpFrame : register (c0);
float4 fxaaQualityOptions  : register (c1); // (subpix, edgeThreshold, edgeThresholdMin, _)

void main(float2        in_texcoord0    : TEXCOORD0,
          out float4    out_color0      : COLOR0)
{
    out_color0 = FxaaPixelShader(in_texcoord0, tex, fxaaQualityRcpFrame, float4(0,0,0,0),
                                 fxaaQualityOptions.x, fxaaQualityOptions.y, fxaaQualityOptions.z);
}
