Exemplo n.º 1
0
            /// <summary>
            ///     Comparse 2 HardwareBuffers for equality.
            /// </summary>
            /// <param name="x"></param>
            /// <param name="y"></param>
            /// <returns></returns>
            public new bool Equals(object x, object y)
            {
                HardwareBuffer a = x as HardwareBuffer;
                HardwareBuffer b = y as HardwareBuffer;

                return(a.ID == b.ID);
            }
        /// <summary>
        ///     Copy data from another buffer into this one.
        /// </summary>
        /// <param name="srcBuffer">The buffer from which to read the copied data.</param>
        /// <param name="srcOffset">Offset in the source buffer at which to start reading.</param>
        /// <param name="destOffset">Offset in the destination buffer to start writing.</param>
        /// <param name="length">Length of the data to copy, in bytes.</param>
        /// <param name="discardWholeBuffer">If true, will discard the entire contents of this buffer before copying.</param>
        public virtual void CopyData(HardwareBuffer srcBuffer, int srcOffset, int destOffset, int length, bool discardWholeBuffer)
        {
            // lock the source buffer
            IntPtr srcData = srcBuffer.Lock(srcOffset, length, BufferLocking.ReadOnly);

            // write the data to this buffer
            this.WriteData(destOffset, length, srcData, discardWholeBuffer);

            // unlock the source buffer
            srcBuffer.Unlock();
        }
 /// <summary>
 ///     Implementation of LicenseExpired.
 /// </summary>
 /// <param name="buffer"></param>
 public void LicenseExpired(HardwareBuffer buffer)
 {
     if (buffer == destPositionBuffer)
     {
         destPositionBuffer = null;
     }
     if (buffer == destNormalBuffer)
     {
         destNormalBuffer = null;
     }
 }
 /// <summary>
 ///     Constructor.
 /// </summary>
 /// <param name="usage">Usage type.</param>
 /// <param name="useSystemMemory"></param>
 /// <param name="useShadowBuffer">Use a software shadow buffer?</param>
 internal HardwareBuffer(BufferUsage usage, bool useSystemMemory, bool useShadowBuffer)
 {
     this.usage                  = usage;
     this.useSystemMemory        = useSystemMemory;
     this.useShadowBuffer        = useShadowBuffer;
     this.shadowBuffer           = null;
     this.shadowUpdated          = false;
     this.suppressHardwareUpdate = false;
     ID = nextID++;
     if (useShadowBuffer && usage == BufferUsage.Dynamic)
     {
         usage = BufferUsage.DynamicWriteOnly;
     }
     else if (useShadowBuffer && usage == BufferUsage.Static)
     {
         usage = BufferUsage.StaticWriteOnly;
     }
 }
Exemplo n.º 5
0
		/// <summary>
		///     Constructor.
		/// </summary>
		/// <param name="owner">Reference to the hardware buffer who owns this stream.</param>
		/// <param name="data">Pointer to the raw data we will be writing to.</param>
		internal BufferStream( HardwareBuffer owner, IntPtr data )
		{
			this.data = data;
			this.owner = owner;
		}
 /// <summary>
 ///     Implementation of LicenseExpired.
 /// </summary>
 /// <param name="buffer"></param>
 public void LicenseExpired(HardwareBuffer buffer)
 {
     if(buffer == destPositionBuffer) {
         destPositionBuffer = null;
     }
     if(buffer == destNormalBuffer) {
         destNormalBuffer = null;
     }
 }
Exemplo n.º 7
0
		/// <summary>
		///     Constructor.
		/// </summary>
		/// <param name="owner">Reference to the hardware buffer who owns this stream.</param>
		/// <param name="data">Pointer to the raw data we will be writing to.</param>
		internal BufferStream( HardwareBuffer owner, BufferBase data )
		{
			this.data = data;
			this.owner = owner;
		}
Exemplo n.º 8
0
            public int GetHashCode(object x)
            {
                HardwareBuffer a = x as HardwareBuffer;

                return(a.ID);
            }
Exemplo n.º 9
0
 public void DisposeIndexBuffer(HardwareBuffer buffer)
 {
     indexBuffers.Remove(buffer);
     buffer.Dispose();
 }
        /// <summary>
        ///     Copy data from another buffer into this one.
        /// </summary>
        /// <param name="srcBuffer">The buffer from which to read the copied data.</param>
        /// <param name="srcOffset">Offset in the source buffer at which to start reading.</param>
        /// <param name="destOffset">Offset in the destination buffer to start writing.</param>
        /// <param name="length">Length of the data to copy, in bytes.</param>
        /// <param name="discardWholeBuffer">If true, will discard the entire contents of this buffer before copying.</param>
        public virtual void CopyData(HardwareBuffer srcBuffer, int srcOffset, int destOffset, int length, bool discardWholeBuffer)
        {
            // lock the source buffer
            IntPtr srcData = srcBuffer.Lock(srcOffset, length, BufferLocking.ReadOnly);

            // write the data to this buffer
            this.WriteData(destOffset, length, srcData, discardWholeBuffer);

            // unlock the source buffer
            srcBuffer.Unlock();
        }
 /// <summary>
 ///     Copy data from another buffer into this one.
 /// </summary>
 /// <param name="srcBuffer">The buffer from which to read the copied data.</param>
 /// <param name="srcOffset">Offset in the source buffer at which to start reading.</param>
 /// <param name="destOffset">Offset in the destination buffer to start writing.</param>
 /// <param name="length">Length of the data to copy, in bytes.</param>
 public virtual void CopyData(HardwareBuffer srcBuffer, int srcOffset, int destOffset, int length)
 {
     // call the overloaded method
     CopyData(srcBuffer, srcOffset, destOffset, length, false);
 }
 /// <summary>
 ///     Constructor.
 /// </summary>
 /// <param name="usage">Usage type.</param>
 /// <param name="useSystemMemory"></param>
 /// <param name="useShadowBuffer">Use a software shadow buffer?</param>
 internal HardwareBuffer(BufferUsage usage, bool useSystemMemory, bool useShadowBuffer)
 {
     this.usage = usage;
     this.useSystemMemory = useSystemMemory;
     this.useShadowBuffer = useShadowBuffer;
     this.shadowBuffer = null;
     this.shadowUpdated = false;
     this.suppressHardwareUpdate = false;
     ID = nextID++;
     if (useShadowBuffer && usage == BufferUsage.Dynamic)
         usage = BufferUsage.DynamicWriteOnly;
     else if (useShadowBuffer && usage == BufferUsage.Static)
         usage = BufferUsage.StaticWriteOnly;
 }
 public void DisposeVertexBuffer(HardwareBuffer buffer)
 {
     vertexBuffers.Remove(buffer);
     buffer.Dispose();
 }
 public void DisposeIndexBuffer(HardwareBuffer buffer)
 {
     indexBuffers.Remove(buffer);
     buffer.Dispose();
 }
 /// <summary>
 ///     Copy data from another buffer into this one.
 /// </summary>
 /// <param name="srcBuffer">The buffer from which to read the copied data.</param>
 /// <param name="srcOffset">Offset in the source buffer at which to start reading.</param>
 /// <param name="destOffset">Offset in the destination buffer to start writing.</param>
 /// <param name="length">Length of the data to copy, in bytes.</param>
 public virtual void CopyData(HardwareBuffer srcBuffer, int srcOffset, int destOffset, int length)
 {
     // call the overloaded method
     CopyData(srcBuffer, srcOffset, destOffset, length, false);
 }
Exemplo n.º 16
0
 public void DisposeVertexBuffer(HardwareBuffer buffer)
 {
     vertexBuffers.Remove(buffer);
     buffer.Dispose();
 }
Exemplo n.º 17
0
 /// <summary>
 ///     Constructor.
 /// </summary>
 /// <param name="owner">Reference to the hardware buffer who owns this stream.</param>
 /// <param name="data">Pointer to the raw data we will be writing to.</param>
 internal BufferStream(HardwareBuffer owner, IntPtr data)
 {
     this.data  = data;
     this.owner = owner;
 }
Exemplo n.º 18
0
 /// <summary>
 ///     Constructor.
 /// </summary>
 /// <param name="owner">Reference to the hardware buffer who owns this stream.</param>
 /// <param name="data">Pointer to the raw data we will be writing to.</param>
 internal BufferStream(HardwareBuffer owner, BufferBase data)
 {
     this.data  = data;
     this.owner = owner;
 }