Index: src/gpu/vk/GrVkImage.cpp |
diff --git a/src/gpu/vk/GrVkImage.cpp b/src/gpu/vk/GrVkImage.cpp |
index d3195e7e8a0a9f41c6f96fe842e7b69aef471b65..7d8e87812af7f1fabc982992a73a21f7c681d9e2 100644 |
--- a/src/gpu/vk/GrVkImage.cpp |
+++ b/src/gpu/vk/GrVkImage.cpp |
@@ -63,6 +63,7 @@ void GrVkImage::setImageLayout(const GrVkGpu* gpu, VkImageLayout newLayout, |
bool GrVkImage::InitImageInfo(const GrVkGpu* gpu, const ImageDesc& imageDesc, GrVkImageInfo* info) { |
VkImage image = 0; |
VkDeviceMemory alloc; |
+ VkDeviceSize offset; |
VkImageLayout initialLayout = (VK_IMAGE_TILING_LINEAR == imageDesc.fImageTiling) |
? VK_IMAGE_LAYOUT_PREINITIALIZED |
@@ -102,13 +103,14 @@ bool GrVkImage::InitImageInfo(const GrVkGpu* gpu, const ImageDesc& imageDesc, Gr |
GR_VK_CALL_ERRCHECK(gpu->vkInterface(), CreateImage(gpu->device(), &imageCreateInfo, nullptr, |
&image)); |
- if (!GrVkMemory::AllocAndBindImageMemory(gpu, image, imageDesc.fMemProps, &alloc)) { |
+ if (!GrVkMemory::AllocAndBindImageMemory(gpu, image, imageDesc.fMemProps, &alloc, &offset)) { |
VK_CALL(gpu, DestroyImage(gpu->device(), image, nullptr)); |
return false; |
} |
info->fImage = image; |
info->fAlloc = alloc; |
+ info->fOffset = offset; |
info->fImageTiling = imageDesc.fImageTiling; |
info->fImageLayout = initialLayout; |
info->fFormat = imageDesc.fFormat; |
@@ -118,11 +120,11 @@ bool GrVkImage::InitImageInfo(const GrVkGpu* gpu, const ImageDesc& imageDesc, Gr |
void GrVkImage::DestroyImageInfo(const GrVkGpu* gpu, GrVkImageInfo* info) { |
VK_CALL(gpu, DestroyImage(gpu->device(), info->fImage, nullptr)); |
- VK_CALL(gpu, FreeMemory(gpu->device(), info->fAlloc, nullptr)); |
+ GrVkMemory::FreeImageMemory(gpu, info->fAlloc, info->fOffset); |
} |
-void GrVkImage::setNewResource(VkImage image, VkDeviceMemory alloc) { |
- fResource = new Resource(image, alloc); |
+void GrVkImage::setNewResource(VkImage image, VkDeviceMemory alloc, VkDeviceSize offset) { |
+ fResource = new Resource(image, alloc, offset); |
} |
GrVkImage::~GrVkImage() { |
@@ -146,7 +148,7 @@ void GrVkImage::abandonImage() { |
void GrVkImage::Resource::freeGPUData(const GrVkGpu* gpu) const { |
VK_CALL(gpu, DestroyImage(gpu->device(), fImage, nullptr)); |
- VK_CALL(gpu, FreeMemory(gpu->device(), fAlloc, nullptr)); |
+ GrVkMemory::FreeImageMemory(gpu, fAlloc, fOffset); |
} |
void GrVkImage::BorrowedResource::freeGPUData(const GrVkGpu* gpu) const { |