//
// Project:
//
//   D3D RightMark
//
// Description:
//   Effect file for "Pixel Filling" test.
//
// Effect Version: 
//
//   DirectX 9.0 (Summer 2003 SDK Update)
//
// Shader Profile:
//
//   Pixel Shaders 2.0 ( Pixel Shader Assembler )
//
//   Vertex Shaders 2.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   oPos
#define OutTexCoord0  oT0
#define OutTexCoord1  oT1
#define OutTexCoord2  oT2
#define OutTexCoord3  oT3
#define OutTexCoord4  oT4
#define OutTexCoord5  oT5
#define OutTexCoord6  oT6
#define OutTexCoord7  oT7

#define Temp          r0

#define MatWVP        0
#define Rot           10

vertexshader VSDefault =
	asm {	
		vs_2_0

		dcl_position InPosition
		dcl_normal   InNormal
		dcl_texcoord InTexCoord

		// 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_2_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_2_0

				dcl t0

				dcl_2d s0

				texld r0, t0, 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_2_0

				dcl t0
				dcl t1

				dcl_2d s0
				dcl_2d s1

				texld r0, t0, s0
				texld r1, t1, 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_2_0

				dcl t0
				dcl t1
				dcl t2

				dcl_2d s0
				dcl_2d s1
				dcl_2d s2

				texld r0, t0, s0
				texld r1, t1, s1
				texld r2, t2, s2

				lrp   r0, c0, r0, r1
				lrp   r0, c0, r0, r2

				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_2_0

				dcl t0
				dcl t1
				dcl t2
				dcl t3

				dcl_2d s0
				dcl_2d s1
				dcl_2d s2
				dcl_2d s3

				texld r0, t0, s0
				texld r1, t1, s1
				texld r2, t2, s2
				texld r3, t3, s3

				lrp   r0, c0, r0, r1
				lrp   r0, c0, r0, r2
				lrp   r0, c0, r0, r3

				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_2_0

				dcl t0
				dcl t1
				dcl t2
				dcl t3
				dcl t4

				dcl_2d s0
				dcl_2d s1
				dcl_2d s2
				dcl_2d s3
				dcl_2d s4

				texld r0, t0, s0
				texld r1, t1, s1
				texld r2, t2, s2
				texld r3, t3, s3
				texld r4, t4, s4

				lrp   r0, c0, r0, r1
				lrp   r0, c0, r0, r2
				lrp   r0, c0, r0, r3
				lrp   r0, c0, r0, r4

				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_2_0

				dcl t0
				dcl t1
				dcl t2
				dcl t3
				dcl t4
				dcl t5

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

				texld r0, t0, s0
				texld r1, t1, s1
				texld r2, t2, s2
				texld r3, t3, s3
				texld r4, t4, s4
				texld r5, t5, s5

				lrp   r0, c0, r0, r1
				lrp   r0, c0, r0, r2
				lrp   r0, c0, r0, r3
				lrp   r0, c0, r0, r4
				lrp   r0, c0, r0, r5

				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_2_0

				dcl t0
				dcl t1
				dcl t2
				dcl t3
				dcl t4
				dcl t5
				dcl t6

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

				texld r0, t0, s0
				texld r1, t1, s1
				texld r2, t2, s2
				texld r3, t3, s3
				texld r4, t4, s4
				texld r5, t5, s5
				texld r6, t6, s6

				lrp   r0, c0, r0, r1
				lrp   r0, c0, r0, r2
				lrp   r0, c0, r0, r3
				lrp   r0, c0, r0, r4
				lrp   r0, c0, r0, r5
				lrp   r0, c0, r0, r6

				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_2_0

				dcl t0
				dcl t1
				dcl t2
				dcl t3
				dcl t4
				dcl t5
				dcl t6
				dcl t7

				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, t0, s0
				texld r1, t1, s1
				texld r2, t2, s2
				texld r3, t3, s3
				texld r4, t4, s4
				texld r5, t5, s5
				texld r6, t6, s6
				texld r7, t7, s7

				lrp   r0, c0, r0, r1
				lrp   r0, c0, r0, r2
				lrp   r0, c0, r0, r3
				lrp   r0, c0, r0, r4
				lrp   r0, c0, r0, r5
				lrp   r0, c0, r0, r6
				lrp   r0, c0, r0, r7

				mov   oC0, r0
		       };

		VertexShader = <VSDefault>;
	}
}
