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

Unified Diff: src/gpu/gl/GrGLGpu.cpp

Issue 1888473002: Use transfer buffer for BatchAtlas texture copies Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix Chrome 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
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,

Powered by Google App Engine
This is Rietveld 408576698