Exemple #1
0
        internal static void _ctor(ref D3D12MA_BlockVector pThis, D3D12MA_AllocatorPimpl *hAllocator, D3D12_HEAP_TYPE heapType, D3D12_HEAP_FLAGS heapFlags, [NativeTypeName("UINT64")] ulong preferredBlockSize, [NativeTypeName("size_t")] nuint minBlockCount, [NativeTypeName("size_t")] nuint maxBlockCount, bool explicitBlockSize)
        {
            pThis.m_hAllocator         = hAllocator;
            pThis.m_HeapType           = heapType;
            pThis.m_HeapFlags          = heapFlags;
            pThis.m_PreferredBlockSize = preferredBlockSize;
            pThis.m_MinBlockCount      = minBlockCount;
            pThis.m_MaxBlockCount      = maxBlockCount;
            pThis.m_ExplicitBlockSize  = explicitBlockSize;
            pThis.m_MinBytes           = 0;
            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);
        }
        internal static void _ctor(ref D3D12MA_PoolPimpl pThis, D3D12MA_AllocatorPimpl *allocator, [NativeTypeName("const D3D12MA_POOL_DESC&")] D3D12MA_POOL_DESC *desc)
        {
            pThis.m_Allocator   = allocator;
            pThis.m_Desc        = *desc;
            pThis.m_BlockVector = null;
            pThis.m_Name        = null;

            bool  explicitBlockSize  = desc->BlockSize != 0;
            ulong preferredBlockSize = explicitBlockSize ? desc->BlockSize : D3D12MA_DEFAULT_BLOCK_SIZE;

            D3D12_HEAP_FLAGS heapFlags     = desc->HeapFlags;
            uint             maxBlockCount = desc->MaxBlockCount != 0 ? desc->MaxBlockCount : uint.MaxValue;

            pThis.m_BlockVector = D3D12MA_NEW <D3D12MA_BlockVector>(allocator->GetAllocs());
            D3D12MA_BlockVector._ctor(
                ref *pThis.m_BlockVector,
                allocator, desc->HeapType, heapFlags,
                preferredBlockSize,
                desc->MinBlockCount, maxBlockCount,
                explicitBlockSize
                );
        }
        public static void _ctor(ref D3D12MA_NormalBlock pThis, D3D12MA_AllocatorPimpl *allocator, ref D3D12MA_BlockVector blockVector, D3D12_HEAP_TYPE heapType, D3D12_HEAP_FLAGS heapFlags, [NativeTypeName("UINT64")] ulong size, [NativeTypeName("UINT")] uint id)
        {
            pThis.Base        = new D3D12MA_MemoryBlock(allocator, heapType, heapFlags, size, id);
            pThis.Base.lpVtbl = Vtbl;

            pThis.m_pMetadata   = null;
            pThis.m_BlockVector = (D3D12MA_BlockVector *)Unsafe.AsPointer(ref blockVector);
        }