diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2022-10-17 13:49:49 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2022-10-20 16:05:25 +0200 |
commit | 8f985af8b11b6c5d96ceabb3668077f3ee6ca39d (patch) | |
tree | fdbb7bea0c1951a83a127a67b3786eda1c8a062d /src/gui/rhi/qrhivulkan.cpp | |
parent | 8cf4f9c449e03c4138b14222e4a950c139ba16de (diff) |
rhi: vk: Switch to cheaper VMA statistics API
Now that we upgraded to 3.0.1 vmaCalculateStatistics can be replaced
with a less-expensive call.
Change-Id: Icb444354ce9e091cf69f82aff2e2f828b8302072
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhivulkan.cpp')
-rw-r--r-- | src/gui/rhi/qrhivulkan.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index 8a2982fbb8..01c0b40294 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -4312,15 +4312,20 @@ QRhiDriverInfo QRhiVulkan::driverInfo() const QRhiStats QRhiVulkan::statistics() { - VmaTotalStatistics stats; - vmaCalculateStatistics(toVmaAllocator(allocator), &stats); - QRhiStats result; result.totalPipelineCreationTime = totalPipelineCreationTime(); - result.blockCount = stats.total.statistics.blockCount; - result.allocCount = stats.total.statistics.allocationCount; - result.usedBytes = stats.total.statistics.allocationBytes; - result.unusedBytes = stats.total.statistics.blockBytes - stats.total.statistics.allocationBytes; + + VmaBudget budgets[VK_MAX_MEMORY_HEAPS]; + vmaGetHeapBudgets(toVmaAllocator(allocator), budgets); + + uint32_t count = toVmaAllocator(allocator)->GetMemoryHeapCount(); + for (uint32_t i = 0; i < count; ++i) { + const VmaStatistics &stats(budgets[i].statistics); + result.blockCount += stats.blockCount; + result.allocCount += stats.allocationCount; + result.usedBytes += stats.allocationBytes; + result.unusedBytes += stats.blockBytes - stats.allocationBytes; + } return result; } |