| 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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER
_BIT, false); | 727 VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER
_BIT, false); |
| 728 | 728 |
| 729 // Blit original image | 729 // Blit original image |
| 730 int width = tex->width(); | 730 int width = tex->width(); |
| 731 int height = tex->height(); | 731 int height = tex->height(); |
| 732 | 732 |
| 733 VkImageBlit blitRegion; | 733 VkImageBlit blitRegion; |
| 734 memset(&blitRegion, 0, sizeof(VkImageBlit)); | 734 memset(&blitRegion, 0, sizeof(VkImageBlit)); |
| 735 blitRegion.srcSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1 }; | 735 blitRegion.srcSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1 }; |
| 736 blitRegion.srcOffsets[0] = { 0, 0, 0 }; | 736 blitRegion.srcOffsets[0] = { 0, 0, 0 }; |
| 737 blitRegion.srcOffsets[1] = { width, height, 0 }; | 737 blitRegion.srcOffsets[1] = { width, height, 1 }; |
| 738 blitRegion.dstSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1 }; | 738 blitRegion.dstSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1 }; |
| 739 blitRegion.dstOffsets[0] = { 0, 0, 0 }; | 739 blitRegion.dstOffsets[0] = { 0, 0, 0 }; |
| 740 blitRegion.dstOffsets[1] = { width, height, 0 }; | 740 blitRegion.dstOffsets[1] = { width, height, 1 }; |
| 741 | 741 |
| 742 fCurrentCmdBuffer->blitImage(this, | 742 fCurrentCmdBuffer->blitImage(this, |
| 743 oldResource, | 743 oldResource, |
| 744 oldImage, | 744 oldImage, |
| 745 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, | 745 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, |
| 746 tex->resource(), | 746 tex->resource(), |
| 747 tex->image(), | 747 tex->image(), |
| 748 VK_IMAGE_LAYOUT_GENERAL, | 748 VK_IMAGE_LAYOUT_GENERAL, |
| 749 1, | 749 1, |
| 750 &blitRegion, | 750 &blitRegion, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 773 int prevHeight = height; | 773 int prevHeight = height; |
| 774 width = SkTMax(1, width / 2); | 774 width = SkTMax(1, width / 2); |
| 775 height = SkTMax(1, height / 2); | 775 height = SkTMax(1, height / 2); |
| 776 | 776 |
| 777 imageMemoryBarrier.subresourceRange.baseMipLevel = mipLevel - 1; | 777 imageMemoryBarrier.subresourceRange.baseMipLevel = mipLevel - 1; |
| 778 this->addImageMemoryBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_
STAGE_TRANSFER_BIT, | 778 this->addImageMemoryBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_
STAGE_TRANSFER_BIT, |
| 779 false, &imageMemoryBarrier); | 779 false, &imageMemoryBarrier); |
| 780 | 780 |
| 781 blitRegion.srcSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, mipLevel - 1, 0
, 1 }; | 781 blitRegion.srcSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, mipLevel - 1, 0
, 1 }; |
| 782 blitRegion.srcOffsets[0] = { 0, 0, 0 }; | 782 blitRegion.srcOffsets[0] = { 0, 0, 0 }; |
| 783 blitRegion.srcOffsets[1] = { prevWidth, prevHeight, 0 }; | 783 blitRegion.srcOffsets[1] = { prevWidth, prevHeight, 1 }; |
| 784 blitRegion.dstSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, mipLevel, 0, 1
}; | 784 blitRegion.dstSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, mipLevel, 0, 1
}; |
| 785 blitRegion.dstOffsets[0] = { 0, 0, 0 }; | 785 blitRegion.dstOffsets[0] = { 0, 0, 0 }; |
| 786 blitRegion.dstOffsets[1] = { width, height, 0 }; | 786 blitRegion.dstOffsets[1] = { width, height, 1 }; |
| 787 fCurrentCmdBuffer->blitImage(this, | 787 fCurrentCmdBuffer->blitImage(this, |
| 788 *tex, | 788 *tex, |
| 789 *tex, | 789 *tex, |
| 790 1, | 790 1, |
| 791 &blitRegion, | 791 &blitRegion, |
| 792 VK_FILTER_LINEAR); | 792 VK_FILTER_LINEAR); |
| 793 ++mipLevel; | 793 ++mipLevel; |
| 794 } | 794 } |
| 795 | 795 |
| 796 oldResource->unref(this); | 796 oldResource->unref(this); |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1687 aglSwapBuffers(aglGetCurrentContext()); | 1687 aglSwapBuffers(aglGetCurrentContext()); |
| 1688 int set_a_break_pt_here = 9; | 1688 int set_a_break_pt_here = 9; |
| 1689 aglSwapBuffers(aglGetCurrentContext()); | 1689 aglSwapBuffers(aglGetCurrentContext()); |
| 1690 #elif defined(SK_BUILD_FOR_WIN32) | 1690 #elif defined(SK_BUILD_FOR_WIN32) |
| 1691 SwapBuf(); | 1691 SwapBuf(); |
| 1692 int set_a_break_pt_here = 9; | 1692 int set_a_break_pt_here = 9; |
| 1693 SwapBuf(); | 1693 SwapBuf(); |
| 1694 #endif | 1694 #endif |
| 1695 #endif | 1695 #endif |
| 1696 } | 1696 } |
| OLD | NEW |