OLD | NEW |
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 3568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3579 SkASSERT(surface->asTexture()); | 3579 SkASSERT(surface->asTexture()); |
3580 GrGLenum textureTarget = static_cast<GrGLTexture*>(surface->asTexture())
->target(); | 3580 GrGLenum textureTarget = static_cast<GrGLTexture*>(surface->asTexture())
->target(); |
3581 GR_GL_CALL(this->glInterface(), FramebufferTexture2D(fboTarget, | 3581 GR_GL_CALL(this->glInterface(), FramebufferTexture2D(fboTarget, |
3582 GR_GL_COLOR_ATTACHM
ENT0, | 3582 GR_GL_COLOR_ATTACHM
ENT0, |
3583 textureTarget, | 3583 textureTarget, |
3584 0, | 3584 0, |
3585 0)); | 3585 0)); |
3586 } | 3586 } |
3587 } | 3587 } |
3588 | 3588 |
3589 bool GrGLGpu::initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc)
const { | 3589 bool GrGLGpu::initDescForDstCopy(const GrRenderTarget* src, GrSurfaceDesc* desc)
const { |
3590 // If the src is a texture, we can implement the blit as a draw assuming the
config is | 3590 // If the src is a texture, we can implement the blit as a draw assuming the
config is |
3591 // renderable. | 3591 // renderable. |
3592 if (src->asTexture() && this->caps()->isConfigRenderable(src->config(), fals
e)) { | 3592 if (src->asTexture() && this->caps()->isConfigRenderable(src->config(), fals
e)) { |
3593 desc->fOrigin = kDefault_GrSurfaceOrigin; | 3593 desc->fOrigin = kDefault_GrSurfaceOrigin; |
3594 desc->fFlags = kRenderTarget_GrSurfaceFlag; | 3594 desc->fFlags = kRenderTarget_GrSurfaceFlag; |
3595 desc->fConfig = src->config(); | 3595 desc->fConfig = src->config(); |
3596 return true; | 3596 return true; |
3597 } | 3597 } |
3598 | 3598 |
3599 const GrGLTexture* srcTexture = static_cast<const GrGLTexture*>(src->asTextu
re()); | 3599 const GrGLTexture* srcTexture = static_cast<const GrGLTexture*>(src->asTextu
re()); |
(...skipping 18 matching lines...) Expand all Loading... |
3618 kBGRA_8888_GrPixelConfig == src->config()) { | 3618 kBGRA_8888_GrPixelConfig == src->config()) { |
3619 // glCopyTexSubImage2D doesn't work with this config. If the bgra can be
used with fbo blit | 3619 // glCopyTexSubImage2D doesn't work with this config. If the bgra can be
used with fbo blit |
3620 // then we set up for that, otherwise fail. | 3620 // then we set up for that, otherwise fail. |
3621 if (this->caps()->isConfigRenderable(kBGRA_8888_GrPixelConfig, false)) { | 3621 if (this->caps()->isConfigRenderable(kBGRA_8888_GrPixelConfig, false)) { |
3622 desc->fOrigin = originForBlitFramebuffer; | 3622 desc->fOrigin = originForBlitFramebuffer; |
3623 desc->fFlags = kRenderTarget_GrSurfaceFlag; | 3623 desc->fFlags = kRenderTarget_GrSurfaceFlag; |
3624 desc->fConfig = kBGRA_8888_GrPixelConfig; | 3624 desc->fConfig = kBGRA_8888_GrPixelConfig; |
3625 return true; | 3625 return true; |
3626 } | 3626 } |
3627 return false; | 3627 return false; |
3628 } else if (nullptr == src->asRenderTarget()) { | |
3629 // CopyTexSubImage2D or fbo blit would require creating a temp fbo for t
he src. | |
3630 return false; | |
3631 } | 3628 } |
3632 | 3629 |
3633 const GrGLRenderTarget* srcRT = static_cast<const GrGLRenderTarget*>(src->as
RenderTarget()); | 3630 const GrGLRenderTarget* srcRT = static_cast<const GrGLRenderTarget*>(src); |
3634 if (srcRT && srcRT->renderFBOID() != srcRT->textureFBOID()) { | 3631 if (srcRT->renderFBOID() != srcRT->textureFBOID()) { |
3635 // It's illegal to call CopyTexSubImage2D on a MSAA renderbuffer. Set up
for FBO blit or | 3632 // It's illegal to call CopyTexSubImage2D on a MSAA renderbuffer. Set up
for FBO blit or |
3636 // fail. | 3633 // fail. |
3637 if (this->caps()->isConfigRenderable(src->config(), false)) { | 3634 if (this->caps()->isConfigRenderable(src->config(), false)) { |
3638 desc->fOrigin = originForBlitFramebuffer; | 3635 desc->fOrigin = originForBlitFramebuffer; |
3639 desc->fFlags = kRenderTarget_GrSurfaceFlag; | 3636 desc->fFlags = kRenderTarget_GrSurfaceFlag; |
3640 desc->fConfig = src->config(); | 3637 desc->fConfig = src->config(); |
3641 return true; | 3638 return true; |
3642 } | 3639 } |
3643 return false; | 3640 return false; |
3644 } | 3641 } |
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4673 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || | 4670 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || |
4674 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { | 4671 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { |
4675 copyParams->fFilter = GrTextureParams::kNone_FilterMode; | 4672 copyParams->fFilter = GrTextureParams::kNone_FilterMode; |
4676 copyParams->fWidth = texture->width(); | 4673 copyParams->fWidth = texture->width(); |
4677 copyParams->fHeight = texture->height(); | 4674 copyParams->fHeight = texture->height(); |
4678 return true; | 4675 return true; |
4679 } | 4676 } |
4680 } | 4677 } |
4681 return false; | 4678 return false; |
4682 } | 4679 } |
OLD | NEW |