| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrVkGpu.h" | 8 #include "GrVkGpu.h" |
| 9 | 9 |
| 10 #include "GrContextOptions.h" | 10 #include "GrContextOptions.h" |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 VK_IMAGE_LAYOUT_GENERAL, | 276 VK_IMAGE_LAYOUT_GENERAL, |
| 277 srcAccessMask, | 277 srcAccessMask, |
| 278 dstAccessMask, | 278 dstAccessMask, |
| 279 srcStageMask, | 279 srcStageMask, |
| 280 dstStageMask, | 280 dstStageMask, |
| 281 false); | 281 false); |
| 282 } | 282 } |
| 283 success = this->uploadTexDataLinear(vkTex, left, top, width, height,
config, | 283 success = this->uploadTexDataLinear(vkTex, left, top, width, height,
config, |
| 284 texels.begin()->fPixels, texels.
begin()->fRowBytes); | 284 texels.begin()->fPixels, texels.
begin()->fRowBytes); |
| 285 } else { | 285 } else { |
| 286 uint32_t mipLevels = texels.count(); | 286 int mipLevels = texels.count(); |
| 287 if (vkTex->texturePriv().maxMipMapLevel() != mipLevels) { | 287 if (vkTex->texturePriv().maxMipMapLevel() != mipLevels) { |
| 288 if (!vkTex->reallocForMipmap(this, mipLevels)) { | 288 if (!vkTex->reallocForMipmap(this, mipLevels)) { |
| 289 return false; | 289 return false; |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 success = this->uploadTexDataOptimal(vkTex, left, top, width, height
, config, texels); | 292 success = this->uploadTexDataOptimal(vkTex, left, top, width, height
, config, texels); |
| 293 } | 293 } |
| 294 } | 294 } |
| 295 | 295 |
| 296 return success; | 296 return success; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 memcpy(dst, src, trimRowBytes * currentHeight); | 452 memcpy(dst, src, trimRowBytes * currentHeight); |
| 453 } else { | 453 } else { |
| 454 SkRectMemcpy(dst, trimRowBytes, src, rowBytes, trimRowBytes, current
Height); | 454 SkRectMemcpy(dst, trimRowBytes, src, rowBytes, trimRowBytes, current
Height); |
| 455 } | 455 } |
| 456 | 456 |
| 457 VkBufferImageCopy& region = regions.push_back(); | 457 VkBufferImageCopy& region = regions.push_back(); |
| 458 memset(®ion, 0, sizeof(VkBufferImageCopy)); | 458 memset(®ion, 0, sizeof(VkBufferImageCopy)); |
| 459 region.bufferOffset = individualMipOffsets[currentMipLevel]; | 459 region.bufferOffset = individualMipOffsets[currentMipLevel]; |
| 460 region.bufferRowLength = currentWidth; | 460 region.bufferRowLength = currentWidth; |
| 461 region.bufferImageHeight = currentHeight; | 461 region.bufferImageHeight = currentHeight; |
| 462 region.imageSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, currentMipLevel,
0, 1 }; | 462 region.imageSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, SkToU32(currentMi
pLevel), 0, 1 }; |
| 463 region.imageOffset = { left, top, 0 }; | 463 region.imageOffset = { left, top, 0 }; |
| 464 region.imageExtent = { (uint32_t)currentWidth, (uint32_t)currentHeight,
1 }; | 464 region.imageExtent = { (uint32_t)currentWidth, (uint32_t)currentHeight,
1 }; |
| 465 } | 465 } |
| 466 | 466 |
| 467 transferBuffer->unmap(); | 467 transferBuffer->unmap(); |
| 468 | 468 |
| 469 // make sure the unmap has finished | 469 // make sure the unmap has finished |
| 470 transferBuffer->addMemoryBarrier(this, | 470 transferBuffer->addMemoryBarrier(this, |
| 471 VK_ACCESS_HOST_WRITE_BIT, | 471 VK_ACCESS_HOST_WRITE_BIT, |
| 472 VK_ACCESS_TRANSFER_READ_BIT, | 472 VK_ACCESS_TRANSFER_READ_BIT, |
| (...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1794 aglSwapBuffers(aglGetCurrentContext()); | 1794 aglSwapBuffers(aglGetCurrentContext()); |
| 1795 int set_a_break_pt_here = 9; | 1795 int set_a_break_pt_here = 9; |
| 1796 aglSwapBuffers(aglGetCurrentContext()); | 1796 aglSwapBuffers(aglGetCurrentContext()); |
| 1797 #elif defined(SK_BUILD_FOR_WIN32) | 1797 #elif defined(SK_BUILD_FOR_WIN32) |
| 1798 SwapBuf(); | 1798 SwapBuf(); |
| 1799 int set_a_break_pt_here = 9; | 1799 int set_a_break_pt_here = 9; |
| 1800 SwapBuf(); | 1800 SwapBuf(); |
| 1801 #endif | 1801 #endif |
| 1802 #endif | 1802 #endif |
| 1803 } | 1803 } |
| OLD | NEW |