From a393127de5153987f9e1f3e40f8ef8e63a3927f5 Mon Sep 17 00:00:00 2001 From: joshualitt Date: Fri, 31 Oct 2014 16:32:22 -0700 Subject: Revert of Temporary fix to remove drawrect call from GpuGL (patchset #6 id:90005 of https://codereview.chromium.org/694933002/) Reason for revert: patch breaks angle bots and K1 Original issue's description: > Temporary fix to remove drawrect call from GpuGL > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/d4a5c2028117c100ccf44263c0118a0b4745f627 TBR=bsalomon@google.com,joshualitt@chromium.org NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/693223002 --- src/gpu/GrDrawTarget.h | 4 ++-- src/gpu/GrInOrderDrawBuffer.cpp | 3 --- src/gpu/gl/GrGpuGL.cpp | 23 ++++++++++++++--------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h index 1b1137d2d5..4545f74d25 100644 --- a/src/gpu/GrDrawTarget.h +++ b/src/gpu/GrDrawTarget.h @@ -925,7 +925,7 @@ private: // Check to see if this set of draw commands has been sent out virtual bool isIssued(uint32_t drawID) { return true; } - virtual GrClipMaskManager* clipMaskManager() = 0; + virtual GrClipMaskManager* getClipMaskManager() = 0; enum { kPreallocGeoSrcStateStackCnt = 4, @@ -981,7 +981,7 @@ protected: GrClipMaskManager fClipMaskManager; private: - GrClipMaskManager* clipMaskManager() { return &fClipMaskManager; } + GrClipMaskManager* getClipMaskManager() { return &fClipMaskManager; } typedef GrDrawTarget INHERITED; }; diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp index 59b31f4f70..b671742309 100644 --- a/src/gpu/GrInOrderDrawBuffer.cpp +++ b/src/gpu/GrInOrderDrawBuffer.cpp @@ -595,9 +595,6 @@ bool GrInOrderDrawBuffer::onCopySurface(GrSurface* dst, cs->fDstPoint = dstPoint; this->recordTraceMarkersIfNecessary(); return true; - } else if (this->canCopySurface(dst, src, srcRect, dstPoint)) { - this->GrDrawTarget::onCopySurface(dst, src, srcRect, dstPoint); - return true; } else { return false; } diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp index 76547760c9..9d08f641eb 100644 --- a/src/gpu/gl/GrGpuGL.cpp +++ b/src/gpu/gl/GrGpuGL.cpp @@ -2403,8 +2403,11 @@ bool GrGpuGL::onCopySurface(GrSurface* dst, GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint) { + bool inheritedCouldCopy = INHERITED::onCanCopySurface(dst, src, srcRect, dstPoint); bool copied = false; - if (can_copy_texsubimage(dst, src, this)) { + bool wouldNeedTempFBO = false; + if (can_copy_texsubimage(dst, src, this, &wouldNeedTempFBO) && + (!wouldNeedTempFBO || !inheritedCouldCopy)) { GrGLuint srcFBO; GrGLIRect srcVP; srcFBO = this->bindSurfaceAsFBO(src, GR_GL_FRAMEBUFFER, &srcVP); @@ -2436,7 +2439,8 @@ bool GrGpuGL::onCopySurface(GrSurface* dst, if (srcFBO) { GL_CALL(DeleteFramebuffers(1, &srcFBO)); } - } else if (can_blit_framebuffer(dst, src, this)) { + } else if (can_blit_framebuffer(dst, src, this, &wouldNeedTempFBO) && + (!wouldNeedTempFBO || !inheritedCouldCopy)) { SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, dstPoint.fY, srcRect.width(), srcRect.height()); bool selfOverlap = false; @@ -2499,6 +2503,10 @@ bool GrGpuGL::onCopySurface(GrSurface* dst, copied = true; } } + if (!copied && inheritedCouldCopy) { + copied = INHERITED::onCopySurface(dst, src, srcRect, dstPoint); + SkASSERT(copied); + } return copied; } @@ -2506,14 +2514,11 @@ bool GrGpuGL::onCanCopySurface(GrSurface* dst, GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint) { - // This mirrors the logic in onCopySurface. We prefer our base makes the copy if we need to - // create a temp fbo - // TODO verify this assumption, it may not be true at all - bool wouldNeedTempFBO = false; - if (can_copy_texsubimage(dst, src, this, &wouldNeedTempFBO) && !wouldNeedTempFBO) { + // This mirrors the logic in onCopySurface. + if (can_copy_texsubimage(dst, src, this)) { return true; } - if (can_blit_framebuffer(dst, src, this, &wouldNeedTempFBO) && !wouldNeedTempFBO) { + if (can_blit_framebuffer(dst, src, this)) { if (dst->surfacePriv().isSameAs(src)) { SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, dstPoint.fY, srcRect.width(), srcRect.height()); @@ -2524,7 +2529,7 @@ bool GrGpuGL::onCanCopySurface(GrSurface* dst, return true; } } - return false; + return INHERITED::onCanCopySurface(dst, src, srcRect, dstPoint); } void GrGpuGL::didAddGpuTraceMarker() { -- cgit v1.2.3