/// <summary>Setup shader static values</summary><param name="state"/>
		private void gdInit(Xen.Graphics.ShaderSystem.ShaderSystemBase state)
		{
			// set the graphics ID
			Character.gd = state.DeviceUniqueIndex;
			this.GraphicsID = state.DeviceUniqueIndex;
			Character.gid0 = state.GetGlobalUniqueID<Microsoft.Xna.Framework.Matrix>("ShadowMapProjection");
			Character.gid1 = state.GetGlobalUniqueID<Microsoft.Xna.Framework.Vector3>("AmbientDiffuseSpecularScale");
			Character.gid2 = state.GetGlobalUniqueID<Microsoft.Xna.Framework.Vector4[]>("EnvironmentSH");
			Character.gid3 = state.GetGlobalUniqueID<Microsoft.Xna.Framework.Vector2>("RgbmImageRenderScale");
			Character.gid4 = state.GetGlobalUniqueID<Microsoft.Xna.Framework.Vector2>("ShadowMapSize");
			Character.gid5 = state.GetGlobalUniqueID<Microsoft.Xna.Framework.Vector3>("SkinLightScatter");
			Character.gid6 = state.GetGlobalUniqueID<Microsoft.Xna.Framework.Vector3>("SunDirection");
			Character.gid7 = state.GetGlobalUniqueID<Microsoft.Xna.Framework.Vector4>("SunRgbIntensity");
			Character.gid8 = state.GetGlobalUniqueID<Microsoft.Xna.Framework.Vector2>("SunSpecularPowerIntensity");
			Character.gid9 = state.GetGlobalUniqueID<Microsoft.Xna.Framework.Vector3>("UseAlbedoOcclusionShadow");
			Character.sid0 = state.GetNameUniqueID("AlbedoSampler");
			Character.sid1 = state.GetNameUniqueID("CubeRgbmSampler");
			Character.sid2 = state.GetNameUniqueID("NormalSampler");
			Character.sid3 = state.GetNameUniqueID("ShadowSampler");
			Character.sid4 = state.GetNameUniqueID("SofSampler");
			Character.tid0 = state.GetGlobalUniqueID<Microsoft.Xna.Framework.Graphics.TextureCube>("CubeRgbmTexture");
			Character.tid1 = state.GetGlobalUniqueID<Microsoft.Xna.Framework.Graphics.Texture2D>("ShadowTexture");
			Character.tid2 = state.GetNameUniqueID("SofTexture");
			Character.tid3 = state.GetNameUniqueID("AlbedoTexture");
			Character.tid4 = state.GetNameUniqueID("NormalTexture");
		}
		/// <summary>Setup shader static values</summary><param name="state"/>
		private void gdInit(Xen.Graphics.ShaderSystem.ShaderSystemBase state)
		{
			// set the graphics ID
			Tutorial16.gd = state.DeviceUniqueIndex;
			this.GraphicsID = state.DeviceUniqueIndex;
			Tutorial16.gid0 = state.GetGlobalUniqueID<Microsoft.Xna.Framework.Vector4>("colour");
		}
		/// <summary>Setup shader static values</summary><param name="state"/>
		private void gdInit(Xen.Graphics.ShaderSystem.ShaderSystemBase state)
		{
			// set the graphics ID
			DrawGraphLine.gd = state.DeviceUniqueIndex;
			this.GraphicsID = state.DeviceUniqueIndex;
			DrawGraphLine.cid0 = state.GetNameUniqueID("graphLine");
		}
		/// <summary>Bind the shader, 'ic' indicates the shader instance has changed and 'ec' indicates the extension has changed.</summary><param name="state"/><param name="ic"/><param name="ec"/><param name="ext"/>
		protected override void BeginImpl(Xen.Graphics.ShaderSystem.ShaderSystemBase state, bool ic, bool ec, Xen.Graphics.ShaderSystem.ShaderExtension ext)
		{
			// if the device changed, call Warm()
			if ((state.DeviceUniqueIndex != DrawVelocityParticles_LinesGpuTex.gd))
			{
				this.WarmShader(state);
				ic = true;
			}
			// Force updating if the instance has changed
			this.vreg_change = (this.vreg_change | ic);
			// Set the value for attribute 'worldViewProj'
			this.vreg_change = (this.vreg_change | state.SetWorldViewProjectionMatrix(ref this.vreg[0], ref this.vreg[1], ref this.vreg[2], ref this.vreg[3], ref this.sc0));
			// Assign pixel shader textures and samplers
			if ((ic | this.vtc))
			{
				state.SetVertexShaderSamplers(this.vtx, this.vts);
				this.vtc = false;
			}
			if ((this.vreg_change == true))
			{
				DrawVelocityParticles_LinesGpuTex.fx.vs_c.SetValue(this.vreg);
				this.vreg_change = false;
				ic = true;
			}
			// Finally, bind the effect
			if ((ic | ec))
			{
				state.SetEffect(this, ref DrawVelocityParticles_LinesGpuTex.fx, ext);
			}
		}
		/// <summary>Bind the shader, 'ic' indicates the shader instance has changed and 'ec' indicates the extension has changed.</summary><param name="state"/><param name="ic"/><param name="ec"/><param name="ext"/>
		protected override void BeginImpl(Xen.Graphics.ShaderSystem.ShaderSystemBase state, bool ic, bool ec, Xen.Graphics.ShaderSystem.ShaderExtension ext)
		{
			// if the device changed, call Warm()
			if ((state.DeviceUniqueIndex != RgbmDecode.gd))
			{
				this.WarmShader(state);
				ic = true;
			}
			// Force updating if the instance has changed
			this.vreg_change = (this.vreg_change | ic);
			this.preg_change = (this.preg_change | ic);
			this.vbreg_change = (this.vbreg_change | ic);
			this.vireg_change = (this.vireg_change | ic);
			// Set the value for attribute 'worldViewProj'
			this.vreg_change = (this.vreg_change | state.SetWorldViewProjectionMatrix(ref this.vreg[0], ref this.vreg[1], ref this.vreg[2], ref this.vreg[3], ref this.sc0));
			// Set the value for global 'BloomScaleThreshold'
			this.preg_change = (this.preg_change | state.SetGlobalVector2(ref this.preg[1], RgbmDecode.gid0, ref this.gc0));
			// Set the value for global 'LensExposure'
			this.preg_change = (this.preg_change | state.SetGlobalSingle(ref this.preg[2], RgbmDecode.gid1, ref this.gc1));
			// Set the value for global 'RgbmImageRenderScale'
			this.preg_change = (this.preg_change | state.SetGlobalVector2(ref this.preg[0], RgbmDecode.gid2, ref this.gc2));
			// Assign pixel shader textures and samplers
			if ((ic | this.ptc))
			{
				state.SetPixelShaderSamplers(this.ptx, this.pts);
				this.ptc = false;
			}
			if ((this.vreg_change == true))
			{
				RgbmDecode.fx.vs_c.SetValue(this.vreg);
				this.vreg_change = false;
				ic = true;
			}
			if ((this.preg_change == true))
			{
				RgbmDecode.fx.ps_c.SetValue(this.preg);
				this.preg_change = false;
				ic = true;
			}
			if ((ext == Xen.Graphics.ShaderSystem.ShaderExtension.Blending))
			{
				ic = (ic | state.SetBlendMatricesDirect(RgbmDecode.fx.vsb_c, ref this.sc1));
			}
			if ((ext == Xen.Graphics.ShaderSystem.ShaderExtension.Instancing))
			{
				this.vireg_change = (this.vireg_change | state.SetViewProjectionMatrix(ref this.vireg[0], ref this.vireg[1], ref this.vireg[2], ref this.vireg[3], ref this.sc2));
				if ((this.vireg_change == true))
				{
					RgbmDecode.fx.vsi_c.SetValue(this.vireg);
					this.vireg_change = false;
					ic = true;
				}
			}
			// Finally, bind the effect
			if ((ic | ec))
			{
				state.SetEffect(this, ref RgbmDecode.fx, ext);
			}
		}
		/// <summary>Setup shader static values</summary><param name="state"/>
		private void gdInit(Xen.Graphics.ShaderSystem.ShaderSystemBase state)
		{
			// set the graphics ID
			ParticleStoreLife128.gd = state.DeviceUniqueIndex;
			this.GraphicsID = state.DeviceUniqueIndex;
			ParticleStoreLife128.cid0 = state.GetNameUniqueID("indices");
			ParticleStoreLife128.cid1 = state.GetNameUniqueID("invTargetSize");
		}
		/// <summary>Setup shader static values</summary><param name="state"/>
		private void gdInit(Xen.Graphics.ShaderSystem.ShaderSystemBase state)
		{
			// set the graphics ID
			Tutorial09Technique.gd = state.DeviceUniqueIndex;
			this.GraphicsID = state.DeviceUniqueIndex;
			Tutorial09Technique.sid0 = state.GetNameUniqueID("DisplayTextureSampler");
			Tutorial09Technique.tid0 = state.GetNameUniqueID("DisplayTexture");
		}
		/// <summary>Setup shader static values</summary><param name="state"/>
		private void gdInit(Xen.Graphics.ShaderSystem.ShaderSystemBase state)
		{
			// set the graphics ID
			FillCustomTexture.gd = state.DeviceUniqueIndex;
			this.GraphicsID = state.DeviceUniqueIndex;
			FillCustomTexture.sid0 = state.GetNameUniqueID("CustomTextureSampler");
			FillCustomTexture.tid0 = state.GetNameUniqueID("CustomTexture");
		}
		/// <summary>Setup shader static values</summary><param name="state"/>
		private void gdInit(Xen.Graphics.ShaderSystem.ShaderSystemBase state)
		{
			// set the graphics ID
			BackgroundFill.gd = state.DeviceUniqueIndex;
			this.GraphicsID = state.DeviceUniqueIndex;
			BackgroundFill.gid0 = state.GetGlobalUniqueID<Microsoft.Xna.Framework.Vector2>("RgbmImageRenderScale");
			BackgroundFill.sid0 = state.GetNameUniqueID("CubeRgbmSampler");
			BackgroundFill.tid0 = state.GetGlobalUniqueID<Microsoft.Xna.Framework.Graphics.TextureCube>("CubeRgbmTexture");
		}
		/// <summary>Setup shader static values</summary><param name="state"/>
		private void gdInit(Xen.Graphics.ShaderSystem.ShaderSystemBase state)
		{
			// set the graphics ID
			InstancingSprite.gd = state.DeviceUniqueIndex;
			this.GraphicsID = state.DeviceUniqueIndex;
			InstancingSprite.cid0 = state.GetNameUniqueID("spriteWorldMatrix");
			InstancingSprite.sid0 = state.GetNameUniqueID("CustomTextureSampler");
			InstancingSprite.tid0 = state.GetNameUniqueID("CustomTexture");
		}
		/// <summary>Setup shader static values</summary><param name="state"/>
		private void gdInit(Xen.Graphics.ShaderSystem.ShaderSystemBase state)
		{
			// set the graphics ID
			Kernel16.gd = state.DeviceUniqueIndex;
			this.GraphicsID = state.DeviceUniqueIndex;
			Kernel16.cid0 = state.GetNameUniqueID("kernel");
			Kernel16.cid1 = state.GetNameUniqueID("textureSize");
			Kernel16.sid0 = state.GetNameUniqueID("TextureSampler");
			Kernel16.tid0 = state.GetNameUniqueID("Texture");
		}
		/// <summary>Setup shader static values</summary><param name="state"/>
		private void gdInit(Xen.Graphics.ShaderSystem.ShaderSystemBase state)
		{
			// set the graphics ID
			DrawVelocityParticles_LinesGpuTex.gd = state.DeviceUniqueIndex;
			this.GraphicsID = state.DeviceUniqueIndex;
			DrawVelocityParticles_LinesGpuTex.cid0 = state.GetNameUniqueID("textureSizeOffset");
			DrawVelocityParticles_LinesGpuTex.cid1 = state.GetNameUniqueID("velocityScale");
			DrawVelocityParticles_LinesGpuTex.sid0 = state.GetNameUniqueID("PositionSampler");
			DrawVelocityParticles_LinesGpuTex.sid1 = state.GetNameUniqueID("VelocitySampler");
			DrawVelocityParticles_LinesGpuTex.tid0 = state.GetNameUniqueID("PositionTexture");
			DrawVelocityParticles_LinesGpuTex.tid2 = state.GetNameUniqueID("VelocityTexture");
		}
		/// <summary>Setup shader static values</summary><param name="state"/>
		private void gdInit(Xen.Graphics.ShaderSystem.ShaderSystemBase state)
		{
			// set the graphics ID
			DrawBillboardParticles_GpuTex.gd = state.DeviceUniqueIndex;
			this.GraphicsID = state.DeviceUniqueIndex;
			DrawBillboardParticles_GpuTex.cid0 = state.GetNameUniqueID("invTextureSizeOffset");
			DrawBillboardParticles_GpuTex.sid0 = state.GetNameUniqueID("DisplaySampler");
			DrawBillboardParticles_GpuTex.sid1 = state.GetNameUniqueID("PositionSampler");
			DrawBillboardParticles_GpuTex.sid2 = state.GetNameUniqueID("VelocitySampler");
			DrawBillboardParticles_GpuTex.tid0 = state.GetNameUniqueID("PositionTexture");
			DrawBillboardParticles_GpuTex.tid2 = state.GetNameUniqueID("VelocityTexture");
			DrawBillboardParticles_GpuTex.tid4 = state.GetNameUniqueID("DisplayTexture");
		}
		/// <summary>Setup shader static values</summary><param name="state"/>
		private void gdInit(Xen.Graphics.ShaderSystem.ShaderSystemBase state)
		{
			// set the graphics ID
			ShadowShader.gd = state.DeviceUniqueIndex;
			this.GraphicsID = state.DeviceUniqueIndex;
			ShadowShader.cid0 = state.GetNameUniqueID("lightColour");
			ShadowShader.cid1 = state.GetNameUniqueID("shadowMapProjection");
			ShadowShader.cid2 = state.GetNameUniqueID("shadowViewDirection");
			ShadowShader.sid0 = state.GetNameUniqueID("ShadowSampler");
			ShadowShader.sid1 = state.GetNameUniqueID("TextureSampler");
			ShadowShader.tid0 = state.GetNameUniqueID("ShadowMap");
			ShadowShader.tid1 = state.GetNameUniqueID("TextureMap");
		}
		/// <summary>Bind the shader, 'ic' indicates the shader instance has changed and 'ec' indicates the extension has changed.</summary><param name="state"/><param name="ic"/><param name="ec"/><param name="ext"/>
		protected override void BeginImpl(Xen.Graphics.ShaderSystem.ShaderSystemBase state, bool ic, bool ec, Xen.Graphics.ShaderSystem.ShaderExtension ext)
		{
			// if the device changed, call Warm()
			if ((state.DeviceUniqueIndex != DepthOutRg.gd))
			{
				this.WarmShader(state);
				ic = true;
			}
			// Force updating if the instance has changed
			this.vreg_change = (this.vreg_change | ic);
			this.vbreg_change = (this.vbreg_change | ic);
			this.vireg_change = (this.vireg_change | ic);
			// Set the value for attribute 'cameraNearFar'
			this.vreg_change = (this.vreg_change | state.SetCameraNearFarVector2(ref this.vreg[9], ref this.sc0));
			// Set the value for attribute 'viewDirection'
			this.vreg_change = (this.vreg_change | state.SetViewDirectionVector3(ref this.vreg[7], ref this.sc1));
			// Set the value for attribute 'viewPoint'
			this.vreg_change = (this.vreg_change | state.SetViewPointVector3(ref this.vreg[8], ref this.sc2));
			Microsoft.Xna.Framework.Vector4 unused = new Microsoft.Xna.Framework.Vector4();
			// Set the value for attribute 'worldMatrix'
			this.vreg_change = (this.vreg_change | state.SetWorldMatrix(ref this.vreg[4], ref this.vreg[5], ref this.vreg[6], ref unused, ref this.sc3));
			// Set the value for attribute 'worldViewProj'
			this.vreg_change = (this.vreg_change | state.SetWorldViewProjectionMatrix(ref this.vreg[0], ref this.vreg[1], ref this.vreg[2], ref this.vreg[3], ref this.sc4));
			if ((this.vreg_change == true))
			{
				DepthOutRg.fx.vs_c.SetValue(this.vreg);
				this.vreg_change = false;
				ic = true;
			}
			if ((ext == Xen.Graphics.ShaderSystem.ShaderExtension.Blending))
			{
				ic = (ic | state.SetBlendMatricesDirect(DepthOutRg.fx.vsb_c, ref this.sc5));
			}
			if ((ext == Xen.Graphics.ShaderSystem.ShaderExtension.Instancing))
			{
				this.vireg_change = (this.vireg_change | state.SetViewProjectionMatrix(ref this.vireg[0], ref this.vireg[1], ref this.vireg[2], ref this.vireg[3], ref this.sc6));
				if ((this.vireg_change == true))
				{
					DepthOutRg.fx.vsi_c.SetValue(this.vireg);
					this.vireg_change = false;
					ic = true;
				}
			}
			// Finally, bind the effect
			if ((ic | ec))
			{
				state.SetEffect(this, ref DepthOutRg.fx, ext);
			}
		}
		/// <summary>Bind the shader, 'ic' indicates the shader instance has changed and 'ec' indicates the extension has changed.</summary><param name="state"/><param name="ic"/><param name="ec"/><param name="ext"/>
		protected override void BeginImpl(Xen.Graphics.ShaderSystem.ShaderSystemBase state, bool ic, bool ec, Xen.Graphics.ShaderSystem.ShaderExtension ext)
		{
			// if the device changed, call Warm()
			if ((state.DeviceUniqueIndex != Tutorial16.gd))
			{
				this.WarmShader(state);
				ic = true;
			}
			// Force updating if the instance has changed
			this.vreg_change = (this.vreg_change | ic);
			this.preg_change = (this.preg_change | ic);
			this.vbreg_change = (this.vbreg_change | ic);
			this.vireg_change = (this.vireg_change | ic);
			// Set the value for attribute 'worldViewProj'
			this.vreg_change = (this.vreg_change | state.SetWorldViewProjectionMatrix(ref this.vreg[0], ref this.vreg[1], ref this.vreg[2], ref this.vreg[3], ref this.sc0));
			// Set the value for global 'colour'
			this.preg_change = (this.preg_change | state.SetGlobalVector4(ref this.preg[0], Tutorial16.gid0, ref this.gc0));
			if ((this.vreg_change == true))
			{
				Tutorial16.fx.vs_c.SetValue(this.vreg);
				this.vreg_change = false;
				ic = true;
			}
			if ((this.preg_change == true))
			{
				Tutorial16.fx.ps_c.SetValue(this.preg);
				this.preg_change = false;
				ic = true;
			}
			if ((ext == Xen.Graphics.ShaderSystem.ShaderExtension.Blending))
			{
				ic = (ic | state.SetBlendMatricesDirect(Tutorial16.fx.vsb_c, ref this.sc1));
			}
			if ((ext == Xen.Graphics.ShaderSystem.ShaderExtension.Instancing))
			{
				this.vireg_change = (this.vireg_change | state.SetViewProjectionMatrix(ref this.vireg[0], ref this.vireg[1], ref this.vireg[2], ref this.vireg[3], ref this.sc2));
				if ((this.vireg_change == true))
				{
					Tutorial16.fx.vsi_c.SetValue(this.vireg);
					this.vireg_change = false;
					ic = true;
				}
			}
			// Finally, bind the effect
			if ((ic | ec))
			{
				state.SetEffect(this, ref Tutorial16.fx, ext);
			}
		}
		/// <summary>Bind the shader, 'ic' indicates the shader instance has changed and 'ec' indicates the extension has changed.</summary><param name="state"/><param name="ic"/><param name="ec"/><param name="ext"/>
		protected override void BeginImpl(Xen.Graphics.ShaderSystem.ShaderSystemBase state, bool ic, bool ec, Xen.Graphics.ShaderSystem.ShaderExtension ext)
		{
			// if the device changed, call Warm()
			if ((state.DeviceUniqueIndex != ShadowShader.gd))
			{
				this.WarmShader(state);
				ic = true;
			}
			// Force updating if the instance has changed
			this.vreg_change = (this.vreg_change | ic);
			this.vbreg_change = (this.vbreg_change | ic);
			this.vireg_change = (this.vireg_change | ic);
			// Set the value for attribute 'worldMatrix'
			this.vreg_change = (this.vreg_change | state.SetWorldMatrix(ref this.vreg[8], ref this.vreg[9], ref this.vreg[10], ref this.vreg[11], ref this.sc0));
			// Set the value for attribute 'worldViewProjection'
			this.vreg_change = (this.vreg_change | state.SetWorldViewProjectionMatrix(ref this.vreg[0], ref this.vreg[1], ref this.vreg[2], ref this.vreg[3], ref this.sc1));
			// Assign pixel shader textures and samplers
			if ((ic | this.ptc))
			{
				state.SetPixelShaderSamplers(this.ptx, this.pts);
				this.ptc = false;
			}
			if ((this.vreg_change == true))
			{
				ShadowShader.fx.vs_c.SetValue(this.vreg);
				this.vreg_change = false;
				ic = true;
			}
			if ((ext == Xen.Graphics.ShaderSystem.ShaderExtension.Blending))
			{
				ic = (ic | state.SetBlendMatricesDirect(ShadowShader.fx.vsb_c, ref this.sc2));
			}
			if ((ext == Xen.Graphics.ShaderSystem.ShaderExtension.Instancing))
			{
				this.vireg_change = (this.vireg_change | state.SetViewProjectionMatrix(ref this.vireg[0], ref this.vireg[1], ref this.vireg[2], ref this.vireg[3], ref this.sc3));
				if ((this.vireg_change == true))
				{
					ShadowShader.fx.vsi_c.SetValue(this.vireg);
					this.vireg_change = false;
					ic = true;
				}
			}
			// Finally, bind the effect
			if ((ic | ec))
			{
				state.SetEffect(this, ref ShadowShader.fx, ext);
			}
		}
		/// <summary>Warm (Preload) the shader</summary><param name="state"/>
		protected override void WarmShader(Xen.Graphics.ShaderSystem.ShaderSystemBase state)
		{
			// Shader is already warmed
			if ((DepthOutRg.gd == state.DeviceUniqueIndex))
			{
				return;
			}
			// Setup the shader
			if ((DepthOutRg.gd != state.DeviceUniqueIndex))
			{
				this.gdInit(state);
			}
			DepthOutRg.fx.Dispose();
			// Create the effect instance
			state.CreateEffect(out DepthOutRg.fx, DepthOutRg.fxb, 14, 7);
		}
		/// <summary>Warm (Preload) the shader</summary><param name="state"/>
		protected override void WarmShader(Xen.Graphics.ShaderSystem.ShaderSystemBase state)
		{
			// Shader is already warmed
			if ((DrawVelocityBillboardParticles_GpuTex3D.gd == state.DeviceUniqueIndex))
			{
				return;
			}
			// Setup the shader
			if ((DrawVelocityBillboardParticles_GpuTex3D.gd != state.DeviceUniqueIndex))
			{
				this.gdInit(state);
			}
			DrawVelocityBillboardParticles_GpuTex3D.fx.Dispose();
			// Create the effect instance
			state.CreateEffect(out DrawVelocityBillboardParticles_GpuTex3D.fx, DrawVelocityBillboardParticles_GpuTex3D.fxb, 55, 8);
		}
		/// <summary>Warm (Preload) the shader</summary><param name="state"/>
		protected override void WarmShader(Xen.Graphics.ShaderSystem.ShaderSystemBase state)
		{
			// Shader is already warmed
			if ((ParticleStoreLife128.gd == state.DeviceUniqueIndex))
			{
				return;
			}
			// Setup the shader
			if ((ParticleStoreLife128.gd != state.DeviceUniqueIndex))
			{
				this.gdInit(state);
			}
			ParticleStoreLife128.fx.Dispose();
			// Create the effect instance
			state.CreateEffect(out ParticleStoreLife128.fx, ParticleStoreLife128.fxb, 20, 5);
		}
		/// <summary>Warm (Preload) the shader</summary><param name="state"/>
		protected override void WarmShader(Xen.Graphics.ShaderSystem.ShaderSystemBase state)
		{
			// Shader is already warmed
			if ((InstancingSprite.gd == state.DeviceUniqueIndex))
			{
				return;
			}
			// Setup the shader
			if ((InstancingSprite.gd != state.DeviceUniqueIndex))
			{
				this.gdInit(state);
			}
			InstancingSprite.fx.Dispose();
			// Create the effect instance
			state.CreateEffect(out InstancingSprite.fx, InstancingSprite.fxb, 36, 6);
		}
		/// <summary>Warm (Preload) the shader</summary><param name="state"/>
		protected override void WarmShader(Xen.Graphics.ShaderSystem.ShaderSystemBase state)
		{
			// Shader is already warmed
			if ((FillCustomTexture.gd == state.DeviceUniqueIndex))
			{
				return;
			}
			// Setup the shader
			if ((FillCustomTexture.gd != state.DeviceUniqueIndex))
			{
				this.gdInit(state);
			}
			FillCustomTexture.fx.Dispose();
			// Create the effect instance
			state.CreateEffect(out FillCustomTexture.fx, FillCustomTexture.fxb, 7, 4);
		}
		/// <summary>Warm (Preload) the shader</summary><param name="state"/>
		protected override void WarmShader(Xen.Graphics.ShaderSystem.ShaderSystemBase state)
		{
			// Shader is already warmed
			if ((Tutorial03Technique.gd == state.DeviceUniqueIndex))
			{
				return;
			}
			// Setup the shader
			if ((Tutorial03Technique.gd != state.DeviceUniqueIndex))
			{
				this.gdInit(state);
			}
			Tutorial03Technique.fx.Dispose();
			// Create the effect instance
			state.CreateEffect(out Tutorial03Technique.fx, Tutorial03Technique.fxb, 7, 1);
		}
		/// <summary>Setup shader static values</summary><param name="state"/>
		private void gdInit(Xen.Graphics.ShaderSystem.ShaderSystemBase state)
		{
			// set the graphics ID
			RgbmDecode.gd = state.DeviceUniqueIndex;
			this.GraphicsID = state.DeviceUniqueIndex;
			RgbmDecode.cid0 = state.GetNameUniqueID("UseExposureTonemapping");
			RgbmDecode.cid1 = state.GetNameUniqueID("UseFilmApproxTonemapping");
			RgbmDecode.cid2 = state.GetNameUniqueID("UseGammaCorrection");
			RgbmDecode.cid3 = state.GetNameUniqueID("UseInverseOneTonemapping");
			RgbmDecode.gid0 = state.GetGlobalUniqueID<Microsoft.Xna.Framework.Vector2>("BloomScaleThreshold");
			RgbmDecode.gid1 = state.GetGlobalUniqueID<float>("LensExposure");
			RgbmDecode.gid2 = state.GetGlobalUniqueID<Microsoft.Xna.Framework.Vector2>("RgbmImageRenderScale");
			RgbmDecode.sid0 = state.GetNameUniqueID("BloomSampler");
			RgbmDecode.sid1 = state.GetNameUniqueID("InputSampler");
			RgbmDecode.tid0 = state.GetNameUniqueID("InputTexture");
			RgbmDecode.tid1 = state.GetNameUniqueID("BloomTexture");
		}
		/// <summary>Bind the shader, 'ic' indicates the shader instance has changed and 'ec' indicates the extension has changed.</summary><param name="state"/><param name="ic"/><param name="ec"/><param name="ext"/>
		protected override void BeginImpl(Xen.Graphics.ShaderSystem.ShaderSystemBase state, bool ic, bool ec, Xen.Graphics.ShaderSystem.ShaderExtension ext)
		{
			// if the device changed, call Warm()
			if ((state.DeviceUniqueIndex != DrawVelocityBillboardParticles_GpuTex3D.gd))
			{
				this.WarmShader(state);
				ic = true;
			}
			// Force updating if the instance has changed
			this.vreg_change = (this.vreg_change | ic);
			// Set the value for attribute 'viewPoint'
			this.vreg_change = (this.vreg_change | state.SetViewPointVector3(ref this.vreg[7], ref this.sc0));
			Microsoft.Xna.Framework.Vector4 unused = new Microsoft.Xna.Framework.Vector4();
			// Set the value for attribute 'worldMatrix'
			this.vreg_change = (this.vreg_change | state.SetWorldMatrix(ref this.vreg[4], ref this.vreg[5], ref this.vreg[6], ref unused, ref this.sc1));
			// Set the value for attribute 'worldViewProj'
			this.vreg_change = (this.vreg_change | state.SetWorldViewProjectionMatrix(ref this.vreg[0], ref this.vreg[1], ref this.vreg[2], ref this.vreg[3], ref this.sc2));
			// Assign pixel shader textures and samplers
			if ((ic | this.ptc))
			{
				state.SetPixelShaderSamplers(this.ptx, this.pts);
				this.ptc = false;
			}
			// Assign pixel shader textures and samplers
			if ((ic | this.vtc))
			{
				state.SetVertexShaderSamplers(this.vtx, this.vts);
				this.vtc = false;
			}
			if ((this.vreg_change == true))
			{
				DrawVelocityBillboardParticles_GpuTex3D.fx.vs_c.SetValue(this.vreg);
				this.vreg_change = false;
				ic = true;
			}
			// Finally, bind the effect
			if ((ic | ec))
			{
				state.SetEffect(this, ref DrawVelocityBillboardParticles_GpuTex3D.fx, ext);
			}
		}
		/// <summary>Bind the shader, 'ic' indicates the shader instance has changed and 'ec' indicates the extension has changed.</summary><param name="state"/><param name="ic"/><param name="ec"/><param name="ext"/>
		protected override void BeginImpl(Xen.Graphics.ShaderSystem.ShaderSystemBase state, bool ic, bool ec, Xen.Graphics.ShaderSystem.ShaderExtension ext)
		{
			// if the device changed, call Warm()
			if ((state.DeviceUniqueIndex != ParticleStoreLife128.gd))
			{
				this.WarmShader(state);
				ic = true;
			}
			// Force updating if the instance has changed
			this.vreg_change = (this.vreg_change | ic);
			if ((this.vreg_change == true))
			{
				ParticleStoreLife128.fx.vs_c.SetValue(this.vreg);
				this.vreg_change = false;
				ic = true;
			}
			// Finally, bind the effect
			if ((ic | ec))
			{
				state.SetEffect(this, ref ParticleStoreLife128.fx, ext);
			}
		}
		/// <summary>Bind the shader, 'ic' indicates the shader instance has changed and 'ec' indicates the extension has changed.</summary><param name="state"/><param name="ic"/><param name="ec"/><param name="ext"/>
		protected override void BeginImpl(Xen.Graphics.ShaderSystem.ShaderSystemBase state, bool ic, bool ec, Xen.Graphics.ShaderSystem.ShaderExtension ext)
		{
			// if the device changed, call Warm()
			if ((state.DeviceUniqueIndex != DrawGraphLine.gd))
			{
				this.WarmShader(state);
				ic = true;
			}
			// Force updating if the instance has changed
			this.vreg_change = (this.vreg_change | ic);
			// Set the value for attribute 'worldViewProj'
			this.vreg_change = (this.vreg_change | state.SetWorldViewProjectionMatrix(ref this.vreg[200], ref this.vreg[201], ref this.vreg[202], ref this.vreg[203], ref this.sc0));
			if ((this.vreg_change == true))
			{
				DrawGraphLine.fx.vs_c.SetValue(this.vreg);
				this.vreg_change = false;
				ic = true;
			}
			// Finally, bind the effect
			if ((ic | ec))
			{
				state.SetEffect(this, ref DrawGraphLine.fx, ext);
			}
		}
		public XnaDrawableGameComponentWrapper(Microsoft.Xna.Framework.DrawableGameComponent component, Xen.Graphics.DrawTarget owner, Application application)
			: base(component.Game)
		{
			if (owner == null || application == null) throw new ArgumentNullException();

			this.owner = owner;
			this.component = component;
			this.application = application;

			this.component.Initialize();
			this.DisposeHandler = new EventHandler<EventArgs>(OnDisposed);
			this.component.Disposed += DisposeHandler;

			//add this object to the main XNA update list, unless it's already there
			bool addToUpdateList = true;
			Microsoft.Xna.Framework.GameComponentCollection components = application.XnaComponents;

			foreach (Microsoft.Xna.Framework.GameComponent item in components)
			{
				XnaDrawableGameComponentWrapper wrapper = item as XnaDrawableGameComponentWrapper;
				if (item == component || (wrapper != null && wrapper.component == component))
				{
					//already in the list...
					addToUpdateList = false;
					break;
				}
			}

			if (addToUpdateList)
			{
				components.Add(this);

				this.UpdateOrderChangedHandler = new EventHandler<EventArgs>(OnUpdateOrderChangedHandler);
				this.component.UpdateOrderChanged += UpdateOrderChangedHandler;
			}
		}
		/// <summary>Draw the cone as a batch</summary>
		public void DrawBatch(DrawState state, Xen.Graphics.InstanceBuffer instances)
		{
			verts.DrawInstances(state, inds, PrimitiveType.TriangleList, instances);
		}
		/// <summary>Set a shader texture of type 'Texture2D' by global unique ID, see <see cref="Xen.Graphics.ShaderSystem.ShaderSystemBase.GetNameUniqueID"/> for details.</summary><param name="state"/><param name="id"/><param name="value"/>
		protected override bool SetTextureImpl(Xen.Graphics.ShaderSystem.ShaderSystemBase state, int id, Microsoft.Xna.Framework.Graphics.Texture2D value)
		{
			if ((RgbmDecodeBloomPass.gd != state.DeviceUniqueIndex))
			{
				this.WarmShader(state);
			}
			if ((id == RgbmDecodeBloomPass.tid0))
			{
				this.InputTexture = value;
				return true;
			}
			return false;
		}