// SwiftShader Software Renderer
//
// Copyright(c) 2005-2013 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//

#include "PixelRoutine.hpp"

#include "Renderer.hpp"
#include "QuadRasterizer.hpp"
#include "Surface.hpp"
#include "Primitive.hpp"
#include "CPUID.hpp"
#include "SamplerCore.hpp"
#include "Constants.hpp"
#include "Debug.hpp"

#include <assert.h>

extern bool localShaderConstants;

namespace sw
{
	extern bool complementaryDepthBuffer;
	extern bool postBlendSRGB;
	extern bool exactColorRounding;
	extern bool booleanFaceRegister;
	extern bool halfIntegerCoordinates;     // Pixel centers are not at integer coordinates
	extern bool fullPixelPositionRegister;

	PixelRoutine::PixelRoutine(const PixelProcessor::State &state, const PixelShader *shader) : Rasterizer(state), shader(shader)
	{
		perturbate = false;
		luminance = false;
		previousScaling = false;

		ifDepth = 0;
		loopRepDepth = 0;
		breakDepth = 0;
		currentLabel = -1;
		whileTest = false;

		for(int i = 0; i < 2048; i++)
		{
			labelBlock[i] = 0;
		}
	}

	PixelRoutine::~PixelRoutine()
	{
		for(int i = 0; i < 16; i++)
		{
			delete sampler[i];
		}
	}

	void PixelRoutine::quad(Registers &r, Pointer<Byte> cBuffer[4], Pointer<Byte> &zBuffer, Pointer<Byte> &sBuffer, Int cMask[4], Int &x, Int &y)
	{
		#if PERF_PROFILE
			Long pipeTime = Ticks();
		#endif

		for(int i = 0; i < 16; i++)
		{
			sampler[i] = new SamplerCore(r.constants, state.sampler[i]);
		}

		const bool earlyDepthTest = !state.depthOverride && !state.alphaTestActive();
		const bool integerPipeline = shaderVersion() <= 0x0104;

		Int zMask[4];   // Depth mask
		Int sMask[4];   // Stencil mask

		for(unsigned int q = 0; q < state.multiSample; q++)
		{
			zMask[q] = cMask[q];
			sMask[q] = cMask[q];
		}

		for(unsigned int q = 0; q < state.multiSample; q++)
		{
			stencilTest(r, sBuffer, q, x, sMask[q], cMask[q]);
		}

		Float4 f;

		Vector4i &current = r.ri[0];
		Vector4i &diffuse = r.vi[0];
		Vector4i &specular = r.vi[1];

		Float4 (&z)[4] = r.z;
		Float4 &w = r.w;
		Float4 &rhw = r.rhw;
		Float4 rhwCentroid;

		Float4 xxxx = Float4(Float(x)) + *Pointer<Float4>(r.primitive + OFFSET(Primitive,xQuad), 16);
		Float4 yyyy = Float4(Float(y)) + *Pointer<Float4>(r.primitive + OFFSET(Primitive,yQuad), 16);

		if(interpolateZ())
		{
			for(unsigned int q = 0; q < state.multiSample; q++)
			{
				Float4 x = xxxx;
			
				if(state.multiSample > 1)
				{
					x -= *Pointer<Float4>(r.constants + OFFSET(Constants,X) + q * sizeof(float4));
				}

				z[q] = interpolate(x, r.Dz[q], z[q], r.primitive + OFFSET(Primitive,z), false, false);
			}
		}

		Bool depthPass = false;

		if(earlyDepthTest)
		{
			for(unsigned int q = 0; q < state.multiSample; q++)
			{
				depthPass = depthPass || depthTest(r, zBuffer, q, x, z[q], sMask[q], zMask[q], cMask[q]);
			}
		}

		If(depthPass || Bool(!earlyDepthTest))
		{
			#if PERF_PROFILE
				Long interpTime = Ticks();
			#endif

			// Centroid locations
			Float4 XXXX = Float4(0.0f);
			Float4 YYYY = Float4(0.0f);

			if(state.centroid)
			{
				Float4 WWWW(1.0e-9f);

				for(unsigned int q = 0; q < state.multiSample; q++)
				{
					XXXX += *Pointer<Float4>(r.constants + OFFSET(Constants,sampleX[q]) + 16 * cMask[q]);
					YYYY += *Pointer<Float4>(r.constants + OFFSET(Constants,sampleY[q]) + 16 * cMask[q]);
					WWWW += *Pointer<Float4>(r.constants + OFFSET(Constants,weight) + 16 * cMask[q]);
				}

				WWWW = Rcp_pp(WWWW);
				XXXX *= WWWW;
				YYYY *= WWWW;

				XXXX += xxxx;
				YYYY += yyyy;
			}

			if(interpolateW())
			{
				w = interpolate(xxxx, r.Dw, rhw, r.primitive + OFFSET(Primitive,w), false, false);
				rhw = reciprocal(w);

				if(state.centroid)
				{
					rhwCentroid = reciprocal(interpolateCentroid(XXXX, YYYY, rhwCentroid, r.primitive + OFFSET(Primitive,w), false, false));
				}
			}

			for(int interpolant = 0; interpolant < 10; interpolant++)
			{
				for(int component = 0; component < 4; component++)
				{
					if(state.interpolant[interpolant].component & (1 << component))
					{
						if(!state.interpolant[interpolant].centroid)
						{
							r.vf[interpolant][component] = interpolate(xxxx, r.Dv[interpolant][component], rhw, r.primitive + OFFSET(Primitive,V[interpolant][component]), (state.interpolant[interpolant].flat & (1 << component)) != 0, state.perspective);
						}
						else
						{
							r.vf[interpolant][component] = interpolateCentroid(XXXX, YYYY, rhwCentroid, r.primitive + OFFSET(Primitive,V[interpolant][component]), (state.interpolant[interpolant].flat & (1 << component)) != 0, state.perspective);
						}
					}
				}

				Float4 rcp;

				switch(state.interpolant[interpolant].project)
				{
				case 0:
					break;
				case 1:
					rcp = reciprocal(r.vf[interpolant].y);
					r.vf[interpolant].x = r.vf[interpolant].x * rcp;
					break;
				case 2:
					rcp = reciprocal(r.vf[interpolant].z);
					r.vf[interpolant].x = r.vf[interpolant].x * rcp;
					r.vf[interpolant].y = r.vf[interpolant].y * rcp;
					break;
				case 3:
					rcp = reciprocal(r.vf[interpolant].w);
					r.vf[interpolant].x = r.vf[interpolant].x * rcp;
					r.vf[interpolant].y = r.vf[interpolant].y * rcp;
					r.vf[interpolant].z = r.vf[interpolant].z * rcp;
					break;
				}
			}

			if(state.fog.component)
			{
				f = interpolate(xxxx, r.Df, rhw, r.primitive + OFFSET(Primitive,f), state.fog.flat & 0x01, state.perspective);
			}

			if(integerPipeline)
			{
				if(state.color[0].component & 0x1) diffuse.x = convertFixed12(r.vf[0].x); else diffuse.x = Short4(0x1000);
				if(state.color[0].component & 0x2) diffuse.y = convertFixed12(r.vf[0].y); else diffuse.y = Short4(0x1000);
				if(state.color[0].component & 0x4) diffuse.z = convertFixed12(r.vf[0].z); else diffuse.z = Short4(0x1000);
				if(state.color[0].component & 0x8) diffuse.w = convertFixed12(r.vf[0].w); else diffuse.w = Short4(0x1000);

				if(state.color[1].component & 0x1) specular.x = convertFixed12(r.vf[1].x); else specular.x = Short4(0x0000, 0x0000, 0x0000, 0x0000);
				if(state.color[1].component & 0x2) specular.y = convertFixed12(r.vf[1].y); else specular.y = Short4(0x0000, 0x0000, 0x0000, 0x0000);
				if(state.color[1].component & 0x4) specular.z = convertFixed12(r.vf[1].z); else specular.z = Short4(0x0000, 0x0000, 0x0000, 0x0000);
				if(state.color[1].component & 0x8) specular.w = convertFixed12(r.vf[1].w); else specular.w = Short4(0x0000, 0x0000, 0x0000, 0x0000);
			}
			else if(shaderVersion() >= 0x0300)
			{
				if(shader->vPosDeclared)
				{
					if(!halfIntegerCoordinates)
					{
						r.vPos.x = Float4(Float(x)) + Float4(0, 1, 0, 1);
						r.vPos.y = Float4(Float(y)) + Float4(0, 0, 1, 1);
					}
					else
					{
						r.vPos.x = Float4(Float(x)) + Float4(0.5f, 1.5f, 0.5f, 1.5f);
						r.vPos.y = Float4(Float(y)) + Float4(0.5f, 0.5f, 1.5f, 1.5f);
					}

					if(fullPixelPositionRegister)
					{
						r.vPos.z = z[0];   // FIXME: Centroid?
						r.vPos.w = w;      // FIXME: Centroid?
					}
				}

				if(shader->vFaceDeclared)
				{
					Float4 area = *Pointer<Float>(r.primitive + OFFSET(Primitive,area));
					Float4 face = booleanFaceRegister ? Float4(As<Float4>(CmpNLT(area, Float4(0.0f)))) : area;

					r.vFace.x = face;
					r.vFace.y = face;
					r.vFace.z = face;
					r.vFace.w = face;
				}
			}

			#if PERF_PROFILE
				r.cycles[PERF_INTERP] += Ticks() - interpTime;
			#endif

			Bool alphaPass = true;

			if(colorUsed())
			{
				#if PERF_PROFILE
					Long shaderTime = Ticks();
				#endif

				if(shader)
				{
				//	shader->print("PixelShader-%0.8X.txt", state.shaderID);

					if(shader->getVersion() <= 0x0104)
					{
						ps_1_x(r, cMask);
					}
					else
					{
						ps_2_x(r, cMask);
					}
				}
				else
				{
					current = diffuse;
					Vector4i temp(0x0000, 0x0000, 0x0000, 0x0000);

					for(int stage = 0; stage < 8; stage++)
					{
						if(state.textureStage[stage].stageOperation == TextureStage::STAGE_DISABLE)
						{
							break;
						}

						Vector4i texture;

						if(state.textureStage[stage].usesTexture)
						{
							sampleTexture(r, texture, stage, stage);
						}

						blendTexture(r, current, temp, texture, stage);
					}

					specularPixel(current, specular);
				}

				#if PERF_PROFILE
					r.cycles[PERF_SHADER] += Ticks() - shaderTime;
				#endif

				if(integerPipeline)
				{
					current.x = Min(current.x, Short4(0x0FFF, 0x0FFF, 0x0FFF, 0x0FFF)); current.x = Max(current.x, Short4(0x0000, 0x0000, 0x0000, 0x0000));
					current.y = Min(current.y, Short4(0x0FFF, 0x0FFF, 0x0FFF, 0x0FFF)); current.y = Max(current.y, Short4(0x0000, 0x0000, 0x0000, 0x0000));
					current.z = Min(current.z, Short4(0x0FFF, 0x0FFF, 0x0FFF, 0x0FFF)); current.z = Max(current.z, Short4(0x0000, 0x0000, 0x0000, 0x0000));
					current.w = Min(current.w, Short4(0x0FFF, 0x0FFF, 0x0FFF, 0x0FFF)); current.w = Max(current.w, Short4(0x0000, 0x0000, 0x0000, 0x0000));

					alphaPass = alphaTest(r, cMask, current);
				}
				else
				{
					clampColor(r.oC);

					alphaPass = alphaTest(r, cMask, r.oC[0]);
				}

				if((shader && shader->containsKill()) || state.alphaTestActive())
				{
					for(unsigned int q = 0; q < state.multiSample; q++)
					{
						zMask[q] &= cMask[q];
						sMask[q] &= cMask[q];
					}
				}
			}

			If(alphaPass)
			{
				if(!earlyDepthTest)
				{
					for(unsigned int q = 0; q < state.multiSample; q++)
					{
						depthPass = depthPass || depthTest(r, zBuffer, q, x, z[q], sMask[q], zMask[q], cMask[q]);
					}
				}

				#if PERF_PROFILE
					Long ropTime = Ticks();
				#endif

				If(depthPass || Bool(earlyDepthTest))
				{
					for(unsigned int q = 0; q < state.multiSample; q++)
					{
						if(state.multiSampleMask & (1 << q))
						{
							writeDepth(r, zBuffer, q, x, z[q], zMask[q]);

							if(state.occlusionEnabled)
							{
								r.occlusion += *Pointer<UInt>(r.constants + OFFSET(Constants,occlusionCount) + 4 * (zMask[q] & sMask[q]));
							}
						}
					}

					if(colorUsed())
					{
						#if PERF_PROFILE
							AddAtomic(Pointer<Long>(&profiler.ropOperations), 4);
						#endif

						if(integerPipeline)
						{
							rasterOperation(current, r, f, cBuffer[0], x, sMask, zMask, cMask);
						}
						else
						{
							rasterOperation(r.oC, r, f, cBuffer, x, sMask, zMask, cMask);
						}
					}
				}

				#if PERF_PROFILE
					r.cycles[PERF_ROP] += Ticks() - ropTime;
				#endif
			}
		}

		for(unsigned int q = 0; q < state.multiSample; q++)
		{
			if(state.multiSampleMask & (1 << q))
			{
				writeStencil(r, sBuffer, q, x, sMask[q], zMask[q], cMask[q]);
			}
		}

		#if PERF_PROFILE
			r.cycles[PERF_PIPE] += Ticks() - pipeTime;
		#endif
	}

	Float4 PixelRoutine::interpolate(Float4 &x, Float4 &D, Float4 &rhw, Pointer<Byte> planeEquation, bool flat, bool perspective)
	{
		Float4 interpolant = D;

		if(!flat)
		{
			interpolant += x * *Pointer<Float4>(planeEquation + OFFSET(PlaneEquation,A), 16);

			if(perspective)
			{
				interpolant *= rhw;
			}
		}

		return interpolant;
	}

	Float4 PixelRoutine::interpolateCentroid(Float4 &x, Float4 &y, Float4 &rhw, Pointer<Byte> planeEquation, bool flat, bool perspective)
	{
		Float4 interpolant = *Pointer<Float4>(planeEquation + OFFSET(PlaneEquation,C), 16);

		if(!flat)
		{
			interpolant += x * *Pointer<Float4>(planeEquation + OFFSET(PlaneEquation,A), 16) +
			               y * *Pointer<Float4>(planeEquation + OFFSET(PlaneEquation,B), 16);

			if(perspective)
			{
				interpolant *= rhw;
			}
		}

		return interpolant;
	}

	void PixelRoutine::stencilTest(Registers &r, Pointer<Byte> &sBuffer, int q, Int &x, Int &sMask, Int &cMask)
	{
		if(!state.stencilActive)
		{
			return;
		}

		// (StencilRef & StencilMask) CompFunc (StencilBufferValue & StencilMask)

		Pointer<Byte> buffer = sBuffer + 2 * x;

		if(q > 0)
		{
			buffer += q * *Pointer<Int>(r.data + OFFSET(DrawData,stencilSliceB));
		}

		Byte8 value = As<Byte8>(Long1(*Pointer<UInt>(buffer)));
		Byte8 valueCCW = value;

		if(!state.noStencilMask)
		{
			value &= *Pointer<Byte8>(r.data + OFFSET(DrawData,stencil[0].testMaskQ));
		}

		stencilTest(r, value, (Context::StencilCompareMode)state.stencilCompareMode, false);

		if(state.twoSidedStencil)
		{
			if(!state.noStencilMaskCCW)
			{
				valueCCW &= *Pointer<Byte8>(r.data + OFFSET(DrawData,stencil[1].testMaskQ));
			}

			stencilTest(r, valueCCW, (Context::StencilCompareMode)state.stencilCompareModeCCW, true);

			value &= *Pointer<Byte8>(r.primitive + OFFSET(Primitive,clockwiseMask));
			valueCCW &= *Pointer<Byte8>(r.primitive + OFFSET(Primitive,invClockwiseMask));
			value |= valueCCW;
		}

		sMask = SignMask(value) & cMask;
	}

	void PixelRoutine::stencilTest(Registers &r, Byte8 &value, Context::StencilCompareMode stencilCompareMode, bool CCW)
	{
		Byte8 equal;

		switch(stencilCompareMode)
		{
		case Context::STENCIL_ALWAYS:
			value = Byte8(0xFFFFFFFFFFFFFFFF);
			break;
		case Context::STENCIL_NEVER:
			value = Byte8(0x0000000000000000);
			break;
		case Context::STENCIL_LESS:			// a < b ~ b > a
			value += Byte8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
			value = CmpGT(As<SByte8>(value), *Pointer<SByte8>(r.data + OFFSET(DrawData,stencil[CCW].referenceMaskedSignedQ)));
			break;
		case Context::STENCIL_EQUAL:
			value = CmpEQ(value, *Pointer<Byte8>(r.data + OFFSET(DrawData,stencil[CCW].referenceMaskedQ)));
			break;
		case Context::STENCIL_NOTEQUAL:		// a != b ~ !(a == b)
			value = CmpEQ(value, *Pointer<Byte8>(r.data + OFFSET(DrawData,stencil[CCW].referenceMaskedQ)));
			value ^= Byte8(0xFFFFFFFFFFFFFFFF);
			break;
		case Context::STENCIL_LESSEQUAL:	// a <= b ~ (b > a) || (a == b)
			equal = value;
			equal = CmpEQ(equal, *Pointer<Byte8>(r.data + OFFSET(DrawData,stencil[CCW].referenceMaskedQ)));
			value += Byte8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
			value = CmpGT(As<SByte8>(value), *Pointer<SByte8>(r.data + OFFSET(DrawData,stencil[CCW].referenceMaskedSignedQ)));
			value |= equal;
			break;
		case Context::STENCIL_GREATER:		// a > b
			equal = *Pointer<Byte8>(r.data + OFFSET(DrawData,stencil[CCW].referenceMaskedSignedQ));
			value += Byte8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
			equal = CmpGT(As<SByte8>(equal), As<SByte8>(value));
			value = equal;
			break;
		case Context::STENCIL_GREATEREQUAL:	// a >= b ~ !(a < b) ~ !(b > a)
			value += Byte8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
			value = CmpGT(As<SByte8>(value), *Pointer<SByte8>(r.data + OFFSET(DrawData,stencil[CCW].referenceMaskedSignedQ)));
			value ^= Byte8(0xFFFFFFFFFFFFFFFF);
			break;
		default:
			ASSERT(false);
		}
	}

	Bool PixelRoutine::depthTest(Registers &r, Pointer<Byte> &zBuffer, int q, Int &x, Float4 &z, Int &sMask, Int &zMask, Int &cMask)
	{
		if(!state.depthTestActive)
		{
			return true;
		}

		Float4 Z = z;

		if(shader && shader->depthOverride())
		{
			if(complementaryDepthBuffer)
			{
				Z = Float4(1.0f) - r.oDepth;
			}
			else
			{
				Z = r.oDepth;
			}
		}

		Pointer<Byte> buffer;
		Int pitch;

		if(!state.quadLayoutDepthBuffer)
		{
			buffer = zBuffer + 4 * x;
			pitch = *Pointer<Int>(r.data + OFFSET(DrawData,depthPitchB));
		}
		else
		{
			buffer = zBuffer + 8 * x;
		}

		if(q > 0)
		{
			buffer += q * *Pointer<Int>(r.data + OFFSET(DrawData,depthSliceB));
		}

		Float4 zValue;

		if(state.depthCompareMode != Context::DEPTH_NEVER || (state.depthCompareMode != Context::DEPTH_ALWAYS && !state.depthWriteEnable))
		{
			if(!state.quadLayoutDepthBuffer)
			{
				// FIXME: Properly optimizes?
				zValue.xy = *Pointer<Float4>(buffer);
				zValue.zw = *Pointer<Float4>(buffer + pitch - 8);
			}
			else
			{
				zValue = *Pointer<Float4>(buffer, 16);
			}
		}

		Int4 zTest;

		switch(state.depthCompareMode)
		{
		case Context::DEPTH_ALWAYS:
			// Optimized
			break;
		case Context::DEPTH_NEVER:
			// Optimized
			break;
		case Context::DEPTH_EQUAL:
			zTest = CmpEQ(zValue, Z);
			break;
		case Context::DEPTH_NOTEQUAL:
			zTest = CmpNEQ(zValue, Z);
			break;
		case Context::DEPTH_LESS:
			if(complementaryDepthBuffer)
			{
				zTest = CmpLT(zValue, Z);
			}
			else
			{
				zTest = CmpNLE(zValue, Z);
			}
			break;
		case Context::DEPTH_GREATEREQUAL:
			if(complementaryDepthBuffer)
			{
				zTest = CmpNLT(zValue, Z);
			}
			else
			{
				zTest = CmpLE(zValue, Z);
			}
			break;
		case Context::DEPTH_LESSEQUAL:
			if(complementaryDepthBuffer)
			{
				zTest = CmpLE(zValue, Z);
			}
			else
			{
				zTest = CmpNLT(zValue, Z);
			}
			break;
		case Context::DEPTH_GREATER:
			if(complementaryDepthBuffer)
			{
				zTest = CmpNLE(zValue, Z);
			}
			else
			{
				zTest = CmpLT(zValue, Z);
			}
			break;
		default:
			ASSERT(false);
		}

		switch(state.depthCompareMode)
		{
		case Context::DEPTH_ALWAYS:
			zMask = cMask;
			break;
		case Context::DEPTH_NEVER:
			zMask = 0x0;
			break;
		default:
			zMask = SignMask(zTest) & cMask;
			break;
		}
		
		if(state.stencilActive)
		{
			zMask &= sMask;
		}

		return zMask != 0;
	}

	void PixelRoutine::blendTexture(Registers &r, Vector4i &current, Vector4i &temp, Vector4i &texture, int stage)
	{
		Vector4i *arg1;
		Vector4i *arg2;
		Vector4i *arg3;
		Vector4i res;

		Vector4i constant;
		Vector4i tfactor;

		const TextureStage::State &textureStage = state.textureStage[stage];

		if(textureStage.firstArgument == TextureStage::SOURCE_CONSTANT ||
		   textureStage.firstArgumentAlpha == TextureStage::SOURCE_CONSTANT ||
		   textureStage.secondArgument == TextureStage::SOURCE_CONSTANT ||
		   textureStage.secondArgumentAlpha == TextureStage::SOURCE_CONSTANT ||
		   textureStage.thirdArgument == TextureStage::SOURCE_CONSTANT ||
		   textureStage.thirdArgumentAlpha == TextureStage::SOURCE_CONSTANT)
		{
			constant.x = *Pointer<Short4>(r.data + OFFSET(DrawData,textureStage[stage].constantColor4[0]));
			constant.y = *Pointer<Short4>(r.data + OFFSET(DrawData,textureStage[stage].constantColor4[1]));
			constant.z = *Pointer<Short4>(r.data + OFFSET(DrawData,textureStage[stage].constantColor4[2]));
			constant.w = *Pointer<Short4>(r.data + OFFSET(DrawData,textureStage[stage].constantColor4[3]));
		}

		if(textureStage.firstArgument == TextureStage::SOURCE_TFACTOR ||
		   textureStage.firstArgumentAlpha == TextureStage::SOURCE_TFACTOR ||
		   textureStage.secondArgument == TextureStage::SOURCE_TFACTOR ||
		   textureStage.secondArgumentAlpha == TextureStage::SOURCE_TFACTOR ||
		   textureStage.thirdArgument == TextureStage::SOURCE_TFACTOR ||
		   textureStage.thirdArgumentAlpha == TextureStage::SOURCE_TFACTOR)
		{
			tfactor.x = *Pointer<Short4>(r.data + OFFSET(DrawData,factor.textureFactor4[0]));
			tfactor.y = *Pointer<Short4>(r.data + OFFSET(DrawData,factor.textureFactor4[1]));
			tfactor.z = *Pointer<Short4>(r.data + OFFSET(DrawData,factor.textureFactor4[2]));
			tfactor.w = *Pointer<Short4>(r.data + OFFSET(DrawData,factor.textureFactor4[3]));
		}

		// Premodulate
		if(stage > 0 && textureStage.usesTexture)
		{
			if(state.textureStage[stage - 1].stageOperation == TextureStage::STAGE_PREMODULATE)
			{
				current.x = MulHigh(current.x, texture.x) << 4;
				current.y = MulHigh(current.y, texture.y) << 4;
				current.z = MulHigh(current.z, texture.z) << 4;
			}

			if(state.textureStage[stage - 1].stageOperationAlpha == TextureStage::STAGE_PREMODULATE)
			{
				current.w = MulHigh(current.w, texture.w) << 4;
			}
		}

		if(luminance)
		{
			texture.x = MulHigh(texture.x, r.L) << 4;
			texture.y = MulHigh(texture.y, r.L) << 4;
			texture.z = MulHigh(texture.z, r.L) << 4;

			luminance = false;
		}

		switch(textureStage.firstArgument)
		{
		case TextureStage::SOURCE_TEXTURE:	arg1 = &texture;		break;
		case TextureStage::SOURCE_CONSTANT:	arg1 = &constant;		break;
		case TextureStage::SOURCE_CURRENT:	arg1 = &current;		break;
		case TextureStage::SOURCE_DIFFUSE:	arg1 = &r.diffuse;		break;
		case TextureStage::SOURCE_SPECULAR:	arg1 = &r.specular;		break;
		case TextureStage::SOURCE_TEMP:		arg1 = &temp;			break;
		case TextureStage::SOURCE_TFACTOR:	arg1 = &tfactor;		break;
		default:
			ASSERT(false);
		}

		switch(textureStage.secondArgument)
		{
		case TextureStage::SOURCE_TEXTURE:	arg2 = &texture;		break;
		case TextureStage::SOURCE_CONSTANT:	arg2 = &constant;		break;
		case TextureStage::SOURCE_CURRENT:	arg2 = &current;		break;
		case TextureStage::SOURCE_DIFFUSE:	arg2 = &r.diffuse;		break;
		case TextureStage::SOURCE_SPECULAR:	arg2 = &r.specular;		break;
		case TextureStage::SOURCE_TEMP:		arg2 = &temp;			break;
		case TextureStage::SOURCE_TFACTOR:	arg2 = &tfactor;		break;
		default:
			ASSERT(false);
		}

		switch(textureStage.thirdArgument)
		{
		case TextureStage::SOURCE_TEXTURE:	arg3 = &texture;		break;
		case TextureStage::SOURCE_CONSTANT:	arg3 = &constant;		break;
		case TextureStage::SOURCE_CURRENT:	arg3 = &current;		break;
		case TextureStage::SOURCE_DIFFUSE:	arg3 = &r.diffuse;		break;
		case TextureStage::SOURCE_SPECULAR:	arg3 = &r.specular;		break;
		case TextureStage::SOURCE_TEMP:		arg3 = &temp;			break;
		case TextureStage::SOURCE_TFACTOR:	arg3 = &tfactor;		break;
		default:
			ASSERT(false);
		}

		Vector4i mod1;
		Vector4i mod2;
		Vector4i mod3;

		switch(textureStage.firstModifier)
		{
		case TextureStage::MODIFIER_COLOR:
			break;
		case TextureStage::MODIFIER_INVCOLOR:
			{
				mod1.x = SubSat(Short4(0x1000), arg1->x);
				mod1.y = SubSat(Short4(0x1000), arg1->y);
				mod1.z = SubSat(Short4(0x1000), arg1->z);
				mod1.w = SubSat(Short4(0x1000), arg1->w);

				arg1 = &mod1;
			}
			break;
		case TextureStage::MODIFIER_ALPHA:
			{
				mod1.x = arg1->w;
				mod1.y = arg1->w;
				mod1.z = arg1->w;
				mod1.w = arg1->w;

				arg1 = &mod1;
			}
			break;
		case TextureStage::MODIFIER_INVALPHA:
			{
				mod1.x = SubSat(Short4(0x1000), arg1->w);
				mod1.y = SubSat(Short4(0x1000), arg1->w);
				mod1.z = SubSat(Short4(0x1000), arg1->w);
				mod1.w = SubSat(Short4(0x1000), arg1->w);

				arg1 = &mod1;
			}
			break;
		default:
			ASSERT(false);
		}

		switch(textureStage.secondModifier)
		{
		case TextureStage::MODIFIER_COLOR:
			break;
		case TextureStage::MODIFIER_INVCOLOR:
			{
				mod2.x = SubSat(Short4(0x1000), arg2->x);
				mod2.y = SubSat(Short4(0x1000), arg2->y);
				mod2.z = SubSat(Short4(0x1000), arg2->z);
				mod2.w = SubSat(Short4(0x1000), arg2->w);

				arg2 = &mod2;
			}
			break;
		case TextureStage::MODIFIER_ALPHA:
			{
				mod2.x = arg2->w;
				mod2.y = arg2->w;
				mod2.z = arg2->w;
				mod2.w = arg2->w;

				arg2 = &mod2;
			}
			break;
		case TextureStage::MODIFIER_INVALPHA:
			{
				mod2.x = SubSat(Short4(0x1000), arg2->w);
				mod2.y = SubSat(Short4(0x1000), arg2->w);
				mod2.z = SubSat(Short4(0x1000), arg2->w);
				mod2.w = SubSat(Short4(0x1000), arg2->w);

				arg2 = &mod2;
			}
			break;
		default:
			ASSERT(false);
		}

		switch(textureStage.thirdModifier)
		{
		case TextureStage::MODIFIER_COLOR:
			break;
		case TextureStage::MODIFIER_INVCOLOR:
			{
				mod3.x = SubSat(Short4(0x1000), arg3->x);
				mod3.y = SubSat(Short4(0x1000), arg3->y);
				mod3.z = SubSat(Short4(0x1000), arg3->z);
				mod3.w = SubSat(Short4(0x1000), arg3->w);

				arg3 = &mod3;
			}
			break;
		case TextureStage::MODIFIER_ALPHA:
			{
				mod3.x = arg3->w;
				mod3.y = arg3->w;
				mod3.z = arg3->w;
				mod3.w = arg3->w;

				arg3 = &mod3;
			}
			break;
		case TextureStage::MODIFIER_INVALPHA:
			{
				mod3.x = SubSat(Short4(0x1000), arg3->w);
				mod3.y = SubSat(Short4(0x1000), arg3->w);
				mod3.z = SubSat(Short4(0x1000), arg3->w);
				mod3.w = SubSat(Short4(0x1000), arg3->w);

				arg3 = &mod3;
			}
			break;
		default:
			ASSERT(false);
		}

		switch(textureStage.stageOperation)
		{
		case TextureStage::STAGE_DISABLE:
			break;
		case TextureStage::STAGE_SELECTARG1:					// Arg1
			{
				res.x = arg1->x;
				res.y = arg1->y;
				res.z = arg1->z;
			}
			break;
		case TextureStage::STAGE_SELECTARG2:					// Arg2
			{
				res.x = arg2->x;
				res.y = arg2->y;
				res.z = arg2->z;
			}
			break;
		case TextureStage::STAGE_SELECTARG3:					// Arg3
			{
				res.x = arg3->x;
				res.y = arg3->y;
				res.z = arg3->z;
			}
			break;
		case TextureStage::STAGE_MODULATE:					// Arg1 * Arg2
			{
				res.x = MulHigh(arg1->x, arg2->x) << 4;
				res.y = MulHigh(arg1->y, arg2->y) << 4;
				res.z = MulHigh(arg1->z, arg2->z) << 4;
			}
			break;
		case TextureStage::STAGE_MODULATE2X:					// Arg1 * Arg2 * 2
			{
				res.x = MulHigh(arg1->x, arg2->x) << 5;
				res.y = MulHigh(arg1->y, arg2->y) << 5;
				res.z = MulHigh(arg1->z, arg2->z) << 5;
			}
			break;
		case TextureStage::STAGE_MODULATE4X:					// Arg1 * Arg2 * 4
			{
				res.x = MulHigh(arg1->x, arg2->x) << 6;
				res.y = MulHigh(arg1->y, arg2->y) << 6;
				res.z = MulHigh(arg1->z, arg2->z) << 6;
			}
			break;
		case TextureStage::STAGE_ADD:						// Arg1 + Arg2
			{
				res.x = AddSat(arg1->x, arg2->x);
				res.y = AddSat(arg1->y, arg2->y);
				res.z = AddSat(arg1->z, arg2->z);
			}
			break;
		case TextureStage::STAGE_ADDSIGNED:					// Arg1 + Arg2 - 0.5
			{
				res.x = AddSat(arg1->x, arg2->x);
				res.y = AddSat(arg1->y, arg2->y);
				res.z = AddSat(arg1->z, arg2->z);

				res.x = SubSat(res.x, Short4(0x0800, 0x0800, 0x0800, 0x0800));
				res.y = SubSat(res.y, Short4(0x0800, 0x0800, 0x0800, 0x0800));
				res.z = SubSat(res.z, Short4(0x0800, 0x0800, 0x0800, 0x0800));
			}
			break;
		case TextureStage::STAGE_ADDSIGNED2X:				// (Arg1 + Arg2 - 0.5) << 1
			{
				res.x = AddSat(arg1->x, arg2->x);
				res.y = AddSat(arg1->y, arg2->y);
				res.z = AddSat(arg1->z, arg2->z);

				res.x = SubSat(res.x, Short4(0x0800, 0x0800, 0x0800, 0x0800));
				res.y = SubSat(res.y, Short4(0x0800, 0x0800, 0x0800, 0x0800));
				res.z = SubSat(res.z, Short4(0x0800, 0x0800, 0x0800, 0x0800));

				res.x = AddSat(res.x, res.x);
				res.y = AddSat(res.y, res.y);
				res.z = AddSat(res.z, res.z);
			}
			break;
		case TextureStage::STAGE_SUBTRACT:					// Arg1 - Arg2
			{
				res.x = SubSat(arg1->x, arg2->x);
				res.y = SubSat(arg1->y, arg2->y);
				res.z = SubSat(arg1->z, arg2->z);
			}
			break;
		case TextureStage::STAGE_ADDSMOOTH:					// Arg1 + Arg2 - Arg1 * Arg2
			{
				Short4 tmp;

				tmp = MulHigh(arg1->x, arg2->x) << 4; res.x = AddSat(arg1->x, arg2->x); res.x = SubSat(res.x, tmp);
				tmp = MulHigh(arg1->y, arg2->y) << 4; res.y = AddSat(arg1->y, arg2->y); res.y = SubSat(res.y, tmp);
				tmp = MulHigh(arg1->z, arg2->z) << 4; res.z = AddSat(arg1->z, arg2->z); res.z = SubSat(res.z, tmp);
			}
			break;
		case TextureStage::STAGE_MULTIPLYADD:				// Arg3 + Arg1 * Arg2
			{
				res.x = MulHigh(arg1->x, arg2->x) << 4; res.x = AddSat(res.x, arg3->x);
				res.y = MulHigh(arg1->y, arg2->y) << 4; res.y = AddSat(res.y, arg3->y);
				res.z = MulHigh(arg1->z, arg2->z) << 4; res.z = AddSat(res.z, arg3->z);
			}
			break;
		case TextureStage::STAGE_LERP:						// Arg3 * (Arg1 - Arg2) + Arg2
			{
				res.x = SubSat(arg1->x, arg2->x); res.x = MulHigh(res.x, arg3->x) << 4; res.x = AddSat(res.x, arg2->x);
				res.y = SubSat(arg1->y, arg2->y); res.y = MulHigh(res.y, arg3->y) << 4; res.y = AddSat(res.y, arg2->y);
				res.z = SubSat(arg1->z, arg2->z); res.z = MulHigh(res.z, arg3->z) << 4; res.z = AddSat(res.z, arg2->z);
			}
			break;
		case TextureStage::STAGE_DOT3:						// 2 * (Arg1.x - 0.5) * 2 * (Arg2.x - 0.5) + 2 * (Arg1.y - 0.5) * 2 * (Arg2.y - 0.5) + 2 * (Arg1.z - 0.5) * 2 * (Arg2.z - 0.5)
			{
				Short4 tmp;

				res.x = SubSat(arg1->x, Short4(0x0800, 0x0800, 0x0800, 0x0800)); tmp = SubSat(arg2->x, Short4(0x0800, 0x0800, 0x0800, 0x0800)); res.x = MulHigh(res.x, tmp);
				res.y = SubSat(arg1->y, Short4(0x0800, 0x0800, 0x0800, 0x0800)); tmp = SubSat(arg2->y, Short4(0x0800, 0x0800, 0x0800, 0x0800)); res.y = MulHigh(res.y, tmp);
				res.z = SubSat(arg1->z, Short4(0x0800, 0x0800, 0x0800, 0x0800)); tmp = SubSat(arg2->z, Short4(0x0800, 0x0800, 0x0800, 0x0800)); res.z = MulHigh(res.z, tmp);

				res.x = res.x << 6;
				res.y = res.y << 6;
				res.z = res.z << 6;

				res.x = AddSat(res.x, res.y);
				res.x = AddSat(res.x, res.z);

				// Clamp to [0, 1]
				res.x = Max(res.x, Short4(0x0000, 0x0000, 0x0000, 0x0000));
				res.x = Min(res.x, Short4(0x1000));

				res.y = res.x;
				res.z = res.x;
				res.w = res.x;
			}
			break;
		case TextureStage::STAGE_BLENDCURRENTALPHA:			// Alpha * (Arg1 - Arg2) + Arg2
			{
				res.x = SubSat(arg1->x, arg2->x); res.x = MulHigh(res.x, current.w) << 4; res.x = AddSat(res.x, arg2->x);
				res.y = SubSat(arg1->y, arg2->y); res.y = MulHigh(res.y, current.w) << 4; res.y = AddSat(res.y, arg2->y);
				res.z = SubSat(arg1->z, arg2->z); res.z = MulHigh(res.z, current.w) << 4; res.z = AddSat(res.z, arg2->z);
			}
			break;
		case TextureStage::STAGE_BLENDDIFFUSEALPHA:			// Alpha * (Arg1 - Arg2) + Arg2
			{
				res.x = SubSat(arg1->x, arg2->x); res.x = MulHigh(res.x, r.diffuse.w) << 4; res.x = AddSat(res.x, arg2->x);
				res.y = SubSat(arg1->y, arg2->y); res.y = MulHigh(res.y, r.diffuse.w) << 4; res.y = AddSat(res.y, arg2->y);
				res.z = SubSat(arg1->z, arg2->z); res.z = MulHigh(res.z, r.diffuse.w) << 4; res.z = AddSat(res.z, arg2->z);
			}
			break;
		case TextureStage::STAGE_BLENDFACTORALPHA:			// Alpha * (Arg1 - Arg2) + Arg2
			{
				res.x = SubSat(arg1->x, arg2->x); res.x = MulHigh(res.x, *Pointer<Short4>(r.data + OFFSET(DrawData,factor.textureFactor4[3]))) << 4; res.x = AddSat(res.x, arg2->x);
				res.y = SubSat(arg1->y, arg2->y); res.y = MulHigh(res.y, *Pointer<Short4>(r.data + OFFSET(DrawData,factor.textureFactor4[3]))) << 4; res.y = AddSat(res.y, arg2->y);
				res.z = SubSat(arg1->z, arg2->z); res.z = MulHigh(res.z, *Pointer<Short4>(r.data + OFFSET(DrawData,factor.textureFactor4[3]))) << 4; res.z = AddSat(res.z, arg2->z);
			}
			break;
		case TextureStage::STAGE_BLENDTEXTUREALPHA:			// Alpha * (Arg1 - Arg2) + Arg2
			{
				res.x = SubSat(arg1->x, arg2->x); res.x = MulHigh(res.x, texture.w) << 4; res.x = AddSat(res.x, arg2->x);
				res.y = SubSat(arg1->y, arg2->y); res.y = MulHigh(res.y, texture.w) << 4; res.y = AddSat(res.y, arg2->y);
				res.z = SubSat(arg1->z, arg2->z); res.z = MulHigh(res.z, texture.w) << 4; res.z = AddSat(res.z, arg2->z);
			}
			break;
		case TextureStage::STAGE_BLENDTEXTUREALPHAPM:		// Arg1 + Arg2 * (1 - Alpha)
			{
				res.x = SubSat(Short4(0x1000), texture.w); res.x = MulHigh(res.x, arg2->x) << 4; res.x = AddSat(res.x, arg1->x);
				res.y = SubSat(Short4(0x1000), texture.w); res.y = MulHigh(res.y, arg2->y) << 4; res.y = AddSat(res.y, arg1->y);
				res.z = SubSat(Short4(0x1000), texture.w); res.z = MulHigh(res.z, arg2->z) << 4; res.z = AddSat(res.z, arg1->z);
			}
			break;
		case TextureStage::STAGE_PREMODULATE:
			{
				res.x = arg1->x;
				res.y = arg1->y;
				res.z = arg1->z;
			}
			break;
		case TextureStage::STAGE_MODULATEALPHA_ADDCOLOR:		// Arg1 + Arg1.w * Arg2
			{
				res.x = MulHigh(arg1->w, arg2->x) << 4; res.x = AddSat(res.x, arg1->x);
				res.y = MulHigh(arg1->w, arg2->y) << 4; res.y = AddSat(res.y, arg1->y);
				res.z = MulHigh(arg1->w, arg2->z) << 4; res.z = AddSat(res.z, arg1->z);
			}
			break;
		case TextureStage::STAGE_MODULATECOLOR_ADDALPHA:		// Arg1 * Arg2 + Arg1.w
			{
				res.x = MulHigh(arg1->x, arg2->x) << 4; res.x = AddSat(res.x, arg1->w);
				res.y = MulHigh(arg1->y, arg2->y) << 4; res.y = AddSat(res.y, arg1->w);
				res.z = MulHigh(arg1->z, arg2->z) << 4; res.z = AddSat(res.z, arg1->w);
			}
			break;
		case TextureStage::STAGE_MODULATEINVALPHA_ADDCOLOR:	// (1 - Arg1.w) * Arg2 + Arg1
			{
				Short4 tmp;

				res.x = AddSat(arg1->x, arg2->x); tmp = MulHigh(arg1->w, arg2->x) << 4; res.x = SubSat(res.x, tmp);
				res.y = AddSat(arg1->y, arg2->y); tmp = MulHigh(arg1->w, arg2->y) << 4; res.y = SubSat(res.y, tmp);
				res.z = AddSat(arg1->z, arg2->z); tmp = MulHigh(arg1->w, arg2->z) << 4; res.z = SubSat(res.z, tmp);
			}
			break;
		case TextureStage::STAGE_MODULATEINVCOLOR_ADDALPHA:	// (1 - Arg1) * Arg2 + Arg1.w
			{
				Short4 tmp;

				res.x = AddSat(arg1->w, arg2->x); tmp = MulHigh(arg1->x, arg2->x) << 4; res.x = SubSat(res.x, tmp);
				res.y = AddSat(arg1->w, arg2->y); tmp = MulHigh(arg1->y, arg2->y) << 4; res.y = SubSat(res.y, tmp);
				res.z = AddSat(arg1->w, arg2->z); tmp = MulHigh(arg1->z, arg2->z) << 4; res.z = SubSat(res.z, tmp);
			}
			break;
		case TextureStage::STAGE_BUMPENVMAP:
			{
				r.du = Float4(texture.x) * Float4(1.0f / 0x0FE0);
				r.dv = Float4(texture.y) * Float4(1.0f / 0x0FE0);
			
				Float4 du2;
				Float4 dv2;

				du2 = r.du;
				dv2 = r.dv;
				r.du *= *Pointer<Float4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4F[0][0]));
				dv2 *= *Pointer<Float4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4F[1][0]));
				r.du += dv2;
				r.dv *= *Pointer<Float4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4F[1][1]));
				du2 *= *Pointer<Float4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4F[0][1]));
				r.dv += du2;

				perturbate = true;

				res.x = r.current.x;
				res.y = r.current.y;
				res.z = r.current.z;
				res.w = r.current.w;
			}
			break;
		case TextureStage::STAGE_BUMPENVMAPLUMINANCE:
			{
				r.du = Float4(texture.x) * Float4(1.0f / 0x0FE0);
				r.dv = Float4(texture.y) * Float4(1.0f / 0x0FE0);
			
				Float4 du2;
				Float4 dv2;

				du2 = r.du;
				dv2 = r.dv;

				r.du *= *Pointer<Float4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4F[0][0]));
				dv2 *= *Pointer<Float4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4F[1][0]));
				r.du += dv2;
				r.dv *= *Pointer<Float4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4F[1][1]));
				du2 *= *Pointer<Float4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4F[0][1]));
				r.dv += du2;

				perturbate = true;

				r.L = texture.z;
				r.L = MulHigh(r.L, *Pointer<Short4>(r.data + OFFSET(DrawData,textureStage[stage].luminanceScale4)));
				r.L = r.L << 4;
				r.L = AddSat(r.L, *Pointer<Short4>(r.data + OFFSET(DrawData,textureStage[stage].luminanceOffset4)));
				r.L = Max(r.L, Short4(0x0000, 0x0000, 0x0000, 0x0000));
				r.L = Min(r.L, Short4(0x1000));

				luminance = true;

				res.x = r.current.x;
				res.y = r.current.y;
				res.z = r.current.z;
				res.w = r.current.w;
			}
			break;
		default:
			ASSERT(false);
		}

		if(textureStage.stageOperation != TextureStage::STAGE_DOT3)
		{
			switch(textureStage.firstArgumentAlpha)
			{
			case TextureStage::SOURCE_TEXTURE:	arg1 = &texture;		break;
			case TextureStage::SOURCE_CONSTANT:	arg1 = &constant;		break;
			case TextureStage::SOURCE_CURRENT:	arg1 = &current;		break;
			case TextureStage::SOURCE_DIFFUSE:	arg1 = &r.diffuse;		break;
			case TextureStage::SOURCE_SPECULAR:	arg1 = &r.specular;		break;
			case TextureStage::SOURCE_TEMP:		arg1 = &temp;			break;
			case TextureStage::SOURCE_TFACTOR:	arg1 = &tfactor;		break;
			default:
				ASSERT(false);
			}

			switch(textureStage.secondArgumentAlpha)
			{
			case TextureStage::SOURCE_TEXTURE:	arg2 = &texture;		break;
			case TextureStage::SOURCE_CONSTANT:	arg2 = &constant;		break;
			case TextureStage::SOURCE_CURRENT:	arg2 = &current;		break;
			case TextureStage::SOURCE_DIFFUSE:	arg2 = &r.diffuse;		break;
			case TextureStage::SOURCE_SPECULAR:	arg2 = &r.specular;		break;
			case TextureStage::SOURCE_TEMP:		arg2 = &temp;			break;
			case TextureStage::SOURCE_TFACTOR:	arg2 = &tfactor;		break;
			default:
				ASSERT(false);
			}

			switch(textureStage.thirdArgumentAlpha)
			{
			case TextureStage::SOURCE_TEXTURE:	arg3 = &texture;		break;
			case TextureStage::SOURCE_CONSTANT:	arg3 = &constant;		break;
			case TextureStage::SOURCE_CURRENT:	arg3 = &current;		break;
			case TextureStage::SOURCE_DIFFUSE:	arg3 = &r.diffuse;		break;
			case TextureStage::SOURCE_SPECULAR:	arg3 = &r.specular;		break;
			case TextureStage::SOURCE_TEMP:		arg3 = &temp;			break;
			case TextureStage::SOURCE_TFACTOR:	arg3 = &tfactor;		break;
			default:
				ASSERT(false);
			}

			switch(textureStage.firstModifierAlpha)   // FIXME: Check if actually used
			{
			case TextureStage::MODIFIER_COLOR:
				break;
			case TextureStage::MODIFIER_INVCOLOR:
				{
					mod1.w = SubSat(Short4(0x1000), arg1->w);

					arg1 = &mod1;
				}
				break;
			case TextureStage::MODIFIER_ALPHA:
				{
					// Redudant
				}
				break;
			case TextureStage::MODIFIER_INVALPHA:
				{
					mod1.w = SubSat(Short4(0x1000), arg1->w);

					arg1 = &mod1;
				}
				break;
			default:
				ASSERT(false);
			}

			switch(textureStage.secondModifierAlpha)   // FIXME: Check if actually used
			{
			case TextureStage::MODIFIER_COLOR:
				break;
			case TextureStage::MODIFIER_INVCOLOR:
				{
					mod2.w = SubSat(Short4(0x1000), arg2->w);

					arg2 = &mod2;
				}
				break;
			case TextureStage::MODIFIER_ALPHA:
				{
					// Redudant
				}
				break;
			case TextureStage::MODIFIER_INVALPHA:
				{
					mod2.w = SubSat(Short4(0x1000), arg2->w);

					arg2 = &mod2;
				}
				break;
			default:
				ASSERT(false);
			}

			switch(textureStage.thirdModifierAlpha)   // FIXME: Check if actually used
			{
			case TextureStage::MODIFIER_COLOR:
				break;
			case TextureStage::MODIFIER_INVCOLOR:
				{
					mod3.w = SubSat(Short4(0x1000), arg3->w);

					arg3 = &mod3;
				}
				break;
			case TextureStage::MODIFIER_ALPHA:
				{
					// Redudant
				}
				break;
			case TextureStage::MODIFIER_INVALPHA:
				{
					mod3.w = SubSat(Short4(0x1000), arg3->w);

					arg3 = &mod3;
				}
				break;
			default:
				ASSERT(false);
			}
		
			switch(textureStage.stageOperationAlpha)
			{
			case TextureStage::STAGE_DISABLE:
				break;
			case TextureStage::STAGE_SELECTARG1:					// Arg1
				{
					res.w = arg1->w;
				}
				break;
			case TextureStage::STAGE_SELECTARG2:					// Arg2
				{
					res.w = arg2->w;
				}
				break;
			case TextureStage::STAGE_SELECTARG3:					// Arg3
				{
					res.w = arg3->w;
				}
				break;
			case TextureStage::STAGE_MODULATE:					// Arg1 * Arg2
				{
					res.w = MulHigh(arg1->w, arg2->w) << 4;
				}
				break;
			case TextureStage::STAGE_MODULATE2X:					// Arg1 * Arg2 * 2
				{
					res.w = MulHigh(arg1->w, arg2->w) << 5;
				}
				break;
			case TextureStage::STAGE_MODULATE4X:					// Arg1 * Arg2 * 4
				{
					res.w = MulHigh(arg1->w, arg2->w) << 6;
				}
				break;
			case TextureStage::STAGE_ADD:						// Arg1 + Arg2
				{
					res.w = AddSat(arg1->w, arg2->w);
				}
				break;
			case TextureStage::STAGE_ADDSIGNED:					// Arg1 + Arg2 - 0.5
				{
					res.w = AddSat(arg1->w, arg2->w);
					res.w = SubSat(res.w, Short4(0x0800, 0x0800, 0x0800, 0x0800));
				}
				break;
			case TextureStage::STAGE_ADDSIGNED2X:					// (Arg1 + Arg2 - 0.5) << 1
				{
					res.w = AddSat(arg1->w, arg2->w);
					res.w = SubSat(res.w, Short4(0x0800, 0x0800, 0x0800, 0x0800));
					res.w = AddSat(res.w, res.w);
				}
				break;
			case TextureStage::STAGE_SUBTRACT:					// Arg1 - Arg2
				{
					res.w = SubSat(arg1->w, arg2->w);
				}
				break;
			case TextureStage::STAGE_ADDSMOOTH:					// Arg1 + Arg2 - Arg1 * Arg2
				{
					Short4 tmp;

					tmp = MulHigh(arg1->w, arg2->w) << 4; res.w = AddSat(arg1->w, arg2->w); res.w = SubSat(res.w, tmp);
				}
				break;
			case TextureStage::STAGE_MULTIPLYADD:				// Arg3 + Arg1 * Arg2
				{
					res.w = MulHigh(arg1->w, arg2->w) << 4; res.w = AddSat(res.w, arg3->w);
				}
				break;
			case TextureStage::STAGE_LERP:						// Arg3 * (Arg1 - Arg2) + Arg2
				{
					res.w = SubSat(arg1->w, arg2->w); res.w = MulHigh(res.w, arg3->w) << 4; res.w = AddSat(res.w, arg2->w);
				}
				break;
			case TextureStage::STAGE_DOT3:
				break;   // Already computed in color channel
			case TextureStage::STAGE_BLENDCURRENTALPHA:			// Alpha * (Arg1 - Arg2) + Arg2
				{
					res.w = SubSat(arg1->w, arg2->w); res.w = MulHigh(res.w, current.w) << 4; res.w = AddSat(res.w, arg2->w);
				}
				break;
			case TextureStage::STAGE_BLENDDIFFUSEALPHA:			// Arg1 * (Alpha) + Arg2 * (1 - Alpha)
				{
					res.w = SubSat(arg1->w, arg2->w); res.w = MulHigh(res.w, r.diffuse.w) << 4; res.w = AddSat(res.w, arg2->w);
				}
				break;
			case TextureStage::STAGE_BLENDFACTORALPHA:
				{
					res.w = SubSat(arg1->w, arg2->w); res.w = MulHigh(res.w, *Pointer<Short4>(r.data + OFFSET(DrawData,factor.textureFactor4[3]))) << 4; res.w = AddSat(res.w, arg2->w);
				}
				break;
			case TextureStage::STAGE_BLENDTEXTUREALPHA:			// Arg1 * (Alpha) + Arg2 * (1 - Alpha)
				{
					res.w = SubSat(arg1->w, arg2->w); res.w = MulHigh(res.w, texture.w) << 4; res.w = AddSat(res.w, arg2->w);
				}
				break;
			case TextureStage::STAGE_BLENDTEXTUREALPHAPM:		// Arg1 + Arg2 * (1 - Alpha)
				{
					res.w = SubSat(Short4(0x1000), texture.w); res.w = MulHigh(res.w, arg2->w) << 4; res.w = AddSat(res.w, arg1->w);
				}
				break;
			case TextureStage::STAGE_PREMODULATE:
				{
					res.w = arg1->w;
				}
				break;
			case TextureStage::STAGE_MODULATEALPHA_ADDCOLOR:
			case TextureStage::STAGE_MODULATECOLOR_ADDALPHA:
			case TextureStage::STAGE_MODULATEINVALPHA_ADDCOLOR:
			case TextureStage::STAGE_MODULATEINVCOLOR_ADDALPHA:
			case TextureStage::STAGE_BUMPENVMAP:
			case TextureStage::STAGE_BUMPENVMAPLUMINANCE:
				break;   // Invalid alpha operations
			default:
				ASSERT(false);
			}
		}

		// Clamp result to [0, 1]

		switch(textureStage.stageOperation)
		{
		case TextureStage::STAGE_DISABLE:
		case TextureStage::STAGE_SELECTARG1:
		case TextureStage::STAGE_SELECTARG2:
		case TextureStage::STAGE_SELECTARG3:
		case TextureStage::STAGE_MODULATE:
		case TextureStage::STAGE_MODULATE2X:
		case TextureStage::STAGE_MODULATE4X:
		case TextureStage::STAGE_ADD:
		case TextureStage::STAGE_MULTIPLYADD:
		case TextureStage::STAGE_LERP:
		case TextureStage::STAGE_BLENDCURRENTALPHA:
		case TextureStage::STAGE_BLENDDIFFUSEALPHA:
		case TextureStage::STAGE_BLENDFACTORALPHA:
		case TextureStage::STAGE_BLENDTEXTUREALPHA:
		case TextureStage::STAGE_BLENDTEXTUREALPHAPM:
		case TextureStage::STAGE_DOT3:   // Already clamped
		case TextureStage::STAGE_PREMODULATE:
		case TextureStage::STAGE_MODULATEALPHA_ADDCOLOR:
		case TextureStage::STAGE_MODULATECOLOR_ADDALPHA:
		case TextureStage::STAGE_MODULATEINVALPHA_ADDCOLOR:
		case TextureStage::STAGE_MODULATEINVCOLOR_ADDALPHA:
		case TextureStage::STAGE_BUMPENVMAP:
		case TextureStage::STAGE_BUMPENVMAPLUMINANCE:
			if(state.textureStage[stage].cantUnderflow)
			{
				break;   // Can't go below zero
			}
		case TextureStage::STAGE_ADDSIGNED:
		case TextureStage::STAGE_ADDSIGNED2X:
		case TextureStage::STAGE_SUBTRACT:
		case TextureStage::STAGE_ADDSMOOTH:
			res.x = Max(res.x, Short4(0x0000, 0x0000, 0x0000, 0x0000));
			res.y = Max(res.y, Short4(0x0000, 0x0000, 0x0000, 0x0000));
			res.z = Max(res.z, Short4(0x0000, 0x0000, 0x0000, 0x0000));
			break;
		default:
			ASSERT(false);
		}

		switch(textureStage.stageOperationAlpha)
		{
		case TextureStage::STAGE_DISABLE:
		case TextureStage::STAGE_SELECTARG1:
		case TextureStage::STAGE_SELECTARG2:
		case TextureStage::STAGE_SELECTARG3:
		case TextureStage::STAGE_MODULATE:
		case TextureStage::STAGE_MODULATE2X:
		case TextureStage::STAGE_MODULATE4X:
		case TextureStage::STAGE_ADD:
		case TextureStage::STAGE_MULTIPLYADD:
		case TextureStage::STAGE_LERP:
		case TextureStage::STAGE_BLENDCURRENTALPHA:
		case TextureStage::STAGE_BLENDDIFFUSEALPHA:
		case TextureStage::STAGE_BLENDFACTORALPHA:
		case TextureStage::STAGE_BLENDTEXTUREALPHA:
		case TextureStage::STAGE_BLENDTEXTUREALPHAPM:
		case TextureStage::STAGE_DOT3:   // Already clamped
		case TextureStage::STAGE_PREMODULATE:
		case TextureStage::STAGE_MODULATEALPHA_ADDCOLOR:
		case TextureStage::STAGE_MODULATECOLOR_ADDALPHA:
		case TextureStage::STAGE_MODULATEINVALPHA_ADDCOLOR:
		case TextureStage::STAGE_MODULATEINVCOLOR_ADDALPHA:
		case TextureStage::STAGE_BUMPENVMAP:
		case TextureStage::STAGE_BUMPENVMAPLUMINANCE:
			if(state.textureStage[stage].cantUnderflow)
			{
				break;   // Can't go below zero
			}
		case TextureStage::STAGE_ADDSIGNED:
		case TextureStage::STAGE_ADDSIGNED2X:
		case TextureStage::STAGE_SUBTRACT:
		case TextureStage::STAGE_ADDSMOOTH:
			res.w = Max(res.w, Short4(0x0000, 0x0000, 0x0000, 0x0000));
			break;
		default:
			ASSERT(false);
		}

		switch(textureStage.stageOperation)
		{
		case TextureStage::STAGE_DISABLE:
		case TextureStage::STAGE_SELECTARG1:
		case TextureStage::STAGE_SELECTARG2:
		case TextureStage::STAGE_SELECTARG3:
		case TextureStage::STAGE_MODULATE:
		case TextureStage::STAGE_SUBTRACT:
		case TextureStage::STAGE_ADDSMOOTH:
		case TextureStage::STAGE_LERP:
		case TextureStage::STAGE_BLENDCURRENTALPHA:
		case TextureStage::STAGE_BLENDDIFFUSEALPHA:
		case TextureStage::STAGE_BLENDFACTORALPHA:
		case TextureStage::STAGE_BLENDTEXTUREALPHA:
		case TextureStage::STAGE_DOT3:   // Already clamped
		case TextureStage::STAGE_PREMODULATE:
		case TextureStage::STAGE_MODULATEINVALPHA_ADDCOLOR:
		case TextureStage::STAGE_MODULATEINVCOLOR_ADDALPHA:
		case TextureStage::STAGE_BUMPENVMAP:
		case TextureStage::STAGE_BUMPENVMAPLUMINANCE:
			break;   // Can't go above one
		case TextureStage::STAGE_MODULATE2X:
		case TextureStage::STAGE_MODULATE4X:
		case TextureStage::STAGE_ADD:
		case TextureStage::STAGE_ADDSIGNED:
		case TextureStage::STAGE_ADDSIGNED2X:
		case TextureStage::STAGE_MULTIPLYADD:
		case TextureStage::STAGE_BLENDTEXTUREALPHAPM:
		case TextureStage::STAGE_MODULATEALPHA_ADDCOLOR:
		case TextureStage::STAGE_MODULATECOLOR_ADDALPHA:
			res.x = Min(res.x, Short4(0x1000));
			res.y = Min(res.y, Short4(0x1000));
			res.z = Min(res.z, Short4(0x1000));
			break;
		default:
			ASSERT(false);
		}

		switch(textureStage.stageOperationAlpha)
		{
		case TextureStage::STAGE_DISABLE:
		case TextureStage::STAGE_SELECTARG1:
		case TextureStage::STAGE_SELECTARG2:
		case TextureStage::STAGE_SELECTARG3:
		case TextureStage::STAGE_MODULATE:
		case TextureStage::STAGE_SUBTRACT:
		case TextureStage::STAGE_ADDSMOOTH:
		case TextureStage::STAGE_LERP:
		case TextureStage::STAGE_BLENDCURRENTALPHA:
		case TextureStage::STAGE_BLENDDIFFUSEALPHA:
		case TextureStage::STAGE_BLENDFACTORALPHA:
		case TextureStage::STAGE_BLENDTEXTUREALPHA:
		case TextureStage::STAGE_DOT3:   // Already clamped
		case TextureStage::STAGE_PREMODULATE:
		case TextureStage::STAGE_MODULATEINVALPHA_ADDCOLOR:
		case TextureStage::STAGE_MODULATEINVCOLOR_ADDALPHA:
		case TextureStage::STAGE_BUMPENVMAP:
		case TextureStage::STAGE_BUMPENVMAPLUMINANCE:
			break;   // Can't go above one
		case TextureStage::STAGE_MODULATE2X:
		case TextureStage::STAGE_MODULATE4X:
		case TextureStage::STAGE_ADD:
		case TextureStage::STAGE_ADDSIGNED:
		case TextureStage::STAGE_ADDSIGNED2X:
		case TextureStage::STAGE_MULTIPLYADD:
		case TextureStage::STAGE_BLENDTEXTUREALPHAPM:
		case TextureStage::STAGE_MODULATEALPHA_ADDCOLOR:
		case TextureStage::STAGE_MODULATECOLOR_ADDALPHA:
			res.w = Min(res.w, Short4(0x1000));
			break;
		default:
			ASSERT(false);
		}

		switch(textureStage.destinationArgument)
		{
		case TextureStage::DESTINATION_CURRENT:
			current.x = res.x;
			current.y = res.y;
			current.z = res.z;
			current.w = res.w;
			break;
		case TextureStage::DESTINATION_TEMP:
			temp.x = res.x;
			temp.y = res.y;
			temp.z = res.z;
			temp.w = res.w;
			break;
		default:
			ASSERT(false);
		}
	}

	void PixelRoutine::alphaTest(Registers &r, Int &aMask, Short4 &alpha)
	{
		Short4 cmp;
		Short4 equal;

		switch(state.alphaCompareMode)
		{
		case Context::ALPHA_ALWAYS:
			aMask = 0xF;
			break;
		case Context::ALPHA_NEVER:
			aMask = 0x0;
			break;
		case Context::ALPHA_EQUAL:
			cmp = CmpEQ(alpha, *Pointer<Short4>(r.data + OFFSET(DrawData,factor.alphaReference4)));
			aMask = SignMask(Pack(cmp, Short4(0x0000, 0x0000, 0x0000, 0x0000)));
			break;
		case Context::ALPHA_NOTEQUAL:		// a != b ~ !(a == b)
			cmp = CmpEQ(alpha, *Pointer<Short4>(r.data + OFFSET(DrawData,factor.alphaReference4))) ^ Short4((short)0xFFFF, (short)0xFFFF, (short)0xFFFF, (short)0xFFFF);   // FIXME
			aMask = SignMask(Pack(cmp, Short4(0x0000, 0x0000, 0x0000, 0x0000)));
			break;
		case Context::ALPHA_LESS:			// a < b ~ b > a
			cmp = CmpGT(*Pointer<Short4>(r.data + OFFSET(DrawData,factor.alphaReference4)), alpha);
			aMask = SignMask(Pack(cmp, Short4(0x0000, 0x0000, 0x0000, 0x0000)));
			break;
		case Context::ALPHA_GREATEREQUAL:	// a >= b ~ (a > b) || (a == b) ~ !(b > a)   // TODO: Approximate
			equal = CmpEQ(alpha, *Pointer<Short4>(r.data + OFFSET(DrawData,factor.alphaReference4)));
			cmp = CmpGT(alpha, *Pointer<Short4>(r.data + OFFSET(DrawData,factor.alphaReference4)));
			cmp |= equal;
			aMask = SignMask(Pack(cmp, Short4(0x0000, 0x0000, 0x0000, 0x0000)));
			break;
		case Context::ALPHA_LESSEQUAL:		// a <= b ~ !(a > b)
			cmp = CmpGT(alpha, *Pointer<Short4>(r.data + OFFSET(DrawData,factor.alphaReference4))) ^ Short4((short)0xFFFF, (short)0xFFFF, (short)0xFFFF, (short)0xFFFF);   // FIXME
			aMask = SignMask(Pack(cmp, Short4(0x0000, 0x0000, 0x0000, 0x0000)));
			break;
		case Context::ALPHA_GREATER:			// a > b
			cmp = CmpGT(alpha, *Pointer<Short4>(r.data + OFFSET(DrawData,factor.alphaReference4)));
			aMask = SignMask(Pack(cmp, Short4(0x0000, 0x0000, 0x0000, 0x0000)));
			break;
		default:
			ASSERT(false);
		}
	}

	void PixelRoutine::alphaToCoverage(Registers &r, Int cMask[4], Float4 &alpha)
	{
		Int4 coverage0 = CmpNLT(alpha, *Pointer<Float4>(r.data + OFFSET(DrawData,a2c0)));
		Int4 coverage1 = CmpNLT(alpha, *Pointer<Float4>(r.data + OFFSET(DrawData,a2c1)));
		Int4 coverage2 = CmpNLT(alpha, *Pointer<Float4>(r.data + OFFSET(DrawData,a2c2)));
		Int4 coverage3 = CmpNLT(alpha, *Pointer<Float4>(r.data + OFFSET(DrawData,a2c3)));

		Int aMask0 = SignMask(coverage0);
		Int aMask1 = SignMask(coverage1);
		Int aMask2 = SignMask(coverage2);
		Int aMask3 = SignMask(coverage3);

		cMask[0] &= aMask0;
		cMask[1] &= aMask1;
		cMask[2] &= aMask2;
		cMask[3] &= aMask3;
	}

	Bool PixelRoutine::alphaTest(Registers &r, Int cMask[4], Vector4i &current)
	{
		if(!state.alphaTestActive())
		{
			return true;
		}

		Int aMask;

		if(state.transparencyAntialiasing == Context::TRANSPARENCY_NONE)
		{
			alphaTest(r, aMask, current.w);

			for(unsigned int q = 0; q < state.multiSample; q++)
			{
				cMask[q] &= aMask;
			}
		}
		else if(state.transparencyAntialiasing == Context::TRANSPARENCY_ALPHA_TO_COVERAGE)
		{
			Float4 alpha = Float4(current.w) * Float4(1.0f / 0x1000);

			alphaToCoverage(r, cMask, alpha);
		}
		else ASSERT(false);

		Int pass = cMask[0];

		for(unsigned int q = 1; q < state.multiSample; q++)
		{
			pass = pass | cMask[q];
		}

		return pass != 0x0;
	}

	Bool PixelRoutine::alphaTest(Registers &r, Int cMask[4], Vector4f &c0)
	{
		if(!state.alphaTestActive())
		{
			return true;
		}

		Int aMask;

		if(state.transparencyAntialiasing == Context::TRANSPARENCY_NONE)
		{
			Short4 alpha = RoundShort4(c0.w * Float4(0x1000));

			alphaTest(r, aMask, alpha);

			for(unsigned int q = 0; q < state.multiSample; q++)
			{
				cMask[q] &= aMask;
			}
		}
		else if(state.transparencyAntialiasing == Context::TRANSPARENCY_ALPHA_TO_COVERAGE)
		{
			alphaToCoverage(r, cMask, c0.w);
		}
		else ASSERT(false);

		Int pass = cMask[0];

		for(unsigned int q = 1; q < state.multiSample; q++)
		{
			pass = pass | cMask[q];
		}

		return pass != 0x0;
	}

	void PixelRoutine::fogBlend(Registers &r, Vector4i &current, Float4 &f, Float4 &z, Float4 &rhw)
	{
		if(!state.fogActive)
		{
			return;
		}

		if(state.pixelFogMode != Context::FOG_NONE)
		{
			pixelFog(r, f, z, rhw);
		}
		
		UShort4 fog = convertFixed16(f, true);

		current.x = As<Short4>(MulHigh(As<UShort4>(current.x), fog));
		current.y = As<Short4>(MulHigh(As<UShort4>(current.y), fog));
		current.z = As<Short4>(MulHigh(As<UShort4>(current.z), fog));

		UShort4 invFog = UShort4(0xFFFFu) - fog;

		current.x += As<Short4>(MulHigh(invFog, *Pointer<UShort4>(r.data + OFFSET(DrawData,fog.color4[0]))));
		current.y += As<Short4>(MulHigh(invFog, *Pointer<UShort4>(r.data + OFFSET(DrawData,fog.color4[1]))));
		current.z += As<Short4>(MulHigh(invFog, *Pointer<UShort4>(r.data + OFFSET(DrawData,fog.color4[2]))));
	}

	void PixelRoutine::fogBlend(Registers &r, Vector4f &c0, Float4 &fog, Float4 &z, Float4 &rhw)
	{
		if(!state.fogActive)
		{
			return;
		}

		if(state.pixelFogMode != Context::FOG_NONE)
		{
			pixelFog(r, fog, z, rhw);

			fog = Min(fog, Float4(1.0f));
			fog = Max(fog, Float4(0.0f));
		}

		c0.x -= *Pointer<Float4>(r.data + OFFSET(DrawData,fog.colorF[0]));
		c0.y -= *Pointer<Float4>(r.data + OFFSET(DrawData,fog.colorF[1]));
		c0.z -= *Pointer<Float4>(r.data + OFFSET(DrawData,fog.colorF[2]));

		c0.x *= fog;
		c0.y *= fog;
		c0.z *= fog;

		c0.x += *Pointer<Float4>(r.data + OFFSET(DrawData,fog.colorF[0]));
		c0.y += *Pointer<Float4>(r.data + OFFSET(DrawData,fog.colorF[1]));
		c0.z += *Pointer<Float4>(r.data + OFFSET(DrawData,fog.colorF[2]));
	}

	void PixelRoutine::pixelFog(Registers &r, Float4 &visibility, Float4 &z, Float4 &rhw)
	{
		Float4 &zw = visibility;

		if(state.pixelFogMode != Context::FOG_NONE)
		{
			if(state.wBasedFog)
			{
				zw = rhw;
			}
			else
			{
				if(complementaryDepthBuffer)
				{
					zw = Float4(1.0f) - z;
				}
				else
				{
					zw = z;
				}
			}
		}

		switch(state.pixelFogMode)
		{
		case Context::FOG_NONE:
			break;
		case Context::FOG_LINEAR:
			zw *= *Pointer<Float4>(r.data + OFFSET(DrawData,fog.scale));
			zw += *Pointer<Float4>(r.data + OFFSET(DrawData,fog.offset));
			break;
		case Context::FOG_EXP:
			zw *= *Pointer<Float4>(r.data + OFFSET(DrawData,fog.densityE));
			zw = exponential2(zw, true);
			break;
		case Context::FOG_EXP2:
			zw *= *Pointer<Float4>(r.data + OFFSET(DrawData,fog.densityE2));
			zw *= zw;
			zw = exponential2(zw, true);
			zw = Rcp_pp(zw);
			break;
		default:
			ASSERT(false);
		}
	}

	void PixelRoutine::specularPixel(Vector4i &current, Vector4i &specular)
	{
		if(!state.specularAdd)
		{
			return;
		}

		current.x = AddSat(current.x, specular.x);
		current.y = AddSat(current.y, specular.y);
		current.z = AddSat(current.z, specular.z);
	}

	void PixelRoutine::writeDepth(Registers &r, Pointer<Byte> &zBuffer, int q, Int &x, Float4 &z, Int &zMask)
	{
		if(!state.depthWriteEnable)
		{
			return;
		}

		Float4 Z = z;

		if(shader && shader->depthOverride())
		{
			if(complementaryDepthBuffer)
			{
				Z = Float4(1.0f) - r.oDepth;
			}
			else
			{
				Z = r.oDepth;
			}
		}

		Pointer<Byte> buffer;
		Int pitch;

		if(!state.quadLayoutDepthBuffer)
		{	
			buffer = zBuffer + 4 * x;
			pitch = *Pointer<Int>(r.data + OFFSET(DrawData,depthPitchB));
		}
		else
		{	
			buffer = zBuffer + 8 * x;
		}

		if(q > 0)
		{
			buffer += q * *Pointer<Int>(r.data + OFFSET(DrawData,depthSliceB));
		}

		Float4 zValue;

		if(state.depthCompareMode != Context::DEPTH_NEVER || (state.depthCompareMode != Context::DEPTH_ALWAYS && !state.depthWriteEnable))
		{
			if(!state.quadLayoutDepthBuffer)
			{
				// FIXME: Properly optimizes?
				zValue.xy = *Pointer<Float4>(buffer);
				zValue.zw = *Pointer<Float4>(buffer + pitch - 8);
			}
			else
			{
				zValue = *Pointer<Float4>(buffer, 16);
			}
		}

		Z = As<Float4>(As<Int4>(Z) & *Pointer<Int4>(r.constants + OFFSET(Constants,maskD4X) + zMask * 16, 16));
		zValue = As<Float4>(As<Int4>(zValue) & *Pointer<Int4>(r.constants + OFFSET(Constants,invMaskD4X) + zMask * 16, 16));
		Z = As<Float4>(As<Int4>(Z) | As<Int4>(zValue));

		if(!state.quadLayoutDepthBuffer)
		{
			// FIXME: Properly optimizes?
			*Pointer<Float2>(buffer) = Float2(Z.xy);
			*Pointer<Float2>(buffer + pitch) = Float2(Z.zw);
		}
		else
		{
			*Pointer<Float4>(buffer, 16) = Z;
		}
	}

	void PixelRoutine::writeStencil(Registers &r, Pointer<Byte> &sBuffer, int q, Int &x, Int &sMask, Int &zMask, Int &cMask)
	{
		if(!state.stencilActive)
		{
			return;
		}

		if(state.stencilPassOperation == Context::OPERATION_KEEP && state.stencilZFailOperation == Context::OPERATION_KEEP && state.stencilFailOperation == Context::OPERATION_KEEP)
		{
			if(!state.twoSidedStencil || (state.stencilPassOperationCCW == Context::OPERATION_KEEP && state.stencilZFailOperationCCW == Context::OPERATION_KEEP && state.stencilFailOperationCCW == Context::OPERATION_KEEP))
			{
				return;
			}
		}

		if(state.stencilWriteMasked && (!state.twoSidedStencil || state.stencilWriteMaskedCCW))
		{
			return;
		}

		Pointer<Byte> buffer = sBuffer + 2 * x;

		if(q > 0)
		{
			buffer += q * *Pointer<Int>(r.data + OFFSET(DrawData,stencilSliceB));
		}

		Byte8 bufferValue = As<Byte8>(Long1(*Pointer<UInt>(buffer)));
	
		Byte8 newValue;
		stencilOperation(r, newValue, bufferValue, (Context::StencilOperation)state.stencilPassOperation, (Context::StencilOperation)state.stencilZFailOperation, (Context::StencilOperation)state.stencilFailOperation, false, zMask, sMask);

		if(!state.noStencilWriteMask)
		{
			Byte8 maskedValue = bufferValue;
			newValue &= *Pointer<Byte8>(r.data + OFFSET(DrawData,stencil[0].writeMaskQ));
			maskedValue &= *Pointer<Byte8>(r.data + OFFSET(DrawData,stencil[0].invWriteMaskQ));
			newValue |= maskedValue;
		}

		if(state.twoSidedStencil)
		{
			Byte8 newValueCCW;

			stencilOperation(r, newValueCCW, bufferValue, (Context::StencilOperation)state.stencilPassOperationCCW, (Context::StencilOperation)state.stencilZFailOperationCCW, (Context::StencilOperation)state.stencilFailOperationCCW, true, zMask, sMask);

			if(!state.noStencilWriteMaskCCW)
			{
				Byte8 maskedValue = bufferValue;
				newValueCCW &= *Pointer<Byte8>(r.data + OFFSET(DrawData,stencil[1].writeMaskQ));
				maskedValue &= *Pointer<Byte8>(r.data + OFFSET(DrawData,stencil[1].invWriteMaskQ));
				newValueCCW |= maskedValue;
			}

			newValue &= *Pointer<Byte8>(r.primitive + OFFSET(Primitive,clockwiseMask));
			newValueCCW &= *Pointer<Byte8>(r.primitive + OFFSET(Primitive,invClockwiseMask));
			newValue |= newValueCCW;
		}

		newValue &= *Pointer<Byte8>(r.constants + OFFSET(Constants,maskB4Q) + 8 * cMask);
		bufferValue &= *Pointer<Byte8>(r.constants + OFFSET(Constants,invMaskB4Q) + 8 * cMask);
		newValue |= bufferValue;

		*Pointer<UInt>(buffer) = UInt(As<Long>(newValue));
	}

	void PixelRoutine::stencilOperation(Registers &r, Byte8 &newValue, Byte8 &bufferValue, Context::StencilOperation stencilPassOperation, Context::StencilOperation stencilZFailOperation, Context::StencilOperation stencilFailOperation, bool CCW, Int &zMask, Int &sMask)
	{
		Byte8 &pass = newValue;
		Byte8 fail;
		Byte8 zFail;

		stencilOperation(r, pass, bufferValue, stencilPassOperation, CCW);

		if(stencilZFailOperation != stencilPassOperation)
		{
			stencilOperation(r, zFail, bufferValue, stencilZFailOperation, CCW);
		}

		if(stencilFailOperation != stencilPassOperation || stencilFailOperation != stencilZFailOperation)
		{
			stencilOperation(r, fail, bufferValue, stencilFailOperation, CCW);
		}

		if(stencilFailOperation != stencilPassOperation || stencilFailOperation != stencilZFailOperation)
		{
			if(state.depthTestActive && stencilZFailOperation != stencilPassOperation)   // zMask valid and values not the same
			{
				pass &= *Pointer<Byte8>(r.constants + OFFSET(Constants,maskB4Q) + 8 * zMask);
				zFail &= *Pointer<Byte8>(r.constants + OFFSET(Constants,invMaskB4Q) + 8 * zMask);
				pass |= zFail;
			}

			pass &= *Pointer<Byte8>(r.constants + OFFSET(Constants,maskB4Q) + 8 * sMask);
			fail &= *Pointer<Byte8>(r.constants + OFFSET(Constants,invMaskB4Q) + 8 * sMask);
			pass |= fail;
		}
	}

	void PixelRoutine::stencilOperation(Registers &r, Byte8 &output, Byte8 &bufferValue, Context::StencilOperation operation, bool CCW)
	{
		switch(operation)
		{
		case Context::OPERATION_KEEP:
			output = bufferValue;
			break;
		case Context::OPERATION_ZERO:
			output = Byte8(0x0000000000000000);
			break;
		case Context::OPERATION_REPLACE:
			output = *Pointer<Byte8>(r.data + OFFSET(DrawData,stencil[CCW].referenceQ));
			break;
		case Context::OPERATION_INCRSAT:
			output = AddSat(bufferValue, Byte8(1, 1, 1, 1, 1, 1, 1, 1));
			break;
		case Context::OPERATION_DECRSAT:
			output = SubSat(bufferValue, Byte8(1, 1, 1, 1, 1, 1, 1, 1));
			break;
		case Context::OPERATION_INVERT:
			output = bufferValue ^ Byte8(0xFFFFFFFFFFFFFFFF);
			break;
		case Context::OPERATION_INCR:
			output = bufferValue + Byte8(1, 1, 1, 1, 1, 1, 1, 1);
			break;
		case Context::OPERATION_DECR:
			output = bufferValue - Byte8(1, 1, 1, 1, 1, 1, 1, 1);
			break;
		default:
			ASSERT(false);
		}
	}

	void PixelRoutine::sampleTexture(Registers &r, Vector4i &c, int coordinates, int stage, bool project)
	{
		Float4 u = r.vf[2 + coordinates].x;
		Float4 v = r.vf[2 + coordinates].y;
		Float4 w = r.vf[2 + coordinates].z;
		Float4 q = r.vf[2 + coordinates].w;

		if(perturbate)
		{
			u += r.du;
			v += r.dv;

			perturbate = false;
		}

		sampleTexture(r, c, stage, u, v, w, q, project);
	}

	void PixelRoutine::sampleTexture(Registers &r, Vector4i &c, int stage, Float4 &u, Float4 &v, Float4 &w, Float4 &q, bool project, bool bias, bool fixed12)
	{
		Vector4f dsx;
		Vector4f dsy;

		sampleTexture(r, c, stage, u, v, w, q, dsx, dsy, project, bias, fixed12, false);
	}

	void PixelRoutine::sampleTexture(Registers &r, Vector4i &c, int stage, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Vector4f &dsx, Vector4f &dsy, bool project, bool bias, bool fixed12, bool gradients, bool lodProvided)
	{
		#if PERF_PROFILE
			Long texTime = Ticks();
		#endif

		Pointer<Byte> texture = r.data + OFFSET(DrawData,mipmap) + stage * sizeof(Texture);

		if(!project)
		{
			sampler[stage]->sampleTexture(texture, c, u, v, w, q, dsx, dsy, bias, fixed12, gradients, lodProvided);
		}
		else
		{
			Float4 rq = reciprocal(q);

			Float4 u_q = u * rq;
			Float4 v_q = v * rq;
			Float4 w_q = w * rq;

			sampler[stage]->sampleTexture(texture, c, u_q, v_q, w_q, q, dsx, dsy, bias, fixed12, gradients, lodProvided);
		}

		#if PERF_PROFILE
			r.cycles[PERF_TEX] += Ticks() - texTime;
		#endif
	}

	void PixelRoutine::sampleTexture(Registers &r, Vector4f &c, const Src &sampler, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Vector4f &dsx, Vector4f &dsy, bool project, bool bias, bool gradients, bool lodProvided)
	{
		if(sampler.type == Shader::PARAMETER_SAMPLER && sampler.rel.type == Shader::PARAMETER_VOID)
		{	
			sampleTexture(r, c, sampler.index, u, v, w, q, dsx, dsy, project, bias, gradients, lodProvided);	
		}
		else
		{
			Int index = As<Int>(Float(reg(r, sampler).x.x));

			for(int i = 0; i < 16; i++)
			{
				if(shader->usesSampler(i))
				{
					If(index == i)
					{
						sampleTexture(r, c, i, u, v, w, q, dsx, dsy, project, bias, gradients, lodProvided);
						// FIXME: When the sampler states are the same, we could use one sampler and just index the texture
					}
				}
			}
		}
	}

	void PixelRoutine::sampleTexture(Registers &r, Vector4f &c, int stage, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Vector4f &dsx, Vector4f &dsy, bool project, bool bias, bool gradients, bool lodProvided)
	{
		#if PERF_PROFILE
			Long texTime = Ticks();
		#endif

		Pointer<Byte> texture = r.data + OFFSET(DrawData,mipmap) + stage * sizeof(Texture);

		if(!project)
		{
			sampler[stage]->sampleTexture(texture, c, u, v, w, q, dsx, dsy, bias, gradients, lodProvided);
		}
		else
		{
			Float4 rq = reciprocal(q);

			Float4 u_q = u * rq;
			Float4 v_q = v * rq;
			Float4 w_q = w * rq;

			sampler[stage]->sampleTexture(texture, c, u_q, v_q, w_q, q, dsx, dsy, bias, gradients, lodProvided);
		}

		#if PERF_PROFILE
			r.cycles[PERF_TEX] += Ticks() - texTime;
		#endif
	}

	void PixelRoutine::clampColor(Vector4f oC[4])
	{
		for(int index = 0; index < 4; index++)
		{
			if(!state.colorWriteActive(index) && !(index == 0 && state.alphaTestActive()))
			{
				continue;
			}

			switch(state.targetFormat[index])
			{
			case FORMAT_NULL:
				break;
			case FORMAT_A16B16G16R16:
			case FORMAT_A8R8G8B8:
			case FORMAT_X8R8G8B8:
			case FORMAT_A8:
			case FORMAT_G16R16:
				oC[index].x = Max(oC[index].x, Float4(0.0f)); oC[index].x = Min(oC[index].x, Float4(1.0f));
				oC[index].y = Max(oC[index].y, Float4(0.0f)); oC[index].y = Min(oC[index].y, Float4(1.0f));
				oC[index].z = Max(oC[index].z, Float4(0.0f)); oC[index].z = Min(oC[index].z, Float4(1.0f));
				oC[index].w = Max(oC[index].w, Float4(0.0f)); oC[index].w = Min(oC[index].w, Float4(1.0f));
				break;
			case FORMAT_R32F:
			case FORMAT_G32R32F:
			case FORMAT_A32B32G32R32F:
				break;
			default:
				ASSERT(false);
			}
		}
	}

	void PixelRoutine::rasterOperation(Vector4i &current, Registers &r, Float4 &fog, Pointer<Byte> &cBuffer, Int &x, Int sMask[4], Int zMask[4], Int cMask[4])
	{
		if(!state.colorWriteActive(0))
		{
			return;
		}

		Vector4f oC;

		switch(state.targetFormat[0])
		{
		case FORMAT_X8R8G8B8:
		case FORMAT_A8R8G8B8:
		case FORMAT_A8:
		case FORMAT_G16R16:
		case FORMAT_A16B16G16R16:
			if(!postBlendSRGB && state.writeSRGB)
			{
				linearToSRGB12_16(r, current);
			}
			else
			{
				current.x <<= 4;
				current.y <<= 4;
				current.z <<= 4;
				current.w <<= 4;
			}

			fogBlend(r, current, fog, r.z[0], r.rhw);

			for(unsigned int q = 0; q < state.multiSample; q++)
			{
				Pointer<Byte> buffer = cBuffer + q * *Pointer<Int>(r.data + OFFSET(DrawData,colorSliceB[0]));
				Vector4i color = current;

				if(state.multiSampleMask & (1 << q))
				{
					alphaBlend(r, 0, buffer, color, x);
					writeColor(r, 0, buffer, x, color, sMask[q], zMask[q], cMask[q]);
				}
			}
			break;
		case FORMAT_R32F:
		case FORMAT_G32R32F:
		case FORMAT_A32B32G32R32F:
			convertSigned12(oC, current);
			fogBlend(r, oC, fog, r.z[0], r.rhw);
			
			for(unsigned int q = 0; q < state.multiSample; q++)
			{
				Pointer<Byte> buffer = cBuffer + q * *Pointer<Int>(r.data + OFFSET(DrawData,colorSliceB[0]));
				Vector4f color = oC;

				if(state.multiSampleMask & (1 << q))
				{
					alphaBlend(r, 0, buffer, color, x);
					writeColor(r, 0, buffer, x, color, sMask[q], zMask[q], cMask[q]);
				}
			}
			break;
		default:
			ASSERT(false);
		}
	}

	void PixelRoutine::rasterOperation(Vector4f oC[4], Registers &r, Float4 &fog, Pointer<Byte> cBuffer[4], Int &x, Int sMask[4], Int zMask[4], Int cMask[4])
	{
		for(int index = 0; index < 4; index++)
		{
			if(!state.colorWriteActive(index))
			{
				continue;
			}

			if(!postBlendSRGB && state.writeSRGB)
			{
				oC[index].x = linearToSRGB(oC[index].x);
				oC[index].y = linearToSRGB(oC[index].y);
				oC[index].z = linearToSRGB(oC[index].z);
			}

			if(index == 0)
			{
				fogBlend(r, oC[index], fog, r.z[0], r.rhw);
			}

			switch(state.targetFormat[index])
			{
			case FORMAT_X8R8G8B8:
			case FORMAT_A8R8G8B8:
			case FORMAT_A8:
			case FORMAT_G16R16:
			case FORMAT_A16B16G16R16:
				for(unsigned int q = 0; q < state.multiSample; q++)
				{
					Pointer<Byte> buffer = cBuffer[index] + q * *Pointer<Int>(r.data + OFFSET(DrawData,colorSliceB[index]));
					Vector4i color;

					color.x = convertFixed16(oC[index].x, false);
					color.y = convertFixed16(oC[index].y, false);
					color.z = convertFixed16(oC[index].z, false);
					color.w = convertFixed16(oC[index].w, false);

					if(state.multiSampleMask & (1 << q))
					{
						alphaBlend(r, index, buffer, color, x);
						writeColor(r, index, buffer, x, color, sMask[q], zMask[q], cMask[q]);
					}
				}
				break;
			case FORMAT_R32F:
			case FORMAT_G32R32F:
			case FORMAT_A32B32G32R32F:
				for(unsigned int q = 0; q < state.multiSample; q++)
				{
					Pointer<Byte> buffer = cBuffer[index] + q * *Pointer<Int>(r.data + OFFSET(DrawData,colorSliceB[index]));
					Vector4f color = oC[index];

					if(state.multiSampleMask & (1 << q))
					{
						alphaBlend(r, index, buffer, color, x);
						writeColor(r, index, buffer, x, color, sMask[q], zMask[q], cMask[q]);
					}
				}
				break;
			default:
				ASSERT(false);
			}
		}
	}

	void PixelRoutine::blendFactor(Registers &r, const Vector4i &blendFactor, const Vector4i &current, const Vector4i &pixel, Context::BlendFactor blendFactorActive)
	{
		switch(blendFactorActive)
		{
		case Context::BLEND_ZERO:
			// Optimized
			break;
		case Context::BLEND_ONE:
			// Optimized
			break;
		case Context::BLEND_SOURCE:
			blendFactor.x = current.x;
			blendFactor.y = current.y;
			blendFactor.z = current.z;
			break;
		case Context::BLEND_INVSOURCE:
			blendFactor.x = Short4(0xFFFFu) - current.x;
			blendFactor.y = Short4(0xFFFFu) - current.y;
			blendFactor.z = Short4(0xFFFFu) - current.z;
			break;
		case Context::BLEND_DEST:
			blendFactor.x = pixel.x;
			blendFactor.y = pixel.y;
			blendFactor.z = pixel.z;
			break;
		case Context::BLEND_INVDEST:
			blendFactor.x = Short4(0xFFFFu) - pixel.x;
			blendFactor.y = Short4(0xFFFFu) - pixel.y;
			blendFactor.z = Short4(0xFFFFu) - pixel.z;
			break;
		case Context::BLEND_SOURCEALPHA:
			blendFactor.x = current.w;
			blendFactor.y = current.w;
			blendFactor.z = current.w;
			break;
		case Context::BLEND_INVSOURCEALPHA:
			blendFactor.x = Short4(0xFFFFu) - current.w;
			blendFactor.y = Short4(0xFFFFu) - current.w;
			blendFactor.z = Short4(0xFFFFu) - current.w;
			break;
		case Context::BLEND_DESTALPHA:
			blendFactor.x = pixel.w;
			blendFactor.y = pixel.w;
			blendFactor.z = pixel.w;
			break;
		case Context::BLEND_INVDESTALPHA:
			blendFactor.x = Short4(0xFFFFu) - pixel.w;
			blendFactor.y = Short4(0xFFFFu) - pixel.w;
			blendFactor.z = Short4(0xFFFFu) - pixel.w;
			break;
		case Context::BLEND_SRCALPHASAT:
			blendFactor.x = Short4(0xFFFFu) - pixel.w;
			blendFactor.x = Min(As<UShort4>(blendFactor.x), As<UShort4>(current.w));
			blendFactor.y = blendFactor.x;
			blendFactor.z = blendFactor.x;
			break;
		case Context::BLEND_CONSTANT:
			blendFactor.x = *Pointer<Short4>(r.data + OFFSET(DrawData,factor.blendConstant4W[0]));
			blendFactor.y = *Pointer<Short4>(r.data + OFFSET(DrawData,factor.blendConstant4W[1]));
			blendFactor.z = *Pointer<Short4>(r.data + OFFSET(DrawData,factor.blendConstant4W[2]));
			break;
		case Context::BLEND_INVCONSTANT:
			blendFactor.x = *Pointer<Short4>(r.data + OFFSET(DrawData,factor.invBlendConstant4W[0]));
			blendFactor.y = *Pointer<Short4>(r.data + OFFSET(DrawData,factor.invBlendConstant4W[1]));
			blendFactor.z = *Pointer<Short4>(r.data + OFFSET(DrawData,factor.invBlendConstant4W[2]));
			break;
		case Context::BLEND_CONSTANTALPHA:
			blendFactor.x = *Pointer<Short4>(r.data + OFFSET(DrawData,factor.blendConstant4W[3]));
			blendFactor.y = *Pointer<Short4>(r.data + OFFSET(DrawData,factor.blendConstant4W[3]));
			blendFactor.z = *Pointer<Short4>(r.data + OFFSET(DrawData,factor.blendConstant4W[3]));
			break;
		case Context::BLEND_INVCONSTANTALPHA:
			blendFactor.x = *Pointer<Short4>(r.data + OFFSET(DrawData,factor.invBlendConstant4W[3]));
			blendFactor.y = *Pointer<Short4>(r.data + OFFSET(DrawData,factor.invBlendConstant4W[3]));
			blendFactor.z = *Pointer<Short4>(r.data + OFFSET(DrawData,factor.invBlendConstant4W[3]));
			break;
		default:
			ASSERT(false);
		}
	}
	
	void PixelRoutine::blendFactorAlpha(Registers &r, const Vector4i &blendFactor, const Vector4i &current, const Vector4i &pixel, Context::BlendFactor blendFactorAlphaActive)
	{
		switch(blendFactorAlphaActive)
		{
		case Context::BLEND_ZERO:
			// Optimized
			break;
		case Context::BLEND_ONE:
			// Optimized
			break;
		case Context::BLEND_SOURCE:
			blendFactor.w = current.w;
			break;
		case Context::BLEND_INVSOURCE:
			blendFactor.w = Short4(0xFFFFu) - current.w;
			break;
		case Context::BLEND_DEST:
			blendFactor.w = pixel.w;
			break;
		case Context::BLEND_INVDEST:
			blendFactor.w = Short4(0xFFFFu) - pixel.w;
			break;
		case Context::BLEND_SOURCEALPHA:
			blendFactor.w = current.w;
			break;
		case Context::BLEND_INVSOURCEALPHA:
			blendFactor.w = Short4(0xFFFFu) - current.w;
			break;
		case Context::BLEND_DESTALPHA:
			blendFactor.w = pixel.w;
			break;
		case Context::BLEND_INVDESTALPHA:
			blendFactor.w = Short4(0xFFFFu) - pixel.w;
			break;
		case Context::BLEND_SRCALPHASAT:
			blendFactor.w = Short4(0xFFFFu);
			break;
		case Context::BLEND_CONSTANT:
		case Context::BLEND_CONSTANTALPHA:
			blendFactor.w = *Pointer<Short4>(r.data + OFFSET(DrawData,factor.blendConstant4W[3]));
			break;
		case Context::BLEND_INVCONSTANT:
		case Context::BLEND_INVCONSTANTALPHA:
			blendFactor.w = *Pointer<Short4>(r.data + OFFSET(DrawData,factor.invBlendConstant4W[3]));
			break;
		default:
			ASSERT(false);
		}
	}

	void PixelRoutine::alphaBlend(Registers &r, int index, Pointer<Byte> &cBuffer, Vector4i &current, Int &x)
	{
		if(!state.alphaBlendActive)
		{
			return;
		}
		 
		Pointer<Byte> buffer;

		Vector4i pixel;
		Short4 c01;
		Short4 c23;

		// Read pixel
		switch(state.targetFormat[index])
		{
		case FORMAT_A8R8G8B8:
			buffer = cBuffer + 4 * x;
			c01 = *Pointer<Short4>(buffer);
			buffer += *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));
			c23 = *Pointer<Short4>(buffer);
			pixel.z = c01;
			pixel.y = c01;
			pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(c23));
			pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(c23));
			pixel.x = pixel.z;
			pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.y));
			pixel.x = UnpackHigh(As<Byte8>(pixel.x), As<Byte8>(pixel.y));
			pixel.y = pixel.z;
			pixel.w = pixel.x;
			pixel.x = UnpackLow(As<Byte8>(pixel.x), As<Byte8>(pixel.x));
			pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(pixel.y));
			pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.z));
			pixel.w = UnpackHigh(As<Byte8>(pixel.w), As<Byte8>(pixel.w));
			break;
		case FORMAT_A8:
			buffer = cBuffer + 1 * x;
			pixel.w = Insert(pixel.w, *Pointer<Short>(buffer), 0);
			buffer += *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));
			pixel.w = Insert(pixel.w, *Pointer<Short>(buffer), 1);
			pixel.w = UnpackLow(As<Byte8>(pixel.w), As<Byte8>(pixel.w));
			pixel.x = Short4(0x0000);
			pixel.y = Short4(0x0000);
			pixel.z = Short4(0x0000);
			break;
		case FORMAT_X8R8G8B8:
			buffer = cBuffer + 4 * x;
			c01 = *Pointer<Short4>(buffer);
			buffer += *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));
			c23 = *Pointer<Short4>(buffer);
			pixel.z = c01;
			pixel.y = c01;
			pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(c23));
			pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(c23));
			pixel.x = pixel.z;
			pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.y));
			pixel.x = UnpackHigh(As<Byte8>(pixel.x), As<Byte8>(pixel.y));
			pixel.y = pixel.z;
			pixel.x = UnpackLow(As<Byte8>(pixel.x), As<Byte8>(pixel.x));
			pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(pixel.y));
			pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.z));
			pixel.w = Short4(0xFFFFu);
			break;
		case FORMAT_A8G8R8B8Q:
			UNIMPLEMENTED();
		//	pixel.z = UnpackLow(As<Byte8>(pixel.z), *Pointer<Byte8>(cBuffer + 8 * x + 0));
		//	pixel.x = UnpackHigh(As<Byte8>(pixel.x), *Pointer<Byte8>(cBuffer + 8 * x + 0));
		//	pixel.y = UnpackLow(As<Byte8>(pixel.y), *Pointer<Byte8>(cBuffer + 8 * x + 8));
		//	pixel.w = UnpackHigh(As<Byte8>(pixel.w), *Pointer<Byte8>(cBuffer + 8 * x + 8));
			break;
		case FORMAT_X8G8R8B8Q:
			UNIMPLEMENTED();
		//	pixel.z = UnpackLow(As<Byte8>(pixel.z), *Pointer<Byte8>(cBuffer + 8 * x + 0));
		//	pixel.x = UnpackHigh(As<Byte8>(pixel.x), *Pointer<Byte8>(cBuffer + 8 * x + 0));
		//	pixel.y = UnpackLow(As<Byte8>(pixel.y), *Pointer<Byte8>(cBuffer + 8 * x + 8));
		//	pixel.w = Short4(0xFFFFu);
			break;
		case FORMAT_A16B16G16R16:
			buffer  = cBuffer;
			pixel.x = *Pointer<Short4>(buffer + 8 * x);
			pixel.y = *Pointer<Short4>(buffer + 8 * x + 8);
			buffer += *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));
			pixel.z = *Pointer<Short4>(buffer + 8 * x);
			pixel.w = *Pointer<Short4>(buffer + 8 * x + 8);
			transpose4x4(pixel.x, pixel.y, pixel.z, pixel.w);
			break;
		case FORMAT_G16R16:
			buffer = cBuffer;
			pixel.x = *Pointer<Short4>(buffer  + 4 * x);
			buffer += *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));
			pixel.y = *Pointer<Short4>(buffer  + 4 * x);
			pixel.z = pixel.x;
			pixel.x = As<Short4>(UnpackLow(pixel.x, pixel.y));
			pixel.z = As<Short4>(UnpackHigh(pixel.z, pixel.y));
			pixel.y = pixel.z;
			pixel.x = As<Short4>(UnpackLow(pixel.x, pixel.z));
			pixel.y = As<Short4>(UnpackHigh(pixel.y, pixel.z));
			pixel.z = Short4(0xFFFFu);
			pixel.w = Short4(0xFFFFu);
			break;
		default:
			ASSERT(false);
		}

		if(postBlendSRGB && state.writeSRGB)
		{
			sRGBtoLinear16_16(r, pixel);	
		}

		// Final Color = ObjectColor * SourceBlendFactor + PixelColor * DestinationBlendFactor
		Vector4i sourceFactor;
		Vector4i destFactor;

		blendFactor(r, sourceFactor, current, pixel, (Context::BlendFactor)state.sourceBlendFactor);
		blendFactor(r, destFactor, current, pixel, (Context::BlendFactor)state.destBlendFactor);

		if(state.sourceBlendFactor != Context::BLEND_ONE && state.sourceBlendFactor != Context::BLEND_ZERO)
		{
			current.x = MulHigh(As<UShort4>(current.x), As<UShort4>(sourceFactor.x));
			current.y = MulHigh(As<UShort4>(current.y), As<UShort4>(sourceFactor.y));
			current.z = MulHigh(As<UShort4>(current.z), As<UShort4>(sourceFactor.z));
		}
	
		if(state.destBlendFactor != Context::BLEND_ONE && state.destBlendFactor != Context::BLEND_ZERO)
		{
			pixel.x = MulHigh(As<UShort4>(pixel.x), As<UShort4>(destFactor.x));
			pixel.y = MulHigh(As<UShort4>(pixel.y), As<UShort4>(destFactor.y));
			pixel.z = MulHigh(As<UShort4>(pixel.z), As<UShort4>(destFactor.z));
		}

		switch(state.blendOperation)
		{
		case Context::BLENDOP_ADD:
			current.x = AddSat(As<UShort4>(current.x), As<UShort4>(pixel.x));
			current.y = AddSat(As<UShort4>(current.y), As<UShort4>(pixel.y));
			current.z = AddSat(As<UShort4>(current.z), As<UShort4>(pixel.z));
			break;
		case Context::BLENDOP_SUB:
			current.x = SubSat(As<UShort4>(current.x), As<UShort4>(pixel.x));
			current.y = SubSat(As<UShort4>(current.y), As<UShort4>(pixel.y));
			current.z = SubSat(As<UShort4>(current.z), As<UShort4>(pixel.z));
			break;
		case Context::BLENDOP_INVSUB:
			current.x = SubSat(As<UShort4>(pixel.x), As<UShort4>(current.x));
			current.y = SubSat(As<UShort4>(pixel.y), As<UShort4>(current.y));
			current.z = SubSat(As<UShort4>(pixel.z), As<UShort4>(current.z));
			break;
		case Context::BLENDOP_MIN:
			current.x = Min(As<UShort4>(current.x), As<UShort4>(pixel.x));
			current.y = Min(As<UShort4>(current.y), As<UShort4>(pixel.y));
			current.z = Min(As<UShort4>(current.z), As<UShort4>(pixel.z));
			break;
		case Context::BLENDOP_MAX:
			current.x = Max(As<UShort4>(current.x), As<UShort4>(pixel.x));
			current.y = Max(As<UShort4>(current.y), As<UShort4>(pixel.y));
			current.z = Max(As<UShort4>(current.z), As<UShort4>(pixel.z));
			break;
		case Context::BLENDOP_SOURCE:
			// No operation
			break;
		case Context::BLENDOP_DEST:
			current.x = pixel.x;
			current.y = pixel.y;
			current.z = pixel.z;
			break;
		case Context::BLENDOP_NULL:
			current.x = Short4(0x0000, 0x0000, 0x0000, 0x0000);
			current.y = Short4(0x0000, 0x0000, 0x0000, 0x0000);
			current.z = Short4(0x0000, 0x0000, 0x0000, 0x0000);
			break;
		default:
			ASSERT(false);
		}

		blendFactorAlpha(r, sourceFactor, current, pixel, (Context::BlendFactor)state.sourceBlendFactorAlpha);
		blendFactorAlpha(r, destFactor, current, pixel, (Context::BlendFactor)state.destBlendFactorAlpha);

		if(state.sourceBlendFactorAlpha != Context::BLEND_ONE && state.sourceBlendFactorAlpha != Context::BLEND_ZERO)
		{
			current.w = MulHigh(As<UShort4>(current.w), As<UShort4>(sourceFactor.w));
		}
	
		if(state.destBlendFactorAlpha != Context::BLEND_ONE && state.destBlendFactorAlpha != Context::BLEND_ZERO)
		{
			pixel.w = MulHigh(As<UShort4>(pixel.w), As<UShort4>(destFactor.w));
		}

		switch(state.blendOperationAlpha)
		{
		case Context::BLENDOP_ADD:
			current.w = AddSat(As<UShort4>(current.w), As<UShort4>(pixel.w));
			break;
		case Context::BLENDOP_SUB:
			current.w = SubSat(As<UShort4>(current.w), As<UShort4>(pixel.w));
			break;
		case Context::BLENDOP_INVSUB:
			current.w = SubSat(As<UShort4>(pixel.w), As<UShort4>(current.w));
			break;
		case Context::BLENDOP_MIN:
			current.w = Min(As<UShort4>(current.w), As<UShort4>(pixel.w));
			break;
		case Context::BLENDOP_MAX:
			current.w = Max(As<UShort4>(current.w), As<UShort4>(pixel.w));
			break;
		case Context::BLENDOP_SOURCE:
			// No operation
			break;
		case Context::BLENDOP_DEST:
			current.w = pixel.w;
			break;
		case Context::BLENDOP_NULL:
			current.w = Short4(0x0000, 0x0000, 0x0000, 0x0000);
			break;
		default:
			ASSERT(false);
		}
	}

	void PixelRoutine::writeColor(Registers &r, int index, Pointer<Byte> &cBuffer, Int &x, Vector4i &current, Int &sMask, Int &zMask, Int &cMask)
	{
		if(!state.colorWriteActive(index))
		{
			return;
		}

		if(postBlendSRGB && state.writeSRGB)
		{
			linearToSRGB16_16(r, current);
		}

		if(exactColorRounding)
		{
			switch(state.targetFormat[index])
			{
			case FORMAT_X8G8R8B8Q:
			case FORMAT_A8G8R8B8Q:
			case FORMAT_X8R8G8B8:
			case FORMAT_A8R8G8B8:
				{
					current.x = current.x - As<Short4>(As<UShort4>(current.x) >> 8) + Short4(0x0080, 0x0080, 0x0080, 0x0080);
					current.y = current.y - As<Short4>(As<UShort4>(current.y) >> 8) + Short4(0x0080, 0x0080, 0x0080, 0x0080);
					current.z = current.z - As<Short4>(As<UShort4>(current.z) >> 8) + Short4(0x0080, 0x0080, 0x0080, 0x0080);
					current.w = current.w - As<Short4>(As<UShort4>(current.w) >> 8) + Short4(0x0080, 0x0080, 0x0080, 0x0080);
				}
				break;
			}
		}

		int rgbaWriteMask = state.colorWriteActive(index);
		int bgraWriteMask = rgbaWriteMask & 0x0000000A | (rgbaWriteMask & 0x00000001) << 2 | (rgbaWriteMask & 0x00000004) >> 2;
		int brgaWriteMask = rgbaWriteMask & 0x00000008 | (rgbaWriteMask & 0x00000001) << 1 | (rgbaWriteMask & 0x00000002) << 1 | (rgbaWriteMask & 0x00000004) >> 2;

		switch(state.targetFormat[index])
		{
		case FORMAT_X8G8R8B8Q:
			UNIMPLEMENTED();
		//	current.x = As<Short4>(As<UShort4>(current.x) >> 8);
		//	current.y = As<Short4>(As<UShort4>(current.y) >> 8);
		//	current.z = As<Short4>(As<UShort4>(current.z) >> 8);

		//	current.z = As<Short4>(Pack(As<UShort4>(current.z), As<UShort4>(current.x)));
		//	current.y = As<Short4>(Pack(As<UShort4>(current.y), As<UShort4>(current.y)));
			break;
		case FORMAT_A8G8R8B8Q:
			UNIMPLEMENTED();
		//	current.x = As<Short4>(As<UShort4>(current.x) >> 8);
		//	current.y = As<Short4>(As<UShort4>(current.y) >> 8);
		//	current.z = As<Short4>(As<UShort4>(current.z) >> 8);
		//	current.w = As<Short4>(As<UShort4>(current.w) >> 8);

		//	current.z = As<Short4>(Pack(As<UShort4>(current.z), As<UShort4>(current.x)));
		//	current.y = As<Short4>(Pack(As<UShort4>(current.y), As<UShort4>(current.w)));
			break;
		case FORMAT_X8R8G8B8:
		case FORMAT_A8R8G8B8:
			if(state.targetFormat[index] == FORMAT_X8R8G8B8 || rgbaWriteMask == 0x7)
			{
				current.x = As<Short4>(As<UShort4>(current.x) >> 8);
				current.y = As<Short4>(As<UShort4>(current.y) >> 8);
				current.z = As<Short4>(As<UShort4>(current.z) >> 8);

				current.z = As<Short4>(Pack(As<UShort4>(current.z), As<UShort4>(current.x)));
				current.y = As<Short4>(Pack(As<UShort4>(current.y), As<UShort4>(current.y)));

				current.x = current.z;
				current.z = UnpackLow(As<Byte8>(current.z), As<Byte8>(current.y));
				current.x = UnpackHigh(As<Byte8>(current.x), As<Byte8>(current.y));
				current.y = current.z;
				current.z = As<Short4>(UnpackLow(current.z, current.x));
				current.y = As<Short4>(UnpackHigh(current.y, current.x));
			}
			else
			{
				current.x = As<Short4>(As<UShort4>(current.x) >> 8);
				current.y = As<Short4>(As<UShort4>(current.y) >> 8);
				current.z = As<Short4>(As<UShort4>(current.z) >> 8);
				current.w = As<Short4>(As<UShort4>(current.w) >> 8);

				current.z = As<Short4>(Pack(As<UShort4>(current.z), As<UShort4>(current.x)));
				current.y = As<Short4>(Pack(As<UShort4>(current.y), As<UShort4>(current.w)));

				current.x = current.z;
				current.z = UnpackLow(As<Byte8>(current.z), As<Byte8>(current.y));
				current.x = UnpackHigh(As<Byte8>(current.x), As<Byte8>(current.y));
				current.y = current.z;
				current.z = As<Short4>(UnpackLow(current.z, current.x));
				current.y = As<Short4>(UnpackHigh(current.y, current.x));
			}
			break;
		case FORMAT_A8:
			current.w = As<Short4>(As<UShort4>(current.w) >> 8);
			current.w = As<Short4>(Pack(As<UShort4>(current.w), As<UShort4>(current.w)));
			break;
		case FORMAT_G16R16:
			current.z = current.x;
			current.x = As<Short4>(UnpackLow(current.x, current.y));
			current.z = As<Short4>(UnpackHigh(current.z, current.y));
			current.y = current.z;
			break;
		case FORMAT_A16B16G16R16:
			transpose4x4(current.x, current.y, current.z, current.w);
			break;
		case FORMAT_R32F:
		case FORMAT_G32R32F:
		case FORMAT_A32B32G32R32F:
			{
				Vector4f oC;

				oC.x = convertUnsigned16(UShort4(current.x));
				oC.y = convertUnsigned16(UShort4(current.y));
				oC.z = convertUnsigned16(UShort4(current.z));
				oC.w = convertUnsigned16(UShort4(current.w));

				writeColor(r, index, cBuffer, x, oC, sMask, zMask, cMask);
			}
			return;
		default:
			ASSERT(false);
		}

		Short4 c01 = current.z;
		Short4 c23 = current.y;

		Int xMask;   // Combination of all masks

		if(state.depthTestActive)
		{
			xMask = zMask;
		}
		else
		{
			xMask = cMask;
		}

		if(state.stencilActive)
		{
			xMask &= sMask;
		}

		Pointer<Byte> buffer;
		Short4 value;

		switch(state.targetFormat[index])
		{
		case FORMAT_A8G8R8B8Q:
		case FORMAT_X8G8R8B8Q:   // FIXME: Don't touch alpha?
			UNIMPLEMENTED();
		//	value = *Pointer<Short4>(cBuffer + 8 * x + 0);

		//	if((state.targetFormat[index] == FORMAT_A8G8R8B8Q && bgraWriteMask != 0x0000000F) ||
		//	   ((state.targetFormat[index] == FORMAT_X8G8R8B8Q && bgraWriteMask != 0x00000007) &&
		//	    (state.targetFormat[index] == FORMAT_X8G8R8B8Q && bgraWriteMask != 0x0000000F)))   // FIXME: Need for masking when XRGB && Fh?
		//	{
		//		Short4 masked = value;
		//		c01 &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskB4Q[bgraWriteMask][0]));
		//		masked &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskB4Q[bgraWriteMask][0]));
		//		c01 |= masked;
		//	}

		//	c01 &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskD01Q) + xMask * 8);
		//	value &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskD01Q) + xMask * 8);
		//	c01 |= value;
		//	*Pointer<Short4>(cBuffer + 8 * x + 0) = c01;

		//	value = *Pointer<Short4>(cBuffer + 8 * x + 8);

		//	if((state.targetFormat[index] == FORMAT_A8G8R8B8Q && bgraWriteMask != 0x0000000F) ||
		//	   ((state.targetFormat[index] == FORMAT_X8G8R8B8Q && bgraWriteMask != 0x00000007) &&
		//	    (state.targetFormat[index] == FORMAT_X8G8R8B8Q && bgraWriteMask != 0x0000000F)))   // FIXME: Need for masking when XRGB && Fh?
		//	{
		//		Short4 masked = value;
		//		c23 &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskB4Q[bgraWriteMask][0]));
		//		masked &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskB4Q[bgraWriteMask][0]));
		//		c23 |= masked;
		//	}

		//	c23 &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskD23Q) + xMask * 8);
		//	value &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskD23Q) + xMask * 8);
		//	c23 |= value;
		//	*Pointer<Short4>(cBuffer + 8 * x + 8) = c23;
			break;
		case FORMAT_A8R8G8B8:
		case FORMAT_X8R8G8B8:   // FIXME: Don't touch alpha?
			buffer = cBuffer + x * 4;
			value = *Pointer<Short4>(buffer);

			if((state.targetFormat[index] == FORMAT_A8R8G8B8 && bgraWriteMask != 0x0000000F) ||
			   ((state.targetFormat[index] == FORMAT_X8R8G8B8 && bgraWriteMask != 0x00000007) &&
			    (state.targetFormat[index] == FORMAT_X8R8G8B8 && bgraWriteMask != 0x0000000F)))   // FIXME: Need for masking when XRGB && Fh?
			{
				Short4 masked = value;
				c01 &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskB4Q[bgraWriteMask][0]));
				masked &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskB4Q[bgraWriteMask][0]));
				c01 |= masked;
			}

			c01 &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskD01Q) + xMask * 8);
			value &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskD01Q) + xMask * 8);
			c01 |= value;
			*Pointer<Short4>(buffer) = c01;

			buffer += *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));
			value = *Pointer<Short4>(buffer);

			if((state.targetFormat[index] == FORMAT_A8R8G8B8 && bgraWriteMask != 0x0000000F) ||
			   ((state.targetFormat[index] == FORMAT_X8R8G8B8 && bgraWriteMask != 0x00000007) &&
			    (state.targetFormat[index] == FORMAT_X8R8G8B8 && bgraWriteMask != 0x0000000F)))   // FIXME: Need for masking when XRGB && Fh?
			{
				Short4 masked = value;
				c23 &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskB4Q[bgraWriteMask][0]));
				masked &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskB4Q[bgraWriteMask][0]));
				c23 |= masked;
			}

			c23 &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskD23Q) + xMask * 8);
			value &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskD23Q) + xMask * 8);
			c23 |= value;
			*Pointer<Short4>(buffer) = c23;
			break;
		case FORMAT_A8:
			if(rgbaWriteMask & 0x00000008)
			{
				buffer = cBuffer + 1 * x;
				Insert(value, *Pointer<Short>(buffer), 0);
				Int pitch = *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));
				Insert(value, *Pointer<Short>(buffer + pitch), 1);
				value = UnpackLow(As<Byte8>(value), As<Byte8>(value));

				current.w &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskB4Q) + 8 * xMask);
				value &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskB4Q) + 8 * xMask);
				current.w |= value;

				*Pointer<Short>(buffer) = Extract(current.w, 0);
				*Pointer<Short>(buffer + pitch) = Extract(current.w, 1);
			}
			break;
		case FORMAT_G16R16:
			buffer = cBuffer + 4 * x;

			value = *Pointer<Short4>(buffer);

			if((rgbaWriteMask & 0x00000003) != 0x00000003)
			{
				Short4 masked = value;
				current.x &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskW01Q[rgbaWriteMask & 0x3][0]));
				masked &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskW01Q[rgbaWriteMask & 0x3][0]));
				current.x |= masked;
			}

			current.x &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskD01Q) + xMask * 8);
			value &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskD01Q) + xMask * 8);
			current.x |= value;
			*Pointer<Short4>(buffer) = current.x;

			buffer += *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));

			value = *Pointer<Short4>(buffer);

			if((rgbaWriteMask & 0x00000003) != 0x00000003)
			{
				Short4 masked = value;
				current.y &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskW01Q[rgbaWriteMask & 0x3][0]));
				masked &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskW01Q[rgbaWriteMask & 0x3][0]));
				current.y |= masked;
			}

			current.y &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskD23Q) + xMask * 8);
			value &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskD23Q) + xMask * 8);
			current.y |= value;
			*Pointer<Short4>(buffer) = current.y;
			break;
		case FORMAT_A16B16G16R16:
			buffer = cBuffer + 8 * x;

			{
				value = *Pointer<Short4>(buffer);

				if(rgbaWriteMask != 0x0000000F)
				{
					Short4 masked = value;
					current.x &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskW4Q[rgbaWriteMask][0]));
					masked &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskW4Q[rgbaWriteMask][0]));
					current.x |= masked;
				}

				current.x &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskQ0Q) + xMask * 8);
				value &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskQ0Q) + xMask * 8);
				current.x |= value;
				*Pointer<Short4>(buffer) = current.x;
			}

			{
				value = *Pointer<Short4>(buffer + 8);

				if(rgbaWriteMask != 0x0000000F)
				{
					Short4 masked = value;
					current.y &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskW4Q[rgbaWriteMask][0]));
					masked &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskW4Q[rgbaWriteMask][0]));
					current.y |= masked;
				}

				current.y &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskQ1Q) + xMask * 8);
				value &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskQ1Q) + xMask * 8);
				current.y |= value;
				*Pointer<Short4>(buffer + 8) = current.y;
			}

			buffer += *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));

			{
				value = *Pointer<Short4>(buffer);

				if(rgbaWriteMask != 0x0000000F)
				{
					Short4 masked = value;
					current.z &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskW4Q[rgbaWriteMask][0]));
					masked &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskW4Q[rgbaWriteMask][0]));
					current.z |= masked;
				}

				current.z &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskQ2Q) + xMask * 8);
				value &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskQ2Q) + xMask * 8);
				current.z |= value;
				*Pointer<Short4>(buffer) = current.z;
			}

			{
				value = *Pointer<Short4>(buffer + 8);

				if(rgbaWriteMask != 0x0000000F)
				{
					Short4 masked = value;
					current.w &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskW4Q[rgbaWriteMask][0]));
					masked &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskW4Q[rgbaWriteMask][0]));
					current.w |= masked;
				}

				current.w &= *Pointer<Short4>(r.constants + OFFSET(Constants,maskQ3Q) + xMask * 8);
				value &= *Pointer<Short4>(r.constants + OFFSET(Constants,invMaskQ3Q) + xMask * 8);
				current.w |= value;
				*Pointer<Short4>(buffer + 8) = current.w;
			}
			break;
		default:
			ASSERT(false);
		}
	}

	void PixelRoutine::blendFactor(Registers &r, const Vector4f &blendFactor, const Vector4f &oC, const Vector4f &pixel, Context::BlendFactor blendFactorActive) 
	{
		switch(blendFactorActive)
		{
		case Context::BLEND_ZERO:
			// Optimized
			break;
		case Context::BLEND_ONE:
			// Optimized
			break;
		case Context::BLEND_SOURCE:
			blendFactor.x = oC.x;
			blendFactor.y = oC.y;
			blendFactor.z = oC.z;
			break;
		case Context::BLEND_INVSOURCE:
			blendFactor.x = Float4(1.0f) - oC.x;
			blendFactor.y = Float4(1.0f) - oC.y;
			blendFactor.z = Float4(1.0f) - oC.z;
			break;
		case Context::BLEND_DEST:
			blendFactor.x = pixel.x;
			blendFactor.y = pixel.y;
			blendFactor.z = pixel.z;
			break;
		case Context::BLEND_INVDEST:
			blendFactor.x = Float4(1.0f) - pixel.x;
			blendFactor.y = Float4(1.0f) - pixel.y;
			blendFactor.z = Float4(1.0f) - pixel.z;
			break;
		case Context::BLEND_SOURCEALPHA:
			blendFactor.x = oC.w;
			blendFactor.y = oC.w;
			blendFactor.z = oC.w;
			break;
		case Context::BLEND_INVSOURCEALPHA:
			blendFactor.x = Float4(1.0f) - oC.w;
			blendFactor.y = Float4(1.0f) - oC.w;
			blendFactor.z = Float4(1.0f) - oC.w;
			break;
		case Context::BLEND_DESTALPHA:
			blendFactor.x = pixel.w;
			blendFactor.y = pixel.w;
			blendFactor.z = pixel.w;
			break;
		case Context::BLEND_INVDESTALPHA:
			blendFactor.x = Float4(1.0f) - pixel.w;
			blendFactor.y = Float4(1.0f) - pixel.w;
			blendFactor.z = Float4(1.0f) - pixel.w;
			break;
		case Context::BLEND_SRCALPHASAT:
			blendFactor.x = Float4(1.0f) - pixel.w;
			blendFactor.x = Min(blendFactor.x, oC.w);
			blendFactor.y = blendFactor.x;
			blendFactor.z = blendFactor.x;
			break;
		case Context::BLEND_CONSTANT:
			blendFactor.x = *Pointer<Float4>(r.data + OFFSET(DrawData,factor.blendConstant4F[0]));
			blendFactor.y = *Pointer<Float4>(r.data + OFFSET(DrawData,factor.blendConstant4F[1]));
			blendFactor.z = *Pointer<Float4>(r.data + OFFSET(DrawData,factor.blendConstant4F[2]));
			break;
		case Context::BLEND_INVCONSTANT:
			blendFactor.x = *Pointer<Float4>(r.data + OFFSET(DrawData,factor.invBlendConstant4F[0]));
			blendFactor.y = *Pointer<Float4>(r.data + OFFSET(DrawData,factor.invBlendConstant4F[1]));
			blendFactor.z = *Pointer<Float4>(r.data + OFFSET(DrawData,factor.invBlendConstant4F[2]));
			break;
		default:
			ASSERT(false);
		}
	}

	void PixelRoutine::blendFactorAlpha(Registers &r, const Vector4f &blendFactor, const Vector4f &oC, const Vector4f &pixel, Context::BlendFactor blendFactorAlphaActive) 
	{
		switch(blendFactorAlphaActive)
		{
		case Context::BLEND_ZERO:
			// Optimized
			break;
		case Context::BLEND_ONE:
			// Optimized
			break;
		case Context::BLEND_SOURCE:
			blendFactor.w = oC.w;
			break;
		case Context::BLEND_INVSOURCE:
			blendFactor.w = Float4(1.0f) - oC.w;
			break;
		case Context::BLEND_DEST:
			blendFactor.w = pixel.w;
			break;
		case Context::BLEND_INVDEST:
			blendFactor.w = Float4(1.0f) - pixel.w;
			break;
		case Context::BLEND_SOURCEALPHA:
			blendFactor.w = oC.w;
			break;
		case Context::BLEND_INVSOURCEALPHA:
			blendFactor.w = Float4(1.0f) - oC.w;
			break;
		case Context::BLEND_DESTALPHA:
			blendFactor.w = pixel.w;
			break;
		case Context::BLEND_INVDESTALPHA:
			blendFactor.w = Float4(1.0f) - pixel.w;
			break;
		case Context::BLEND_SRCALPHASAT:
			blendFactor.w = Float4(1.0f);
			break;
		case Context::BLEND_CONSTANT:
			blendFactor.w = *Pointer<Float4>(r.data + OFFSET(DrawData,factor.blendConstant4F[3]));
			break;
		case Context::BLEND_INVCONSTANT:
			blendFactor.w = *Pointer<Float4>(r.data + OFFSET(DrawData,factor.invBlendConstant4F[3]));
			break;
		default:
			ASSERT(false);
		}
	}

	void PixelRoutine::alphaBlend(Registers &r, int index, Pointer<Byte> &cBuffer, Vector4f &oC, Int &x)
	{
		if(!state.alphaBlendActive)
		{
			return;
		}

		Pointer<Byte> buffer;
		Vector4f pixel;

		Vector4i color;
		Short4 c01;
		Short4 c23;

		// Read pixel
		switch(state.targetFormat[index])
		{
		case FORMAT_A8R8G8B8:
			buffer = cBuffer + 4 * x;
			c01 = *Pointer<Short4>(buffer);
			buffer += *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));
			c23 = *Pointer<Short4>(buffer);
			color.z = c01;
			color.y = c01;
			color.z = UnpackLow(As<Byte8>(color.z), As<Byte8>(c23));
			color.y = UnpackHigh(As<Byte8>(color.y), As<Byte8>(c23));
			color.x = color.z;
			color.z = UnpackLow(As<Byte8>(color.z), As<Byte8>(color.y));
			color.x = UnpackHigh(As<Byte8>(color.x), As<Byte8>(color.y));
			color.y = color.z;
			color.w = color.x;
			color.x = UnpackLow(As<Byte8>(color.x), As<Byte8>(color.x));
			color.y = UnpackHigh(As<Byte8>(color.y), As<Byte8>(color.y));
			color.z = UnpackLow(As<Byte8>(color.z), As<Byte8>(color.z));
			color.w = UnpackHigh(As<Byte8>(color.w), As<Byte8>(color.w));

			pixel.x = convertUnsigned16(As<UShort4>(color.x));
			pixel.y = convertUnsigned16(As<UShort4>(color.y));
			pixel.z = convertUnsigned16(As<UShort4>(color.z));
			pixel.w = convertUnsigned16(As<UShort4>(color.w));
			break;
		case FORMAT_X8R8G8B8:
			buffer = cBuffer + 4 * x;
			c01 = *Pointer<Short4>(buffer);
			buffer += *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));
			c23 = *Pointer<Short4>(buffer);
			color.z = c01;
			color.y = c01;
			color.z = UnpackLow(As<Byte8>(color.z), As<Byte8>(c23));
			color.y = UnpackHigh(As<Byte8>(color.y), As<Byte8>(c23));
			color.x = color.z;
			color.z = UnpackLow(As<Byte8>(color.z), As<Byte8>(color.y));
			color.x = UnpackHigh(As<Byte8>(color.x), As<Byte8>(color.y));
			color.y = color.z;
			color.x = UnpackLow(As<Byte8>(color.x), As<Byte8>(color.x));
			color.y = UnpackHigh(As<Byte8>(color.y), As<Byte8>(color.y));
			color.z = UnpackLow(As<Byte8>(color.z), As<Byte8>(color.z));

			pixel.x = convertUnsigned16(As<UShort4>(color.x));
			pixel.y = convertUnsigned16(As<UShort4>(color.y));
			pixel.z = convertUnsigned16(As<UShort4>(color.z));
			pixel.w = Float4(1.0f);
			break;
		case FORMAT_A8:
			buffer = cBuffer + 1 * x;
			c01 = Insert(c01, *Pointer<Short>(buffer), 0);
			buffer += *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));
			c01 = Insert(c01, *Pointer<Short>(buffer), 1);
			pixel.w = convertUnsigned16(As<UShort4>(UnpackLow(As<Byte8>(c01), As<Byte8>(c01))));
			pixel.x = Float4(0.0f);
			pixel.y = Float4(0.0f);
			pixel.z = Float4(0.0f);
			break;
		case FORMAT_A8G8R8B8Q:
			UNIMPLEMENTED();
		//	UnpackLow(pixel.z, qword_ptr [cBuffer+8*x+0]);
		//	UnpackHigh(pixel.x, qword_ptr [cBuffer+8*x+0]);
		//	UnpackLow(pixel.y, qword_ptr [cBuffer+8*x+8]);
		//	UnpackHigh(pixel.w, qword_ptr [cBuffer+8*x+8]);
			break;
		case FORMAT_X8G8R8B8Q:
			UNIMPLEMENTED();
		//	UnpackLow(pixel.z, qword_ptr [cBuffer+8*x+0]);
		//	UnpackHigh(pixel.x, qword_ptr [cBuffer+8*x+0]);
		//	UnpackLow(pixel.y, qword_ptr [cBuffer+8*x+8]);
		//	pixel.w = Short4(0xFFFFu);
			break;
		case FORMAT_A16B16G16R16:
			buffer  = cBuffer;
			color.x = *Pointer<Short4>(buffer + 8 * x);
			color.y = *Pointer<Short4>(buffer + 8 * x + 8);
			buffer += *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));
			color.z = *Pointer<Short4>(buffer + 8 * x);
			color.w = *Pointer<Short4>(buffer + 8 * x + 8);
			
			transpose4x4(color.x, color.y, color.z, color.w);

			pixel.x = convertUnsigned16(As<UShort4>(color.x));
			pixel.y = convertUnsigned16(As<UShort4>(color.y));
			pixel.z = convertUnsigned16(As<UShort4>(color.z));
			pixel.w = convertUnsigned16(As<UShort4>(color.w));
			break;
		case FORMAT_G16R16:
			buffer = cBuffer;
			color.x = *Pointer<Short4>(buffer  + 4 * x);
			buffer += *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));
			color.y = *Pointer<Short4>(buffer  + 4 * x);
			color.z = color.x;
			color.x = As<Short4>(UnpackLow(color.x, color.y));
			color.z = As<Short4>(UnpackHigh(color.z, color.y));
			color.y = color.z;
			color.x = As<Short4>(UnpackLow(color.x, color.z));
			color.y = As<Short4>(UnpackHigh(color.y, color.z));
			
			pixel.x = convertUnsigned16(As<UShort4>(color.x));
			pixel.y = convertUnsigned16(As<UShort4>(color.y));
			pixel.z = Float4(1.0f);
			pixel.w = Float4(1.0f);
			break;
		case FORMAT_R32F:
			buffer = cBuffer;
			// FIXME: movlps
			pixel.x.x = *Pointer<Float>(buffer + 4 * x + 0);
			pixel.x.y = *Pointer<Float>(buffer + 4 * x + 4);
			buffer += *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));
			// FIXME: movhps
			pixel.x.z = *Pointer<Float>(buffer + 4 * x + 0);
			pixel.x.w = *Pointer<Float>(buffer + 4 * x + 4);
			pixel.y = Float4(1.0f);
			pixel.z = Float4(1.0f);
			pixel.w = Float4(1.0f);
			break;
		case FORMAT_G32R32F:
			buffer = cBuffer;
			pixel.x = *Pointer<Float4>(buffer + 8 * x, 16);
			buffer += *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));
			pixel.y = *Pointer<Float4>(buffer + 8 * x, 16);
			pixel.z = pixel.x;
			pixel.x = ShuffleLowHigh(pixel.x, pixel.y, 0x88);
			pixel.z = ShuffleLowHigh(pixel.z, pixel.y, 0xDD);
			pixel.y = pixel.z;
			pixel.z = Float4(1.0f);
			pixel.w = Float4(1.0f);
			break;
		case FORMAT_A32B32G32R32F:
			buffer = cBuffer;
			pixel.x = *Pointer<Float4>(buffer + 16 * x, 16);
			pixel.y = *Pointer<Float4>(buffer + 16 * x + 16, 16);
			buffer += *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));
			pixel.z = *Pointer<Float4>(buffer + 16 * x, 16);
			pixel.w = *Pointer<Float4>(buffer + 16 * x + 16, 16);
			transpose4x4(pixel.x, pixel.y, pixel.z, pixel.w);
			break;
		default:
			ASSERT(false);
		}

		if(postBlendSRGB && state.writeSRGB)
		{
			sRGBtoLinear(pixel.x);
			sRGBtoLinear(pixel.y);
			sRGBtoLinear(pixel.z);
		}

		// Final Color = ObjectColor * SourceBlendFactor + PixelColor * DestinationBlendFactor
		Vector4f sourceFactor;
		Vector4f destFactor;

		blendFactor(r, sourceFactor, oC, pixel, (Context::BlendFactor)state.sourceBlendFactor);
		blendFactor(r, destFactor, oC, pixel, (Context::BlendFactor)state.destBlendFactor);

		if(state.sourceBlendFactor != Context::BLEND_ONE && state.sourceBlendFactor != Context::BLEND_ZERO)
		{
			oC.x *= sourceFactor.x;
			oC.y *= sourceFactor.y;
			oC.z *= sourceFactor.z;
		}
	
		if(state.destBlendFactor != Context::BLEND_ONE && state.destBlendFactor != Context::BLEND_ZERO)
		{
			pixel.x *= destFactor.x;
			pixel.y *= destFactor.y;
			pixel.z *= destFactor.z;
		}

		switch(state.blendOperation)
		{
		case Context::BLENDOP_ADD:
			oC.x += pixel.x;
			oC.y += pixel.y;
			oC.z += pixel.z;
			break;
		case Context::BLENDOP_SUB:
			oC.x -= pixel.x;
			oC.y -= pixel.y;
			oC.z -= pixel.z;
			break;
		case Context::BLENDOP_INVSUB:
			oC.x = pixel.x - oC.x;
			oC.y = pixel.y - oC.y;
			oC.z = pixel.z - oC.z;
			break;
		case Context::BLENDOP_MIN:
			oC.x = Min(oC.x, pixel.x);
			oC.y = Min(oC.y, pixel.y);
			oC.z = Min(oC.z, pixel.z);
			break;
		case Context::BLENDOP_MAX:
			oC.x = Max(oC.x, pixel.x);
			oC.y = Max(oC.y, pixel.y);
			oC.z = Max(oC.z, pixel.z);
			break;
		case Context::BLENDOP_SOURCE:
			// No operation
			break;
		case Context::BLENDOP_DEST:
			oC.x = pixel.x;
			oC.y = pixel.y;
			oC.z = pixel.z;
			break;
		case Context::BLENDOP_NULL:
			oC.x = Float4(0.0f);
			oC.y = Float4(0.0f);
			oC.z = Float4(0.0f);
			break;
		default:
			ASSERT(false);
		}

		blendFactorAlpha(r, sourceFactor, oC, pixel, (Context::BlendFactor)state.sourceBlendFactorAlpha);
		blendFactorAlpha(r, destFactor, oC, pixel, (Context::BlendFactor)state.destBlendFactorAlpha);

		if(state.sourceBlendFactorAlpha != Context::BLEND_ONE && state.sourceBlendFactorAlpha != Context::BLEND_ZERO)
		{
			oC.w *= sourceFactor.w;
		}
	
		if(state.destBlendFactorAlpha != Context::BLEND_ONE && state.destBlendFactorAlpha != Context::BLEND_ZERO)
		{
			pixel.w *= destFactor.w;
		}

		switch(state.blendOperationAlpha)
		{
		case Context::BLENDOP_ADD:
			oC.w += pixel.w;
			break;
		case Context::BLENDOP_SUB:
			oC.w -= pixel.w;
			break;
		case Context::BLENDOP_INVSUB:
			pixel.w -= oC.w;
			oC.w = pixel.w;
			break;
		case Context::BLENDOP_MIN:	
			oC.w = Min(oC.w, pixel.w);
			break;
		case Context::BLENDOP_MAX:	
			oC.w = Max(oC.w, pixel.w);
			break;
		case Context::BLENDOP_SOURCE:
			// No operation
			break;
		case Context::BLENDOP_DEST:
			oC.w = pixel.w;
			break;
		case Context::BLENDOP_NULL:
			oC.w = Float4(0.0f);
			break;
		default:
			ASSERT(false);
		}
	}

	void PixelRoutine::writeColor(Registers &r, int index, Pointer<Byte> &cBuffer, Int &x, Vector4f &oC, Int &sMask, Int &zMask, Int &cMask)
	{
		if(!state.colorWriteActive(index))
		{
			return;
		}

		Vector4i color;

		switch(state.targetFormat[index])
		{
		case FORMAT_X8R8G8B8:
		case FORMAT_A8R8G8B8:
		case FORMAT_A8:
		case FORMAT_G16R16:
		case FORMAT_A16B16G16R16:
			convertFixed16(color, oC, true);
			writeColor(r, index, cBuffer, x, color, sMask, zMask, cMask);
			return;
		case FORMAT_R32F:
			break;
		case FORMAT_G32R32F:
			oC.z = oC.x;
			oC.x = UnpackLow(oC.x, oC.y);
			oC.z = UnpackHigh(oC.z, oC.y);
			oC.y = oC.z;
			break;
		case FORMAT_A32B32G32R32F:
			transpose4x4(oC.x, oC.y, oC.z, oC.w);
			break;
		default:
			ASSERT(false);
		}

		int rgbaWriteMask = state.colorWriteActive(index);

		Int xMask;   // Combination of all masks

		if(state.depthTestActive)
		{
			xMask = zMask;
		}
		else
		{
			xMask = cMask;
		}

		if(state.stencilActive)
		{
			xMask &= sMask;
		}

		Pointer<Byte> buffer;
		Float4 value;

		switch(state.targetFormat[index])
		{
		case FORMAT_R32F:
			if(rgbaWriteMask & 0x00000001)
			{
				buffer = cBuffer + 4 * x;

				// FIXME: movlps
				value.x = *Pointer<Float>(buffer + 0);
				value.y = *Pointer<Float>(buffer + 4);

				buffer += *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));

				// FIXME: movhps
				value.z = *Pointer<Float>(buffer + 0);
				value.w = *Pointer<Float>(buffer + 4);

				oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(r.constants + OFFSET(Constants,maskD4X) + xMask * 16, 16));
				value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(r.constants + OFFSET(Constants,invMaskD4X) + xMask * 16, 16));
				oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(value));

				// FIXME: movhps
				*Pointer<Float>(buffer + 0) = oC.x.z;
				*Pointer<Float>(buffer + 4) = oC.x.w;

				buffer -= *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));

				// FIXME: movlps
				*Pointer<Float>(buffer + 0) = oC.x.x;
				*Pointer<Float>(buffer + 4) = oC.x.y;
			}
			break;
		case FORMAT_G32R32F:
			buffer = cBuffer + 8 * x;

			value = *Pointer<Float4>(buffer);

			if((rgbaWriteMask & 0x00000003) != 0x00000003)
			{
				Float4 masked = value;
				oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(r.constants + OFFSET(Constants,maskD01X[rgbaWriteMask & 0x3][0])));
				masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(r.constants + OFFSET(Constants,invMaskD01X[rgbaWriteMask & 0x3][0])));
				oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(masked));
			}

			oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(r.constants + OFFSET(Constants,maskQ01X) + xMask * 16, 16));
			value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(r.constants + OFFSET(Constants,invMaskQ01X) + xMask * 16, 16));
			oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(value));
			*Pointer<Float4>(buffer) = oC.x;

			buffer += *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));

			value = *Pointer<Float4>(buffer);

			if((rgbaWriteMask & 0x00000003) != 0x00000003)
			{
				Float4 masked;

				masked = value;
				oC.y = As<Float4>(As<Int4>(oC.y) & *Pointer<Int4>(r.constants + OFFSET(Constants,maskD01X[rgbaWriteMask & 0x3][0])));
				masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(r.constants + OFFSET(Constants,invMaskD01X[rgbaWriteMask & 0x3][0])));
				oC.y = As<Float4>(As<Int4>(oC.y) | As<Int4>(masked));
			}

			oC.y = As<Float4>(As<Int4>(oC.y) & *Pointer<Int4>(r.constants + OFFSET(Constants,maskQ23X) + xMask * 16, 16));
			value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(r.constants + OFFSET(Constants,invMaskQ23X) + xMask * 16, 16));
			oC.y = As<Float4>(As<Int4>(oC.y) | As<Int4>(value));
			*Pointer<Float4>(buffer) = oC.y;
			break;
		case FORMAT_A32B32G32R32F:
			buffer = cBuffer + 16 * x;

			{
				value = *Pointer<Float4>(buffer, 16);

				if(rgbaWriteMask != 0x0000000F)
				{
					Float4 masked = value;
					oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(r.constants + OFFSET(Constants,maskD4X[rgbaWriteMask][0])));
					masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(r.constants + OFFSET(Constants,invMaskD4X[rgbaWriteMask][0])));
					oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(masked));
				}
				
				oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(r.constants + OFFSET(Constants,maskX0X) + xMask * 16, 16));
				value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(r.constants + OFFSET(Constants,invMaskX0X) + xMask * 16, 16));
				oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(value));
				*Pointer<Float4>(buffer, 16) = oC.x;
			}

			{
				value = *Pointer<Float4>(buffer + 16, 16);

				if(rgbaWriteMask != 0x0000000F)
				{	
					Float4 masked = value;
					oC.y = As<Float4>(As<Int4>(oC.y) & *Pointer<Int4>(r.constants + OFFSET(Constants,maskD4X[rgbaWriteMask][0])));
					masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(r.constants + OFFSET(Constants,invMaskD4X[rgbaWriteMask][0])));
					oC.y = As<Float4>(As<Int4>(oC.y) | As<Int4>(masked));
				}

				oC.y = As<Float4>(As<Int4>(oC.y) & *Pointer<Int4>(r.constants + OFFSET(Constants,maskX1X) + xMask * 16, 16));
				value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(r.constants + OFFSET(Constants,invMaskX1X) + xMask * 16, 16));
				oC.y = As<Float4>(As<Int4>(oC.y) | As<Int4>(value));
				*Pointer<Float4>(buffer + 16, 16) = oC.y;
			}

			buffer += *Pointer<Int>(r.data + OFFSET(DrawData,colorPitchB[index]));

			{
				value = *Pointer<Float4>(buffer, 16);

				if(rgbaWriteMask != 0x0000000F)
				{
					Float4 masked = value;
					oC.z = As<Float4>(As<Int4>(oC.z) & *Pointer<Int4>(r.constants + OFFSET(Constants,maskD4X[rgbaWriteMask][0])));
					masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(r.constants + OFFSET(Constants,invMaskD4X[rgbaWriteMask][0])));
					oC.z = As<Float4>(As<Int4>(oC.z) | As<Int4>(masked));
				}

				oC.z = As<Float4>(As<Int4>(oC.z) & *Pointer<Int4>(r.constants + OFFSET(Constants,maskX2X) + xMask * 16, 16));
				value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(r.constants + OFFSET(Constants,invMaskX2X) + xMask * 16, 16));
				oC.z = As<Float4>(As<Int4>(oC.z) | As<Int4>(value));
				*Pointer<Float4>(buffer, 16) = oC.z;
			}

			{
				value = *Pointer<Float4>(buffer + 16, 16);

				if(rgbaWriteMask != 0x0000000F)
				{
					Float4 masked = value;
					oC.w = As<Float4>(As<Int4>(oC.w) & *Pointer<Int4>(r.constants + OFFSET(Constants,maskD4X[rgbaWriteMask][0])));
					masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(r.constants + OFFSET(Constants,invMaskD4X[rgbaWriteMask][0])));
					oC.w = As<Float4>(As<Int4>(oC.w) | As<Int4>(masked));
				}

				oC.w = As<Float4>(As<Int4>(oC.w) & *Pointer<Int4>(r.constants + OFFSET(Constants,maskX3X) + xMask * 16, 16));
				value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(r.constants + OFFSET(Constants,invMaskX3X) + xMask * 16, 16));
				oC.w = As<Float4>(As<Int4>(oC.w) | As<Int4>(value));
				*Pointer<Float4>(buffer + 16, 16) = oC.w;
			}
			break;
		default:
			ASSERT(false);
		}
	}

	void PixelRoutine::ps_1_x(Registers &r, Int cMask[4])
	{
		int pad = 0;        // Count number of texm3x3pad instructions
		Vector4i dPairing;   // Destination for first pairing instruction

		for(int i = 0; i < shader->getLength(); i++)
		{
			const Shader::Instruction *instruction = shader->getInstruction(i);
			Shader::Opcode opcode = instruction->opcode;

		//	#ifndef NDEBUG   // FIXME: Centralize debug output control
		//		shader->printInstruction(i, "debug.txt");
		//	#endif

			if(opcode == Shader::OPCODE_DCL || opcode == Shader::OPCODE_DEF || opcode == Shader::OPCODE_DEFI || opcode == Shader::OPCODE_DEFB)
			{
				continue;
			}

			const Dst &dst = instruction->dst;
			const Src &src0 = instruction->src[0];
			const Src &src1 = instruction->src[1];
			const Src &src2 = instruction->src[2];

			unsigned short version = shader->getVersion();
			bool pairing = i + 1 < shader->getLength() && shader->getInstruction(i + 1)->coissue;   // First instruction of pair
			bool coissue = instruction->coissue;                                                              // Second instruction of pair

			Vector4i d;
			Vector4i s0;
			Vector4i s1;
			Vector4i s2;

			if(src0.type != Shader::PARAMETER_VOID) s0 = regi(r, src0);
			if(src1.type != Shader::PARAMETER_VOID) s1 = regi(r, src1);
			if(src2.type != Shader::PARAMETER_VOID) s2 = regi(r, src2);

			Float4 u = version < 0x0104 ? r.vf[2 + dst.index].x : r.vf[2 + src0.index].x;
			Float4 v = version < 0x0104 ? r.vf[2 + dst.index].y : r.vf[2 + src0.index].y;
			Float4 s = version < 0x0104 ? r.vf[2 + dst.index].z : r.vf[2 + src0.index].z;
			Float4 t = version < 0x0104 ? r.vf[2 + dst.index].w : r.vf[2 + src0.index].w;

			switch(opcode)
			{
			case Shader::OPCODE_PS_1_0:															break;
			case Shader::OPCODE_PS_1_1:															break;
			case Shader::OPCODE_PS_1_2:															break;
			case Shader::OPCODE_PS_1_3:															break;
			case Shader::OPCODE_PS_1_4:															break;

			case Shader::OPCODE_DEF:															break;

			case Shader::OPCODE_NOP:															break;
			case Shader::OPCODE_MOV:			MOV(d, s0);										break;
			case Shader::OPCODE_ADD:			ADD(d, s0, s1);									break;
			case Shader::OPCODE_SUB:			SUB(d, s0, s1);									break;
			case Shader::OPCODE_MAD:			MAD(d, s0, s1, s2);								break;
			case Shader::OPCODE_MUL:			MUL(d, s0, s1);									break;
			case Shader::OPCODE_DP3:			DP3(d, s0, s1);									break;
			case Shader::OPCODE_DP4:			DP4(d, s0, s1);									break;
			case Shader::OPCODE_LRP:			LRP(d, s0, s1, s2);								break;
			case Shader::OPCODE_TEXCOORD:
				if(version < 0x0104)
				{
					TEXCOORD(d, u, v, s, dst.index);
				}
				else
				{
					if((src0.swizzle & 0x30) == 0x20)   // .xyz
					{
						TEXCRD(d, u, v, s, src0.index, src0.modifier == Shader::MODIFIER_DZ || src0.modifier == Shader::MODIFIER_DW);
					}
					else   // .xyw
					{
						TEXCRD(d, u, v, t, src0.index, src0.modifier == Shader::MODIFIER_DZ || src0.modifier == Shader::MODIFIER_DW);
					}
				}
				break;
			case Shader::OPCODE_TEXKILL:
				if(version < 0x0104)
				{
					TEXKILL(cMask, u, v, s);
				}
				else if(version == 0x0104)
				{
					if(dst.type == Shader::PARAMETER_TEXTURE)
					{
						TEXKILL(cMask, u, v, s);
					}
					else
					{
						TEXKILL(cMask, r.ri[dst.index]);
					}
				}
				else ASSERT(false);
				break;
			case Shader::OPCODE_TEX:
				if(version < 0x0104)
				{
					TEX(r, d, u, v, s, dst.index, false);
				}
				else if(version == 0x0104)
				{
					if(src0.type == Shader::PARAMETER_TEXTURE)
					{
						if((src0.swizzle & 0x30) == 0x20)   // .xyz
						{
							TEX(r, d, u, v, s, dst.index, src0.modifier == Shader::MODIFIER_DZ || src0.modifier == Shader::MODIFIER_DW);
						}
						else   // .xyw
						{
							TEX(r, d, u, v, t, dst.index, src0.modifier == Shader::MODIFIER_DZ || src0.modifier == Shader::MODIFIER_DW);
						}
					}
					else
					{
						TEXLD(r, d, s0, dst.index, src0.modifier == Shader::MODIFIER_DZ || src0.modifier == Shader::MODIFIER_DW);
					}
				}
				else ASSERT(false);
				break;
			case Shader::OPCODE_TEXBEM:			TEXBEM(r, d, s0, u, v, s, dst.index);	break;
			case Shader::OPCODE_TEXBEML:		TEXBEML(r, d, s0, u, v, s, dst.index);	break;
			case Shader::OPCODE_TEXREG2AR:		TEXREG2AR(r, d, s0, dst.index);					break;
			case Shader::OPCODE_TEXREG2GB:		TEXREG2GB(r, d, s0, dst.index);					break;
			case Shader::OPCODE_TEXM3X2PAD:		TEXM3X2PAD(r, u, v, s, s0, 0, src0.modifier == Shader::MODIFIER_SIGN);	break;
			case Shader::OPCODE_TEXM3X2TEX:		TEXM3X2TEX(r, d, u, v, s, dst.index, s0, src0.modifier == Shader::MODIFIER_SIGN);	break;
			case Shader::OPCODE_TEXM3X3PAD:		TEXM3X3PAD(r, u, v, s, s0, pad++ % 2, src0.modifier == Shader::MODIFIER_SIGN);	break;
			case Shader::OPCODE_TEXM3X3TEX:		TEXM3X3TEX(r, d, u, v, s, dst.index, s0, src0.modifier == Shader::MODIFIER_SIGN);	break;
			case Shader::OPCODE_TEXM3X3SPEC:	TEXM3X3SPEC(r, d, u, v, s, dst.index, s0, s1);		break;
			case Shader::OPCODE_TEXM3X3VSPEC:	TEXM3X3VSPEC(r, d, u, v, s, dst.index, s0);		break;
			case Shader::OPCODE_CND:			CND(d, s0, s1, s2);								break;
			case Shader::OPCODE_TEXREG2RGB:		TEXREG2RGB(r, d, s0, dst.index);				break;
			case Shader::OPCODE_TEXDP3TEX:		TEXDP3TEX(r, d, u, v, s, dst.index, s0);	break;
			case Shader::OPCODE_TEXM3X2DEPTH:	TEXM3X2DEPTH(r, d, u, v, s, s0, src0.modifier == Shader::MODIFIER_SIGN);	break;
			case Shader::OPCODE_TEXDP3:			TEXDP3(r, d, u, v, s, s0);				break;
			case Shader::OPCODE_TEXM3X3:		TEXM3X3(r, d, u, v, s, s0, src0.modifier == Shader::MODIFIER_SIGN); 	break;
			case Shader::OPCODE_TEXDEPTH:		TEXDEPTH(r);									break;
			case Shader::OPCODE_CMP0:			CMP(d, s0, s1, s2);								break;
			case Shader::OPCODE_BEM:			BEM(r, d, s0, s1, dst.index);					break;
			case Shader::OPCODE_PHASE:															break;
			case Shader::OPCODE_END:															break;
			default:
				ASSERT(false);
			}

			if(dst.type != Shader::PARAMETER_VOID && opcode != Shader::OPCODE_TEXKILL)
			{
				if(dst.shift > 0)
				{
					if(dst.mask & 0x1) {d.x = AddSat(d.x, d.x); if(dst.shift > 1) d.x = AddSat(d.x, d.x); if(dst.shift > 2) d.x = AddSat(d.x, d.x);}
					if(dst.mask & 0x2) {d.y = AddSat(d.y, d.y); if(dst.shift > 1) d.y = AddSat(d.y, d.y); if(dst.shift > 2) d.y = AddSat(d.y, d.y);}
					if(dst.mask & 0x4) {d.z = AddSat(d.z, d.z); if(dst.shift > 1) d.z = AddSat(d.z, d.z); if(dst.shift > 2) d.z = AddSat(d.z, d.z);}
					if(dst.mask & 0x8) {d.w = AddSat(d.w, d.w); if(dst.shift > 1) d.w = AddSat(d.w, d.w); if(dst.shift > 2) d.w = AddSat(d.w, d.w);}
				}
				else if(dst.shift < 0)
				{
					if(dst.mask & 0x1) d.x = d.x >> -dst.shift;
					if(dst.mask & 0x2) d.y = d.y >> -dst.shift;
					if(dst.mask & 0x4) d.z = d.z >> -dst.shift;
					if(dst.mask & 0x8) d.w = d.w >> -dst.shift;
				}

				if(dst.saturate)
				{
					if(dst.mask & 0x1) {d.x = Min(d.x, Short4(0x1000)); d.x = Max(d.x, Short4(0x0000, 0x0000, 0x0000, 0x0000));}
					if(dst.mask & 0x2) {d.y = Min(d.y, Short4(0x1000)); d.y = Max(d.y, Short4(0x0000, 0x0000, 0x0000, 0x0000));}
					if(dst.mask & 0x4) {d.z = Min(d.z, Short4(0x1000)); d.z = Max(d.z, Short4(0x0000, 0x0000, 0x0000, 0x0000));}
					if(dst.mask & 0x8) {d.w = Min(d.w, Short4(0x1000)); d.w = Max(d.w, Short4(0x0000, 0x0000, 0x0000, 0x0000));}
				}

				if(pairing)
				{
					if(dst.mask & 0x1) dPairing.x = d.x;
					if(dst.mask & 0x2) dPairing.y = d.y;
					if(dst.mask & 0x4) dPairing.z = d.z;
					if(dst.mask & 0x8) dPairing.w = d.w;
				}
			
				if(coissue)
				{
					const Dst &dst = shader->getInstruction(i - 1)->dst;

					writeDestination(r, dPairing, dst);
				}
			
				if(!pairing)
				{
					writeDestination(r, d, dst);
				}
			}
		}
	}

	void PixelRoutine::ps_2_x(Registers &r, Int cMask[4])
	{
		r.enableIndex = 0;
		r.stackIndex = 0;

		bool out[4][4] = {false};

		// Create all call site return blocks up front
		for(int i = 0; i < shader->getLength(); i++)
		{
			const Shader::Instruction *instruction = shader->getInstruction(i);
			Shader::Opcode opcode = instruction->opcode;

			if(opcode == Shader::OPCODE_CALL || opcode == Shader::OPCODE_CALLNZ)
			{
				const Dst &dst = instruction->dst;

				ASSERT(callRetBlock[dst.label].size() == dst.callSite);
				callRetBlock[dst.label].push_back(Nucleus::createBasicBlock());
			}
		}
		
		for(int i = 0; i < shader->getLength(); i++)
		{
			const Shader::Instruction *instruction = shader->getInstruction(i);
			Shader::Opcode opcode = instruction->opcode;

			if(opcode == Shader::OPCODE_DCL || opcode == Shader::OPCODE_DEF || opcode == Shader::OPCODE_DEFI || opcode == Shader::OPCODE_DEFB)
			{
				continue;
			}

			const Dst &dst = instruction->dst;
			const Src &src0 = instruction->src[0];
			const Src &src1 = instruction->src[1];
			const Src &src2 = instruction->src[2];
			const Src &src3 = instruction->src[3];

			bool predicate = instruction->predicate;
			Control control = instruction->control;
			bool pp = dst.partialPrecision;
			bool project = instruction->project;
			bool bias = instruction->bias;

			Vector4f d;
			Vector4f s0;
			Vector4f s1;
			Vector4f s2;
			Vector4f s3;

			if(opcode == Shader::OPCODE_TEXKILL)   // Takes destination as input
			{
				if(dst.type == Shader::PARAMETER_TEXTURE)
				{
					d.x = r.vf[2 + dst.index].x;
					d.y = r.vf[2 + dst.index].y;
					d.z = r.vf[2 + dst.index].z;
					d.w = r.vf[2 + dst.index].w;
				}
				else
				{
					d = r.rf[dst.index];
				}
			}

			if(src0.type != Shader::PARAMETER_VOID) s0 = reg(r, src0);
			if(src1.type != Shader::PARAMETER_VOID) s1 = reg(r, src1);
			if(src2.type != Shader::PARAMETER_VOID) s2 = reg(r, src2);
			if(src3.type != Shader::PARAMETER_VOID) s3 = reg(r, src3);

			switch(opcode)
			{
			case Shader::OPCODE_PS_2_0:														break;
			case Shader::OPCODE_PS_2_x:														break;
			case Shader::OPCODE_PS_3_0:														break;
			case Shader::OPCODE_DEF:														break;
			case Shader::OPCODE_DCL:														break;
			case Shader::OPCODE_NOP:														break;
			case Shader::OPCODE_MOV:		mov(d, s0);										break;
			case Shader::OPCODE_F2B:		f2b(d, s0);										break;
			case Shader::OPCODE_B2F:		b2f(d, s0);										break;
			case Shader::OPCODE_ADD:		add(d, s0, s1);									break;
			case Shader::OPCODE_SUB:		sub(d, s0, s1);									break;
			case Shader::OPCODE_MUL:		mul(d, s0, s1);									break;
			case Shader::OPCODE_MAD:		mad(d, s0, s1, s2);								break;
			case Shader::OPCODE_DP1:		dp1(d, s0, s1);									break;
			case Shader::OPCODE_DP2:		dp2(d, s0, s1);									break;
			case Shader::OPCODE_DP2ADD:		dp2add(d, s0, s1, s2);							break;
			case Shader::OPCODE_DP3:		dp3(d, s0, s1);									break;
			case Shader::OPCODE_DP4:		dp4(d, s0, s1);									break;
			case Shader::OPCODE_CMP0:		cmp0(d, s0, s1, s2);							break;
			case Shader::OPCODE_ICMP:		icmp(d, s0, s1, control);						break;
			case Shader::OPCODE_SELECT:		select(d, s0, s1, s2);							break;
			case Shader::OPCODE_EXTRACT:	extract(d.x, s0, s1.x);							break;
			case Shader::OPCODE_INSERT:		insert(d, s0, s1.x, s2.x);						break;
			case Shader::OPCODE_FRC:		frc(d, s0);										break;
			case Shader::OPCODE_TRUNC:      trunc(d, s0);                                   break;
			case Shader::OPCODE_FLOOR:      floor(d, s0);                                   break;
			case Shader::OPCODE_CEIL:       ceil(d, s0);                                    break;
			case Shader::OPCODE_EXP2X:		exp2x(d, s0, pp);								break;
			case Shader::OPCODE_EXP2:		exp2(d, s0, pp);								break;
			case Shader::OPCODE_LOG2X:		log2x(d, s0, pp);								break;
			case Shader::OPCODE_LOG2:		log2(d, s0, pp);								break;
			case Shader::OPCODE_EXP:		exp(d, s0, pp);									break;
			case Shader::OPCODE_LOG:		log(d, s0, pp);									break;
			case Shader::OPCODE_RCPX:		rcpx(d, s0, pp);								break;
			case Shader::OPCODE_DIV:		div(d, s0, s1);									break;
			case Shader::OPCODE_MOD:		mod(d, s0, s1);									break;
			case Shader::OPCODE_RSQX:		rsqx(d, s0, pp);								break;
			case Shader::OPCODE_SQRT:		sqrt(d, s0, pp);								break;
			case Shader::OPCODE_RSQ:		rsq(d, s0, pp);									break;
			case Shader::OPCODE_LEN2:		len2(d.x, s0, pp);								break;
			case Shader::OPCODE_LEN3:		len3(d.x, s0, pp);								break;
			case Shader::OPCODE_LEN4:		len4(d.x, s0, pp);								break;
			case Shader::OPCODE_DIST1:		dist1(d.x, s0, s1, pp);							break;
			case Shader::OPCODE_DIST2:		dist2(d.x, s0, s1, pp);							break;
			case Shader::OPCODE_DIST3:		dist3(d.x, s0, s1, pp);							break;
			case Shader::OPCODE_DIST4:		dist4(d.x, s0, s1, pp);							break;
			case Shader::OPCODE_MIN:		min(d, s0, s1);									break;
			case Shader::OPCODE_MAX:		max(d, s0, s1);									break;
			case Shader::OPCODE_LRP:		lrp(d, s0, s1, s2);								break;
			case Shader::OPCODE_STEP:		step(d, s0, s1);								break;
			case Shader::OPCODE_SMOOTH:		smooth(d, s0, s1, s2);							break;
			case Shader::OPCODE_POWX:		powx(d, s0, s1, pp);							break;
			case Shader::OPCODE_POW:		pow(d, s0, s1, pp);								break;
			case Shader::OPCODE_SGN:		sgn(d, s0);										break;
			case Shader::OPCODE_CRS:		crs(d, s0, s1);									break;
			case Shader::OPCODE_FORWARD1:	forward1(d, s0, s1, s2);						break;
			case Shader::OPCODE_FORWARD2:	forward2(d, s0, s1, s2);						break;
			case Shader::OPCODE_FORWARD3:	forward3(d, s0, s1, s2);						break;
			case Shader::OPCODE_FORWARD4:	forward4(d, s0, s1, s2);						break;
			case Shader::OPCODE_REFLECT1:	reflect1(d, s0, s1);							break;
			case Shader::OPCODE_REFLECT2:	reflect2(d, s0, s1);							break;
			case Shader::OPCODE_REFLECT3:	reflect3(d, s0, s1);							break;
			case Shader::OPCODE_REFLECT4:	reflect4(d, s0, s1);							break;
			case Shader::OPCODE_REFRACT1:	refract1(d, s0, s1, s2.x);						break;
			case Shader::OPCODE_REFRACT2:	refract2(d, s0, s1, s2.x);						break;
			case Shader::OPCODE_REFRACT3:	refract3(d, s0, s1, s2.x);						break;
			case Shader::OPCODE_REFRACT4:	refract4(d, s0, s1, s2.x);						break;
			case Shader::OPCODE_NRM2:		nrm2(d, s0, pp);								break;
			case Shader::OPCODE_NRM3:		nrm3(d, s0, pp);								break;
			case Shader::OPCODE_NRM4:		nrm4(d, s0, pp);								break;
			case Shader::OPCODE_ABS:		abs(d, s0);										break;
			case Shader::OPCODE_SINCOS:		sincos(d, s0, pp);								break;
			case Shader::OPCODE_COS:		cos(d, s0, pp);									break;
			case Shader::OPCODE_SIN:		sin(d, s0, pp);									break;
			case Shader::OPCODE_TAN:		tan(d, s0, pp);									break;
			case Shader::OPCODE_ACOS:		acos(d, s0, pp);								break;
			case Shader::OPCODE_ASIN:		asin(d, s0, pp);								break;
			case Shader::OPCODE_ATAN:		atan(d, s0, pp);								break;
			case Shader::OPCODE_ATAN2:		atan2(d, s0, s1, pp);							break;
			case Shader::OPCODE_M4X4:		M4X4(r, d, s0, src1);							break;
			case Shader::OPCODE_M4X3:		M4X3(r, d, s0, src1);							break;
			case Shader::OPCODE_M3X4:		M3X4(r, d, s0, src1);							break;
			case Shader::OPCODE_M3X3:		M3X3(r, d, s0, src1);							break;
			case Shader::OPCODE_M3X2:		M3X2(r, d, s0, src1);							break;
			case Shader::OPCODE_TEX:		TEXLD(r, d, s0, src1, project, bias);			break;
			case Shader::OPCODE_TEXLDD:		TEXLDD(r, d, s0, src1, s2, s3, project, bias);	break;
			case Shader::OPCODE_TEXLDL:		TEXLDL(r, d, s0, src1, project, bias);			break;
			case Shader::OPCODE_TEXKILL:	TEXKILL(cMask, d, dst.mask);					break;
			case Shader::OPCODE_DISCARD:	DISCARD(r, cMask, instruction);					break;
			case Shader::OPCODE_DFDX:		DFDX(d, s0);									break;
			case Shader::OPCODE_DFDY:		DFDY(d, s0);									break;
			case Shader::OPCODE_FWIDTH:		FWIDTH(d, s0);									break;
			case Shader::OPCODE_BREAK:		BREAK(r);										break;
			case Shader::OPCODE_BREAKC:		BREAKC(r, s0, s1, control);						break;
			case Shader::OPCODE_BREAKP:		BREAKP(r, src0);								break;
			case Shader::OPCODE_CONTINUE:	CONTINUE(r);									break;
			case Shader::OPCODE_TEST:		TEST();											break;
			case Shader::OPCODE_CALL:		CALL(r, dst.label, dst.callSite);               break;
			case Shader::OPCODE_CALLNZ:		CALLNZ(r, dst.label, dst.callSite, src0);       break;
			case Shader::OPCODE_ELSE:		ELSE(r);										break;
			case Shader::OPCODE_ENDIF:		ENDIF(r);										break;
			case Shader::OPCODE_ENDLOOP:	ENDLOOP(r);										break;
			case Shader::OPCODE_ENDREP:		ENDREP(r);										break;
			case Shader::OPCODE_ENDWHILE:	ENDWHILE(r);	     							break;
			case Shader::OPCODE_IF:			IF(r, src0);									break;
			case Shader::OPCODE_IFC:		IFC(r, s0, s1, control);						break;
			case Shader::OPCODE_LABEL:		LABEL(dst.index);								break;
			case Shader::OPCODE_LOOP:		LOOP(r, src1);									break;
			case Shader::OPCODE_REP:		REP(r, src0);									break;
			case Shader::OPCODE_WHILE:		WHILE(r, src0);									break;
			case Shader::OPCODE_RET:		RET(r);											break;
			case Shader::OPCODE_LEAVE:		LEAVE(r);										break;
			case Shader::OPCODE_CMP:		cmp(d, s0, s1, control);						break;
			case Shader::OPCODE_ALL:		all(d.x, s0);									break;
			case Shader::OPCODE_ANY:		any(d.x, s0);									break;
			case Shader::OPCODE_NOT:		not(d, s0);										break;
			case Shader::OPCODE_OR:			or(d.x, s0.x, s1.x);							break;
			case Shader::OPCODE_XOR:		xor(d.x, s0.x, s1.x);							break;
			case Shader::OPCODE_AND:		and(d.x, s0.x, s1.x);							break;
			case Shader::OPCODE_END:														break;
			default:
				ASSERT(false);
			}

			if(dst.type != Shader::PARAMETER_VOID && dst.type != Shader::PARAMETER_LABEL && opcode != Shader::OPCODE_TEXKILL && opcode != Shader::OPCODE_NOP)
			{
				if(dst.integer)
				{
					switch(opcode)
					{
					case Shader::OPCODE_DIV:
						if(dst.x) d.x = Trunc(d.x);
						if(dst.y) d.y = Trunc(d.y);
						if(dst.z) d.z = Trunc(d.z);
						if(dst.w) d.w = Trunc(d.w);
						break;
					default:
						break;   // No truncation to integer required when arguments are integer
					}
				}

				if(dst.saturate)
				{
					if(dst.x) d.x = Max(d.x, Float4(0.0f));
					if(dst.y) d.y = Max(d.y, Float4(0.0f));
					if(dst.z) d.z = Max(d.z, Float4(0.0f));
					if(dst.w) d.w = Max(d.w, Float4(0.0f));

					if(dst.x) d.x = Min(d.x, Float4(1.0f));
					if(dst.y) d.y = Min(d.y, Float4(1.0f));
					if(dst.z) d.z = Min(d.z, Float4(1.0f));
					if(dst.w) d.w = Min(d.w, Float4(1.0f));
				}

				if(shader->containsDynamicBranching())
				{
					Vector4f pDst;   // FIXME: Rename

					switch(dst.type)
					{
					case Shader::PARAMETER_TEMP:
						if(dst.rel.type == Shader::PARAMETER_VOID)
						{
							if(dst.x) pDst.x = r.rf[dst.index].x;
							if(dst.y) pDst.y = r.rf[dst.index].y;
							if(dst.z) pDst.z = r.rf[dst.index].z;
							if(dst.w) pDst.w = r.rf[dst.index].w;
						}
						else
						{
							Int a = relativeAddress(r, dst);

							if(dst.x) pDst.x = r.rf[dst.index + a].x;
							if(dst.y) pDst.y = r.rf[dst.index + a].y;
							if(dst.z) pDst.z = r.rf[dst.index + a].z;
							if(dst.w) pDst.w = r.rf[dst.index + a].w;
						}
						break;
					case Shader::PARAMETER_COLOROUT:
						ASSERT(dst.rel.type == Shader::PARAMETER_VOID);
						if(dst.x) pDst.x = r.oC[dst.index].x;
						if(dst.y) pDst.y = r.oC[dst.index].y;
						if(dst.z) pDst.z = r.oC[dst.index].z;
						if(dst.w) pDst.w = r.oC[dst.index].w;
						break;
					case Shader::PARAMETER_PREDICATE:
						if(dst.x) pDst.x = r.p0.x;
						if(dst.y) pDst.y = r.p0.y;
						if(dst.z) pDst.z = r.p0.z;
						if(dst.w) pDst.w = r.p0.w;
						break;
					case Shader::PARAMETER_DEPTHOUT:
						pDst.x = r.oDepth;
						break;
					default:
						ASSERT(false);
					}
				
					Int4 enable = enableMask(r, instruction);

					Int4 xEnable = enable;
					Int4 yEnable = enable;
					Int4 zEnable = enable;
					Int4 wEnable = enable;

					if(predicate)
					{
						unsigned char pSwizzle = instruction->predicateSwizzle;

						Float4 xPredicate = r.p0[(pSwizzle >> 0) & 0x03];
						Float4 yPredicate = r.p0[(pSwizzle >> 2) & 0x03];
						Float4 zPredicate = r.p0[(pSwizzle >> 4) & 0x03];
						Float4 wPredicate = r.p0[(pSwizzle >> 6) & 0x03];

						if(!instruction->predicateNot)
						{
							if(dst.x) xEnable = xEnable & As<Int4>(xPredicate);
							if(dst.y) yEnable = yEnable & As<Int4>(yPredicate);
							if(dst.z) zEnable = zEnable & As<Int4>(zPredicate);
							if(dst.w) wEnable = wEnable & As<Int4>(wPredicate);
						}
						else
						{
							if(dst.x) xEnable = xEnable & ~As<Int4>(xPredicate);
							if(dst.y) yEnable = yEnable & ~As<Int4>(yPredicate);
							if(dst.z) zEnable = zEnable & ~As<Int4>(zPredicate);
							if(dst.w) wEnable = wEnable & ~As<Int4>(wPredicate);
						}
					}

					if(dst.x) d.x = As<Float4>(As<Int4>(d.x) & xEnable);
					if(dst.y) d.y = As<Float4>(As<Int4>(d.y) & yEnable);
					if(dst.z) d.z = As<Float4>(As<Int4>(d.z) & zEnable);
					if(dst.w) d.w = As<Float4>(As<Int4>(d.w) & wEnable);

					if(dst.x) d.x = As<Float4>(As<Int4>(d.x) | (As<Int4>(pDst.x) & ~xEnable));
					if(dst.y) d.y = As<Float4>(As<Int4>(d.y) | (As<Int4>(pDst.y) & ~yEnable));
					if(dst.z) d.z = As<Float4>(As<Int4>(d.z) | (As<Int4>(pDst.z) & ~zEnable));
					if(dst.w) d.w = As<Float4>(As<Int4>(d.w) | (As<Int4>(pDst.w) & ~wEnable));
				}

				switch(dst.type)
				{
				case Shader::PARAMETER_TEMP:
					if(dst.rel.type == Shader::PARAMETER_VOID)
					{
						if(dst.x) r.rf[dst.index].x = d.x;
						if(dst.y) r.rf[dst.index].y = d.y;
						if(dst.z) r.rf[dst.index].z = d.z;
						if(dst.w) r.rf[dst.index].w = d.w;
					}
					else
					{
						Int a = relativeAddress(r, dst);

						if(dst.x) r.rf[dst.index + a].x = d.x;
						if(dst.y) r.rf[dst.index + a].y = d.y;
						if(dst.z) r.rf[dst.index + a].z = d.z;
						if(dst.w) r.rf[dst.index + a].w = d.w;
					}
					break;
				case Shader::PARAMETER_COLOROUT:
					ASSERT(dst.rel.type == Shader::PARAMETER_VOID);
					if(dst.x) {r.oC[dst.index].x = d.x; out[dst.index][0] = true;}
					if(dst.y) {r.oC[dst.index].y = d.y; out[dst.index][1] = true;}
					if(dst.z) {r.oC[dst.index].z = d.z; out[dst.index][2] = true;}
					if(dst.w) {r.oC[dst.index].w = d.w; out[dst.index][3] = true;}
					break;
				case Shader::PARAMETER_PREDICATE:
					if(dst.x) r.p0.x = d.x;
					if(dst.y) r.p0.y = d.y;
					if(dst.z) r.p0.z = d.z;
					if(dst.w) r.p0.w = d.w;
					break;
				case Shader::PARAMETER_DEPTHOUT:
					r.oDepth = d.x;
					break;
				default:
					ASSERT(false);
				}
			}
		}

		if(currentLabel != -1)
		{
			Nucleus::setInsertBlock(returnBlock);
		}

		for(int i = 0; i < 4; i++)
		{
			if((Format)state.targetFormat[i] != FORMAT_NULL)
			{
				if(!out[i][0]) r.oC[i].x = Float4(0.0f);
				if(!out[i][1]) r.oC[i].y = Float4(0.0f);
				if(!out[i][2]) r.oC[i].z = Float4(0.0f);
				if(!out[i][3]) r.oC[i].w = Float4(0.0f);
			}
		}
	}

	Short4 PixelRoutine::convertFixed12(RValue<Float4> cf)
	{
		return RoundShort4(cf * Float4(0x1000));
	}

	void PixelRoutine::convertFixed12(Vector4i &ci, Vector4f &cf)
	{
		ci.x = convertFixed12(cf.x);
		ci.y = convertFixed12(cf.y);
		ci.z = convertFixed12(cf.z);
		ci.w = convertFixed12(cf.w);
	}

	UShort4 PixelRoutine::convertFixed16(Float4 &cf, bool saturate)
	{
		return UShort4(cf * Float4(0xFFFF), saturate);
	}

	void PixelRoutine::convertFixed16(Vector4i &ci, Vector4f &cf, bool saturate)
	{
		ci.x = convertFixed16(cf.x, saturate);
		ci.y = convertFixed16(cf.y, saturate);
		ci.z = convertFixed16(cf.z, saturate);
		ci.w = convertFixed16(cf.w, saturate);
	}

	Float4 PixelRoutine::convertSigned12(Short4 &ci)
	{
		return Float4(ci) * Float4(1.0f / 0x0FFE);
	}

	void PixelRoutine::convertSigned12(Vector4f &cf, Vector4i &ci)
	{
		cf.x = convertSigned12(ci.x);
		cf.y = convertSigned12(ci.y);
		cf.z = convertSigned12(ci.z);
		cf.w = convertSigned12(ci.w);
	}

	Float4 PixelRoutine::convertUnsigned16(UShort4 ci)
	{
		return Float4(ci) * Float4(1.0f / 0xFFFF);
	}

	void PixelRoutine::sRGBtoLinear16_16(Registers &r, Vector4i &c)
	{
		c.x = As<UShort4>(c.x) >> 4;
		c.y = As<UShort4>(c.y) >> 4;
		c.z = As<UShort4>(c.z) >> 4;

		sRGBtoLinear12_16(r, c);
	}

	void PixelRoutine::sRGBtoLinear12_16(Registers &r, Vector4i &c)
	{
		Pointer<Byte> LUT = r.constants + OFFSET(Constants,sRGBtoLin12_16);

		c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 0))), 0);
		c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 1))), 1);
		c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 2))), 2);
		c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 3))), 3);

		c.y = Insert(c.y, *Pointer<Short>(LUT + 2 * Int(Extract(c.y, 0))), 0);
		c.y = Insert(c.y, *Pointer<Short>(LUT + 2 * Int(Extract(c.y, 1))), 1);
		c.y = Insert(c.y, *Pointer<Short>(LUT + 2 * Int(Extract(c.y, 2))), 2);
		c.y = Insert(c.y, *Pointer<Short>(LUT + 2 * Int(Extract(c.y, 3))), 3);

		c.z = Insert(c.z, *Pointer<Short>(LUT + 2 * Int(Extract(c.z, 0))), 0);
		c.z = Insert(c.z, *Pointer<Short>(LUT + 2 * Int(Extract(c.z, 1))), 1);
		c.z = Insert(c.z, *Pointer<Short>(LUT + 2 * Int(Extract(c.z, 2))), 2);
		c.z = Insert(c.z, *Pointer<Short>(LUT + 2 * Int(Extract(c.z, 3))), 3);
	}

	void PixelRoutine::linearToSRGB16_16(Registers &r, Vector4i &c)
	{
		c.x = As<UShort4>(c.x) >> 4;
		c.y = As<UShort4>(c.y) >> 4;
		c.z = As<UShort4>(c.z) >> 4;

		linearToSRGB12_16(r, c);
	}

	void PixelRoutine::linearToSRGB12_16(Registers &r, Vector4i &c)
	{
		Pointer<Byte> LUT = r.constants + OFFSET(Constants,linToSRGB12_16);

		c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 0))), 0);
		c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 1))), 1);
		c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 2))), 2);
		c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 3))), 3);

		c.y = Insert(c.y, *Pointer<Short>(LUT + 2 * Int(Extract(c.y, 0))), 0);
		c.y = Insert(c.y, *Pointer<Short>(LUT + 2 * Int(Extract(c.y, 1))), 1);
		c.y = Insert(c.y, *Pointer<Short>(LUT + 2 * Int(Extract(c.y, 2))), 2);
		c.y = Insert(c.y, *Pointer<Short>(LUT + 2 * Int(Extract(c.y, 3))), 3);

		c.z = Insert(c.z, *Pointer<Short>(LUT + 2 * Int(Extract(c.z, 0))), 0);
		c.z = Insert(c.z, *Pointer<Short>(LUT + 2 * Int(Extract(c.z, 1))), 1);
		c.z = Insert(c.z, *Pointer<Short>(LUT + 2 * Int(Extract(c.z, 2))), 2);
		c.z = Insert(c.z, *Pointer<Short>(LUT + 2 * Int(Extract(c.z, 3))), 3);
	}

	Float4 PixelRoutine::linearToSRGB(const Float4 &x)   // Approximates x^(1.0/2.2)
	{
		Float4 sqrtx = Rcp_pp(RcpSqrt_pp(x));
		Float4 sRGB = sqrtx * Float4(1.14f) - x * Float4(0.14f);

		return Min(Max(sRGB, Float4(0.0f)), Float4(1.0f));
	}

	Float4 PixelRoutine::sRGBtoLinear(const Float4 &x)   // Approximates x^2.2
	{
		Float4 linear = x * x;
		linear = linear * Float4(0.73f) + linear * x * Float4(0.27f);

		return Min(Max(linear, Float4(0.0f)), Float4(1.0f));
	}

	void PixelRoutine::MOV(Vector4i &dst, Vector4i &src0)
	{
		dst.x = src0.x;
		dst.y = src0.y;
		dst.z = src0.z;
		dst.w = src0.w;
	}

	void PixelRoutine::ADD(Vector4i &dst, Vector4i &src0, Vector4i &src1)
	{
		dst.x = AddSat(src0.x, src1.x);
		dst.y = AddSat(src0.y, src1.y);
		dst.z = AddSat(src0.z, src1.z);
		dst.w = AddSat(src0.w, src1.w);
	}

	void PixelRoutine::SUB(Vector4i &dst, Vector4i &src0, Vector4i &src1)
	{
		dst.x = SubSat(src0.x, src1.x);
		dst.y = SubSat(src0.y, src1.y);
		dst.z = SubSat(src0.z, src1.z);
		dst.w = SubSat(src0.w, src1.w);
	}

	void PixelRoutine::MAD(Vector4i &dst, Vector4i &src0, Vector4i &src1, Vector4i &src2)
	{
		// FIXME: Long fixed-point multiply fixup
		{dst.x = MulHigh(src0.x, src1.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, src2.x);}
		{dst.y = MulHigh(src0.y, src1.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, src2.y);}
		{dst.z = MulHigh(src0.z, src1.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, src2.z);}
		{dst.w = MulHigh(src0.w, src1.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, src2.w);}
	}

	void PixelRoutine::MUL(Vector4i &dst, Vector4i &src0, Vector4i &src1)
	{
		// FIXME: Long fixed-point multiply fixup
		{dst.x = MulHigh(src0.x, src1.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, dst.x);}
		{dst.y = MulHigh(src0.y, src1.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, dst.y);}
		{dst.z = MulHigh(src0.z, src1.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, dst.z);}
		{dst.w = MulHigh(src0.w, src1.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, dst.w);}
	}

	void PixelRoutine::DP3(Vector4i &dst, Vector4i &src0, Vector4i &src1)
	{
		Short4 t0;
		Short4 t1;

		// FIXME: Long fixed-point multiply fixup
		t0 = MulHigh(src0.x, src1.x); t0 = AddSat(t0, t0); t0 = AddSat(t0, t0); t0 = AddSat(t0, t0); t0 = AddSat(t0, t0); 
		t1 = MulHigh(src0.y, src1.y); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); 
		t0 = AddSat(t0, t1);
		t1 = MulHigh(src0.z, src1.z); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); 
		t0 = AddSat(t0, t1);

		dst.x = t0;
		dst.y = t0;
		dst.z = t0;
		dst.w = t0;
	}

	void PixelRoutine::DP4(Vector4i &dst, Vector4i &src0, Vector4i &src1)
	{
		Short4 t0;
		Short4 t1;

		// FIXME: Long fixed-point multiply fixup
		t0 = MulHigh(src0.x, src1.x); t0 = AddSat(t0, t0); t0 = AddSat(t0, t0); t0 = AddSat(t0, t0); t0 = AddSat(t0, t0); 
		t1 = MulHigh(src0.y, src1.y); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); 
		t0 = AddSat(t0, t1);
		t1 = MulHigh(src0.z, src1.z); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); 
		t0 = AddSat(t0, t1);
		t1 = MulHigh(src0.w, src1.w); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); 
		t0 = AddSat(t0, t1);

		dst.x = t0;
		dst.y = t0;
		dst.z = t0;
		dst.w = t0;
	}

	void PixelRoutine::LRP(Vector4i &dst, Vector4i &src0, Vector4i &src1, Vector4i &src2)
	{
		// FIXME: Long fixed-point multiply fixup
		{dst.x = SubSat(src1.x, src2.x); dst.x = MulHigh(dst.x, src0.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, src2.x);}
		{dst.y = SubSat(src1.y, src2.y); dst.y = MulHigh(dst.y, src0.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, src2.y);}
		{dst.z = SubSat(src1.z, src2.z); dst.z = MulHigh(dst.z, src0.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, src2.z);}
		{dst.w = SubSat(src1.w, src2.w); dst.w = MulHigh(dst.w, src0.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, src2.w);}
	}

	void PixelRoutine::TEXCOORD(Vector4i &dst, Float4 &u, Float4 &v, Float4 &s, int coordinate)
	{
		Float4 uw;
		Float4 vw;
		Float4 sw;

		if(state.interpolant[2 + coordinate].component & 0x01)
		{
			uw = Max(u, Float4(0.0f));
			uw = Min(uw, Float4(1.0f));
			dst.x = convertFixed12(uw);
		}
		else
		{
			dst.x = Short4(0x0000, 0x0000, 0x0000, 0x0000);
		}

		if(state.interpolant[2 + coordinate].component & 0x02)
		{
			vw = Max(v, Float4(0.0f));
			vw = Min(vw, Float4(1.0f));
			dst.y = convertFixed12(vw);
		}
		else
		{
			dst.y = Short4(0x0000, 0x0000, 0x0000, 0x0000);
		}

		if(state.interpolant[2 + coordinate].component & 0x04)
		{
			sw = Max(s, Float4(0.0f));
			sw = Min(sw, Float4(1.0f));
			dst.z = convertFixed12(sw);
		}
		else
		{
			dst.z = Short4(0x0000, 0x0000, 0x0000, 0x0000);
		}

		dst.w = Short4(0x1000);
	}

	void PixelRoutine::TEXCRD(Vector4i &dst, Float4 &u, Float4 &v, Float4 &s, int coordinate, bool project)
	{
		Float4 uw = u;
		Float4 vw = v;
		Float4 sw = s;

		if(project)
		{
			uw *= Rcp_pp(s);
			vw *= Rcp_pp(s);
		}

		if(state.interpolant[2 + coordinate].component & 0x01)
		{
			uw *= Float4(0x1000);
			uw = Max(uw, Float4(-0x8000));
			uw = Min(uw, Float4(0x7FFF));
			dst.x = RoundShort4(uw);
		}
		else
		{
			dst.x = Short4(0x0000);
		}

		if(state.interpolant[2 + coordinate].component & 0x02)
		{
			vw *= Float4(0x1000);
			vw = Max(vw, Float4(-0x8000));
			vw = Min(vw, Float4(0x7FFF));
			dst.y = RoundShort4(vw);
		}
		else
		{
			dst.y = Short4(0x0000, 0x0000, 0x0000, 0x0000);
		}
		
		if(state.interpolant[2 + coordinate].component & 0x04)
		{
			sw *= Float4(0x1000);
			sw = Max(sw, Float4(-0x8000));
			sw = Min(sw, Float4(0x7FFF));
			dst.z = RoundShort4(sw);
		}
		else
		{
			dst.z = Short4(0x0000, 0x0000, 0x0000, 0x0000);
		}
	}

	void PixelRoutine::TEXDP3(Registers &r, Vector4i &dst, Float4 &u, Float4 &v, Float4 &s, Vector4i &src)
	{
		TEXM3X3PAD(r, u, v, s, src, 0, false);

		Short4 t0 = RoundShort4(r.u_ * Float4(0x1000));

		dst.x = t0;
		dst.y = t0;
		dst.z = t0;
		dst.w = t0;
	}

	void PixelRoutine::TEXDP3TEX(Registers &r, Vector4i &dst, Float4 &u, Float4 &v, Float4 &s, int stage, Vector4i &src0)
	{
		TEXM3X3PAD(r, u, v, s, src0, 0, false);

		r.v_ = Float4(0.0f);
		r.w_ = Float4(0.0f);

		sampleTexture(r, dst, stage, r.u_, r.v_, r.w_, r.w_);
	}

	void PixelRoutine::TEXKILL(Int cMask[4], Float4 &u, Float4 &v, Float4 &s)
	{
		Int kill = SignMask(CmpNLT(u, Float4(0.0f))) &
		           SignMask(CmpNLT(v, Float4(0.0f))) &
		           SignMask(CmpNLT(s, Float4(0.0f)));

		for(unsigned int q = 0; q < state.multiSample; q++)
		{
			cMask[q] &= kill;
		}
	}

	void PixelRoutine::TEXKILL(Int cMask[4], Vector4i &src)
	{
		Short4 test = src.x | src.y | src.z;
		Int kill = SignMask(Pack(test, test)) ^ 0x0000000F;

		for(unsigned int q = 0; q < state.multiSample; q++)
		{
			cMask[q] &= kill;
		}
	}

	void PixelRoutine::TEX(Registers &r, Vector4i &dst, Float4 &u, Float4 &v, Float4 &s, int sampler, bool project)
	{
		sampleTexture(r, dst, sampler, u, v, s, s, project);
	}

	void PixelRoutine::TEXLD(Registers &r, Vector4i &dst, Vector4i &src, int sampler, bool project)
	{
		Float4 u = Float4(src.x) * Float4(1.0f / 0x0FFE);
		Float4 v = Float4(src.y) * Float4(1.0f / 0x0FFE);
		Float4 s = Float4(src.z) * Float4(1.0f / 0x0FFE);

		sampleTexture(r, dst, sampler, u, v, s, s, project);
	}

	void PixelRoutine::TEXBEM(Registers &r, Vector4i &dst, Vector4i &src, Float4 &u, Float4 &v, Float4 &s, int stage)
	{
		Float4 du = Float4(src.x) * Float4(1.0f / 0x0FFE);
		Float4 dv = Float4(src.y) * Float4(1.0f / 0x0FFE);

		Float4 du2 = du;
		Float4 dv2 = dv;

		du *= *Pointer<Float4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4F[0][0]));
		dv2 *= *Pointer<Float4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4F[1][0]));
		du += dv2;
		dv *= *Pointer<Float4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4F[1][1]));
		du2 *= *Pointer<Float4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4F[0][1]));
		dv += du2;

		Float4 u_ = u + du;
		Float4 v_ = v + dv;

		sampleTexture(r, dst, stage, u_, v_, s, s);
	}

	void PixelRoutine::TEXBEML(Registers &r, Vector4i &dst, Vector4i &src, Float4 &u, Float4 &v, Float4 &s, int stage)
	{
		Float4 du = Float4(src.x) * Float4(1.0f / 0x0FFE);
		Float4 dv = Float4(src.y) * Float4(1.0f / 0x0FFE);

		Float4 du2 = du;
		Float4 dv2 = dv;

		du *= *Pointer<Float4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4F[0][0]));
		dv2 *= *Pointer<Float4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4F[1][0]));
		du += dv2;
		dv *= *Pointer<Float4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4F[1][1]));
		du2 *= *Pointer<Float4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4F[0][1]));
		dv += du2;

		Float4 u_ = u + du;
		Float4 v_ = v + dv;

		sampleTexture(r, dst, stage, u_, v_, s, s);

		Short4 L;

		L = src.z;
		L = MulHigh(L, *Pointer<Short4>(r.data + OFFSET(DrawData,textureStage[stage].luminanceScale4)));
		L = L << 4;
		L = AddSat(L, *Pointer<Short4>(r.data + OFFSET(DrawData,textureStage[stage].luminanceOffset4)));
		L = Max(L, Short4(0x0000, 0x0000, 0x0000, 0x0000));
		L = Min(L, Short4(0x1000));

		dst.x = MulHigh(dst.x, L); dst.x = dst.x << 4;
		dst.y = MulHigh(dst.y, L); dst.y = dst.y << 4;
		dst.z = MulHigh(dst.z, L); dst.z = dst.z << 4;
	}

	void PixelRoutine::TEXREG2AR(Registers &r, Vector4i &dst, Vector4i &src0, int stage)
	{
		Float4 u = Float4(src0.w) * Float4(1.0f / 0x0FFE);
		Float4 v = Float4(src0.x) * Float4(1.0f / 0x0FFE);
		Float4 s = Float4(src0.z) * Float4(1.0f / 0x0FFE);

		sampleTexture(r, dst, stage, u, v, s, s);
	}

	void PixelRoutine::TEXREG2GB(Registers &r, Vector4i &dst, Vector4i &src0, int stage)
	{
		Float4 u = Float4(src0.y) * Float4(1.0f / 0x0FFE);
		Float4 v = Float4(src0.z) * Float4(1.0f / 0x0FFE);
		Float4 s = v;

		sampleTexture(r, dst, stage, u, v, s, s);
	}

	void PixelRoutine::TEXREG2RGB(Registers &r, Vector4i &dst, Vector4i &src0, int stage)
	{
		Float4 u = Float4(src0.x) * Float4(1.0f / 0x0FFE);
		Float4 v = Float4(src0.y) * Float4(1.0f / 0x0FFE);
		Float4 s = Float4(src0.z) * Float4(1.0f / 0x0FFE);

		sampleTexture(r, dst, stage, u, v, s, s);
	}

	void PixelRoutine::TEXM3X2DEPTH(Registers &r, Vector4i &dst, Float4 &u, Float4 &v, Float4 &s, Vector4i &src, bool signedScaling)
	{
		TEXM3X2PAD(r, u, v, s, src, 1, signedScaling);

		// z / w
		r.u_ *= Rcp_pp(r.v_);   // FIXME: Set result to 1.0 when division by zero

		r.oDepth = r.u_;
	}

	void PixelRoutine::TEXM3X2PAD(Registers &r, Float4 &u, Float4 &v, Float4 &s, Vector4i &src0, int component, bool signedScaling)
	{
		TEXM3X3PAD(r, u, v, s, src0, component, signedScaling);
	}

	void PixelRoutine::TEXM3X2TEX(Registers &r, Vector4i &dst, Float4 &u, Float4 &v, Float4 &s, int stage, Vector4i &src0, bool signedScaling)
	{
		TEXM3X2PAD(r, u, v, s, src0, 1, signedScaling);

		r.w_ = Float4(0.0f);

		sampleTexture(r, dst, stage, r.u_, r.v_, r.w_, r.w_);
	}

	void PixelRoutine::TEXM3X3(Registers &r, Vector4i &dst, Float4 &u, Float4 &v, Float4 &s, Vector4i &src0, bool signedScaling)
	{
		TEXM3X3PAD(r, u, v, s, src0, 2, signedScaling);

		dst.x = RoundShort4(r.u_ * Float4(0x1000));
		dst.y = RoundShort4(r.v_ * Float4(0x1000));
		dst.z = RoundShort4(r.w_ * Float4(0x1000));
		dst.w = Short4(0x1000);
	}

	void PixelRoutine::TEXM3X3PAD(Registers &r, Float4 &u, Float4 &v, Float4 &s, Vector4i &src0, int component, bool signedScaling)
	{
		if(component == 0 || previousScaling != signedScaling)   // FIXME: Other source modifiers?
		{
			r.U = Float4(src0.x);
			r.V = Float4(src0.y);
			r.W = Float4(src0.z);

			previousScaling = signedScaling;
		}

		Float4 x = r.U * u + r.V * v + r.W * s;

		x *= Float4(1.0f / 0x1000);

		switch(component)
		{
		case 0:	r.u_ = x; break;
		case 1:	r.v_ = x; break;
		case 2: r.w_ = x; break;
		default: ASSERT(false);
		}
	}

	void PixelRoutine::TEXM3X3SPEC(Registers &r, Vector4i &dst, Float4 &u, Float4 &v, Float4 &s, int stage, Vector4i &src0, Vector4i &src1)
	{
		TEXM3X3PAD(r, u, v, s, src0, 2, false);

		Float4 E[3];   // Eye vector

		E[0] = Float4(src1.x) * Float4(1.0f / 0x0FFE);
		E[1] = Float4(src1.y) * Float4(1.0f / 0x0FFE);
		E[2] = Float4(src1.z) * Float4(1.0f / 0x0FFE);

		// Reflection
		Float4 u__;
		Float4 v__;
		Float4 w__;

		// (u'', v'', w'') = 2 * (N . E) * N - E * (N . N)
		u__ = r.u_ * E[0];
		v__ = r.v_ * E[1];
		w__ = r.w_ * E[2];
		u__ += v__ + w__;
		u__ += u__;
		v__ = u__;
		w__ = u__;
		u__ *= r.u_;
		v__ *= r.v_;
		w__ *= r.w_;
		r.u_ *= r.u_;
		r.v_ *= r.v_;
		r.w_ *= r.w_;
		r.u_ += r.v_ + r.w_;
		u__ -= E[0] * r.u_;
		v__ -= E[1] * r.u_;
		w__ -= E[2] * r.u_;

		sampleTexture(r, dst, stage,  u__, v__, w__, w__);
	}

	void PixelRoutine::TEXM3X3TEX(Registers &r, Vector4i &dst, Float4 &u, Float4 &v, Float4 &s, int stage, Vector4i &src0, bool signedScaling)
	{
		TEXM3X3PAD(r, u, v, s, src0, 2, signedScaling);

		sampleTexture(r, dst, stage, r.u_, r.v_, r.w_, r.w_);
	}

	void PixelRoutine::TEXM3X3VSPEC(Registers &r, Vector4i &dst, Float4 &u, Float4 &v, Float4 &s, int stage, Vector4i &src0)
	{
		TEXM3X3PAD(r, u, v, s, src0, 2, false);

		Float4 E[3];   // Eye vector

		E[0] = r.vf[2 + stage - 2].w;
		E[1] = r.vf[2 + stage - 1].w;
		E[2] = r.vf[2 + stage - 0].w;

		// Reflection
		Float4 u__;
		Float4 v__;
		Float4 w__;

		// (u'', v'', w'') = 2 * (N . E) * N - E * (N . N)
		u__ = r.u_ * E[0];
		v__ = r.v_ * E[1];
		w__ = r.w_ * E[2];
		u__ += v__ + w__;
		u__ += u__;
		v__ = u__;
		w__ = u__;
		u__ *= r.u_;
		v__ *= r.v_;
		w__ *= r.w_;
		r.u_ *= r.u_;
		r.v_ *= r.v_;
		r.w_ *= r.w_;
		r.u_ += r.v_ + r.w_;
		u__ -= E[0] * r.u_;
		v__ -= E[1] * r.u_;
		w__ -= E[2] * r.u_;

		sampleTexture(r, dst, stage, u__, v__, w__, w__);
	}

	void PixelRoutine::TEXDEPTH(Registers &r)
	{
		r.u_ = Float4(r.ri[5].x);
		r.v_ = Float4(r.ri[5].y);

		// z / w
		r.u_ *= Rcp_pp(r.v_);   // FIXME: Set result to 1.0 when division by zero

		r.oDepth = r.u_;
	}

	void PixelRoutine::CND(Vector4i &dst, Vector4i &src0, Vector4i &src1, Vector4i &src2)
	{
		{Short4 t0; t0 = src0.x; t0 = CmpGT(t0, Short4(0x0800, 0x0800, 0x0800, 0x0800)); Short4 t1; t1 = src1.x; t1 = t1 & t0; t0 = ~t0 & src2.x; t0 = t0 | t1; dst.x = t0;};
		{Short4 t0; t0 = src0.y; t0 = CmpGT(t0, Short4(0x0800, 0x0800, 0x0800, 0x0800)); Short4 t1; t1 = src1.y; t1 = t1 & t0; t0 = ~t0 & src2.y; t0 = t0 | t1; dst.y = t0;};
		{Short4 t0; t0 = src0.z; t0 = CmpGT(t0, Short4(0x0800, 0x0800, 0x0800, 0x0800)); Short4 t1; t1 = src1.z; t1 = t1 & t0; t0 = ~t0 & src2.z; t0 = t0 | t1; dst.z = t0;};
		{Short4 t0; t0 = src0.w; t0 = CmpGT(t0, Short4(0x0800, 0x0800, 0x0800, 0x0800)); Short4 t1; t1 = src1.w; t1 = t1 & t0; t0 = ~t0 & src2.w; t0 = t0 | t1; dst.w = t0;};
	}

	void PixelRoutine::CMP(Vector4i &dst, Vector4i &src0, Vector4i &src1, Vector4i &src2)
	{
		{Short4 t0 = CmpGT(Short4(0x0000, 0x0000, 0x0000, 0x0000), src0.x); Short4 t1; t1 = src2.x; t1 &= t0; t0 = ~t0 & src1.x; t0 |= t1; dst.x = t0;};
		{Short4 t0 = CmpGT(Short4(0x0000, 0x0000, 0x0000, 0x0000), src0.y); Short4 t1; t1 = src2.y; t1 &= t0; t0 = ~t0 & src1.y; t0 |= t1; dst.y = t0;};
		{Short4 t0 = CmpGT(Short4(0x0000, 0x0000, 0x0000, 0x0000), src0.z); Short4 t1; t1 = src2.z; t1 &= t0; t0 = ~t0 & src1.z; t0 |= t1; dst.z = t0;};
		{Short4 t0 = CmpGT(Short4(0x0000, 0x0000, 0x0000, 0x0000), src0.w); Short4 t1; t1 = src2.w; t1 &= t0; t0 = ~t0 & src1.w; t0 |= t1; dst.w = t0;};
	}

	void PixelRoutine::BEM(Registers &r, Vector4i &dst, Vector4i &src0, Vector4i &src1, int stage)
	{
		Short4 t0;
		Short4 t1;

		// dst.x = src0.x + BUMPENVMAT00(stage) * src1.x + BUMPENVMAT10(stage) * src1.y
		t0 = MulHigh(src1.x, *Pointer<Short4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4W[0][0]))); t0 = t0 << 4;   // FIXME: Matrix components range? Overflow hazard.
		t1 = MulHigh(src1.y, *Pointer<Short4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4W[1][0]))); t1 = t1 << 4;   // FIXME: Matrix components range? Overflow hazard.
		t0 = AddSat(t0, t1);
		t0 = AddSat(t0, src0.x);
		dst.x = t0;

		// dst.y = src0.y + BUMPENVMAT01(stage) * src1.x + BUMPENVMAT11(stage) * src1.y
		t0 = MulHigh(src1.x, *Pointer<Short4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4W[0][1]))); t0 = t0 << 4;   // FIXME: Matrix components range? Overflow hazard.
		t1 = MulHigh(src1.y, *Pointer<Short4>(r.data + OFFSET(DrawData,textureStage[stage].bumpmapMatrix4W[1][1]))); t1 = t1 << 4;   // FIXME: Matrix components range? Overflow hazard.
		t0 = AddSat(t0, t1);
		t0 = AddSat(t0, src0.y);
		dst.y = t0;
	}

	void PixelRoutine::M3X2(Registers &r, Vector4f &dst, Vector4f &src0, const Src &src1)
	{
		Vector4f row0 = reg(r, src1, 0);
		Vector4f row1 = reg(r, src1, 1);

		dst.x = dot3(src0, row0);
		dst.y = dot3(src0, row1);
	}

	void PixelRoutine::M3X3(Registers &r, Vector4f &dst, Vector4f &src0, const Src &src1)
	{
		Vector4f row0 = reg(r, src1, 0);
		Vector4f row1 = reg(r, src1, 1);
		Vector4f row2 = reg(r, src1, 2);

		dst.x = dot3(src0, row0);
		dst.y = dot3(src0, row1);
		dst.z = dot3(src0, row2);
	}

	void PixelRoutine::M3X4(Registers &r, Vector4f &dst, Vector4f &src0, const Src &src1)
	{
		Vector4f row0 = reg(r, src1, 0);
		Vector4f row1 = reg(r, src1, 1);
		Vector4f row2 = reg(r, src1, 2);
		Vector4f row3 = reg(r, src1, 3);

		dst.x = dot3(src0, row0);
		dst.y = dot3(src0, row1);
		dst.z = dot3(src0, row2);
		dst.w = dot3(src0, row3);
	}

	void PixelRoutine::M4X3(Registers &r, Vector4f &dst, Vector4f &src0, const Src &src1)
	{
		Vector4f row0 = reg(r, src1, 0);
		Vector4f row1 = reg(r, src1, 1);
		Vector4f row2 = reg(r, src1, 2);

		dst.x = dot4(src0, row0);
		dst.y = dot4(src0, row1);
		dst.z = dot4(src0, row2);
	}

	void PixelRoutine::M4X4(Registers &r, Vector4f &dst, Vector4f &src0, const Src &src1)
	{
		Vector4f row0 = reg(r, src1, 0);
		Vector4f row1 = reg(r, src1, 1);
		Vector4f row2 = reg(r, src1, 2);
		Vector4f row3 = reg(r, src1, 3);

		dst.x = dot4(src0, row0);
		dst.y = dot4(src0, row1);
		dst.z = dot4(src0, row2);
		dst.w = dot4(src0, row3);
	}

	void PixelRoutine::TEXLD(Registers &r, Vector4f &dst, Vector4f &src0, const Src &src1, bool project, bool bias)
	{
		Vector4f tmp;
		sampleTexture(r, tmp, src1, src0.x, src0.y, src0.z, src0.w, src0, src0, project, bias);	

		dst.x = tmp[(src1.swizzle >> 0) & 0x3];
		dst.y = tmp[(src1.swizzle >> 2) & 0x3];
		dst.z = tmp[(src1.swizzle >> 4) & 0x3];
		dst.w = tmp[(src1.swizzle >> 6) & 0x3];
	}
	
	void PixelRoutine::TEXLDD(Registers &r, Vector4f &dst, Vector4f &src0, const Src &src1, Vector4f &src2,  Vector4f &src3, bool project, bool bias)
	{
		Vector4f tmp;
		sampleTexture(r, tmp, src1, src0.x, src0.y, src0.z, src0.w, src2, src3, project, bias, true);

		dst.x = tmp[(src1.swizzle >> 0) & 0x3];
		dst.y = tmp[(src1.swizzle >> 2) & 0x3];
		dst.z = tmp[(src1.swizzle >> 4) & 0x3];
		dst.w = tmp[(src1.swizzle >> 6) & 0x3];
	}
	
	void PixelRoutine::TEXLDL(Registers &r, Vector4f &dst, Vector4f &src0, const Src &src1, bool project, bool bias)
	{
		Vector4f tmp;
		sampleTexture(r, tmp, src1, src0.x, src0.y, src0.z, src0.w, src0, src0, project, bias, false, true);

		dst.x = tmp[(src1.swizzle >> 0) & 0x3];
		dst.y = tmp[(src1.swizzle >> 2) & 0x3];
		dst.z = tmp[(src1.swizzle >> 4) & 0x3];
		dst.w = tmp[(src1.swizzle >> 6) & 0x3];
	}

	void PixelRoutine::TEXKILL(Int cMask[4], Vector4f &src, unsigned char mask)
	{
		Int kill = -1;
		
		if(mask & 0x1) kill &= SignMask(CmpNLT(src.x, Float4(0.0f)));
		if(mask & 0x2) kill &= SignMask(CmpNLT(src.y, Float4(0.0f)));
		if(mask & 0x4) kill &= SignMask(CmpNLT(src.z, Float4(0.0f)));
		if(mask & 0x8) kill &= SignMask(CmpNLT(src.w, Float4(0.0f)));

		// FIXME: Dynamic branching affects TEXKILL?
	//	if(shader->containsDynamicBranching())
	//	{
	//		kill = ~SignMask(enableMask(r));
	//	}

		for(unsigned int q = 0; q < state.multiSample; q++)
		{
			cMask[q] &= kill;
		}

		// FIXME: Branch to end of shader if all killed?
	}

	void PixelRoutine::DISCARD(Registers &r, Int cMask[4], const Shader::Instruction *instruction)
	{
		Int kill = 0;
		
		if(shader->containsDynamicBranching())
		{
			kill = ~SignMask(enableMask(r, instruction));
		}
		
		for(unsigned int q = 0; q < state.multiSample; q++)
		{
			cMask[q] &= kill;
		}

		// FIXME: Branch to end of shader if all killed?
	}

	void PixelRoutine::DFDX(Vector4f &dst, Vector4f &src)
	{
		dst.x = src.x.yyww - src.x.xxzz;
		dst.y = src.y.yyww - src.y.xxzz;
		dst.z = src.z.yyww - src.z.xxzz;
		dst.w = src.w.yyww - src.w.xxzz;
	}

	void PixelRoutine::DFDY(Vector4f &dst, Vector4f &src)
	{
		dst.x = src.x.zwzw - src.x.xyxy;
		dst.y = src.y.zwzw - src.y.xyxy;
		dst.z = src.z.zwzw - src.z.xyxy;
		dst.w = src.w.zwzw - src.w.xyxy;
	}

	void PixelRoutine::FWIDTH(Vector4f &dst, Vector4f &src)
	{
		// abs(dFdx(src)) + abs(dFdy(src));
		dst.x = Abs(src.x.yyww - src.x.xxzz) + Abs(src.x.zwzw - src.x.xyxy);
		dst.y = Abs(src.y.yyww - src.x.xxzz) + Abs(src.y.zwzw - src.y.xyxy);
		dst.z = Abs(src.z.yyww - src.x.xxzz) + Abs(src.z.zwzw - src.z.xyxy);
		dst.w = Abs(src.w.yyww - src.x.xxzz) + Abs(src.w.zwzw - src.w.xyxy);
	}

	void PixelRoutine::BREAK(Registers &r)
	{
		llvm::BasicBlock *deadBlock = Nucleus::createBasicBlock();
		llvm::BasicBlock *endBlock = loopRepEndBlock[loopRepDepth - 1];

		if(breakDepth == 0)
		{
			r.enableIndex = r.enableIndex - breakDepth;
			Nucleus::createBr(endBlock);
		}
		else
		{
			r.enableBreak = r.enableBreak & ~r.enableStack[r.enableIndex];
			Bool allBreak = SignMask(r.enableBreak) == 0x0;

			r.enableIndex = r.enableIndex - breakDepth;
			branch(allBreak, endBlock, deadBlock);
		}

		Nucleus::setInsertBlock(deadBlock);
		r.enableIndex = r.enableIndex + breakDepth;
	}

	void PixelRoutine::BREAKC(Registers &r, Vector4f &src0, Vector4f &src1, Control control)
	{
		Int4 condition;

		switch(control)
		{
		case Shader::CONTROL_GT: condition = CmpNLE(src0.x,  src1.x);	break;
		case Shader::CONTROL_EQ: condition = CmpEQ(src0.x, src1.x);		break;
		case Shader::CONTROL_GE: condition = CmpNLT(src0.x, src1.x);	break;
		case Shader::CONTROL_LT: condition = CmpLT(src0.x,  src1.x);	break;
		case Shader::CONTROL_NE: condition = CmpNEQ(src0.x, src1.x);	break;
		case Shader::CONTROL_LE: condition = CmpLE(src0.x, src1.x);		break;
		default:
			ASSERT(false);
		}

		BREAK(r, condition);
	}

	void PixelRoutine::BREAKP(Registers &r, const Src &predicateRegister)   // FIXME: Factor out parts common with BREAKC
	{
		Int4 condition = As<Int4>(r.p0[predicateRegister.swizzle & 0x3]);

		if(predicateRegister.modifier == Shader::MODIFIER_NOT)
		{
			condition = ~condition;
		}

		BREAK(r, condition);
	}

	void PixelRoutine::BREAK(Registers &r, Int4 &condition)
	{
		condition &= r.enableStack[r.enableIndex];

		llvm::BasicBlock *continueBlock = Nucleus::createBasicBlock();
		llvm::BasicBlock *endBlock = loopRepEndBlock[loopRepDepth - 1];

		r.enableBreak = r.enableBreak & ~condition;
		Bool allBreak = SignMask(r.enableBreak) == 0x0;

		r.enableIndex = r.enableIndex - breakDepth;
		branch(allBreak, endBlock, continueBlock);

		Nucleus::setInsertBlock(continueBlock);
		r.enableIndex = r.enableIndex + breakDepth;
	}

	void PixelRoutine::CONTINUE(Registers &r)
	{
		r.enableContinue = r.enableContinue & ~r.enableStack[r.enableIndex];
	}

	void PixelRoutine::TEST()
	{
		whileTest = true;
	}

	void PixelRoutine::CALL(Registers &r, int labelIndex, int callSiteIndex)
	{
		if(!labelBlock[labelIndex])
		{
			labelBlock[labelIndex] = Nucleus::createBasicBlock();
		}

		if(callRetBlock[labelIndex].size() > 1)
		{
			r.callStack[r.stackIndex++] = UInt(callSiteIndex);
		}

		Int4 restoreLeave = r.enableLeave;

		Nucleus::createBr(labelBlock[labelIndex]);
		Nucleus::setInsertBlock(callRetBlock[labelIndex][callSiteIndex]);

		r.enableLeave = restoreLeave;
	}

	void PixelRoutine::CALLNZ(Registers &r, int labelIndex, int callSiteIndex, const Src &src)
	{
		if(src.type == Shader::PARAMETER_CONSTBOOL)
		{
			CALLNZb(r, labelIndex, callSiteIndex, src);
		}
		else if(src.type == Shader::PARAMETER_PREDICATE)
		{
			CALLNZp(r, labelIndex, callSiteIndex, src);
		}
		else ASSERT(false);
	}

	void PixelRoutine::CALLNZb(Registers &r, int labelIndex, int callSiteIndex, const Src &boolRegister)
	{
		Bool condition = (*Pointer<Byte>(r.data + OFFSET(DrawData,ps.b[boolRegister.index])) != Byte(0));   // FIXME
		
		if(boolRegister.modifier == Shader::MODIFIER_NOT)
		{
			condition = !condition;	
		}

		if(!labelBlock[labelIndex])
		{
			labelBlock[labelIndex] = Nucleus::createBasicBlock();
		}

		if(callRetBlock[labelIndex].size() > 1)
		{
			r.callStack[r.stackIndex++] = UInt(callSiteIndex);
		}

		Int4 restoreLeave = r.enableLeave;

		branch(condition, labelBlock[labelIndex], callRetBlock[labelIndex][callSiteIndex]);
		Nucleus::setInsertBlock(callRetBlock[labelIndex][callSiteIndex]);

		r.enableLeave = restoreLeave;
	}

	void PixelRoutine::CALLNZp(Registers &r, int labelIndex, int callSiteIndex, const Src &predicateRegister)
	{
		Int4 condition = As<Int4>(r.p0[predicateRegister.swizzle & 0x3]);

		if(predicateRegister.modifier == Shader::MODIFIER_NOT)
		{
			condition = ~condition;
		}

		condition &= r.enableStack[r.enableIndex];

		if(!labelBlock[labelIndex])
		{
			labelBlock[labelIndex] = Nucleus::createBasicBlock();
		}

		if(callRetBlock[labelIndex].size() > 1)
		{
			r.callStack[r.stackIndex++] = UInt(callSiteIndex);
		}

		r.enableIndex++;
		r.enableStack[r.enableIndex] = condition;
		Int4 restoreLeave = r.enableLeave;

		Bool notAllFalse = SignMask(condition) != 0;
		branch(notAllFalse, labelBlock[labelIndex], callRetBlock[labelIndex][callSiteIndex]);
		Nucleus::setInsertBlock(callRetBlock[labelIndex][callSiteIndex]);

		r.enableIndex--;
		r.enableLeave = restoreLeave;
	}

	void PixelRoutine::ELSE(Registers &r)
	{
		ifDepth--;

		llvm::BasicBlock *falseBlock = ifFalseBlock[ifDepth];
		llvm::BasicBlock *endBlock = Nucleus::createBasicBlock();

		if(isConditionalIf[ifDepth])
		{
			Int4 condition = ~r.enableStack[r.enableIndex] & r.enableStack[r.enableIndex - 1];
			Bool notAllFalse = SignMask(condition) != 0;

			branch(notAllFalse, falseBlock, endBlock);

			r.enableStack[r.enableIndex] = ~r.enableStack[r.enableIndex] & r.enableStack[r.enableIndex - 1];
		}
		else
		{
			Nucleus::createBr(endBlock);
			Nucleus::setInsertBlock(falseBlock);
		}

		ifFalseBlock[ifDepth] = endBlock;

		ifDepth++;
	}

	void PixelRoutine::ENDIF(Registers &r)
	{
		ifDepth--;

		llvm::BasicBlock *endBlock = ifFalseBlock[ifDepth];

		Nucleus::createBr(endBlock);
		Nucleus::setInsertBlock(endBlock);

		if(isConditionalIf[ifDepth])
		{
			breakDepth--;
			r.enableIndex--;
		}
	}

	void PixelRoutine::ENDLOOP(Registers &r)
	{
		loopRepDepth--;

		r.aL[r.loopDepth] = r.aL[r.loopDepth] + r.increment[r.loopDepth];   // FIXME: +=

		llvm::BasicBlock *testBlock = loopRepTestBlock[loopRepDepth];
		llvm::BasicBlock *endBlock = loopRepEndBlock[loopRepDepth];

		Nucleus::createBr(testBlock);
		Nucleus::setInsertBlock(endBlock);

		r.loopDepth--;
		r.enableBreak = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
	}

	void PixelRoutine::ENDREP(Registers &r)
	{
		loopRepDepth--;

		llvm::BasicBlock *testBlock = loopRepTestBlock[loopRepDepth];
		llvm::BasicBlock *endBlock = loopRepEndBlock[loopRepDepth];

		Nucleus::createBr(testBlock);
		Nucleus::setInsertBlock(endBlock);

		r.loopDepth--;
		r.enableBreak = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
	}

	void PixelRoutine::ENDWHILE(Registers &r)
	{
		loopRepDepth--;

		llvm::BasicBlock *testBlock = loopRepTestBlock[loopRepDepth];
		llvm::BasicBlock *endBlock = loopRepEndBlock[loopRepDepth];

		Nucleus::createBr(testBlock);
		Nucleus::setInsertBlock(endBlock);

		r.enableIndex--;
		r.enableBreak = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
		whileTest = false;
	}

	void PixelRoutine::IF(Registers &r, const Src &src)
	{
		if(src.type == Shader::PARAMETER_CONSTBOOL)
		{
			IFb(r, src);
		}
		else if(src.type == Shader::PARAMETER_PREDICATE)
		{
			IFp(r, src);
		}
		else
		{
			Int4 condition = As<Int4>(reg(r, src).x);
			IF(r, condition);
		}
	}

	void PixelRoutine::IFb(Registers &r, const Src &boolRegister)
	{
		ASSERT(ifDepth < 24 + 4);

		Bool condition = (*Pointer<Byte>(r.data + OFFSET(DrawData,ps.b[boolRegister.index])) != Byte(0));   // FIXME

		if(boolRegister.modifier == Shader::MODIFIER_NOT)
		{
			condition = !condition;
		}

		llvm::BasicBlock *trueBlock = Nucleus::createBasicBlock();
		llvm::BasicBlock *falseBlock = Nucleus::createBasicBlock();

		branch(condition, trueBlock, falseBlock);

		isConditionalIf[ifDepth] = false;
		ifFalseBlock[ifDepth] = falseBlock;

		ifDepth++;
	}

	void PixelRoutine::IFp(Registers &r, const Src &predicateRegister)
	{
		Int4 condition = As<Int4>(r.p0[predicateRegister.swizzle & 0x3]);

		if(predicateRegister.modifier == Shader::MODIFIER_NOT)
		{
			condition = ~condition;
		}

		IF(r, condition);
	}

	void PixelRoutine::IFC(Registers &r, Vector4f &src0, Vector4f &src1, Control control)
	{
		Int4 condition;

		switch(control)
		{
		case Shader::CONTROL_GT: condition = CmpNLE(src0.x,  src1.x);	break;
		case Shader::CONTROL_EQ: condition = CmpEQ(src0.x, src1.x);		break;
		case Shader::CONTROL_GE: condition = CmpNLT(src0.x, src1.x);	break;
		case Shader::CONTROL_LT: condition = CmpLT(src0.x,  src1.x);	break;
		case Shader::CONTROL_NE: condition = CmpNEQ(src0.x, src1.x);	break;
		case Shader::CONTROL_LE: condition = CmpLE(src0.x, src1.x);		break;
		default:
			ASSERT(false);
		}

		IF(r, condition);
	}

	void PixelRoutine::IF(Registers &r, Int4 &condition)
	{
		condition &= r.enableStack[r.enableIndex];

		r.enableIndex++;
		r.enableStack[r.enableIndex] = condition;

		llvm::BasicBlock *trueBlock = Nucleus::createBasicBlock();
		llvm::BasicBlock *falseBlock = Nucleus::createBasicBlock();

		Bool notAllFalse = SignMask(condition) != 0;

		branch(notAllFalse, trueBlock, falseBlock);

		isConditionalIf[ifDepth] = true;
		ifFalseBlock[ifDepth] = falseBlock;

		ifDepth++;
		breakDepth++;
	}

	void PixelRoutine::LABEL(int labelIndex)
	{
		if(!labelBlock[labelIndex])
		{
			labelBlock[labelIndex] = Nucleus::createBasicBlock();
		}

		Nucleus::setInsertBlock(labelBlock[labelIndex]);
		currentLabel = labelIndex;
	}

	void PixelRoutine::LOOP(Registers &r, const Src &integerRegister)
	{
		r.loopDepth++;

		r.iteration[r.loopDepth] = *Pointer<Int>(r.data + OFFSET(DrawData,ps.i[integerRegister.index][0]));
		r.aL[r.loopDepth] = *Pointer<Int>(r.data + OFFSET(DrawData,ps.i[integerRegister.index][1]));
		r.increment[r.loopDepth] = *Pointer<Int>(r.data + OFFSET(DrawData,ps.i[integerRegister.index][2]));

	//	If(r.increment[r.loopDepth] == 0)
	//	{
	//		r.increment[r.loopDepth] = 1;
	//	}

		llvm::BasicBlock *loopBlock = Nucleus::createBasicBlock();
		llvm::BasicBlock *testBlock = Nucleus::createBasicBlock();
		llvm::BasicBlock *endBlock = Nucleus::createBasicBlock();

		loopRepTestBlock[loopRepDepth] = testBlock;
		loopRepEndBlock[loopRepDepth] = endBlock;

		// FIXME: jump(testBlock)
		Nucleus::createBr(testBlock);
		Nucleus::setInsertBlock(testBlock);

		branch(r.iteration[r.loopDepth] > 0, loopBlock, endBlock);
		Nucleus::setInsertBlock(loopBlock);

		r.iteration[r.loopDepth] = r.iteration[r.loopDepth] - 1;   // FIXME: --
		
		loopRepDepth++;
		breakDepth = 0;
	}

	void PixelRoutine::REP(Registers &r, const Src &integerRegister)
	{
		r.loopDepth++;

		r.iteration[r.loopDepth] = *Pointer<Int>(r.data + OFFSET(DrawData,ps.i[integerRegister.index][0]));
		r.aL[r.loopDepth] = r.aL[r.loopDepth - 1];

		llvm::BasicBlock *loopBlock = Nucleus::createBasicBlock();
		llvm::BasicBlock *testBlock = Nucleus::createBasicBlock();
		llvm::BasicBlock *endBlock = Nucleus::createBasicBlock();

		loopRepTestBlock[loopRepDepth] = testBlock;
		loopRepEndBlock[loopRepDepth] = endBlock;

		// FIXME: jump(testBlock)
		Nucleus::createBr(testBlock);
		Nucleus::setInsertBlock(testBlock);

		branch(r.iteration[r.loopDepth] > 0, loopBlock, endBlock);
		Nucleus::setInsertBlock(loopBlock);

		r.iteration[r.loopDepth] = r.iteration[r.loopDepth] - 1;   // FIXME: --

		loopRepDepth++;
		breakDepth = 0;
	}

	void PixelRoutine::WHILE(Registers &r, const Src &temporaryRegister)
	{
		r.enableIndex++;

		llvm::BasicBlock *loopBlock = Nucleus::createBasicBlock();
		llvm::BasicBlock *testBlock = Nucleus::createBasicBlock();
		llvm::BasicBlock *endBlock = Nucleus::createBasicBlock();
		
		loopRepTestBlock[loopRepDepth] = testBlock;
		loopRepEndBlock[loopRepDepth] = endBlock;

		Int4 restoreBreak = r.enableBreak;
		Int4 restoreContinue = r.enableContinue;

		// FIXME: jump(testBlock)
		Nucleus::createBr(testBlock);
		Nucleus::setInsertBlock(testBlock);
		r.enableContinue = restoreContinue;

		const Vector4f &src = reg(r, temporaryRegister);
		Int4 condition = As<Int4>(src.x);
		condition &= r.enableStack[r.enableIndex - 1];
		r.enableStack[r.enableIndex] = condition;

		Bool notAllFalse = SignMask(condition) != 0;
		branch(notAllFalse, loopBlock, endBlock);
		
		Nucleus::setInsertBlock(endBlock);
		r.enableBreak = restoreBreak;
		
		Nucleus::setInsertBlock(loopBlock);

		loopRepDepth++;
		breakDepth = 0;
	}

	void PixelRoutine::RET(Registers &r)
	{
		if(currentLabel == -1)
		{
			returnBlock = Nucleus::createBasicBlock();
			Nucleus::createBr(returnBlock);
		}
		else
		{
			llvm::BasicBlock *unreachableBlock = Nucleus::createBasicBlock();

			if(callRetBlock[currentLabel].size() > 1)   // Pop the return destination from the call stack
			{
				// FIXME: Encapsulate
				UInt index = r.callStack[--r.stackIndex];
 
				llvm::Value *value = index.loadValue();
				llvm::Value *switchInst = Nucleus::createSwitch(value, unreachableBlock, (int)callRetBlock[currentLabel].size());

				for(unsigned int i = 0; i < callRetBlock[currentLabel].size(); i++)
				{
					Nucleus::addSwitchCase(switchInst, i, callRetBlock[currentLabel][i]);
				}
			}
			else if(callRetBlock[currentLabel].size() == 1)   // Jump directly to the unique return destination
			{
				Nucleus::createBr(callRetBlock[currentLabel][0]);
			}
			else   // Function isn't called
			{
				Nucleus::createBr(unreachableBlock);
			}

			Nucleus::setInsertBlock(unreachableBlock);
			Nucleus::createUnreachable();
		}
	}

	void PixelRoutine::LEAVE(Registers &r)
	{
		r.enableLeave = r.enableLeave & ~r.enableStack[r.enableIndex];

		// FIXME: Return from function if all instances left
		// FIXME: Use enableLeave in other control-flow constructs
	}
	
	void PixelRoutine::writeDestination(Registers &r, Vector4i &d, const Dst &dst)
	{
		switch(dst.type)
		{
		case Shader::PARAMETER_TEMP:
			if(dst.mask & 0x1) r.ri[dst.index].x = d.x;
			if(dst.mask & 0x2) r.ri[dst.index].y = d.y;
			if(dst.mask & 0x4) r.ri[dst.index].z = d.z;
			if(dst.mask & 0x8) r.ri[dst.index].w = d.w;
			break;
		case Shader::PARAMETER_INPUT:
			if(dst.mask & 0x1) r.vi[dst.index].x = d.x;
			if(dst.mask & 0x2) r.vi[dst.index].y = d.y;
			if(dst.mask & 0x4) r.vi[dst.index].z = d.z;
			if(dst.mask & 0x8) r.vi[dst.index].w = d.w;
			break;
		case Shader::PARAMETER_CONST:			ASSERT(false);	break;
		case Shader::PARAMETER_TEXTURE:
			if(dst.mask & 0x1) r.ti[dst.index].x = d.x;
			if(dst.mask & 0x2) r.ti[dst.index].y = d.y;
			if(dst.mask & 0x4) r.ti[dst.index].z = d.z;
			if(dst.mask & 0x8) r.ti[dst.index].w = d.w;
			break;
		case Shader::PARAMETER_COLOROUT:
			if(dst.mask & 0x1) r.vi[dst.index].x = d.x;
			if(dst.mask & 0x2) r.vi[dst.index].y = d.y;
			if(dst.mask & 0x4) r.vi[dst.index].z = d.z;
			if(dst.mask & 0x8) r.vi[dst.index].w = d.w;
			break;
		default:
			ASSERT(false);
		}
	}

	Vector4i PixelRoutine::regi(Registers &r, const Src &src)
	{
		Vector4i *reg;
		int i = src.index;

		Vector4i c;

		if(src.type == Shader::PARAMETER_CONST)
		{
			c.x = *Pointer<Short4>(r.data + OFFSET(DrawData,ps.cW[i][0]));
			c.y = *Pointer<Short4>(r.data + OFFSET(DrawData,ps.cW[i][1]));
			c.z = *Pointer<Short4>(r.data + OFFSET(DrawData,ps.cW[i][2]));
			c.w = *Pointer<Short4>(r.data + OFFSET(DrawData,ps.cW[i][3]));
		}

		switch(src.type)
		{
		case Shader::PARAMETER_TEMP:          reg = &r.ri[i]; break;
		case Shader::PARAMETER_INPUT:         reg = &r.vi[i]; break;
		case Shader::PARAMETER_CONST:         reg = &c;       break;
		case Shader::PARAMETER_TEXTURE:       reg = &r.ti[i]; break;
		case Shader::PARAMETER_VOID:          return r.ri[0]; // Dummy
		case Shader::PARAMETER_FLOAT4LITERAL: return r.ri[0]; // Dummy
		default:
			ASSERT(false);
		}

		const Short4 &x = (*reg)[(src.swizzle >> 0) & 0x3];
		const Short4 &y = (*reg)[(src.swizzle >> 2) & 0x3];
		const Short4 &z = (*reg)[(src.swizzle >> 4) & 0x3];
		const Short4 &w = (*reg)[(src.swizzle >> 6) & 0x3];

		Vector4i mod;

		switch(src.modifier)
		{
		case Shader::MODIFIER_NONE:
			mod.x = x;
			mod.y = y;
			mod.z = z;
			mod.w = w;
			break;
		case Shader::MODIFIER_BIAS:
			mod.x = SubSat(x, Short4(0x0800, 0x0800, 0x0800, 0x0800));
			mod.y = SubSat(y, Short4(0x0800, 0x0800, 0x0800, 0x0800));
			mod.z = SubSat(z, Short4(0x0800, 0x0800, 0x0800, 0x0800));
			mod.w = SubSat(w, Short4(0x0800, 0x0800, 0x0800, 0x0800));
			break;
		case Shader::MODIFIER_BIAS_NEGATE:
			mod.x = SubSat(Short4(0x0800, 0x0800, 0x0800, 0x0800), x);
			mod.y = SubSat(Short4(0x0800, 0x0800, 0x0800, 0x0800), y);
			mod.z = SubSat(Short4(0x0800, 0x0800, 0x0800, 0x0800), z);
			mod.w = SubSat(Short4(0x0800, 0x0800, 0x0800, 0x0800), w);
			break;
		case Shader::MODIFIER_COMPLEMENT:
			mod.x = SubSat(Short4(0x1000), x);
			mod.y = SubSat(Short4(0x1000), y);
			mod.z = SubSat(Short4(0x1000), z);
			mod.w = SubSat(Short4(0x1000), w);
			break;
		case Shader::MODIFIER_NEGATE:
			mod.x = -x;
			mod.y = -y;
			mod.z = -z;
			mod.w = -w;
			break;
		case Shader::MODIFIER_X2:
			mod.x = AddSat(x, x);
			mod.y = AddSat(y, y);
			mod.z = AddSat(z, z);
			mod.w = AddSat(w, w);
			break;
		case Shader::MODIFIER_X2_NEGATE:
			mod.x = -AddSat(x, x);
			mod.y = -AddSat(y, y);
			mod.z = -AddSat(z, z);
			mod.w = -AddSat(w, w);
			break;
		case Shader::MODIFIER_SIGN:
			mod.x = SubSat(x, Short4(0x0800, 0x0800, 0x0800, 0x0800));
			mod.y = SubSat(y, Short4(0x0800, 0x0800, 0x0800, 0x0800));
			mod.z = SubSat(z, Short4(0x0800, 0x0800, 0x0800, 0x0800));
			mod.w = SubSat(w, Short4(0x0800, 0x0800, 0x0800, 0x0800));
			mod.x = AddSat(mod.x, mod.x);
			mod.y = AddSat(mod.y, mod.y);
			mod.z = AddSat(mod.z, mod.z);
			mod.w = AddSat(mod.w, mod.w);
			break;
		case Shader::MODIFIER_SIGN_NEGATE:
			mod.x = SubSat(Short4(0x0800, 0x0800, 0x0800, 0x0800), x);
			mod.y = SubSat(Short4(0x0800, 0x0800, 0x0800, 0x0800), y);
			mod.z = SubSat(Short4(0x0800, 0x0800, 0x0800, 0x0800), z);
			mod.w = SubSat(Short4(0x0800, 0x0800, 0x0800, 0x0800), w);
			mod.x = AddSat(mod.x, mod.x);
			mod.y = AddSat(mod.y, mod.y);
			mod.z = AddSat(mod.z, mod.z);
			mod.w = AddSat(mod.w, mod.w);
			break;
		case Shader::MODIFIER_DZ:
			mod.x = x;
			mod.y = y;
			mod.z = z;
			mod.w = w;
			// Projection performed by texture sampler
			break;
		case Shader::MODIFIER_DW:
			mod.x = x;
			mod.y = y;
			mod.z = z;
			mod.w = w;
			// Projection performed by texture sampler
			break;
		default:
			ASSERT(false);
		}

		if(src.type == Shader::PARAMETER_CONST && (src.modifier == Shader::MODIFIER_X2 || src.modifier == Shader::MODIFIER_X2_NEGATE))
		{
			mod.x = Min(mod.x, Short4(0x1000)); mod.x = Max(mod.x, Short4(-0x1000, -0x1000, -0x1000, -0x1000));
			mod.y = Min(mod.y, Short4(0x1000)); mod.y = Max(mod.y, Short4(-0x1000, -0x1000, -0x1000, -0x1000));
			mod.z = Min(mod.z, Short4(0x1000)); mod.z = Max(mod.z, Short4(-0x1000, -0x1000, -0x1000, -0x1000));
			mod.w = Min(mod.w, Short4(0x1000)); mod.w = Max(mod.w, Short4(-0x1000, -0x1000, -0x1000, -0x1000));
		}

		return mod;
	}

	Vector4f PixelRoutine::reg(Registers &r, const Src &src, int offset)
	{
		Vector4f reg;
		int i = src.index + offset;

		switch(src.type)
		{
		case Shader::PARAMETER_TEMP:
			if(src.rel.type == Shader::PARAMETER_VOID)
			{
				reg = r.rf[i];
			}
			else
			{
				Int a = relativeAddress(r, src);

				reg = r.rf[i + a];
			}
			break;
		case Shader::PARAMETER_INPUT:
			{
				if(src.rel.type == Shader::PARAMETER_VOID)   // Not relative
				{
					reg = r.vf[i];
				}
				else if(src.rel.type == Shader::PARAMETER_LOOP)
				{
					Int aL = r.aL[r.loopDepth];

					reg = r.vf[i + aL];
				}
				else
				{
					Int a = relativeAddress(r, src);
					
					reg = r.vf[i + a];
				}
			}
			break;
		case Shader::PARAMETER_CONST:
			reg = readConstant(r, src, offset);
			break;
		case Shader::PARAMETER_TEXTURE:
			reg = r.vf[2 + i];
			break;
		case Shader::PARAMETER_MISCTYPE:
			if(src.index == 0)				reg = r.vPos;
			if(src.index == 1)				reg = r.vFace;
			break;
		case Shader::PARAMETER_SAMPLER:
			if(src.rel.type == Shader::PARAMETER_VOID)
			{
				reg.x = As<Float4>(Int4(i));
			}
			else if(src.rel.type == Shader::PARAMETER_TEMP)
			{
				reg.x = As<Float4>(Int4(i) + RoundInt(r.rf[src.rel.index].x));
			}
			return reg;
		case Shader::PARAMETER_PREDICATE:	return reg;   // Dummy
		case Shader::PARAMETER_VOID:		return reg;   // Dummy
		case Shader::PARAMETER_FLOAT4LITERAL:
			reg.x = Float4(src.value[0]);
			reg.y = Float4(src.value[1]);
			reg.z = Float4(src.value[2]);
			reg.w = Float4(src.value[3]);
			break;
		case Shader::PARAMETER_CONSTINT:	return reg;   // Dummy
		case Shader::PARAMETER_CONSTBOOL:	return reg;   // Dummy
		case Shader::PARAMETER_LOOP:		return reg;   // Dummy
		case Shader::PARAMETER_COLOROUT:
			reg = r.oC[i];
			break;
		case Shader::PARAMETER_DEPTHOUT:
			reg.x = r.oDepth;
			break;
		default:
			ASSERT(false);
		}

		const Float4 &x = reg[(src.swizzle >> 0) & 0x3];
		const Float4 &y = reg[(src.swizzle >> 2) & 0x3];
		const Float4 &z = reg[(src.swizzle >> 4) & 0x3];
		const Float4 &w = reg[(src.swizzle >> 6) & 0x3];

		Vector4f mod;

		switch(src.modifier)
		{
		case Shader::MODIFIER_NONE:
			mod.x = x;
			mod.y = y;
			mod.z = z;
			mod.w = w;
			break;
		case Shader::MODIFIER_NEGATE:
			mod.x = -x;
			mod.y = -y;
			mod.z = -z;
			mod.w = -w;
			break;
		case Shader::MODIFIER_ABS:
			mod.x = Abs(x);
			mod.y = Abs(y);
			mod.z = Abs(z);
			mod.w = Abs(w);
			break;
		case Shader::MODIFIER_ABS_NEGATE:
			mod.x = -Abs(x);
			mod.y = -Abs(y);
			mod.z = -Abs(z);
			mod.w = -Abs(w);
			break;
		case Shader::MODIFIER_NOT:
			mod.x = As<Float4>(As<Int4>(x) ^ Int4(0xFFFFFFFF));
			mod.y = As<Float4>(As<Int4>(y) ^ Int4(0xFFFFFFFF));
			mod.z = As<Float4>(As<Int4>(z) ^ Int4(0xFFFFFFFF));
			mod.w = As<Float4>(As<Int4>(w) ^ Int4(0xFFFFFFFF));
			break;
		default:
			ASSERT(false);
		}

		return mod;
	}

	Vector4f PixelRoutine::readConstant(Registers &r, const Src &src, int offset)
	{
		Vector4f c;

		int i = src.index + offset;

		if(src.rel.type == Shader::PARAMETER_VOID)   // Not relative
		{
			c.x = c.y = c.z = c.w = *Pointer<Float4>(r.data + OFFSET(DrawData,ps.c[i]));

			c.x = c.x.xxxx;
			c.y = c.y.yyyy;
			c.z = c.z.zzzz;
			c.w = c.w.wwww;

			if(localShaderConstants)   // Constant may be known at compile time
			{
				for(int j = 0; j < shader->getLength(); j++)
				{
					const Shader::Instruction &instruction = *shader->getInstruction(j);

					if(instruction.opcode == Shader::OPCODE_DEF)
					{
						if(instruction.dst.index == i)
						{
							c.x = Float4(instruction.src[0].value[0]);
							c.y = Float4(instruction.src[0].value[1]);
							c.z = Float4(instruction.src[0].value[2]);
							c.w = Float4(instruction.src[0].value[3]);

							break;
						}
					}
				}
			}
		}
		else if(src.rel.type == Shader::PARAMETER_LOOP)
		{
			Int loopCounter = r.aL[r.loopDepth];

			c.x = c.y = c.z = c.w = *Pointer<Float4>(r.data + OFFSET(DrawData,ps.c[i]) + loopCounter * 16);

			c.x = c.x.xxxx;
			c.y = c.y.yyyy;
			c.z = c.z.zzzz;
			c.w = c.w.wwww;
		}
		else
		{
			Int a = relativeAddress(r, src);
			
			c.x = c.y = c.z = c.w = *Pointer<Float4>(r.data + OFFSET(DrawData,ps.c[i]) + a * 16);

			c.x = c.x.xxxx;
			c.y = c.y.yyyy;
			c.z = c.z.zzzz;
			c.w = c.w.wwww;
		}

		return c;
	}

	Int PixelRoutine::relativeAddress(Registers &r, const Shader::Parameter &var)
	{
		ASSERT(var.rel.deterministic);

		if(var.rel.type == Shader::PARAMETER_TEMP)
		{
			return RoundInt(Extract(r.rf[var.rel.index].x, 0)) * var.rel.scale;
		}
		else if(var.rel.type == Shader::PARAMETER_INPUT)
		{
			return RoundInt(Extract(r.vf[var.rel.index].x, 0)) * var.rel.scale;
		}
		else if(var.rel.type == Shader::PARAMETER_OUTPUT)
		{
			return RoundInt(Extract(r.oC[var.rel.index].x, 0)) * var.rel.scale;
		}
		else if(var.rel.type == Shader::PARAMETER_CONST)
		{
			RValue<Float4> c = *Pointer<Float4>(r.data + OFFSET(DrawData,vs.c[var.rel.index]));

			return RoundInt(Extract(c, 0)) * var.rel.scale;
		}
		else ASSERT(false);

		return 0;
	}

	Int4 PixelRoutine::enableMask(Registers &r, const Shader::Instruction *instruction)
	{
		Int4 enable = instruction->analysisBranch ? Int4(r.enableStack[r.enableIndex]) : Int4(0xFFFFFFFF);
					
		if(shader->containsBreakInstruction() && !whileTest && instruction->analysisBreak)
		{
			enable &= r.enableBreak;
		}

		if(shader->containsContinueInstruction() && !whileTest && instruction->analysisContinue)
		{
			enable &= r.enableContinue;
		}

		if(shader->containsLeaveInstruction() && instruction->analysisLeave)
		{
			enable &= r.enableLeave;
		}

		return enable;
	}

	bool PixelRoutine::colorUsed()
	{
		return state.colorWriteMask || state.alphaTestActive() || state.shaderContainsKill;
	}

	unsigned short PixelRoutine::shaderVersion() const
	{
		return shader ? shader->getVersion() : 0x0000;
	}

	bool PixelRoutine::interpolateZ() const
	{
		return state.depthTestActive || state.pixelFogActive() || (shader && shader->vPosDeclared && fullPixelPositionRegister);
	}

	bool PixelRoutine::interpolateW() const
	{
		return state.perspective || (shader && shader->vPosDeclared && fullPixelPositionRegister);
	}
}
