diff options
author | 2017-03-28 14:56:46 -0400 | |
---|---|---|
committer | 2017-03-29 15:40:15 +0000 | |
commit | a1b282be3f93a6713e1bf7e1d0fc0caef5940a40 (patch) | |
tree | bb7f474bf21d8c9a72d754da8a1953187407bada /src/gpu/vk/GrVkGpu.cpp | |
parent | 2f3db61fed9cd2ebc888297a558c84194685572d (diff) |
Fix copy offset when uploading initial mip data in Vulkan
This is a fix to an original fix which was reverted
BUG=skia:
Change-Id: I21fcda28a5d342984784a35d2b3e985c6e4199cf
Reviewed-on: https://skia-review.googlesource.com/10290
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src/gpu/vk/GrVkGpu.cpp')
-rw-r--r-- | src/gpu/vk/GrVkGpu.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp index 767696469e..77816e00f7 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -590,7 +590,9 @@ bool GrVkGpu::uploadTexDataOptimal(GrVkTexture* tex, currentWidth = width; currentHeight = height; + int layerHeight = tex->height(); for (int currentMipLevel = 0; currentMipLevel < texelsShallowCopy.count(); currentMipLevel++) { + SkASSERT(1 == texelsShallowCopy.count() || currentHeight == layerHeight); const size_t trimRowBytes = currentWidth * bpp; const size_t rowBytes = texelsShallowCopy[currentMipLevel].fRowBytes; @@ -614,11 +616,12 @@ bool GrVkGpu::uploadTexDataOptimal(GrVkTexture* tex, region.bufferRowLength = currentWidth; region.bufferImageHeight = currentHeight; region.imageSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, SkToU32(currentMipLevel), 0, 1 }; - region.imageOffset = { left, flipY ? tex->height() - top - currentHeight : top, 0 }; + region.imageOffset = { left, flipY ? layerHeight - top - currentHeight : top, 0 }; region.imageExtent = { (uint32_t)currentWidth, (uint32_t)currentHeight, 1 }; currentWidth = SkTMax(1, currentWidth/2); currentHeight = SkTMax(1, currentHeight/2); + layerHeight = currentHeight; } // no need to flush non-coherent memory, unmap will do that for us |