Index: src/gpu/gl/GrGLGpu.cpp |
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp |
index 4f09ebae00b4556edf52cdb85b6a34d9035277fc..b01310ef8c67a1de1d1e098295a366763e5ed940 100644 |
--- a/src/gpu/gl/GrGLGpu.cpp |
+++ b/src/gpu/gl/GrGLGpu.cpp |
@@ -920,12 +920,13 @@ bool GrGLGpu::onTransferPixels(GrSurface* surface, |
bool success = false; |
GrMipLevel mipLevel; |
- mipLevel.fPixels = transferBuffer; |
+ mipLevel.fPixels = (void*)offset; |
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(surface, &rect); |
@@ -1196,6 +1197,14 @@ bool GrGLGpu::uploadTexData(const GrSurfaceDesc& desc, |
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, |