//
// Project:
//
//   D3D RightMark
//
// Description:
//   Effect file for "Pixel Filling" test.
//
// Effect Version: 
//
//   DirectX 9.0 (Summer 2003 SDK Update)
//
// Shader Profile:
//
//   Pixel Shaders 2.x ( Pixel Shader Assembler )
//
//   Vertex Shaders 2.x ( 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_x

		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_x
				
				mov_pp 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_x

				dcl t0

				dcl_2d s0

				texld_pp r0, t0, s0

				mov_pp   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_x

				dcl t0
				dcl t1

				dcl_2d s0
				dcl_2d s1

				texld_pp r0, t0, s0
				texld_pp r1, t1, s1
				lrp_pp   r0, c0, r0, r1

				mov_pp   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_x

				dcl t0
				dcl t1
				dcl t2

				dcl_2d s0
				dcl_2d s1
				dcl_2d s2

				texld_pp r0, t0, s0
				texld_pp r1, t1, s1
				lrp_pp   r0, c0, r0, r1

				texld_pp r1, t2, s2
				lrp_pp   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_2_x

				dcl t0
				dcl t1
				dcl t2
				dcl t3

				dcl_2d s0
				dcl_2d s1
				dcl_2d s2
				dcl_2d s3

				texld_pp r0, t0, s0
				texld_pp r1, t1, s1
				lrp_pp   r0, c0, r0, r1

				texld_pp r1, t2, s2
				texld_pp r2, t3, s3
				lrp_pp   r0, c0, r0, r1
				lrp_pp   r0, c0, r0, r2

				mov_pp   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_x

				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_pp r0, t0, s0
				texld_pp r1, t1, s1
				lrp_pp   r0, c0, r0, r1

				texld_pp r1, t2, s2
				texld_pp r2, t3, s3
				lrp_pp   r0, c0, r0, r1
				lrp_pp   r0, c0, r0, r2

				texld_pp r1, t4, s4
				lrp_pp   r0, c0, r0, r1

				mov_pp   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_x

				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_pp r0, t0, s0
				texld_pp r1, t1, s1
				lrp_pp   r0, c0, r0, r1

				texld_pp r1, t2, s2
				texld_pp r2, t3, s3
				lrp_pp   r0, c0, r0, r1
				lrp_pp   r0, c0, r0, r2

				texld_pp r1, t4, s4
				texld_pp r2, t5, s5
				lrp_pp   r0, c0, r0, r1
				lrp_pp   r0, c0, r0, r2

				mov_pp   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_x

				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_pp r0, t0, s0
				texld_pp r1, t1, s1
				lrp_pp   r0, c0, r0, r1

				texld_pp r1, t2, s2
				texld_pp r2, t3, s3
				lrp_pp   r0, c0, r0, r1
				lrp_pp   r0, c0, r0, r2

				texld_pp r1, t4, s4
				texld_pp r2, t5, s5
				lrp_pp   r0, c0, r0, r1
				lrp_pp   r0, c0, r0, r2

				texld_pp r1, t6, s6
				lrp_pp   r0, c0, r0, r1

				mov_pp   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_x

				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_pp r0, t0, s0
				texld_pp r1, t1, s1
				lrp_pp   r0, c0, r0, r1

				texld_pp r1, t2, s2
				texld_pp r2, t3, s3
				lrp_pp   r0, c0, r0, r1
				lrp_pp   r0, c0, r0, r2

				texld_pp r1, t4, s4
				texld_pp r2, t5, s5
				lrp_pp   r0, c0, r0, r1
				lrp_pp   r0, c0, r0, r2

				texld_pp r1, t6, s6
				texld_pp r2, t7, s7
				lrp_pp   r0, c0, r0, r1
				lrp_pp   r0, c0, r0, r2

				mov_pp   oC0, r0
		       };

		VertexShader = <VSDefault>;
	}
}
