aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/vk/GrVkGpu.cpp
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2017-03-28 14:56:46 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-29 15:40:15 +0000
commita1b282be3f93a6713e1bf7e1d0fc0caef5940a40 (patch)
treebb7f474bf21d8c9a72d754da8a1953187407bada /src/gpu/vk/GrVkGpu.cpp
parent2f3db61fed9cd2ebc888297a558c84194685572d (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.cpp5
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