/// <summary> /// Registers the custom allocator and hooks into it's supplied events /// </summary> protected void RegisterCustomAllocator(ICustomAllocator allocator) { FreeCustomAllocator(); if (allocator == null) { return; } m_customAllocator = allocator; m_customAllocator.NewAllocatorFrame += CustomAllocatorNewAllocatorFrame; m_customAllocator.NewAllocatorSurface += CustomAllocatorNewAllocatorSurface; }
/// <summary> /// Disposes of the current allocator /// </summary> protected void FreeCustomAllocator() { if (m_customAllocator == null) { return; } m_customAllocator.Dispose(); m_customAllocator.NewAllocatorFrame -= CustomAllocatorNewAllocatorFrame; m_customAllocator.NewAllocatorSurface -= CustomAllocatorNewAllocatorSurface; if (Marshal.IsComObject(m_customAllocator)) { Marshal.ReleaseComObject(m_customAllocator); } m_customAllocator = null; }
/// <summary> /// Registers the custom allocator and hooks into it's supplied events /// </summary> protected void RegisterCustomAllocator(ICustomAllocator allocator) { FreeCustomAllocator(); if (allocator == null) return; m_customAllocator = allocator; m_customAllocator.NewAllocatorFrame += CustomAllocator_NewAllocatorFrame; m_customAllocator.NewAllocatorSurface += CustomAllocator_NewAllocatorSurface; }
/// <summary> /// Disposes of the current allocator /// </summary> protected void FreeCustomAllocator() { if (m_customAllocator == null) return; m_customAllocator.NewAllocatorFrame -= CustomAllocator_NewAllocatorFrame; m_customAllocator.NewAllocatorSurface -= CustomAllocator_NewAllocatorSurface; m_customAllocator.Dispose(); m_customAllocator = null; }
/// <summary> /// Disposes of the current allocator /// </summary> protected void FreeCustomAllocator() { if (m_customAllocator == null) return; m_customAllocator.Dispose(); m_customAllocator.NewAllocatorFrame -= CustomAllocatorNewAllocatorFrame; m_customAllocator.NewAllocatorSurface -= CustomAllocatorNewAllocatorSurface; if(Marshal.IsComObject(m_customAllocator)) Marshal.ReleaseComObject(m_customAllocator); m_customAllocator = null; }