Address feedback.

This commit is contained in:
Henrik Rydgård committed 2020-08-16 10:15:17 +02:00
1 parent c8a06d40c9
commit 449f80b74f
2 files changed
+8 -8

No files matched your search

+6 -6
View File
@@ -278,7 +278,7 @@ bool VulkanDeviceAllocator::AllocateFromSlab(Slab &slab, size_t &start, size_t b
// Remember the size so we can free.
slab.allocSizes[start] = blocks;
slab.tags[start] = { tag, (float)time_now_d(), 0.0f };
slab.tags[start] = { tag, time_now_d(), 0.0 };
slab.totalUsage += blocks;
return true;
}
@@ -436,15 +436,15 @@ bool VulkanDeviceAllocator::AllocateSlab(VkDeviceSize minBytes, int memoryTypeIn
}
void VulkanDeviceAllocator::ReportOldUsage() {
float now = time_now_d();
static const float OLD_AGE = 10.0f;
double now = time_now_d();
static const double OLD_AGE = 10.0;
for (size_t i = 0; i < slabs_.size(); ++i) {
const auto &slab = slabs_[i];
bool hasOldAllocs = false;
for (auto it : slab.tags) {
const auto info = it.second;
float touchedAge = now - info.touched;
double touchedAge = now - info.touched;
if (touchedAge >= OLD_AGE) {
hasOldAllocs = true;
break;
@@ -456,8 +456,8 @@ void VulkanDeviceAllocator::ReportOldUsage() {
for (auto it : slab.tags) {
const auto info = it.second;
float createAge = now - info.created;
float touchedAge = now - info.touched;
double createAge = now - info.created;
double touchedAge = now - info.touched;
NOTICE_LOG(G3D, " * %s (created %fs ago, used %fs ago)", info.tag.c_str(), createAge, touchedAge);
}
}