Beispiel #1
0
        internal static void _ctor(ref D3D12MA_Pool pThis, ref D3D12MA_Allocator allocator, [NativeTypeName("const D3D12MA_POOL_DESC&")] D3D12MA_POOL_DESC *desc)
        {
            D3D12MA_IUnknownImpl._ctor(ref pThis.m_IUnknownImpl, Vtbl);

            pThis.m_Allocator   = (D3D12MA_Allocator *)Unsafe.AsPointer(ref allocator);
            pThis.m_Desc        = *desc;
            pThis.m_BlockVector = null;
            pThis.m_Name        = null;
            pThis.m_PrevPool    = null;
            pThis.m_NextPool    = 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,
                (D3D12MA_Allocator *)Unsafe.AsPointer(ref allocator),
                &desc->HeapProperties,
                heapFlags,
                preferredBlockSize,
                desc->MinBlockCount, maxBlockCount,
                explicitBlockSize,
                D3D12MA_MAX(desc->MinAllocationAlignment, D3D12MA_DEBUG_ALIGNMENT)
                );
        }
Beispiel #2
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);
        }
        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);
        }