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

Side by Side Diff: src/gpu/gl/GrGLGpu.cpp

Issue 2049753002: When setting up a copySurface dst texture make the orientation match the src when glBlitFramebuffer… (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrGLGpu.h" 8 #include "GrGLGpu.h"
9 #include "GrGLBuffer.h" 9 #include "GrGLBuffer.h"
10 #include "GrGLGLSL.h" 10 #include "GrGLGLSL.h"
(...skipping 3557 matching lines...) Expand 10 before | Expand all | Expand 10 after
3568 if (srcTexture && srcTexture->target() != GR_GL_TEXTURE_2D) { 3568 if (srcTexture && srcTexture->target() != GR_GL_TEXTURE_2D) {
3569 // Not supported for FBO blit or CopyTexSubImage 3569 // Not supported for FBO blit or CopyTexSubImage
3570 return false; 3570 return false;
3571 } 3571 }
3572 3572
3573 // We look for opportunities to use CopyTexSubImage, or fbo blit. If neither are 3573 // We look for opportunities to use CopyTexSubImage, or fbo blit. If neither are
3574 // possible and we return false to fallback to creating a render target dst for render-to- 3574 // possible and we return false to fallback to creating a render target dst for render-to-
3575 // texture. This code prefers CopyTexSubImage to fbo blit and avoids trigger ing temporary fbo 3575 // texture. This code prefers CopyTexSubImage to fbo blit and avoids trigger ing temporary fbo
3576 // creation. It isn't clear that avoiding temporary fbo creation is actually optimal. 3576 // creation. It isn't clear that avoiding temporary fbo creation is actually optimal.
3577 3577
3578 GrSurfaceOrigin originForBlitFramebuffer = kDefault_GrSurfaceOrigin;
3579 if (this->glCaps().blitFramebufferSupport() ==
3580 GrGLCaps::kNoScalingNoMirroring_BlitFramebufferSupport) {
3581 originForBlitFramebuffer = src->origin();
3582 }
3583
3578 // Check for format issues with glCopyTexSubImage2D 3584 // Check for format issues with glCopyTexSubImage2D
3579 if (kGLES_GrGLStandard == this->glStandard() && this->glCaps().bgraIsInterna lFormat() && 3585 if (kGLES_GrGLStandard == this->glStandard() && this->glCaps().bgraIsInterna lFormat() &&
3580 kBGRA_8888_GrPixelConfig == src->config()) { 3586 kBGRA_8888_GrPixelConfig == src->config()) {
3581 // glCopyTexSubImage2D doesn't work with this config. If the bgra can be used with fbo blit 3587 // glCopyTexSubImage2D doesn't work with this config. If the bgra can be used with fbo blit
3582 // then we set up for that, otherwise fail. 3588 // then we set up for that, otherwise fail.
3583 if (this->caps()->isConfigRenderable(kBGRA_8888_GrPixelConfig, false)) { 3589 if (this->caps()->isConfigRenderable(kBGRA_8888_GrPixelConfig, false)) {
3584 desc->fOrigin = kDefault_GrSurfaceOrigin; 3590 desc->fOrigin = originForBlitFramebuffer;
3585 desc->fFlags = kRenderTarget_GrSurfaceFlag; 3591 desc->fFlags = kRenderTarget_GrSurfaceFlag;
3586 desc->fConfig = kBGRA_8888_GrPixelConfig; 3592 desc->fConfig = kBGRA_8888_GrPixelConfig;
3587 return true; 3593 return true;
3588 } 3594 }
3589 return false; 3595 return false;
3590 } else if (nullptr == src->asRenderTarget()) { 3596 } else if (nullptr == src->asRenderTarget()) {
3591 // CopyTexSubImage2D or fbo blit would require creating a temp fbo for t he src. 3597 // CopyTexSubImage2D or fbo blit would require creating a temp fbo for t he src.
3592 return false; 3598 return false;
3593 } 3599 }
3594 3600
3595 const GrGLRenderTarget* srcRT = static_cast<const GrGLRenderTarget*>(src->as RenderTarget()); 3601 const GrGLRenderTarget* srcRT = static_cast<const GrGLRenderTarget*>(src->as RenderTarget());
3596 if (srcRT && srcRT->renderFBOID() != srcRT->textureFBOID()) { 3602 if (srcRT && srcRT->renderFBOID() != srcRT->textureFBOID()) {
3597 // It's illegal to call CopyTexSubImage2D on a MSAA renderbuffer. Set up for FBO blit or 3603 // It's illegal to call CopyTexSubImage2D on a MSAA renderbuffer. Set up for FBO blit or
3598 // fail. 3604 // fail.
3599 if (this->caps()->isConfigRenderable(src->config(), false)) { 3605 if (this->caps()->isConfigRenderable(src->config(), false)) {
3600 desc->fOrigin = kDefault_GrSurfaceOrigin; 3606 desc->fOrigin = originForBlitFramebuffer;
3601 desc->fFlags = kRenderTarget_GrSurfaceFlag; 3607 desc->fFlags = kRenderTarget_GrSurfaceFlag;
3602 desc->fConfig = src->config(); 3608 desc->fConfig = src->config();
3603 return true; 3609 return true;
3604 } 3610 }
3605 return false; 3611 return false;
3606 } 3612 }
3607 3613
3608 // We'll do a CopyTexSubImage. Make the dst a plain old texture. 3614 // We'll do a CopyTexSubImage. Make the dst a plain old texture.
3609 desc->fConfig = src->config(); 3615 desc->fConfig = src->config();
3610 desc->fOrigin = src->origin(); 3616 desc->fOrigin = src->origin();
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
4630 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || 4636 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() ||
4631 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { 4637 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) {
4632 copyParams->fFilter = GrTextureParams::kNone_FilterMode; 4638 copyParams->fFilter = GrTextureParams::kNone_FilterMode;
4633 copyParams->fWidth = texture->width(); 4639 copyParams->fWidth = texture->width();
4634 copyParams->fHeight = texture->height(); 4640 copyParams->fHeight = texture->height();
4635 return true; 4641 return true;
4636 } 4642 }
4637 } 4643 }
4638 return false; 4644 return false;
4639 } 4645 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698