Index: src/gpu/vk/GrVkMemory.cpp |
diff --git a/src/gpu/vk/GrVkMemory.cpp b/src/gpu/vk/GrVkMemory.cpp |
index 19150c62a735feb51a2a86138a9616a7a38d534b..1dac9f344094299ca20a288530a7c26e49a8d5f2 100644 |
--- a/src/gpu/vk/GrVkMemory.cpp |
+++ b/src/gpu/vk/GrVkMemory.cpp |
@@ -82,7 +82,7 @@ bool GrVkMemory::AllocAndBindBufferMemory(const GrVkGpu* gpu, |
} |
// Bind Memory to device |
- VkResult err = GR_VK_CALL(iface, BindBufferMemory(device, buffer, |
+ VkResult err = GR_VK_CALL(iface, BindBufferMemory(device, buffer, |
alloc->fMemory, alloc->fOffset)); |
if (err) { |
SkASSERT_RELEASE(heap->free(*alloc)); |
@@ -429,7 +429,7 @@ void GrVkSubHeap::free(const GrVkAlloc& alloc) { |
INHERITED::free(alloc.fOffset, alloc.fSize); |
} |
-bool GrVkHeap::subAlloc(VkDeviceSize size, VkDeviceSize alignment, |
+bool GrVkHeap::subAlloc(VkDeviceSize size, VkDeviceSize alignment, |
uint32_t memoryTypeIndex, GrVkAlloc* alloc) { |
VkDeviceSize alignedSize = align_size(size, alignment); |
@@ -451,7 +451,7 @@ bool GrVkHeap::subAlloc(VkDeviceSize size, VkDeviceSize alignment, |
} |
alloc->fOffset = 0; |
alloc->fSize = 0; // hint that this is not a subheap allocation |
- |
+ |
return true; |
} |
@@ -459,7 +459,8 @@ bool GrVkHeap::subAlloc(VkDeviceSize size, VkDeviceSize alignment, |
int bestFitIndex = -1; |
VkDeviceSize bestFitSize = 0x7FFFFFFF; |
for (auto i = 0; i < fSubHeaps.count(); ++i) { |
- if (fSubHeaps[i]->memoryTypeIndex() == memoryTypeIndex) { |
+ if (fSubHeaps[i]->memoryTypeIndex() == memoryTypeIndex && |
+ fSubHeaps[i]->alignment() == alignment) { |
VkDeviceSize heapSize = fSubHeaps[i]->largestBlockSize(); |
if (heapSize >= alignedSize && heapSize < bestFitSize) { |
bestFitIndex = i; |
@@ -497,7 +498,7 @@ bool GrVkHeap::subAlloc(VkDeviceSize size, VkDeviceSize alignment, |
return false; |
} |
-bool GrVkHeap::singleAlloc(VkDeviceSize size, VkDeviceSize alignment, |
+bool GrVkHeap::singleAlloc(VkDeviceSize size, VkDeviceSize alignment, |
uint32_t memoryTypeIndex, GrVkAlloc* alloc) { |
VkDeviceSize alignedSize = align_size(size, alignment); |
@@ -505,7 +506,9 @@ bool GrVkHeap::singleAlloc(VkDeviceSize size, VkDeviceSize alignment, |
int bestFitIndex = -1; |
VkDeviceSize bestFitSize = 0x7FFFFFFF; |
for (auto i = 0; i < fSubHeaps.count(); ++i) { |
- if (fSubHeaps[i]->memoryTypeIndex() == memoryTypeIndex && fSubHeaps[i]->unallocated()) { |
+ if (fSubHeaps[i]->memoryTypeIndex() == memoryTypeIndex && |
+ fSubHeaps[i]->alignment() == alignment && |
+ fSubHeaps[i]->unallocated()) { |
VkDeviceSize heapSize = fSubHeaps[i]->size(); |
if (heapSize >= alignedSize && heapSize < bestFitSize) { |
bestFitIndex = i; |