Exemplo n.º 1
0
        public void CalculateStats([NativeTypeName("StatInfo&")] ref D3D12MA_StatInfo outStats)
        {
            ZeroMemory(Unsafe.AsPointer(ref outStats), (nuint)sizeof(D3D12MA_StatInfo));
            outStats.AllocationSizeMin  = UINT64_MAX;
            outStats.UnusedRangeSizeMin = UINT64_MAX;

            using D3D12MA_MutexLockRead @lock = new(ref m_Mutex, m_useMutex != 0);

            for (D3D12MA_Allocation *alloc = m_AllocationList.Front();
                 alloc != null; alloc = D3D12MA_IntrusiveLinkedList <D3D12MA_Allocation> .GetNext(alloc))
            {
                ulong size = alloc->GetSize();
                ++outStats.BlockCount;
                ++outStats.AllocationCount;
                outStats.UsedBytes += size;

                if (size > outStats.AllocationSizeMax)
                {
                    outStats.AllocationSizeMax = size;
                }

                if (size < outStats.AllocationSizeMin)
                {
                    outStats.AllocationSizeMin = size;
                }
            }
        }
        public static void _ctor(ref D3D12MA_IntrusiveLinkedList <TItemType> pThis, [NativeTypeName("IntrusiveLinkedList<ItemTypeTraits>&&")] D3D12MA_IntrusiveLinkedList <TItemType> **src)
        {
            pThis.m_Front = (*src)->m_Front;
            pThis.m_Back  = (*src)->m_Back;
            pThis.m_Count = (*src)->m_Count;

            (*src)->m_Front = (*src)->m_Back = null;
            (*src)->m_Count = 0;
        }
Exemplo n.º 3
0
        /// <summary>Writes JSON array with the list of allocations.</summary>
        public void BuildStatsString([NativeTypeName("JsonWriter&")] ref D3D12MA_JsonWriter json)
        {
            using D3D12MA_MutexLockRead @lock = new(ref m_Mutex, m_useMutex != 0);

            json.BeginArray();
            for (D3D12MA_Allocation *alloc = m_AllocationList.Front();
                 alloc != null; alloc = D3D12MA_IntrusiveLinkedList <D3D12MA_Allocation> .GetNext(alloc))
            {
                json.BeginObject(true);
                json.AddAllocationToObject(alloc);
                json.EndObject();
            }
            json.EndArray();
        }
        public D3D12MA_IntrusiveLinkedList <TItemType> *Assign([NativeTypeName("IntrusiveLinkedList<ItemTypeTraits>&&")] D3D12MA_IntrusiveLinkedList <TItemType> **src)
        {
            if (*src != Unsafe.AsPointer(ref this))
            {
                D3D12MA_HEAVY_ASSERT((D3D12MA_DEBUG_LEVEL > 1) && (IsEmpty()));
                m_Front         = (*src)->m_Front;
                m_Back          = (*src)->m_Back;
                m_Count         = (*src)->m_Count;
                (*src)->m_Front = (*src)->m_Back = null;
                (*src)->m_Count = 0;
            }

            return((D3D12MA_IntrusiveLinkedList <TItemType> *)Unsafe.AsPointer(ref this));
        }
 public static void _ctor(ref D3D12MA_IntrusiveLinkedList <TItemType> pThis)
 {
     pThis.m_Front = null;
     pThis.m_Back  = null;
     pThis.m_Count = 0;
 }