File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5799,9 +5799,11 @@ uint64_t RenderingDeviceDriverD3D12::get_resource_native_handle(DriverResource p
57995799}
58005800
58015801uint64_t RenderingDeviceDriverD3D12::get_total_memory_used () {
5802- D3D12MA::TotalStatistics stats;
5803- allocator->CalculateStatistics (&stats);
5804- return stats.Total .Stats .BlockBytes ;
5802+ D3D12MA::Budget local_budget;
5803+ D3D12MA::Budget non_local_budget;
5804+ allocator->GetBudget (&local_budget, &non_local_budget);
5805+
5806+ return local_budget.Stats .AllocationBytes + non_local_budget.Stats .AllocationBytes ;
58055807}
58065808
58075809uint64_t RenderingDeviceDriverD3D12::get_lazily_memory_used () {
Original file line number Diff line number Diff line change @@ -7166,9 +7166,18 @@ uint64_t RenderingDeviceDriverVulkan::get_resource_native_handle(DriverResource
71667166}
71677167
71687168uint64_t RenderingDeviceDriverVulkan::get_total_memory_used () {
7169- VmaTotalStatistics stats = {};
7170- vmaCalculateStatistics (allocator, &stats);
7171- return stats.total .statistics .allocationBytes ;
7169+ const VkPhysicalDeviceMemoryProperties *memory_properties = nullptr ;
7170+ vmaGetMemoryProperties (allocator, &memory_properties);
7171+
7172+ VmaBudget *budgets = ALLOCA_ARRAY (VmaBudget, memory_properties->memoryHeapCount );
7173+ vmaGetHeapBudgets (allocator, budgets);
7174+
7175+ uint64_t total_memory_used = 0 ;
7176+ for (uint32_t i = 0 ; i < memory_properties->memoryHeapCount ; i++) {
7177+ total_memory_used += budgets[i].statistics .allocationBytes ;
7178+ }
7179+
7180+ return total_memory_used;
71727181}
71737182
71747183uint64_t RenderingDeviceDriverVulkan::get_lazily_memory_used () {
You can’t perform that action at this time.
0 commit comments