コード例 #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;
                }
            }
        }
コード例 #2
0
        internal void AddStats([NativeTypeName("Stats&")] D3D12MA_Stats *inoutStats)
        {
            D3D12MA_StatInfo poolStatInfo = default;

            CalculateStats(&poolStatInfo);

            AddStatInfo(ref inoutStats->Total, ref poolStatInfo);
            AddStatInfo(ref inoutStats->HeapType[(int)HeapTypeToIndex(m_Desc.HeapProperties.Type)], ref poolStatInfo);
        }