internal static void SAFE_RELEASE(ref D3D12MA_Allocator *ptr)
 {
     if (ptr != null)
     {
         _   = ptr->Release();
         ptr = null;
     }
 }
        public static void _ctor(ref D3D12MA_NormalBlock pThis, D3D12MA_Allocator *allocator, ref D3D12MA_BlockVector blockVector, [NativeTypeName("const D3D12_HEAP_PROPERTIES&")] D3D12_HEAP_PROPERTIES *heapProps, D3D12_HEAP_FLAGS heapFlags, [NativeTypeName("UINT64")] ulong size, [NativeTypeName("UINT")] uint id)
        {
            pThis.Base        = new D3D12MA_MemoryBlock(allocator, heapProps, heapFlags, size, id);
            pThis.Base.lpVtbl = Vtbl;

            pThis.m_pMetadata   = null;
            pThis.m_BlockVector = (D3D12MA_BlockVector *)Unsafe.AsPointer(ref blockVector);
        }
        public D3D12MA_Allocation *Allocate(D3D12MA_Allocator *allocator, ulong size, int wasZeroInitialized)
        {
            using var mutexLock = new D3D12MA_MutexLock(ref m_Mutex);

            var allocation = m_Allocator.Alloc();

            D3D12MA_Allocation._ctor(ref *allocation, allocator, size, wasZeroInitialized);

            return(allocation);
        }
Esempio n. 4
0
        public D3D12MA_MemoryBlock(D3D12MA_Allocator *allocator, [NativeTypeName("const D3D12_HEAP_PROPERTIES&")] D3D12_HEAP_PROPERTIES *heapProps, D3D12_HEAP_FLAGS heapFlags, [NativeTypeName("UINT64")] ulong size, [NativeTypeName("UINT")] uint id)
        {
            lpVtbl = Vtbl;

            m_Allocator = allocator;
            m_HeapProps = *heapProps;
            m_HeapFlags = heapFlags;
            m_Size      = size;
            m_Id        = id;
            m_Heap      = null;
        }
Esempio n. 5
0
        internal static void _ctor(ref D3D12MA_BlockVector pThis, D3D12MA_Allocator *hAllocator, [NativeTypeName("const D3D12_HEAP_PROPERTIES&")] D3D12_HEAP_PROPERTIES *heapProps, D3D12_HEAP_FLAGS heapFlags, [NativeTypeName("UINT64")] ulong preferredBlockSize, [NativeTypeName("size_t")] nuint minBlockCount, [NativeTypeName("size_t")] nuint maxBlockCount, bool explicitBlockSize, [NativeTypeName("UINT64")] ulong minAllocationAlignment)
        {
            pThis.m_hAllocator             = hAllocator;
            pThis.m_HeapProps              = *heapProps;
            pThis.m_HeapFlags              = heapFlags;
            pThis.m_PreferredBlockSize     = preferredBlockSize;
            pThis.m_MinBlockCount          = minBlockCount;
            pThis.m_MaxBlockCount          = maxBlockCount;
            pThis.m_ExplicitBlockSize      = explicitBlockSize;
            pThis.m_MinAllocationAlignment = minAllocationAlignment;
            pThis.m_HasEmptyBlock          = false;
            D3D12MA_Vector <Pointer <D3D12MA_NormalBlock> > ._ctor(ref pThis.m_Blocks, hAllocator->GetAllocs());

            pThis.m_NextBlockId = 0;

            D3D12MA_RW_MUTEX._ctor(ref pThis.m_Mutex);
        }