public void Dispose() { if (vertexBuffer != null) { vertexBuffer.Dispose(); GC.SuppressFinalize(vertexBuffer); vertexBuffer = null; } if (fallbackVertexBuffer != null) { fallbackVertexBuffer.Dispose(); GC.SuppressFinalize(fallbackVertexBuffer); fallbackVertexBuffer = null; } if (spriteCornerVertexBuffer != null) { spriteCornerVertexBuffer.Dispose(); GC.SuppressFinalize(spriteCornerVertexBuffer); spriteCornerVertexBuffer = null; } if (indexBuffer != null) { indexBuffer.Dispose(); GC.SuppressFinalize(indexBuffer); indexBuffer = null; } }
public override void CleanUp(bool removeFromParent) { base.CleanUp(removeFromParent); this.ImageData = null; if (this.texture != null) { this.texture.Dispose(); GC.SuppressFinalize(texture); this.texture = null; } if (this.vertexBuffer != null) { try { this.vertexBuffer.Dispose(); GC.SuppressFinalize(vertexBuffer); this.vertexBuffer = null; } catch { } } if (this.indexBuffer != null) { try { indexBuffer.Dispose(); GC.SuppressFinalize(indexBuffer); indexBuffer = null; } catch { } } }
//[LayerProperty] //public override Color Color //{ // get // { // return base.Color; // } // set // { // base.Color = value; // CleanUp(); // } //} public override void CleanUp() { if (shapeFileIndex != null) { shapeFileIndex.Dispose(); GC.SuppressFinalize(shapeFileIndex); shapeFileIndex = null; } if (shapeFileVertex != null) { shapeFileVertex.Dispose(); GC.SuppressFinalize(shapeFileVertex); shapeFileVertex = null; } }
public static void ReturnShortIndexBuffer(IndexBuffer11 buff) { if (buff == null) { return; } //old code to dispose buffers buff.Dispose(); GC.SuppressFinalize(buff); //todo11 reenable buffer pooling //int count = buff.Count; //if (!IndexPools.ContainsKey(count)) //{ // IndexPools.Add(count, new Buffers(count)); //} //IndexPools[count].Entries.Push(buff); }
public override void CleanUp() { CleanAndReady = false; if (shapeFileIndex != null) { shapeFileIndex.Dispose(); GC.SuppressFinalize(shapeFileIndex); shapeFileIndex = null; } if (shapeFileVertex != null) { shapeFileVertex.Dispose(); GC.SuppressFinalize(shapeFileVertex); shapeFileVertex = null; } if (lineList != null) { lineList.Clear(); } if (lineList2d != null) { lineList2d.Clear(); } if (triangleList2d != null) { triangleList2d.Clear(); } if (triangleList != null) { triangleList.Clear(); } if (textBatch != null) { textBatch.CleanUp(); } }
public static void DisposeBuffers() { foreach (Buffers pool in IndexPools.Values) { foreach (object buf in pool.Entries) { IndexBuffer11 indexBuf = buf as IndexBuffer11; indexBuf.Dispose(); GC.SuppressFinalize(indexBuf); } } IndexPools.Clear(); foreach (Buffers pool in VertexX2Pools.Values) { foreach (object buf in pool.Entries) { VertexBuffer11 vertexBuf = buf as VertexBuffer11; vertexBuf.Dispose(); GC.SuppressFinalize(vertexBuf); } } Vector3dPools.Clear(); // no need to dispose since these are just managed buffers LockX2Pools.Clear(); Vector3dPools.Clear(); IndexU32Pools.Clear(); IndexU32Pools.Clear(); TriangleListPool.Entries.Clear(); foreach (Texture11 texture in TexturePool256) { texture.Dispose(); GC.SuppressFinalize(texture); } TexturePool256.Clear(); }