//
// Project:
//
//   D3D RightMark
//
// Description:
//   Effect file for "Pixel Filling" test.
//
// Effect Version: 
//
//   DirectX 9.0 (Summer 2003 SDK Update)
//
// Shader Profile:
//
//   Pixel Shaders 3.0 ( Pixel Shader Assembler )
//
//   Vertex Shaders 3.0 ( Vertex Shader Assembler )
//

float4x4 mWVP;
float4   vRot;

float    fFilter;
float    fMipFilter;

float    fAnisotropy;

float4   vOne = { 1.0f, 1.0f, 1.0f, 1.0f };
float4   vTextureFactor = { 0.5f, 0.5f, 0.5f, 0.5f };

#define TextureFactor 0
#define One           1

#define InPosition    v0
#define InNormal      v3
#define InTexCoord    v7

#define OutPosition   o0
#define OutTexCoord0  o1
#define OutTexCoord1  o2
#define OutTexCoord2  o3
#define OutTexCoord3  o4
#define OutTexCoord4  o5
#define OutTexCoord5  o6
#define OutTexCoord6  o7
#define OutTexCoord7  o8

#define Temp          r0

#define MatWVP        0
#define Rot           10

vertexshader VSDefault =
	asm {	
		vs_3_0

		dcl_position InPosition
		dcl_normal   InNormal
		dcl_texcoord InTexCoord

		dcl_position  OutPosition
		dcl_texcoord0 OutTexCoord0
		dcl_texcoord1 OutTexCoord1
		dcl_texcoord2 OutTexCoord2
		dcl_texcoord3 OutTexCoord3
		dcl_texcoord4 OutTexCoord4
		dcl_texcoord5 OutTexCoord5
		dcl_texcoord6 OutTexCoord6
		dcl_texcoord7 OutTexCoord7

		// Position

		mul  Temp, InNormal, c[Rot]
		add  Temp, Temp, InPosition
		m4x4 OutPosition, Temp, c[MatWVP]

		// Texture Coords Setup

		mov OutTexCoord0.xy, InTexCoord.xy
		mov OutTexCoord1.xy, InTexCoord.xy
		mov OutTexCoord2.xy, InTexCoord.xy
		mov OutTexCoord3.xy, InTexCoord.xy
		mov OutTexCoord4.xy, InTexCoord.xy
		mov OutTexCoord5.xy, InTexCoord.xy
		mov OutTexCoord6.xy, InTexCoord.xy
		mov OutTexCoord7.xy, InTexCoord.xy
	};

technique TFillRate0
{   
	pass p0
	{
		// Common States

		CullMode		 = None;
		AlphaBlendEnable	 = False;
		ZWriteEnable		 = False;
		ZEnable			 = False;

		// Shader Constants

		PixelShaderConstant[ TextureFactor ]  = <vTextureFactor>;
		PixelShaderConstant[ One ]            = <vOne>;

		VertexShaderConstant[ MatWVP ]        = <mWVP>;
		VertexShaderConstant[ Rot ]           = <vRot>;

		// Shaders

		PixelShader = 
		
		   asm {
				ps_3_0
				
				mov oC0, c1
		       };

		VertexShader = <VSDefault>;
	}
}

technique TFillRate1
{   
	pass p0
	{
		// Common States

		CullMode		 = None;
		AlphaBlendEnable	 = False;
		ZWriteEnable		 = False;
		ZEnable			 = False;

		MinFilter[ 0 ]           = <fFilter>;
		MagFilter[ 0 ]           = <fFilter>;
		MipFilter[ 0 ]           = <fMipFilter>;

		MaxAnisotropy[ 0 ]	 = <fAnisotropy>;

		// Shader Constants

		PixelShaderConstant[ TextureFactor ]  = <vTextureFactor>;
		PixelShaderConstant[ One ]            = <vOne>;

		VertexShaderConstant[ MatWVP ]        = <mWVP>;
		VertexShaderConstant[ Rot ]           = <vRot>;

		// Shaders

		PixelShader = 
		
		   asm {
				ps_3_0

				dcl_texcoord0 v0.xy

				dcl_2d s0

				texld r0, v0.xy, s0

				mov   oC0, r0
		       };

		VertexShader = <VSDefault>;
	}
}

technique TFillRate2
{   
	pass p0
	{
		// Common States

		CullMode		 = None;
		AlphaBlendEnable	 = False;
		ZWriteEnable		 = False;
		ZEnable			 = False;

		MinFilter[ 0 ]           = <fFilter>;
		MagFilter[ 0 ]           = <fFilter>;
		MipFilter[ 0 ]           = <fMipFilter>;

		MaxAnisotropy[ 0 ]	 = <fAnisotropy>;

		MinFilter[ 1 ]           = <fFilter>;
		MagFilter[ 1 ]           = <fFilter>;
		MipFilter[ 1 ]           = <fMipFilter>;

		MaxAnisotropy[ 1 ]	 = <fAnisotropy>;

		// Shader Constants

		PixelShaderConstant[ TextureFactor ]  = <vTextureFactor>;
		PixelShaderConstant[ One ]            = <vOne>;

		VertexShaderConstant[ MatWVP ]        = <mWVP>;
		VertexShaderConstant[ Rot ]           = <vRot>;

		// Shaders

		PixelShader = 
		
		   asm {
				ps_3_0

				dcl_texcoord0 v0.xy
				dcl_texcoord1 v1.xy

				dcl_2d s0
				dcl_2d s1

				texld r0, v0.xy, s0
				texld r1, v1.xy, s1
				lrp   r0, c0, r0, r1

				mov   oC0, r0
		       };

		VertexShader = <VSDefault>;
	}
}

technique TFillRate3
{   
	pass p0
	{
		// Common States

		CullMode		 = None;
		AlphaBlendEnable	 = False;
		ZWriteEnable		 = False;
		ZEnable			 = False;

		MinFilter[ 0 ]           = <fFilter>;
		MagFilter[ 0 ]           = <fFilter>;
		MipFilter[ 0 ]           = <fMipFilter>;

		MaxAnisotropy[ 0 ]	 = <fAnisotropy>;

		MinFilter[ 1 ]           = <fFilter>;
		MagFilter[ 1 ]           = <fFilter>;
		MipFilter[ 1 ]           = <fMipFilter>;

		MaxAnisotropy[ 1 ]	 = <fAnisotropy>;

		MinFilter[ 2 ]           = <fFilter>;
		MagFilter[ 2 ]           = <fFilter>;
		MipFilter[ 2 ]           = <fMipFilter>;

		MaxAnisotropy[ 2 ]	 = <fAnisotropy>;

		// Shader Constants

		PixelShaderConstant[ TextureFactor ]  = <vTextureFactor>;
		PixelShaderConstant[ One ]            = <vOne>;

		VertexShaderConstant[ MatWVP ]        = <mWVP>;
		VertexShaderConstant[ Rot ]           = <vRot>;

		// Shaders

		PixelShader = 
		
		   asm {
				ps_3_0

				dcl_texcoord0 v0.xy
				dcl_texcoord1 v1.xy
				dcl_texcoord2 v2.xy

				dcl_2d s0
				dcl_2d s1
				dcl_2d s2

				texld r0, v0.xy, s0
				texld r1, v1.xy, s1
				lrp   r0, c0, r0, r1

				texld r1, v2.xy, s2
				lrp   r0, c0, r0, r1

				mov   oC0, r0
		       };

		VertexShader = <VSDefault>;
	}
}

technique TFillRate4
{   
	pass p0
	{
		// Common States

		CullMode		 = None;
		AlphaBlendEnable	 = False;
		ZWriteEnable		 = False;
		ZEnable			 = False;

		MinFilter[ 0 ]           = <fFilter>;
		MagFilter[ 0 ]           = <fFilter>;
		MipFilter[ 0 ]           = <fMipFilter>;

		MaxAnisotropy[ 0 ]	 = <fAnisotropy>;

		MinFilter[ 1 ]           = <fFilter>;
		MagFilter[ 1 ]           = <fFilter>;
		MipFilter[ 1 ]           = <fMipFilter>;

		MaxAnisotropy[ 1 ]	 = <fAnisotropy>;

		MinFilter[ 2 ]           = <fFilter>;
		MagFilter[ 2 ]           = <fFilter>;
		MipFilter[ 2 ]           = <fMipFilter>;

		MaxAnisotropy[ 2 ]	 = <fAnisotropy>;

		MinFilter[ 3 ]           = <fFilter>;
		MagFilter[ 3 ]           = <fFilter>;
		MipFilter[ 3 ]           = <fMipFilter>;

		MaxAnisotropy[ 3 ]	 = <fAnisotropy>;

		// Shader Constants

		PixelShaderConstant[ TextureFactor ]  = <vTextureFactor>;
		PixelShaderConstant[ One ]            = <vOne>;

		VertexShaderConstant[ MatWVP ]        = <mWVP>;
		VertexShaderConstant[ Rot ]           = <vRot>;

		// Shaders

		PixelShader = 
		
		   asm {
				ps_3_0

				dcl_texcoord0 v0.xy
				dcl_texcoord1 v1.xy
				dcl_texcoord2 v2.xy
				dcl_texcoord3 v3.xy

				dcl_2d s0
				dcl_2d s1
				dcl_2d s2
				dcl_2d s3

				texld r0, v0.xy, s0
				texld r1, v1.xy, s1
				lrp   r0, c0, r0, r1

				texld r1, v2.xy, s2
				texld r2, v3.xy, s3
				lrp   r0, c0, r0, r1
				lrp   r0, c0, r0, r2

				mov   oC0, r0
		       };

		VertexShader = <VSDefault>;
	}
}

technique TFillRate5
{   
	pass p0
	{
		// Common States

		CullMode		 = None;
		AlphaBlendEnable	 = False;
		ZWriteEnable		 = False;
		ZEnable			 = False;

		MinFilter[ 0 ]           = <fFilter>;
		MagFilter[ 0 ]           = <fFilter>;
		MipFilter[ 0 ]           = <fMipFilter>;

		MaxAnisotropy[ 0 ]	 = <fAnisotropy>;

		MinFilter[ 1 ]           = <fFilter>;
		MagFilter[ 1 ]           = <fFilter>;
		MipFilter[ 1 ]           = <fMipFilter>;

		MaxAnisotropy[ 1 ]	 = <fAnisotropy>;

		MinFilter[ 2 ]           = <fFilter>;
		MagFilter[ 2 ]           = <fFilter>;
		MipFilter[ 2 ]           = <fMipFilter>;

		MaxAnisotropy[ 2 ]	 = <fAnisotropy>;

		MinFilter[ 3 ]           = <fFilter>;
		MagFilter[ 3 ]           = <fFilter>;
		MipFilter[ 3 ]           = <fMipFilter>;

		MaxAnisotropy[ 3 ]	 = <fAnisotropy>;

		MinFilter[ 4 ]           = <fFilter>;
		MagFilter[ 4 ]           = <fFilter>;
		MipFilter[ 4 ]           = <fMipFilter>;

		MaxAnisotropy[ 4 ]	 = <fAnisotropy>;

		// Shader Constants

		PixelShaderConstant[ 0 ]  = <vTextureFactor>;
		PixelShaderConstant[ 1 ]  = <vOne>;

		VertexShaderConstant[ 0 ]  = <mWVP>;
		VertexShaderConstant[ 10 ] = <vRot>;

		// Shaders

		PixelShader = 
		
		   asm {
				ps_3_0

				dcl_texcoord0 v0.xy
				dcl_texcoord1 v1.xy
				dcl_texcoord2 v2.xy
				dcl_texcoord3 v3.xy
				dcl_texcoord4 v4.xy

				dcl_2d s0
				dcl_2d s1
				dcl_2d s2
				dcl_2d s3
				dcl_2d s4

				texld r0, v0.xy, s0
				texld r1, v1.xy, s1
				lrp   r0, c0, r0, r1

				texld r1, v2.xy, s2
				texld r2, v3.xy, s3
				lrp   r0, c0, r0, r1
				lrp   r0, c0, r0, r2

				texld r1, v4.xy, s4
				lrp   r0, c0, r0, r1

				mov   oC0, r0
		       };

		VertexShader = <VSDefault>;
	}
}

technique TFillRate6
{   
	pass p0
	{
		// Common States

		CullMode		 = None;
		AlphaBlendEnable	 = False;
		ZWriteEnable		 = False;
		ZEnable			 = False;

		MinFilter[ 0 ]           = <fFilter>;
		MagFilter[ 0 ]           = <fFilter>;
		MipFilter[ 0 ]           = <fMipFilter>;

		MaxAnisotropy[ 0 ]	 = <fAnisotropy>;

		MinFilter[ 1 ]           = <fFilter>;
		MagFilter[ 1 ]           = <fFilter>;
		MipFilter[ 1 ]           = <fMipFilter>;

		MaxAnisotropy[ 1 ]	 = <fAnisotropy>;

		MinFilter[ 2 ]           = <fFilter>;
		MagFilter[ 2 ]           = <fFilter>;
		MipFilter[ 2 ]           = <fMipFilter>;

		MaxAnisotropy[ 2 ]	 = <fAnisotropy>;

		MinFilter[ 3 ]           = <fFilter>;
		MagFilter[ 3 ]           = <fFilter>;
		MipFilter[ 3 ]           = <fMipFilter>;

		MaxAnisotropy[ 3 ]	 = <fAnisotropy>;

		MinFilter[ 4 ]           = <fFilter>;
		MagFilter[ 4 ]           = <fFilter>;
		MipFilter[ 4 ]           = <fMipFilter>;

		MaxAnisotropy[ 4 ]	 = <fAnisotropy>;

		MinFilter[ 5 ]           = <fFilter>;
		MagFilter[ 5 ]           = <fFilter>;
		MipFilter[ 5 ]           = <fMipFilter>;

		MaxAnisotropy[ 5 ]	 = <fAnisotropy>;

		// Shader Constants

		PixelShaderConstant[ TextureFactor ]  = <vTextureFactor>;
		PixelShaderConstant[ One ]            = <vOne>;

		VertexShaderConstant[ MatWVP ]        = <mWVP>;
		VertexShaderConstant[ Rot ]           = <vRot>;

		// Shaders

		PixelShader = 
		
		   asm {
				ps_3_0

				dcl_texcoord0 v0.xy
				dcl_texcoord1 v1.xy
				dcl_texcoord2 v2.xy
				dcl_texcoord3 v3.xy
				dcl_texcoord4 v4.xy
				dcl_texcoord5 v5.xy

				dcl_2d s0
				dcl_2d s1
				dcl_2d s2
				dcl_2d s3
				dcl_2d s4
				dcl_2d s5

				texld r0, v0.xy, s0
				texld r1, v1.xy, s1
				lrp   r0, c0, r0, r1

				texld r1, v2.xy, s2
				texld r2, v3.xy, s3
				lrp   r0, c0, r0, r1
				lrp   r0, c0, r0, r2

				texld r1, v4.xy, s4
				texld r2, v5.xy, s5
				lrp   r0, c0, r0, r1
				lrp   r0, c0, r0, r2

				mov   oC0, r0
		       };

		VertexShader = <VSDefault>;
	}
}

technique TFillRate7
{   
	pass p0
	{
		// Common States

		CullMode		 = None;
		AlphaBlendEnable	 = False;
		ZWriteEnable		 = False;
		ZEnable			 = False;

		MinFilter[ 0 ]           = <fFilter>;
		MagFilter[ 0 ]           = <fFilter>;
		MipFilter[ 0 ]           = <fMipFilter>;

		MaxAnisotropy[ 0 ]	 = <fAnisotropy>;

		MinFilter[ 1 ]           = <fFilter>;
		MagFilter[ 1 ]           = <fFilter>;
		MipFilter[ 1 ]           = <fMipFilter>;

		MaxAnisotropy[ 1 ]	 = <fAnisotropy>;

		MinFilter[ 2 ]           = <fFilter>;
		MagFilter[ 2 ]           = <fFilter>;
		MipFilter[ 2 ]           = <fMipFilter>;

		MaxAnisotropy[ 2 ]	 = <fAnisotropy>;

		MinFilter[ 3 ]           = <fFilter>;
		MagFilter[ 3 ]           = <fFilter>;
		MipFilter[ 3 ]           = <fMipFilter>;

		MaxAnisotropy[ 3 ]	 = <fAnisotropy>;

		MinFilter[ 4 ]           = <fFilter>;
		MagFilter[ 4 ]           = <fFilter>;
		MipFilter[ 4 ]           = <fMipFilter>;

		MaxAnisotropy[ 4 ]	 = <fAnisotropy>;

		MinFilter[ 5 ]           = <fFilter>;
		MagFilter[ 5 ]           = <fFilter>;
		MipFilter[ 5 ]           = <fMipFilter>;

		MaxAnisotropy[ 5 ]	 = <fAnisotropy>;

		MinFilter[ 6 ]           = <fFilter>;
		MagFilter[ 6 ]           = <fFilter>;
		MipFilter[ 6 ]           = <fMipFilter>;

		MaxAnisotropy[ 6 ]	 = <fAnisotropy>;

		// Shader Constants

		PixelShaderConstant[ TextureFactor ]  = <vTextureFactor>;
		PixelShaderConstant[ One ]            = <vOne>;

		VertexShaderConstant[ MatWVP ]        = <mWVP>;
		VertexShaderConstant[ Rot ]           = <vRot>;

		// Shaders

		PixelShader = 
		
		   asm {
				ps_3_0

				dcl_texcoord0 v0.xy
				dcl_texcoord1 v1.xy
				dcl_texcoord2 v2.xy
				dcl_texcoord3 v3.xy
				dcl_texcoord4 v4.xy
				dcl_texcoord5 v5.xy
				dcl_texcoord6 v6.xy

				dcl_2d s0
				dcl_2d s1
				dcl_2d s2
				dcl_2d s3
				dcl_2d s4
				dcl_2d s5
				dcl_2d s6

				texld r0, v0.xy, s0
				texld r1, v1.xy, s1
				lrp   r0, c0, r0, r1

				texld r1, v2.xy, s2
				texld r2, v3.xy, s3
				lrp   r0, c0, r0, r1
				lrp   r0, c0, r0, r2

				texld r1, v4.xy, s4
				texld r2, v5.xy, s5
				lrp   r0, c0, r0, r1
				lrp   r0, c0, r0, r2

				texld r1, v6.xy, s6
				lrp   r0, c0, r0, r1

				mov   oC0, r0
		       };

		VertexShader = <VSDefault>;
	}
}

technique TFillRate8
{   
	pass p0
	{
		// Common States

		CullMode		 = None;
		AlphaBlendEnable	 = False;
		ZWriteEnable		 = False;
		ZEnable			 = False;

		MinFilter[ 0 ]           = <fFilter>;
		MagFilter[ 0 ]           = <fFilter>;
		MipFilter[ 0 ]           = <fMipFilter>;

		MaxAnisotropy[ 0 ]	 = <fAnisotropy>;

		MinFilter[ 1 ]           = <fFilter>;
		MagFilter[ 1 ]           = <fFilter>;
		MipFilter[ 1 ]           = <fMipFilter>;

		MaxAnisotropy[ 1 ]	 = <fAnisotropy>;

		MinFilter[ 2 ]           = <fFilter>;
		MagFilter[ 2 ]           = <fFilter>;
		MipFilter[ 2 ]           = <fMipFilter>;

		MaxAnisotropy[ 2 ]	 = <fAnisotropy>;

		MinFilter[ 3 ]           = <fFilter>;
		MagFilter[ 3 ]           = <fFilter>;
		MipFilter[ 3 ]           = <fMipFilter>;

		MaxAnisotropy[ 3 ]	 = <fAnisotropy>;

		MinFilter[ 4 ]           = <fFilter>;
		MagFilter[ 4 ]           = <fFilter>;
		MipFilter[ 4 ]           = <fMipFilter>;

		MaxAnisotropy[ 4 ]	 = <fAnisotropy>;

		MinFilter[ 5 ]           = <fFilter>;
		MagFilter[ 5 ]           = <fFilter>;
		MipFilter[ 5 ]           = <fMipFilter>;

		MaxAnisotropy[ 5 ]	 = <fAnisotropy>;

		MinFilter[ 6 ]           = <fFilter>;
		MagFilter[ 6 ]           = <fFilter>;
		MipFilter[ 6 ]           = <fMipFilter>;

		MaxAnisotropy[ 6 ]	 = <fAnisotropy>;

		MinFilter[ 7 ]           = <fFilter>;
		MagFilter[ 7 ]           = <fFilter>;
		MipFilter[ 7 ]           = <fMipFilter>;

		MaxAnisotropy[ 7 ]	 = <fAnisotropy>;

		// Shader Constants

		PixelShaderConstant[ TextureFactor ]  = <vTextureFactor>;
		PixelShaderConstant[ One ]            = <vOne>;

		VertexShaderConstant[ MatWVP ]        = <mWVP>;
		VertexShaderConstant[ Rot ]           = <vRot>;

		// Shaders

		PixelShader = 
		
		   asm {
				ps_3_0

				dcl_texcoord0 v0.xy
				dcl_texcoord1 v1.xy
				dcl_texcoord2 v2.xy
				dcl_texcoord3 v3.xy
				dcl_texcoord4 v4.xy
				dcl_texcoord5 v5.xy
				dcl_texcoord6 v6.xy
				dcl_texcoord7 v7.xy

				dcl_2d s0
				dcl_2d s1
				dcl_2d s2
				dcl_2d s3
				dcl_2d s4
				dcl_2d s5
				dcl_2d s6
				dcl_2d s7

				texld r0, v0.xy, s0
				texld r1, v1.xy, s1
				lrp   r0, c0, r0, r1

				texld r1, v2.xy, s2
				texld r2, v3.xy, s3
				lrp   r0, c0, r0, r1
				lrp   r0, c0, r0, r2

				texld r1, v4.xy, s4
				texld r2, v5.xy, s5
				lrp   r0, c0, r0, r1
				lrp   r0, c0, r0, r2

				texld r1, v6.xy, s6
				texld r2, v7.xy, s7
				lrp   r0, c0, r0, r1
				lrp   r0, c0, r0, r2

				mov   oC0, r0
		       };

		VertexShader = <VSDefault>;
	}
}
