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>
This commit is contained in:
parent
8cf4f9c449
commit
8f985af8b1
@ -7156,9 +7156,6 @@ QDebug operator<<(QDebug dbg, const QRhiStats &info)
|
||||
from the underlying memory allocator library. This gives an insight into
|
||||
the memory requirements of the active buffers and textures.
|
||||
|
||||
\warning Gathering some of the data may be an expensive operation, and
|
||||
therefore the function must not be called at a high frequency.
|
||||
|
||||
Additional data, such as the total time in milliseconds spent in graphics
|
||||
and compute pipeline creation (which usually involves shader compilation or
|
||||
cache lookups, and potentially expensive processing) is available with most
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user