diff options
author | bsalomon <bsalomon@google.com> | 2014-11-26 10:20:45 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-26 10:20:45 -0800 |
commit | 8ee4e601f9aa4199e62b57260780207fd26e446a (patch) | |
tree | fd9b11034471902f053b0f0f5731a096d787949d /src/gpu/gl | |
parent | f0090cb80ab10a49e511aa5450ae38917fa058d9 (diff) |
Revert of some cleanup around GrGpu/GrDrawTarget copySurface (patchset #3 id:40001 of https://codereview.chromium.org/749903003/)
Reason for revert:
likely causing es rendering errors.
Original issue's description:
> some cleanup around GrGpu/GrDrawTarget copySurface
>
> Committed: https://skia.googlesource.com/skia/+/e9aa5dc4d5906788eaf691d7c69f1494928f401d
TBR=joshualitt@google.com
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.chromium.org/763593002
Diffstat (limited to 'src/gpu/gl')
-rw-r--r-- | src/gpu/gl/GrGpuGL.cpp | 50 | ||||
-rw-r--r-- | src/gpu/gl/GrGpuGL.h | 19 |
2 files changed, 27 insertions, 42 deletions
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp index d56566379d..8bf35c1690 100644 --- a/src/gpu/gl/GrGpuGL.cpp +++ b/src/gpu/gl/GrGpuGL.cpp @@ -2362,46 +2362,30 @@ GrGLuint GrGpuGL::bindSurfaceAsFBO(GrSurface* surface, GrGLenum fboTarget, GrGLI return tempFBOID; } -bool GrGpuGL::initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) { - // In here we look for opportunities to use CopyTexSubImage, or fbo blit. If neither are - // possible and we return false to fallback to creating a render target dst for render-to- - // texture. This code prefers CopyTexSubImage to fbo blit and avoids triggering temporary fbo - // creation. It isn't clear that avoiding temporary fbo creation is actually optimal. - +void GrGpuGL::initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) { // Check for format issues with glCopyTexSubImage2D if (kGLES_GrGLStandard == this->glStandard() && this->glCaps().bgraIsInternalFormat() && kBGRA_8888_GrPixelConfig == src->config()) { - // glCopyTexSubImage2D doesn't work with this config. If the bgra can be used with fbo blit - // then we set up for that, otherwise fail. - if (this->caps()->isConfigRenderable(kBGRA_8888_GrPixelConfig, false)) { - desc->fOrigin = kDefault_GrSurfaceOrigin; - desc->fFlags = kRenderTarget_GrSurfaceFlag | kNoStencil_GrSurfaceFlag; - desc->fConfig = kBGRA_8888_GrPixelConfig; - return true; - } - return false; + // glCopyTexSubImage2D doesn't work with this config. We'll want to make it a render target + // in order to call glBlitFramebuffer or to copy to it by rendering. + INHERITED::initCopySurfaceDstDesc(src, desc); + return; } else if (NULL == src->asRenderTarget()) { - // CopyTexSubImage2D or fbo blit would require creating a temp fbo for the src. - return false; + // We don't want to have to create an FBO just to use glCopyTexSubImage2D. Let the base + // class handle it by rendering. + INHERITED::initCopySurfaceDstDesc(src, desc); + return; } const GrGLRenderTarget* srcRT = static_cast<const GrGLRenderTarget*>(src->asRenderTarget()); if (srcRT && srcRT->renderFBOID() != srcRT->textureFBOID()) { - // It's illegal to call CopyTexSubImage2D on a MSAA renderbuffer. Set up for FBO blit or - // fail. - if (this->caps()->isConfigRenderable(src->config(), false)) { - desc->fOrigin = kDefault_GrSurfaceOrigin; - desc->fFlags = kRenderTarget_GrSurfaceFlag | kNoStencil_GrSurfaceFlag; - desc->fConfig = src->config(); - } - return false; + // It's illegal to call CopyTexSubImage2D on a MSAA renderbuffer. + INHERITED::initCopySurfaceDstDesc(src, desc); + } else { + desc->fConfig = src->config(); + desc->fOrigin = src->origin(); + desc->fFlags = kNone_GrSurfaceFlags; } - - // We'll do a CopyTexSubImage. Make the dst a plain old texture. - desc->fConfig = src->config(); - desc->fOrigin = src->origin(); - desc->fFlags = kNone_GrSurfaceFlags; - return true; } bool GrGpuGL::copySurface(GrSurface* dst, @@ -2512,8 +2496,8 @@ bool GrGpuGL::canCopySurface(const GrSurface* dst, 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 the assumption that temp fbos are expensive; it may not be - // true at all. + // 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) { return true; diff --git a/src/gpu/gl/GrGpuGL.h b/src/gpu/gl/GrGpuGL.h index 4224ba64fd..a176c95bca 100644 --- a/src/gpu/gl/GrGpuGL.h +++ b/src/gpu/gl/GrGpuGL.h @@ -68,7 +68,7 @@ public: size_t rowBytes) const SK_OVERRIDE; virtual bool fullReadPixelsIsFasterThanPartial() const SK_OVERRIDE; - virtual bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) SK_OVERRIDE; + virtual void initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) SK_OVERRIDE; // These functions should be used to bind GL objects. They track the GL state and skip redundant // bindings. Making the equivalent glBind calls directly will confuse the state tracking. @@ -94,15 +94,16 @@ public: fHWGeometryState.notifyIndexBufferDelete(id); } - bool copySurface(GrSurface* dst, - GrSurface* src, - const SkIRect& srcRect, - const SkIPoint& dstPoint) SK_OVERRIDE; + // DrawTarget overrides + virtual bool copySurface(GrSurface* dst, + GrSurface* src, + const SkIRect& srcRect, + const SkIPoint& dstPoint) SK_OVERRIDE; - bool canCopySurface(const GrSurface* dst, - const GrSurface* src, - const SkIRect& srcRect, - const SkIPoint& dstPoint) SK_OVERRIDE; + virtual bool canCopySurface(const GrSurface* dst, + const GrSurface* src, + const SkIRect& srcRect, + const SkIPoint& dstPoint) SK_OVERRIDE; protected: virtual void buildProgramDesc(const GrOptDrawState&, |