Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: src/gpu/vk/GrVkGpu.cpp

Issue 1904723003: Revert of Use transfer buffer for BatchAtlas texture copies (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/vk/GrVkGpu.h ('k') | tools/gpu/GrTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkGpu.cpp
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 8083509877105c8c68bde6279db2afb0870f730f..5fba475cab34c4bb3a942bd77b7296d6cc013a60 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -187,13 +187,11 @@
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 @@
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(&region, 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,
- &region);
-
- // 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,
« no previous file with comments | « src/gpu/vk/GrVkGpu.h ('k') | tools/gpu/GrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698