| Index: src/gpu/vk/GrVkBuffer.cpp
|
| diff --git a/src/gpu/vk/GrVkBuffer.cpp b/src/gpu/vk/GrVkBuffer.cpp
|
| index 6fbdaac8673afdab207c44f91e00138e49a538b2..75e0a6a645fb49eb099668cba26ef752409fa219 100644
|
| --- a/src/gpu/vk/GrVkBuffer.cpp
|
| +++ b/src/gpu/vk/GrVkBuffer.cpp
|
| @@ -21,6 +21,7 @@
|
| const GrVkBuffer::Resource* GrVkBuffer::Create(const GrVkGpu* gpu, const Desc& desc) {
|
| VkBuffer buffer;
|
| VkDeviceMemory alloc;
|
| + VkDeviceSize offset;
|
|
|
| // create the buffer object
|
| VkBufferCreateInfo bufInfo;
|
| @@ -63,23 +64,25 @@ const GrVkBuffer::Resource* GrVkBuffer::Create(const GrVkGpu* gpu, const Desc& d
|
| if (!GrVkMemory::AllocAndBindBufferMemory(gpu,
|
| buffer,
|
| requiredMemProps,
|
| - &alloc)) {
|
| + &alloc,
|
| + &offset)) {
|
| // Try again without requiring host cached memory
|
| requiredMemProps = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
|
| VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
|
| if (!GrVkMemory::AllocAndBindBufferMemory(gpu,
|
| buffer,
|
| requiredMemProps,
|
| - &alloc)) {
|
| + &alloc,
|
| + &offset)) {
|
| VK_CALL(gpu, DestroyBuffer(gpu->device(), buffer, nullptr));
|
| return nullptr;
|
| }
|
| }
|
|
|
| - const GrVkBuffer::Resource* resource = new GrVkBuffer::Resource(buffer, alloc);
|
| + const GrVkBuffer::Resource* resource = new GrVkBuffer::Resource(buffer, alloc, offset);
|
| if (!resource) {
|
| VK_CALL(gpu, DestroyBuffer(gpu->device(), buffer, nullptr));
|
| - VK_CALL(gpu, FreeMemory(gpu->device(), alloc, nullptr));
|
| + GrVkMemory::FreeBufferMemory(gpu, alloc, offset);
|
| return nullptr;
|
| }
|
|
|
| @@ -113,7 +116,7 @@ void GrVkBuffer::Resource::freeGPUData(const GrVkGpu* gpu) const {
|
| SkASSERT(fBuffer);
|
| SkASSERT(fAlloc);
|
| VK_CALL(gpu, DestroyBuffer(gpu->device(), fBuffer, nullptr));
|
| - VK_CALL(gpu, FreeMemory(gpu->device(), fAlloc, nullptr));
|
| + GrVkMemory::FreeBufferMemory(gpu, fAlloc, fOffset);
|
| }
|
|
|
| void GrVkBuffer::vkRelease(const GrVkGpu* gpu) {
|
|
|