Chromium Code Reviews| Index: src/gpu/vk/GrVkGpu.cpp |
| diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp |
| index f87a6f6fbd199b626d28eebc75f66b980f1760d5..38fdc079934834a76b6d35a494c5aefe54f3e261 100644 |
| --- a/src/gpu/vk/GrVkGpu.cpp |
| +++ b/src/gpu/vk/GrVkGpu.cpp |
| @@ -331,7 +331,7 @@ bool GrVkGpu::uploadTexDataLinear(GrVkTexture* tex, |
| &layout)); |
| int texTop = kBottomLeft_GrSurfaceOrigin == desc.fOrigin ? tex->height() - top - height : top; |
| - VkDeviceSize offset = texTop*layout.rowPitch + left*bpp; |
| + VkDeviceSize offset = tex->offset() + texTop*layout.rowPitch + left*bpp; |
|
egdaniel
2016/05/31 13:22:14
is the offset actually needed here? If the image i
jvanverth1
2016/05/31 22:05:57
There's no reference to the image in MapMemory, so
|
| VkDeviceSize size = height*layout.rowPitch; |
| void* mapPtr; |
| err = GR_VK_CALL(interface, MapMemory(fDevice, tex->memory(), offset, size, 0, &mapPtr)); |
| @@ -874,6 +874,7 @@ GrBackendObject GrVkGpu::createTestingOnlyBackendTexture(void* srcData, int w, i |
| VkImage image = VK_NULL_HANDLE; |
| VkDeviceMemory alloc = VK_NULL_HANDLE; |
| + VkDeviceSize offset = 0; |
| VkImageTiling imageTiling = linearTiling ? VK_IMAGE_TILING_LINEAR : VK_IMAGE_TILING_OPTIMAL; |
| VkImageLayout initialLayout = (VK_IMAGE_TILING_LINEAR == imageTiling) |
| @@ -906,7 +907,7 @@ GrBackendObject GrVkGpu::createTestingOnlyBackendTexture(void* srcData, int w, i |
| GR_VK_CALL_ERRCHECK(this->vkInterface(), CreateImage(this->device(), &imageCreateInfo, nullptr, &image)); |
| - if (!GrVkMemory::AllocAndBindImageMemory(this, image, memProps, &alloc)) { |
| + if (!GrVkMemory::AllocAndBindImageMemory(this, image, memProps, &alloc, &offset)) { |
| VK_CALL(DestroyImage(this->device(), image, nullptr)); |
| return 0; |
| } |
| @@ -926,7 +927,7 @@ GrBackendObject GrVkGpu::createTestingOnlyBackendTexture(void* srcData, int w, i |
| void* mapPtr; |
| err = VK_CALL(MapMemory(fDevice, alloc, 0, layout.rowPitch * h, 0, &mapPtr)); |
| if (err) { |
| - VK_CALL(FreeMemory(this->device(), alloc, nullptr)); |
| + GrVkMemory::FreeImageMemory(this, alloc, offset); |
| VK_CALL(DestroyImage(this->device(), image, nullptr)); |
| return 0; |
| } |
| @@ -951,6 +952,7 @@ GrBackendObject GrVkGpu::createTestingOnlyBackendTexture(void* srcData, int w, i |
| GrVkImageInfo* info = new GrVkImageInfo; |
| info->fImage = image; |
| info->fAlloc = alloc; |
| + info->fOffset = offset; |
| info->fImageTiling = imageTiling; |
| info->fImageLayout = initialLayout; |
| info->fFormat = pixelFormat; |
| @@ -984,7 +986,7 @@ void GrVkGpu::deleteTestingOnlyBackendTexture(GrBackendObject id, bool abandon) |
| // something in the command buffer may still be using this, so force submit |
| this->submitCommandBuffer(kForce_SyncQueue); |
| - VK_CALL(FreeMemory(this->device(), backend->fAlloc, nullptr)); |
| + GrVkMemory::FreeImageMemory(this, backend->fAlloc, backend->fOffset); |
| VK_CALL(DestroyImage(this->device(), backend->fImage, nullptr)); |
| } |
| delete backend; |