/// <summary>
 /// Define double buffered RenderSurface.
 /// </summary>
 /// <param name="policy">
 /// A <see cref="BufferPolicy"/>
 /// </param>
 public void DefineStereoBuffers(BufferPolicy policy)
 {
     // Define buffer
     DefineBuffer(BufferType.Stereo, policy);
     // Set stereo buffer flag
     mStereoBuffers = true;
 }
 /// <summary>
 /// Define double buffered RenderSurface.
 /// </summary>
 /// <param name="policy">
 /// A <see cref="BufferPolicy"/>
 /// </param>
 public void DefineDoubleBuffers(BufferPolicy policy)
 {
     // Define buffer
     DefineBuffer(BufferType.Double, policy);
     // Set double buffer flag
     mDoubleBuffers = true;
 }
        /// <summary>
        /// Define RenderSurface multisample buffer.
        /// </summary>
        /// <param name="bits">
        /// A <see cref="Int32"/>
        /// </param>
        /// <param name="policy">
        /// A <see cref="BufferPolicy"/>
        /// </param>
        public void DefineMultisampleBuffer(uint bits, BufferPolicy policy)
        {
            if (bits == 0)
            {
                throw new ArgumentException("zero bits", "bits");
            }

            // Define buffer
            DefineBuffer(BufferType.Multisample, policy);
            // Set multisample bits
            mMultisampleBits = bits;
        }
        /// <summary>
        /// Define RenderSurface color buffer.
        /// </summary>
        /// <param name="pType">
        /// A <see cref="PixelLayout"/>
        /// </param>
        /// <param name="policy">
        /// A <see cref="BufferPolicy"/>
        /// </param>
        public void DefineColorSRGBBuffer(PixelLayout pType, BufferPolicy policy)
        {
            if (pType == PixelLayout.None)
            {
                throw new ArgumentException("invalid pixel type", "pType");
            }

            // Define buffer
            DefineBuffer(BufferType.ColorSRGB, policy);
            // Set color buffer bits.
            mColorType = pType;
        }
        /// <summary>
        /// Define RenderSurface stencil buffer.
        /// </summary>
        /// <param name="bits">
        /// A <see cref="Int32"/>
        /// </param>
        /// <param name="policy">
        /// A <see cref="BufferPolicy"/>
        /// </param>
        public void DefineStencilBuffer(uint bits, BufferPolicy policy)
        {
            if (bits == 0)
            {
                throw new ArgumentException("zero bits", "bits");
            }

            // Define buffer
            DefineBuffer(BufferType.Stencil, policy);
            // Set depth buffer bits
            mStencilBits = bits;
        }
        /// <summary>
        /// Define a buffer in this configuration.
        /// </summary>
        /// <param name="bType">
        /// A <see cref="BufferType"/> indicating the buffer to define.
        /// </param>
        /// <param name="bPolicy">
        /// A <see cref="BufferPolicy"/> specifing the buffer definition policy.
        /// </param>
        private void DefineBuffer(BufferType bType, BufferPolicy bPolicy)
        {
            // Store color buffer definition policy
            switch (bPolicy)
            {
            case BufferPolicy.DontCare:
                mRequiredSurfaceBuffers   &= ~bType;
                mDegradableSurfaceBuffers &= ~bType;
                break;

            case BufferPolicy.Required:
                mRequiredSurfaceBuffers   |= bType;
                mDegradableSurfaceBuffers &= ~bType;
                break;

            case BufferPolicy.RequiredAndDegradable:
                mRequiredSurfaceBuffers   |= bType;
                mDegradableSurfaceBuffers |= bType;
                break;
            }
            // Define buffer
            mSurfaceBuffers |= bType;
        }
 /// <summary>
 /// Define RenderSurface format index.
 /// </summary>
 /// <param name="formatIndex">
 /// A <see cref="Int32"/>
 /// </param>
 /// <param name="policy">
 /// A <see cref="BufferPolicy"/>
 /// </param>
 public void DefineFormatIndex(int formatIndex, BufferPolicy policy)
 {
     mFormatIndex  = formatIndex;
     mFormatPolicy = policy;
 }
		/// <summary>
		/// Define double buffered RenderSurface.
		/// </summary>
		/// <param name="policy">
		/// A <see cref="BufferPolicy"/>
		/// </param>
		public void DefineDoubleBuffers(BufferPolicy policy)
		{
			// Define buffer
			DefineBuffer(BufferType.Double, policy);
			// Set double buffer flag
			mDoubleBuffers = true;
		}
		/// <summary>
		/// Define double buffered RenderSurface.
		/// </summary>
		/// <param name="policy">
		/// A <see cref="BufferPolicy"/>
		/// </param>
		public void DefineStereoBuffers(BufferPolicy policy)
		{
			// Define buffer
			DefineBuffer(BufferType.Stereo, policy);
			// Set stereo buffer flag
			mStereoBuffers = true;
		}
		/// <summary>
		/// Define RenderSurface multisample buffer.
		/// </summary>
		/// <param name="bits">
		/// A <see cref="Int32"/>
		/// </param>
		/// <param name="policy">
		/// A <see cref="BufferPolicy"/>
		/// </param>
		public void DefineMultisampleBuffer(uint bits, BufferPolicy policy)
		{
			if (bits == 0)
				throw new ArgumentException("zero bits", "bits");
			
			// Define buffer
			DefineBuffer(BufferType.Multisample, policy);
			// Set multisample bits
			mMultisampleBits = bits;
		}
		/// <summary>
		/// Define RenderSurface stencil buffer.
		/// </summary>
		/// <param name="bits">
		/// A <see cref="Int32"/>
		/// </param>
		/// <param name="policy">
		/// A <see cref="BufferPolicy"/>
		/// </param>
		public void DefineStencilBuffer(uint bits, BufferPolicy policy)
		{
			if (bits == 0)
				throw new ArgumentException("zero bits", "bits");
			
			// Define buffer
			DefineBuffer(BufferType.Stencil, policy);
			// Set depth buffer bits
			mStencilBits = bits;
		}
		/// <summary>
		/// Define RenderSurface color buffer. 
		/// </summary>
		/// <param name="pType">
		/// A <see cref="PixelLayout"/>
		/// </param>
		/// <param name="policy">
		/// A <see cref="BufferPolicy"/>
		/// </param>
		public void DefineColorSRGBBuffer(PixelLayout pType, BufferPolicy policy)
		{
			if (pType == PixelLayout.None)
				throw new ArgumentException("invalid pixel type", "pType");

			// Define buffer
			DefineBuffer(BufferType.ColorSRGB, policy);
			// Set color buffer bits.
			mColorType = pType;
		}
		/// <summary>
		/// Define RenderSurface format index. 
		/// </summary>
		/// <param name="formatIndex">
		/// A <see cref="Int32"/>
		/// </param>
		/// <param name="policy">
		/// A <see cref="BufferPolicy"/>
		/// </param>
		public void DefineFormatIndex(int formatIndex, BufferPolicy policy)
		{
			mFormatIndex = formatIndex;
			mFormatPolicy = policy;
		}
		/// <summary>
		/// Define a buffer in this configuration.
		/// </summary>
		/// <param name="bType">
		/// A <see cref="BufferType"/> indicating the buffer to define.
		/// </param>
		/// <param name="bPolicy">
		/// A <see cref="BufferPolicy"/> specifing the buffer definition policy.
		/// </param>
		private void DefineBuffer(BufferType bType, BufferPolicy bPolicy)
		{
			// Store color buffer definition policy
			switch (bPolicy) {
				case BufferPolicy.DontCare:
					mRequiredSurfaceBuffers &= ~bType;
					mDegradableSurfaceBuffers &= ~bType;
					break;
				case BufferPolicy.Required:
					mRequiredSurfaceBuffers |= bType;
					mDegradableSurfaceBuffers &= ~bType;
					break;
				case BufferPolicy.RequiredAndDegradable:
					mRequiredSurfaceBuffers |= bType;
					mDegradableSurfaceBuffers |= bType;
					break;
			}
			// Define buffer
			mSurfaceBuffers |= bType;
		}