/// <summary> /// constructor /// </summary> /// <param name="physicalBuffer"></param> public DataChunk(IPhysicalGraphicsBuffer physicalBuffer) { PhysicalBuffer = physicalBuffer; Available = physicalBuffer.Size; GraphicsStreams = new ArrayList(); FreeSlots = new ArrayList( ); FreeSlots.Add(new Slot(0, Available)); }
/// <summary> /// disposes online data /// </summary> public void DisposeOnlineData() { if (HasOnlineData()) { BufferManager.RemoveBuffer(this); } physicalBuffer = null; changeCounter = 0; }
/// <summary> /// adds a new DataChunk for the given stream format /// </summary> /// <param name="key">of entry</param> /// <param name="stream">stream to create DataChunk for</param> /// <returns></returns> protected DataChunk AddDataChunk(object key, IGraphicsStream stream) { Log.Spam("Create stream " + stream.ToString()); ArrayList list = table[key] as ArrayList; IPhysicalGraphicsBuffer physical = CreatePhysicalBuffer(stream); DataChunk chunk = new DataChunk(physical); list.Add(chunk); return(chunk); }
/// <summary> /// uploads from offline to online data /// </summary> public void Upload() { if (!IsSoftware) { if (physicalBuffer == null) { physicalBuffer = BufferManager.GetBuffer(this); } physicalBuffer.Upload(Data, position, 0, Data.Length); this.changeCounter = physicalBuffer.ChangeCounter; } }
/// <summary> /// uploads from offline to online data /// </summary> /// <param name="start">The start index for uploading.</param> /// <param name="length">The number of elements to upload</param> public void Upload(int start, int length) { if (!IsSoftware) { if (physicalBuffer == null) { physicalBuffer = BufferManager.GetBuffer(this); } Purple.Profiling.Profiler.Instance.Begin("Upload"); physicalBuffer.Upload(Data, position, start, length); Profiling.Profiler.Instance.End("Upload"); this.changeCounter = physicalBuffer.ChangeCounter; } }
/// <summary> /// frees ressources /// </summary> public void Dispose() { PhysicalBuffer.Dispose(); PhysicalBuffer = null; }