diff --git a/drivers/d3d12/rendering_device_driver_d3d12.cpp b/drivers/d3d12/rendering_device_driver_d3d12.cpp index 3eead5350e..3471c361cb 100644 --- a/drivers/d3d12/rendering_device_driver_d3d12.cpp +++ b/drivers/d3d12/rendering_device_driver_d3d12.cpp @@ -5799,9 +5799,11 @@ uint64_t RenderingDeviceDriverD3D12::get_resource_native_handle(DriverResource p } uint64_t RenderingDeviceDriverD3D12::get_total_memory_used() { - D3D12MA::TotalStatistics stats; - allocator->CalculateStatistics(&stats); - return stats.Total.Stats.BlockBytes; + D3D12MA::Budget local_budget; + D3D12MA::Budget non_local_budget; + allocator->GetBudget(&local_budget, &non_local_budget); + + return local_budget.Stats.AllocationBytes + non_local_budget.Stats.AllocationBytes; } uint64_t RenderingDeviceDriverD3D12::get_lazily_memory_used() { diff --git a/drivers/vulkan/rendering_device_driver_vulkan.cpp b/drivers/vulkan/rendering_device_driver_vulkan.cpp index dc8a909d83..5c999af94b 100644 --- a/drivers/vulkan/rendering_device_driver_vulkan.cpp +++ b/drivers/vulkan/rendering_device_driver_vulkan.cpp @@ -7166,9 +7166,18 @@ uint64_t RenderingDeviceDriverVulkan::get_resource_native_handle(DriverResource } uint64_t RenderingDeviceDriverVulkan::get_total_memory_used() { - VmaTotalStatistics stats = {}; - vmaCalculateStatistics(allocator, &stats); - return stats.total.statistics.allocationBytes; + const VkPhysicalDeviceMemoryProperties *memory_properties = nullptr; + vmaGetMemoryProperties(allocator, &memory_properties); + + VmaBudget *budgets = ALLOCA_ARRAY(VmaBudget, memory_properties->memoryHeapCount); + vmaGetHeapBudgets(allocator, budgets); + + uint64_t total_memory_used = 0; + for (uint32_t i = 0; i < memory_properties->memoryHeapCount; i++) { + total_memory_used += budgets[i].statistics.allocationBytes; + } + + return total_memory_used; } uint64_t RenderingDeviceDriverVulkan::get_lazily_memory_used() {