Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1216)

Unified Diff: src/gpu/vk/GrVkMemory.cpp

Issue 2072453002: Add heap tests for Vulkan (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: One last test Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/vk/GrVkMemory.h ('k') | tests/VkHeapTests.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkMemory.cpp
diff --git a/src/gpu/vk/GrVkMemory.cpp b/src/gpu/vk/GrVkMemory.cpp
index 407a2c1ca3a30de48ce1bd4e98ecaa155d07343e..984e3271b0716df82d9c6a22912b9a783af609e4 100644
--- a/src/gpu/vk/GrVkMemory.cpp
+++ b/src/gpu/vk/GrVkMemory.cpp
@@ -375,11 +375,11 @@ void GrVkSubHeap::free(const GrVkAlloc& alloc) {
// find the block right after this allocation
FreeList::Iter iter = fFreeList.headIter();
+ FreeList::Iter prev;
while (iter.get() && iter.get()->fOffset < alloc.fOffset) {
+ prev = iter;
iter.next();
}
- FreeList::Iter prev = iter;
- prev.prev();
// we have four cases:
// we exactly follow the previous one
Block* block;
@@ -446,7 +446,7 @@ bool GrVkHeap::subAlloc(VkDeviceSize size, VkDeviceSize alignment,
for (auto i = 0; i < fSubHeaps.count(); ++i) {
if (fSubHeaps[i]->memoryTypeIndex() == memoryTypeIndex) {
VkDeviceSize heapSize = fSubHeaps[i]->largestBlockSize();
- if (heapSize > alignedSize && heapSize < bestFitSize) {
+ if (heapSize >= alignedSize && heapSize < bestFitSize) {
bestFitIndex = i;
bestFitSize = heapSize;
}
@@ -484,7 +484,7 @@ bool GrVkHeap::singleAlloc(VkDeviceSize size, VkDeviceSize alignment,
for (auto i = 0; i < fSubHeaps.count(); ++i) {
if (fSubHeaps[i]->memoryTypeIndex() == memoryTypeIndex && fSubHeaps[i]->unallocated()) {
VkDeviceSize heapSize = fSubHeaps[i]->size();
- if (heapSize > alignedSize && heapSize < bestFitSize) {
+ if (heapSize >= alignedSize && heapSize < bestFitSize) {
bestFitIndex = i;
bestFitSize = heapSize;
}
« no previous file with comments | « src/gpu/vk/GrVkMemory.h ('k') | tests/VkHeapTests.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698