When setting up a copySurface dst texture make the orientation match the src when...
authorbsalomon <bsalomon@google.com>
Wed, 8 Jun 2016 19:32:02 +0000 (12:32 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 8 Jun 2016 19:32:02 +0000 (12:32 -0700)
TBR=egdaniel@google.com
BUG=chromium:618122
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2049753002

Review-Url: https://codereview.chromium.org/2049753002

Cherry-pick from master to chrome/m52
NOTREECHECKS=true
NOTRY=true
NOPRESUBMIT=true

Review-Url: https://codereview.chromium.org/2049493003

src/gpu/gl/GrGLGpu.cpp

index 6b03df3e107aa07d5f5ce328de5d938265317c14..a62739ba391b1999cd3ea9ca79b4139f551c1a6d 100644 (file)
@@ -3502,13 +3502,19 @@ bool GrGLGpu::initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc)
     // 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.
 
+    GrSurfaceOrigin originForBlitFramebuffer = kDefault_GrSurfaceOrigin;
+    if (this->glCaps().blitFramebufferSupport() ==
+       GrGLCaps::kNoScalingNoMirroring_BlitFramebufferSupport) {
+        originForBlitFramebuffer = src->origin();
+    }
+
     // 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->fOrigin = originForBlitFramebuffer;
             desc->fFlags = kRenderTarget_GrSurfaceFlag;
             desc->fConfig = kBGRA_8888_GrPixelConfig;
             return true;
@@ -3524,7 +3530,7 @@ bool GrGLGpu::initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc)
         // 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->fOrigin = originForBlitFramebuffer;
             desc->fFlags = kRenderTarget_GrSurfaceFlag;
             desc->fConfig = src->config();
             return true;