diff options
author | jvanverth <jvanverth@google.com> | 2016-04-20 10:33:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-20 10:33:28 -0700 |
commit | c3d706f7ce87cdd94158d2266ab2fe2f18f5020a (patch) | |
tree | b206d0bfc72e532c9a61c19fbd74ea4c8cfb5057 /src/gpu/vk/GrVkGpu.cpp | |
parent | 0d9e9bee17aa2901582c5461ae60f7241fc0cd59 (diff) |
Revert of Use transfer buffer for BatchAtlas texture copies (patchset #9 id:160001 of https://codereview.chromium.org/1888473002/ )
Reason for revert:
Lots of sync issues with paths and text.
Original issue's description:
> Use transfer buffer for BatchAtlas texture copies.
>
> Sets up use of transfer buffer (if available) to do one-copy transfers.
> Get transfer buffers working properly in GL.
> Implement GrVkGpu::onTransferPixels.
> Check caps to ensure we can create a transfer buffer.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1888473002
>
> Committed: https://skia.googlesource.com/skia/+/b0ec9836dbf7f2304a3a29289b818719ca0a39bd
TBR=robertphillips@google.com,egdaniel@google.com,bsalomon@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1904723003
Diffstat (limited to 'src/gpu/vk/GrVkGpu.cpp')
-rw-r--r-- | src/gpu/vk/GrVkGpu.cpp | 95 |
1 files changed, 2 insertions, 93 deletions
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp index 8083509877..5fba475cab 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -187,13 +187,11 @@ GrBuffer* GrVkGpu::onCreateBuffer(size_t size, GrBufferType type, GrAccessPatter buff = GrVkIndexBuffer::Create(this, size, kDynamic_GrAccessPattern == accessPattern); break; case kXferCpuToGpu_GrBufferType: - SkASSERT(kDynamic_GrAccessPattern == accessPattern || - kStream_GrAccessPattern == accessPattern); + SkASSERT(kStream_GrAccessPattern == accessPattern); buff = GrVkTransferBuffer::Create(this, size, GrVkBuffer::kCopyRead_Type); break; case kXferGpuToCpu_GrBufferType: - SkASSERT(kDynamic_GrAccessPattern == accessPattern || - kStream_GrAccessPattern == accessPattern); + SkASSERT(kStream_GrAccessPattern == accessPattern); buff = GrVkTransferBuffer::Create(this, size, GrVkBuffer::kCopyWrite_Type); break; default: @@ -286,95 +284,6 @@ bool GrVkGpu::onWritePixels(GrSurface* surface, return false; } - -bool GrVkGpu::onTransferPixels(GrTexture* texture, - int left, int top, int width, int height, - GrPixelConfig config, GrBuffer* transferBuffer, - size_t bufferOffset, size_t rowBytes) { - GrVkTexture* vkTex = static_cast<GrVkTexture*>(texture); - if (!vkTex) { - return false; - } - GrVkTransferBuffer* vkBuffer = static_cast<GrVkTransferBuffer*>(transferBuffer); - if (!vkBuffer) { - return false; - } - - // We assume Vulkan doesn't do sRGB <-> linear conversions when reading and writing pixels. - if (GrPixelConfigIsSRGB(texture->config()) != GrPixelConfigIsSRGB(config)) { - return false; - } - - // TODO: Handle y axis flip via copy to temp image, then blit to final - if (kBottomLeft_GrSurfaceOrigin == vkTex->origin()) { - return false; - } - - bool success = false; - if (GrPixelConfigIsCompressed(vkTex->desc().fConfig)) { - // We check that config == desc.fConfig in GrGpu::getWritePixelsInfo() - SkASSERT(config == vkTex->desc().fConfig); - // TODO: add compressed texture support - // delete the following two lines and uncomment the two after that when ready - vkTex->unref(); - return false; - //success = this->uploadCompressedTexData(vkTex->desc(), buffer, false, left, top, width, - // height); - } else { - // make sure the unmap has finished - vkBuffer->addMemoryBarrier(this, - VK_ACCESS_HOST_WRITE_BIT, - VK_ACCESS_TRANSFER_READ_BIT, - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT, - false); - - // Set up copy region - size_t bpp = GrBytesPerPixel(config); - - VkBufferImageCopy region; - memset(®ion, 0, sizeof(VkBufferImageCopy)); - region.bufferOffset = bufferOffset; - region.bufferRowLength = (uint32_t)(rowBytes/bpp); - region.bufferImageHeight = 0; - region.imageSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1 }; - region.imageOffset = { left, top, 0 }; - region.imageExtent = { (uint32_t)width, (uint32_t)height, 1 }; - - // Change layout of our target so it can be copied to - VkImageLayout layout = vkTex->currentLayout(); - VkPipelineStageFlags srcStageMask = GrVkMemory::LayoutToPipelineStageFlags(layout); - VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_TRANSFER_BIT; - VkAccessFlags srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(layout); - VkAccessFlags dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; - vkTex->setImageLayout(this, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - srcAccessMask, - dstAccessMask, - srcStageMask, - dstStageMask, - false); - - // Copy the buffer to the image - fCurrentCmdBuffer->copyBufferToImage(this, - vkBuffer, - vkTex, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - 1, - ®ion); - - // Submit the current command buffer to the Queue - this->submitCommandBuffer(kSkip_SyncQueue); - } - - if (success) { - vkTex->texturePriv().dirtyMipMaps(true); - return true; - } - - return false; -} - bool GrVkGpu::uploadTexData(GrVkTexture* tex, int left, int top, int width, int height, GrPixelConfig dataConfig, |