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
diff --git a/src/gpu/GrBatchAtlas.cpp b/src/gpu/GrBatchAtlas.cpp
index 17e82ef..40ab0e6 100644
--- a/src/gpu/GrBatchAtlas.cpp
+++ b/src/gpu/GrBatchAtlas.cpp
@@ -7,23 +7,19 @@
#include "GrBatchAtlas.h"
#include "GrBatchFlushState.h"
-#include "GrBuffer.h"
#include "GrRectanizer.h"
-#include "GrResourceProvider.h"
#include "GrTracing.h"
////////////////////////////////////////////////////////////////////////////////
GrBatchAtlas::BatchPlot::BatchPlot(int index, uint64_t genID, int offX, int offY, int width,
- int height, GrPixelConfig config, GrResourceProvider* rp)
- : fResourceProvider(rp)
- , fLastUpload(GrBatchDrawToken::AlreadyFlushedToken())
+ int height, GrPixelConfig config)
+ : fLastUpload(GrBatchDrawToken::AlreadyFlushedToken())
, fLastUse(GrBatchDrawToken::AlreadyFlushedToken())
, fIndex(index)
, fGenID(genID)
, fID(CreateId(fIndex, fGenID))
- , fDataPtr(nullptr)
- , fTransferBuffer(nullptr)
+ , fData(nullptr)
, fWidth(width)
, fHeight(height)
, fX(offX)
@@ -40,11 +36,7 @@
}
GrBatchAtlas::BatchPlot::~BatchPlot() {
- if (fTransferBuffer) {
- fTransferBuffer->unref();
- } else {
- sk_free(fDataPtr);
- }
+ sk_free(fData);
delete fRects;
}
@@ -60,26 +52,14 @@
return false;
}
- if (!fDataPtr) {
- if (!fTransferBuffer) {
- fTransferBuffer =
- fResourceProvider->createBuffer(fBytesPerPixel * fWidth * fHeight,
- kXferCpuToGpu_GrBufferType,
- kDynamic_GrAccessPattern,
- GrResourceProvider::kNoPendingIO_Flag);
- }
- if (fTransferBuffer) {
- fDataPtr = (unsigned char*)fTransferBuffer->map();
- } else {
- fDataPtr = reinterpret_cast<unsigned char*>(sk_calloc_throw(fBytesPerPixel * fWidth *
- fHeight));
- }
+ if (!fData) {
+ fData = reinterpret_cast<unsigned char*>(sk_calloc_throw(fBytesPerPixel * fWidth *
+ fHeight));
}
-
size_t rowBytes = width * fBytesPerPixel;
const unsigned char* imagePtr = (const unsigned char*)image;
// point ourselves at the right starting spot
- unsigned char* dataPtr = fDataPtr;
+ unsigned char* dataPtr = fData;
dataPtr += fBytesPerPixel * fWidth * loc->fY;
dataPtr += fBytesPerPixel * loc->fX;
// copy into the data buffer
@@ -99,25 +79,16 @@
}
void GrBatchAtlas::BatchPlot::uploadToTexture(GrDrawBatch::WritePixelsFn& writePixels,
- GrDrawBatch::TransferPixelsFn& xferPixels,
GrTexture* texture) {
// We should only be issuing uploads if we are in fact dirty
- SkASSERT(fDirty && fDataPtr && texture);
+ SkASSERT(fDirty && fData && texture);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("skia.gpu"), "GrBatchPlot::uploadToTexture");
size_t rowBytes = fBytesPerPixel * fWidth;
- size_t dataOffset = rowBytes * fDirtyRect.fTop + fBytesPerPixel * fDirtyRect.fLeft;
- if (fTransferBuffer) {
- fTransferBuffer->unmap();
- fDataPtr = nullptr;
- xferPixels(texture, fOffset.fX + fDirtyRect.fLeft, fOffset.fY + fDirtyRect.fTop,
- fDirtyRect.width(), fDirtyRect.height(), fConfig, fTransferBuffer, dataOffset,
- rowBytes);
- } else {
- writePixels(texture, fOffset.fX + fDirtyRect.fLeft, fOffset.fY + fDirtyRect.fTop,
- fDirtyRect.width(), fDirtyRect.height(), fConfig, fDataPtr + dataOffset,
- rowBytes);
- }
-
+ const unsigned char* dataPtr = fData;
+ dataPtr += rowBytes * fDirtyRect.fTop;
+ dataPtr += fBytesPerPixel * fDirtyRect.fLeft;
+ writePixels(texture, fOffset.fX + fDirtyRect.fLeft, fOffset.fY + fDirtyRect.fTop,
+ fDirtyRect.width(), fDirtyRect.height(), fConfig, dataPtr, rowBytes);
fDirtyRect.setEmpty();
SkDEBUGCODE(fDirty = false;)
}
@@ -131,8 +102,8 @@
fID = CreateId(fIndex, fGenID);
// zero out the plot
- if (fDataPtr) {
- sk_bzero(fDataPtr, fBytesPerPixel * fWidth * fHeight);
+ if (fData) {
+ sk_bzero(fData, fBytesPerPixel * fWidth * fHeight);
}
fDirtyRect.setEmpty();
@@ -141,7 +112,7 @@
///////////////////////////////////////////////////////////////////////////////
-GrBatchAtlas::GrBatchAtlas(GrResourceProvider* rp, GrTexture* texture, int numPlotsX, int numPlotsY)
+GrBatchAtlas::GrBatchAtlas(GrTexture* texture, int numPlotsX, int numPlotsY)
: fTexture(texture)
, fAtlasGeneration(kInvalidAtlasGeneration + 1) {
@@ -164,7 +135,7 @@
for (int x = numPlotsX - 1, c = 0; x >= 0; --x, ++c) {
uint32_t index = r * numPlotsX + c;
currPlot->reset(new BatchPlot(index, 1, x, y, plotWidth, plotHeight,
- texture->desc().fConfig, rp));
+ texture->desc().fConfig));
// build LRU list
fPlotList.addToHead(currPlot->get());
@@ -191,13 +162,12 @@
// upload. Otherwise, we already have a scheduled upload that hasn't yet ocurred.
// This new update will piggy back on that previously scheduled update.
if (target->hasDrawBeenFlushed(plot->lastUploadToken())) {
- // With c+14 we could move sk_sp into lambda to only ref once.
+ // With c+14 we could move sk_sp into lamba to only ref once.
sk_sp<BatchPlot> plotsp(SkRef(plot));
GrTexture* texture = fTexture;
GrBatchDrawToken lastUploadToken = target->addAsapUpload(
- [plotsp, texture] (GrDrawBatch::WritePixelsFn& writePixels,
- GrDrawBatch::TransferPixelsFn& transferPixels) {
- plotsp->uploadToTexture(writePixels, transferPixels, texture);
+ [plotsp, texture] (GrDrawBatch::WritePixelsFn& writePixels) {
+ plotsp->uploadToTexture(writePixels, texture);
}
);
plot->setLastUploadToken(lastUploadToken);
@@ -265,9 +235,8 @@
sk_sp<BatchPlot> plotsp(SkRef(newPlot.get()));
GrTexture* texture = fTexture;
GrBatchDrawToken lastUploadToken = target->addInlineUpload(
- [plotsp, texture] (GrDrawBatch::WritePixelsFn& writePixels,
- GrDrawBatch::TransferPixelsFn& transferPixels) {
- plotsp->uploadToTexture(writePixels, transferPixels, texture);
+ [plotsp, texture] (GrDrawBatch::WritePixelsFn& writePixels) {
+ plotsp->uploadToTexture(writePixels, texture);
}
);
newPlot->setLastUploadToken(lastUploadToken);
diff --git a/src/gpu/GrBatchAtlas.h b/src/gpu/GrBatchAtlas.h
index 418739f..707f463 100644
--- a/src/gpu/GrBatchAtlas.h
+++ b/src/gpu/GrBatchAtlas.h
@@ -16,8 +16,6 @@
#include "batches/GrDrawBatch.h"
class GrRectanizer;
-class GrResourceProvider;
-class GrBuffer;
struct GrBatchAtlasConfig {
int numPlotsX() const { return fWidth / fPlotWidth; }
@@ -43,7 +41,7 @@
// the eviction
typedef void (*EvictionFunc)(GrBatchAtlas::AtlasID, void*);
- GrBatchAtlas(GrResourceProvider*, GrTexture*, int numPlotsX, int numPlotsY);
+ GrBatchAtlas(GrTexture*, int numPlotsX, int numPlotsY);
~GrBatchAtlas();
// Adds a width x height subimage to the atlas. Upon success it returns
@@ -174,21 +172,19 @@
void setLastUploadToken(GrBatchDrawToken batchToken) { fLastUpload = batchToken; }
void setLastUseToken(GrBatchDrawToken batchToken) { fLastUse = batchToken; }
- void uploadToTexture(GrDrawBatch::WritePixelsFn&, GrDrawBatch::TransferPixelsFn&,
- GrTexture* texture);
+ void uploadToTexture(GrDrawBatch::WritePixelsFn&, GrTexture* texture);
void resetRects();
private:
BatchPlot(int index, uint64_t genID, int offX, int offY, int width, int height,
- GrPixelConfig config, GrResourceProvider* rp);
+ GrPixelConfig config);
~BatchPlot() override;
// Create a clone of this plot. The cloned plot will take the place of the
// current plot in the atlas.
BatchPlot* clone() const {
- return new BatchPlot(fIndex, fGenID+1, fX, fY, fWidth, fHeight, fConfig,
- fResourceProvider);
+ return new BatchPlot(fIndex, fGenID+1, fX, fY, fWidth, fHeight, fConfig);
}
static GrBatchAtlas::AtlasID CreateId(uint32_t index, uint64_t generation) {
@@ -197,16 +193,13 @@
return generation << 16 | index;
}
- // used to create transfer buffers
- GrResourceProvider* fResourceProvider;
GrBatchDrawToken fLastUpload;
GrBatchDrawToken fLastUse;
const uint32_t fIndex;
uint64_t fGenID;
GrBatchAtlas::AtlasID fID;
- unsigned char* fDataPtr;
- GrBuffer* fTransferBuffer;
+ unsigned char* fData;
const int fWidth;
const int fHeight;
const int fX;
diff --git a/src/gpu/GrBatchFlushState.h b/src/gpu/GrBatchFlushState.h
index ee7e3a0..0b2e2bd 100644
--- a/src/gpu/GrBatchFlushState.h
+++ b/src/gpu/GrBatchFlushState.h
@@ -77,14 +77,7 @@
return this->fGpu->writePixels(surface, left, top, width, height, config, buffer,
rowBytes);
};
- GrDrawBatch::TransferPixelsFn tp = [this](GrTexture* texture,
- int left, int top, int width, int height,
- GrPixelConfig config, GrBuffer* buffer,
- size_t offset, size_t rowBytes) -> bool {
- return this->fGpu->transferPixels(texture, left, top, width, height, config, buffer,
- offset, rowBytes);
- };
- upload(wp, tp);
+ upload(wp);
}
void putBackIndices(size_t indices) { fIndexPool.putBack(indices * sizeof(uint16_t)); }
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 088641b..d062a48 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -397,14 +397,14 @@
return this->writePixels(surface, left, top, width, height, config, texels);
}
-bool GrGpu::transferPixels(GrTexture* texture,
+bool GrGpu::transferPixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig config, GrBuffer* transferBuffer,
size_t offset, size_t rowBytes) {
SkASSERT(transferBuffer);
this->handleDirtyContext();
- if (this->onTransferPixels(texture, left, top, width, height, config,
+ if (this->onTransferPixels(surface, left, top, width, height, config,
transferBuffer, offset, rowBytes)) {
fStats.incTransfersToTexture();
return true;
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 4defa04..883b7ee 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -280,9 +280,9 @@
size_t rowBytes);
/**
- * Updates the pixels in a rectangle of a texture using a buffer
+ * Updates the pixels in a rectangle of a surface using a buffer
*
- * @param textre The texture to write to.
+ * @param surface The surface to write to.
* @param left left edge of the rectangle to write (inclusive)
* @param top top edge of the rectangle to write (inclusive)
* @param width width of rectangle to write in pixels.
@@ -293,7 +293,7 @@
* @param rowBytes number of bytes between consecutive rows. Zero
* means rows are tightly packed.
*/
- bool transferPixels(GrTexture* texture,
+ bool transferPixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig config, GrBuffer* transferBuffer,
size_t offset, size_t rowBytes);
@@ -579,8 +579,8 @@
GrPixelConfig config,
const SkTArray<GrMipLevel>& texels) = 0;
- // overridden by backend-specific derived class to perform the texture transfer
- virtual bool onTransferPixels(GrTexture*,
+ // overridden by backend-specific derived class to perform the surface write
+ virtual bool onTransferPixels(GrSurface*,
int left, int top, int width, int height,
GrPixelConfig config, GrBuffer* transferBuffer,
size_t offset, size_t rowBytes) = 0;
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 922e5be3..9a2fff3 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -139,8 +139,7 @@
if (!texture) {
return nullptr;
}
- GrBatchAtlas* atlas = new GrBatchAtlas(this, texture,
- numPlotsX, numPlotsY);
+ GrBatchAtlas* atlas = new GrBatchAtlas(texture, numPlotsX, numPlotsY);
atlas->registerEvictionCallback(func, data);
return atlas;
}
diff --git a/src/gpu/batches/GrDrawBatch.h b/src/gpu/batches/GrDrawBatch.h
index ef335fb..bf93cf5 100644
--- a/src/gpu/batches/GrDrawBatch.h
+++ b/src/gpu/batches/GrDrawBatch.h
@@ -46,17 +46,13 @@
*/
class GrDrawBatch : public GrBatch {
public:
- /** Method that performs a texture write on behalf of a DeferredUploadFn. */
+ /** Method that performs an upload on behalf of a DeferredUploadFn. */
using WritePixelsFn = std::function<bool(GrSurface* texture,
int left, int top, int width, int height,
- GrPixelConfig config, const void* buffer,
+ GrPixelConfig config, const void* buffer,
size_t rowBytes)>;
- using TransferPixelsFn = std::function<bool(GrTexture* texture,
- int left, int top, int width, int height,
- GrPixelConfig config, GrBuffer* buffer,
- size_t offset, size_t rowBytes)>;
/** See comments before GrDrawBatch::Target definition on how deferred uploaders work. */
- using DeferredUploadFn = std::function<void(WritePixelsFn&, TransferPixelsFn&)>;
+ using DeferredUploadFn = std::function<void(WritePixelsFn&)>;
class Target;
diff --git a/src/gpu/gl/GrGLBuffer.cpp b/src/gpu/gl/GrGLBuffer.cpp
index 787445e..24fd592 100644
--- a/src/gpu/gl/GrGLBuffer.cpp
+++ b/src/gpu/gl/GrGLBuffer.cpp
@@ -30,12 +30,6 @@
GrGLBuffer* GrGLBuffer::Create(GrGLGpu* gpu, size_t size, GrBufferType intendedType,
GrAccessPattern accessPattern, const void* data) {
- if (gpu->glCaps().transferBufferType() == GrGLCaps::kNone_TransferBufferType &&
- (kXferCpuToGpu_GrBufferType == intendedType ||
- kXferGpuToCpu_GrBufferType == intendedType)) {
- return nullptr;
- }
-
bool cpuBacked = gpu->glCaps().useNonVBOVertexAndIndexDynamicData() &&
GrBufferTypeIsVertexOrIndex(intendedType) &&
kDynamic_GrAccessPattern == accessPattern;
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index abf2cb7..f3e494a 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -393,9 +393,8 @@
} else {
if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_NV_pixel_buffer_object")) {
fTransferBufferType = kPBO_TransferBufferType;
-// TODO: get transfer buffers working in Chrome
-// } else if (ctxInfo.hasExtension("GL_CHROMIUM_pixel_transfer_buffer_object")) {
-// fTransferBufferType = kChromium_TransferBufferType;
+ } else if (ctxInfo.hasExtension("GL_CHROMIUM_pixel_transfer_buffer_object")) {
+ fTransferBufferType = kChromium_TransferBufferType;
}
}
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index e50f1e2..3a7f531 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -895,13 +895,13 @@
return success;
}
-bool GrGLGpu::onTransferPixels(GrTexture* texture,
+bool GrGLGpu::onTransferPixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig config, GrBuffer* transferBuffer,
size_t offset, size_t rowBytes) {
- GrGLTexture* glTex = static_cast<GrGLTexture*>(texture);
+ GrGLTexture* glTex = static_cast<GrGLTexture*>(surface->asTexture());
- if (!check_write_and_transfer_input(glTex, texture, config)) {
+ if (!check_write_and_transfer_input(glTex, surface, config)) {
return false;
}
@@ -920,16 +920,15 @@
bool success = false;
GrMipLevel mipLevel;
- mipLevel.fPixels = (void*)offset;
+ mipLevel.fPixels = transferBuffer;
mipLevel.fRowBytes = rowBytes;
SkSTArray<1, GrMipLevel> texels;
texels.push_back(mipLevel);
success = this->uploadTexData(glTex->desc(), glTex->target(), kTransfer_UploadType,
left, top, width, height, config, texels);
-
if (success) {
SkIRect rect = SkIRect::MakeXYWH(left, top, width, height);
- this->didWriteToSurface(texture, &rect);
+ this->didWriteToSurface(surface, &rect);
return true;
}
@@ -1197,14 +1196,6 @@
SkASSERT(this->caps()->isConfigTexturable(desc.fConfig));
- // unbind any previous transfer buffer if not transferring
- auto& xferBufferState = fHWBufferState[kXferCpuToGpu_GrBufferType];
- if (kTransfer_UploadType != uploadType &&
- SK_InvalidUniqueID != xferBufferState.fBoundBufferUniqueID) {
- GL_CALL(BindBuffer(xferBufferState.fGLTarget, 0));
- xferBufferState.invalidate();
- }
-
// texels is const.
// But we may need to flip the texture vertically to prepare it.
// Rather than flip in place and alter the incoming data,
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index 57d0760..00ceb85 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -184,7 +184,7 @@
GrPixelConfig config,
const SkTArray<GrMipLevel>& texels) override;
- bool onTransferPixels(GrTexture*,
+ bool onTransferPixels(GrSurface*,
int left, int top, int width, int height,
GrPixelConfig config, GrBuffer* transferBuffer,
size_t offset, size_t rowBytes) override;
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 8083509..5fba475 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(®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,
diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h
index e738e73..76b18ac 100644
--- a/src/gpu/vk/GrVkGpu.h
+++ b/src/gpu/vk/GrVkGpu.h
@@ -151,10 +151,10 @@
int left, int top, int width, int height,
GrPixelConfig config, const SkTArray<GrMipLevel>&) override;
- bool onTransferPixels(GrTexture*,
+ bool onTransferPixels(GrSurface*,
int left, int top, int width, int height,
GrPixelConfig config, GrBuffer* transferBuffer,
- size_t offset, size_t rowBytes) override;
+ size_t offset, size_t rowBytes) override { return false; }
void onResolveRenderTarget(GrRenderTarget* target) override {}
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp
index 56db2be..5771a78 100644
--- a/tools/gpu/GrTest.cpp
+++ b/tools/gpu/GrTest.cpp
@@ -372,7 +372,7 @@
return false;
}
- bool onTransferPixels(GrTexture* texture,
+ bool onTransferPixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig config, GrBuffer* transferBuffer,
size_t offset, size_t rowBytes) override {