/// <summary>Begins this pass</summary>
        public override void Apply()
        {
            // Shaders
            bool shadersChanged = false;

            if (vertexShader != device.GetVertexShader())
            {
                device.SetVertexShader(vertexShader);
                shadersChanged = true;
            }

            if (pixelShader != device.GetPixelShader())
            {
                device.SetPixelShader(pixelShader);
                shadersChanged = true;
            }

            // Parameters
            // If shaderChanged == true, we don't know what was set in the registers before so
            // force all registers as dirty.
            ParentEffect.Apply(shadersChanged);

            foreach (SilverlightEffectInternalParameter effectParameter in Parameters)
            {
                effectParameter.Apply();
            }

            // Render states
            if (depthStencilState.IsActive)
            {
                depthStencilState.ProcessState(device);
            }

            if (blendState.IsActive)
            {
                blendState.ProcessState(device);
            }

            if (rasterizerState.IsActive)
            {
                rasterizerState.ProcessState(device);
            }

            for (int index = 0; index < SamplerStatesCount; index++)
            {
                if (samplerStates[index].IsActive)
                {
                    samplerStates[index].ProcessState(device);
                }
            }
        }