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 | 8 |
9 #include "GrGpuGL.h" | 9 #include "GrGpuGL.h" |
10 #include "GrGLStencilBuffer.h" | 10 #include "GrGLStencilBuffer.h" |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 if (desc->fRTFBOID != desc->fTexFBOID) { | 863 if (desc->fRTFBOID != desc->fTexFBOID) { |
864 SkASSERT(desc->fSampleCnt > 0); | 864 SkASSERT(desc->fSampleCnt > 0); |
865 GL_CALL(BindRenderbuffer(GR_GL_RENDERBUFFER, | 865 GL_CALL(BindRenderbuffer(GR_GL_RENDERBUFFER, |
866 desc->fMSColorRenderbufferID)); | 866 desc->fMSColorRenderbufferID)); |
867 if (!renderbuffer_storage_msaa(fGLContext, | 867 if (!renderbuffer_storage_msaa(fGLContext, |
868 desc->fSampleCnt, | 868 desc->fSampleCnt, |
869 msColorFormat, | 869 msColorFormat, |
870 width, height)) { | 870 width, height)) { |
871 goto FAILED; | 871 goto FAILED; |
872 } | 872 } |
| 873 fGPUStats.incRenderTargetBinds(); |
873 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, desc->fRTFBOID)); | 874 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, desc->fRTFBOID)); |
874 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, | 875 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
875 GR_GL_COLOR_ATTACHMENT0, | 876 GR_GL_COLOR_ATTACHMENT0, |
876 GR_GL_RENDERBUFFER, | 877 GR_GL_RENDERBUFFER, |
877 desc->fMSColorRenderbufferID)); | 878 desc->fMSColorRenderbufferID)); |
878 if (desc->fCheckAllocation || | 879 if (desc->fCheckAllocation || |
879 !this->glCaps().isConfigVerifiedColorAttachment(desc->fConfig)) { | 880 !this->glCaps().isConfigVerifiedColorAttachment(desc->fConfig)) { |
880 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); | 881 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); |
881 if (status != GR_GL_FRAMEBUFFER_COMPLETE) { | 882 if (status != GR_GL_FRAMEBUFFER_COMPLETE) { |
882 goto FAILED; | 883 goto FAILED; |
883 } | 884 } |
884 fGLContext.caps()->markConfigAsValidColorAttachment(desc->fConfig); | 885 fGLContext.caps()->markConfigAsValidColorAttachment(desc->fConfig); |
885 } | 886 } |
886 } | 887 } |
| 888 fGPUStats.incRenderTargetBinds(); |
887 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, desc->fTexFBOID)); | 889 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, desc->fTexFBOID)); |
888 | 890 |
889 if (this->glCaps().usesImplicitMSAAResolve() && desc->fSampleCnt > 0) { | 891 if (this->glCaps().usesImplicitMSAAResolve() && desc->fSampleCnt > 0) { |
890 GL_CALL(FramebufferTexture2DMultisample(GR_GL_FRAMEBUFFER, | 892 GL_CALL(FramebufferTexture2DMultisample(GR_GL_FRAMEBUFFER, |
891 GR_GL_COLOR_ATTACHMENT0, | 893 GR_GL_COLOR_ATTACHMENT0, |
892 GR_GL_TEXTURE_2D, | 894 GR_GL_TEXTURE_2D, |
893 texID, 0, desc->fSampleCnt)); | 895 texID, 0, desc->fSampleCnt)); |
894 } else { | 896 } else { |
895 GL_CALL(FramebufferTexture2D(GR_GL_FRAMEBUFFER, | 897 GL_CALL(FramebufferTexture2D(GR_GL_FRAMEBUFFER, |
896 GR_GL_COLOR_ATTACHMENT0, | 898 GR_GL_COLOR_ATTACHMENT0, |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); | 1240 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); |
1239 SkASSERT(GR_GL_FRAMEBUFFER_COMPLETE == status); | 1241 SkASSERT(GR_GL_FRAMEBUFFER_COMPLETE == status); |
1240 #endif | 1242 #endif |
1241 } | 1243 } |
1242 return true; | 1244 return true; |
1243 } else { | 1245 } else { |
1244 GrGLStencilBuffer* glsb = static_cast<GrGLStencilBuffer*>(sb); | 1246 GrGLStencilBuffer* glsb = static_cast<GrGLStencilBuffer*>(sb); |
1245 GrGLuint rb = glsb->renderbufferID(); | 1247 GrGLuint rb = glsb->renderbufferID(); |
1246 | 1248 |
1247 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; | 1249 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; |
| 1250 fGPUStats.incRenderTargetBinds(); |
1248 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, fbo)); | 1251 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, fbo)); |
1249 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, | 1252 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
1250 GR_GL_STENCIL_ATTACHMENT, | 1253 GR_GL_STENCIL_ATTACHMENT, |
1251 GR_GL_RENDERBUFFER, rb)); | 1254 GR_GL_RENDERBUFFER, rb)); |
1252 if (glsb->format().fPacked) { | 1255 if (glsb->format().fPacked) { |
1253 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, | 1256 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
1254 GR_GL_DEPTH_ATTACHMENT, | 1257 GR_GL_DEPTH_ATTACHMENT, |
1255 GR_GL_RENDERBUFFER, rb)); | 1258 GR_GL_RENDERBUFFER, rb)); |
1256 } else { | 1259 } else { |
1257 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, | 1260 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1431 if (NULL == renderTarget) { | 1434 if (NULL == renderTarget) { |
1432 renderTarget = this->drawState()->getRenderTarget(); | 1435 renderTarget = this->drawState()->getRenderTarget(); |
1433 if (NULL == renderTarget) { | 1436 if (NULL == renderTarget) { |
1434 return; | 1437 return; |
1435 } | 1438 } |
1436 } | 1439 } |
1437 | 1440 |
1438 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(renderTarget); | 1441 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(renderTarget); |
1439 if (renderTarget->getUniqueID() != fHWBoundRenderTargetUniqueID) { | 1442 if (renderTarget->getUniqueID() != fHWBoundRenderTargetUniqueID) { |
1440 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; | 1443 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; |
| 1444 fGPUStats.incRenderTargetBinds(); |
1441 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, glRT->renderFBOID())); | 1445 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, glRT->renderFBOID())); |
1442 } | 1446 } |
1443 switch (this->glCaps().invalidateFBType()) { | 1447 switch (this->glCaps().invalidateFBType()) { |
1444 case GrGLCaps::kNone_InvalidateFBType: | 1448 case GrGLCaps::kNone_InvalidateFBType: |
1445 SkFAIL("Should never get here."); | 1449 SkFAIL("Should never get here."); |
1446 break; | 1450 break; |
1447 case GrGLCaps::kInvalidate_InvalidateFBType: | 1451 case GrGLCaps::kInvalidate_InvalidateFBType: |
1448 if (0 == glRT->renderFBOID()) { | 1452 if (0 == glRT->renderFBOID()) { |
1449 // When rendering to the default framebuffer the legal values f
or attachments | 1453 // When rendering to the default framebuffer the legal values f
or attachments |
1450 // are GL_COLOR, GL_DEPTH, GL_STENCIL, ... rather than the vari
ous FBO attachment | 1454 // are GL_COLOR, GL_DEPTH, GL_STENCIL, ... rather than the vari
ous FBO attachment |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 switch (tgt->getResolveType()) { | 1598 switch (tgt->getResolveType()) { |
1595 case GrGLRenderTarget::kCantResolve_ResolveType: | 1599 case GrGLRenderTarget::kCantResolve_ResolveType: |
1596 return false; | 1600 return false; |
1597 case GrGLRenderTarget::kAutoResolves_ResolveType: | 1601 case GrGLRenderTarget::kAutoResolves_ResolveType: |
1598 this->flushRenderTarget(static_cast<GrGLRenderTarget*>(target), | 1602 this->flushRenderTarget(static_cast<GrGLRenderTarget*>(target), |
1599 &SkIRect::EmptyIRect()); | 1603 &SkIRect::EmptyIRect()); |
1600 break; | 1604 break; |
1601 case GrGLRenderTarget::kCanResolve_ResolveType: | 1605 case GrGLRenderTarget::kCanResolve_ResolveType: |
1602 this->onResolveRenderTarget(tgt); | 1606 this->onResolveRenderTarget(tgt); |
1603 // we don't track the state of the READ FBO ID. | 1607 // we don't track the state of the READ FBO ID. |
| 1608 fGPUStats.incRenderTargetBinds(); |
1604 GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, | 1609 GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, |
1605 tgt->textureFBOID())); | 1610 tgt->textureFBOID())); |
1606 break; | 1611 break; |
1607 default: | 1612 default: |
1608 SkFAIL("Unknown resolve type"); | 1613 SkFAIL("Unknown resolve type"); |
1609 } | 1614 } |
1610 | 1615 |
1611 const GrGLIRect& glvp = tgt->getViewport(); | 1616 const GrGLIRect& glvp = tgt->getViewport(); |
1612 | 1617 |
1613 // the read rect is viewport-relative | 1618 // the read rect is viewport-relative |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 } | 1696 } |
1692 return true; | 1697 return true; |
1693 } | 1698 } |
1694 | 1699 |
1695 void GrGpuGL::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bound)
{ | 1700 void GrGpuGL::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bound)
{ |
1696 | 1701 |
1697 SkASSERT(target); | 1702 SkASSERT(target); |
1698 | 1703 |
1699 uint32_t rtID = target->getUniqueID(); | 1704 uint32_t rtID = target->getUniqueID(); |
1700 if (fHWBoundRenderTargetUniqueID != rtID) { | 1705 if (fHWBoundRenderTargetUniqueID != rtID) { |
| 1706 fGPUStats.incRenderTargetBinds(); |
1701 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, target->renderFBOID())); | 1707 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, target->renderFBOID())); |
1702 #ifdef SK_DEBUG | 1708 #ifdef SK_DEBUG |
1703 // don't do this check in Chromium -- this is causing | 1709 // don't do this check in Chromium -- this is causing |
1704 // lots of repeated command buffer flushes when the compositor is | 1710 // lots of repeated command buffer flushes when the compositor is |
1705 // rendering with Ganesh, which is really slow; even too slow for | 1711 // rendering with Ganesh, which is really slow; even too slow for |
1706 // Debug mode. | 1712 // Debug mode. |
1707 if (!this->glContext().isChromium()) { | 1713 if (!this->glContext().isChromium()) { |
1708 GrGLenum status; | 1714 GrGLenum status; |
1709 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); | 1715 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); |
1710 if (status != GR_GL_FRAMEBUFFER_COMPLETE) { | 1716 if (status != GR_GL_FRAMEBUFFER_COMPLETE) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1793 #endif | 1799 #endif |
1794 #endif | 1800 #endif |
1795 } | 1801 } |
1796 | 1802 |
1797 void GrGpuGL::onResolveRenderTarget(GrRenderTarget* target) { | 1803 void GrGpuGL::onResolveRenderTarget(GrRenderTarget* target) { |
1798 GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(target); | 1804 GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(target); |
1799 if (rt->needsResolve()) { | 1805 if (rt->needsResolve()) { |
1800 // Some extensions automatically resolves the texture when it is read. | 1806 // Some extensions automatically resolves the texture when it is read. |
1801 if (this->glCaps().usesMSAARenderBuffers()) { | 1807 if (this->glCaps().usesMSAARenderBuffers()) { |
1802 SkASSERT(rt->textureFBOID() != rt->renderFBOID()); | 1808 SkASSERT(rt->textureFBOID() != rt->renderFBOID()); |
| 1809 fGPUStats.incRenderTargetBinds(); |
| 1810 fGPUStats.incRenderTargetBinds(); |
1803 GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, rt->renderFBOID())); | 1811 GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, rt->renderFBOID())); |
1804 GL_CALL(BindFramebuffer(GR_GL_DRAW_FRAMEBUFFER, rt->textureFBOID()))
; | 1812 GL_CALL(BindFramebuffer(GR_GL_DRAW_FRAMEBUFFER, rt->textureFBOID()))
; |
1805 // make sure we go through flushRenderTarget() since we've modified | 1813 // make sure we go through flushRenderTarget() since we've modified |
1806 // the bound DRAW FBO ID. | 1814 // the bound DRAW FBO ID. |
1807 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; | 1815 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; |
1808 const GrGLIRect& vp = rt->getViewport(); | 1816 const GrGLIRect& vp = rt->getViewport(); |
1809 const SkIRect dirtyRect = rt->getResolveRect(); | 1817 const SkIRect dirtyRect = rt->getResolveRect(); |
1810 GrGLIRect r; | 1818 GrGLIRect r; |
1811 r.setRelativeTo(vp, dirtyRect.fLeft, dirtyRect.fTop, | 1819 r.setRelativeTo(vp, dirtyRect.fLeft, dirtyRect.fTop, |
1812 dirtyRect.width(), dirtyRect.height(), target->origi
n()); | 1820 dirtyRect.width(), dirtyRect.height(), target->origi
n()); |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 !GrPixelConfigIsCompressed(src->config())) { | 2364 !GrPixelConfigIsCompressed(src->config())) { |
2357 if (wouldNeedTempFBO) { | 2365 if (wouldNeedTempFBO) { |
2358 *wouldNeedTempFBO = NULL == src->asRenderTarget(); | 2366 *wouldNeedTempFBO = NULL == src->asRenderTarget(); |
2359 } | 2367 } |
2360 return true; | 2368 return true; |
2361 } else { | 2369 } else { |
2362 return false; | 2370 return false; |
2363 } | 2371 } |
2364 } | 2372 } |
2365 | 2373 |
| 2374 } |
| 2375 |
2366 // If a temporary FBO was created, its non-zero ID is returned. The viewport tha
t the copy rect is | 2376 // If a temporary FBO was created, its non-zero ID is returned. The viewport tha
t the copy rect is |
2367 // relative to is output. | 2377 // relative to is output. |
2368 inline GrGLuint bind_surface_as_fbo(const GrGLInterface* gl, | 2378 GrGLuint GrGpuGL::bindSurfaceAsFBO(GrSurface* surface, GrGLenum fboTarget, GrGLI
Rect* viewport) { |
2369 GrSurface* surface, | |
2370 GrGLenum fboTarget, | |
2371 GrGLIRect* viewport) { | |
2372 GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(surface->asRenderTarge
t()); | 2379 GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(surface->asRenderTarge
t()); |
2373 GrGLuint tempFBOID; | 2380 GrGLuint tempFBOID; |
2374 if (NULL == rt) { | 2381 if (NULL == rt) { |
2375 SkASSERT(surface->asTexture()); | 2382 SkASSERT(surface->asTexture()); |
2376 GrGLuint texID = static_cast<GrGLTexture*>(surface->asTexture())->textur
eID(); | 2383 GrGLuint texID = static_cast<GrGLTexture*>(surface->asTexture())->textur
eID(); |
2377 GR_GL_CALL(gl, GenFramebuffers(1, &tempFBOID)); | 2384 GR_GL_CALL(this->glInterface(), GenFramebuffers(1, &tempFBOID)); |
2378 GR_GL_CALL(gl, BindFramebuffer(fboTarget, tempFBOID)); | 2385 fGPUStats.incRenderTargetBinds(); |
2379 GR_GL_CALL(gl, FramebufferTexture2D(fboTarget, | 2386 GR_GL_CALL(this->glInterface(), BindFramebuffer(fboTarget, tempFBOID)); |
2380 GR_GL_COLOR_ATTACHMENT0, | 2387 GR_GL_CALL(this->glInterface(), FramebufferTexture2D(fboTarget, |
2381 GR_GL_TEXTURE_2D, | 2388 GR_GL_COLOR_ATTACHM
ENT0, |
2382 texID, | 2389 GR_GL_TEXTURE_2D, |
2383 0)); | 2390 texID, |
| 2391 0)); |
2384 viewport->fLeft = 0; | 2392 viewport->fLeft = 0; |
2385 viewport->fBottom = 0; | 2393 viewport->fBottom = 0; |
2386 viewport->fWidth = surface->width(); | 2394 viewport->fWidth = surface->width(); |
2387 viewport->fHeight = surface->height(); | 2395 viewport->fHeight = surface->height(); |
2388 } else { | 2396 } else { |
2389 tempFBOID = 0; | 2397 tempFBOID = 0; |
2390 GR_GL_CALL(gl, BindFramebuffer(fboTarget, rt->renderFBOID())); | 2398 fGPUStats.incRenderTargetBinds(); |
| 2399 GR_GL_CALL(this->glInterface(), BindFramebuffer(fboTarget, rt->renderFBO
ID())); |
2391 *viewport = rt->getViewport(); | 2400 *viewport = rt->getViewport(); |
2392 } | 2401 } |
2393 return tempFBOID; | 2402 return tempFBOID; |
2394 } | 2403 } |
2395 | 2404 |
2396 } | |
2397 | |
2398 void GrGpuGL::initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* desc)
{ | 2405 void GrGpuGL::initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* desc)
{ |
2399 // Check for format issues with glCopyTexSubImage2D | 2406 // Check for format issues with glCopyTexSubImage2D |
2400 if (kGLES_GrGLStandard == this->glStandard() && this->glCaps().bgraIsInterna
lFormat() && | 2407 if (kGLES_GrGLStandard == this->glStandard() && this->glCaps().bgraIsInterna
lFormat() && |
2401 kBGRA_8888_GrPixelConfig == src->config()) { | 2408 kBGRA_8888_GrPixelConfig == src->config()) { |
2402 // glCopyTexSubImage2D doesn't work with this config. We'll want to make
it a render target | 2409 // glCopyTexSubImage2D doesn't work with this config. We'll want to make
it a render target |
2403 // in order to call glBlitFramebuffer or to copy to it by rendering. | 2410 // in order to call glBlitFramebuffer or to copy to it by rendering. |
2404 INHERITED::initCopySurfaceDstDesc(src, desc); | 2411 INHERITED::initCopySurfaceDstDesc(src, desc); |
2405 return; | 2412 return; |
2406 } else if (NULL == src->asRenderTarget()) { | 2413 } else if (NULL == src->asRenderTarget()) { |
2407 // We don't want to have to create an FBO just to use glCopyTexSubImage2
D. Let the base | 2414 // We don't want to have to create an FBO just to use glCopyTexSubImage2
D. Let the base |
(...skipping 17 matching lines...) Expand all Loading... |
2425 GrSurface* src, | 2432 GrSurface* src, |
2426 const SkIRect& srcRect, | 2433 const SkIRect& srcRect, |
2427 const SkIPoint& dstPoint) { | 2434 const SkIPoint& dstPoint) { |
2428 bool inheritedCouldCopy = INHERITED::onCanCopySurface(dst, src, srcRect, dst
Point); | 2435 bool inheritedCouldCopy = INHERITED::onCanCopySurface(dst, src, srcRect, dst
Point); |
2429 bool copied = false; | 2436 bool copied = false; |
2430 bool wouldNeedTempFBO = false; | 2437 bool wouldNeedTempFBO = false; |
2431 if (can_copy_texsubimage(dst, src, this, &wouldNeedTempFBO) && | 2438 if (can_copy_texsubimage(dst, src, this, &wouldNeedTempFBO) && |
2432 (!wouldNeedTempFBO || !inheritedCouldCopy)) { | 2439 (!wouldNeedTempFBO || !inheritedCouldCopy)) { |
2433 GrGLuint srcFBO; | 2440 GrGLuint srcFBO; |
2434 GrGLIRect srcVP; | 2441 GrGLIRect srcVP; |
2435 srcFBO = bind_surface_as_fbo(this->glInterface(), src, GR_GL_FRAMEBUFFER
, &srcVP); | 2442 srcFBO = this->bindSurfaceAsFBO(src, GR_GL_FRAMEBUFFER, &srcVP); |
2436 GrGLTexture* dstTex = static_cast<GrGLTexture*>(dst->asTexture()); | 2443 GrGLTexture* dstTex = static_cast<GrGLTexture*>(dst->asTexture()); |
2437 SkASSERT(dstTex); | 2444 SkASSERT(dstTex); |
2438 // We modified the bound FBO | 2445 // We modified the bound FBO |
2439 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; | 2446 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; |
2440 GrGLIRect srcGLRect; | 2447 GrGLIRect srcGLRect; |
2441 srcGLRect.setRelativeTo(srcVP, | 2448 srcGLRect.setRelativeTo(srcVP, |
2442 srcRect.fLeft, | 2449 srcRect.fLeft, |
2443 srcRect.fTop, | 2450 srcRect.fTop, |
2444 srcRect.width(), | 2451 srcRect.width(), |
2445 srcRect.height(), | 2452 srcRect.height(), |
(...skipping 22 matching lines...) Expand all Loading... |
2468 bool selfOverlap = false; | 2475 bool selfOverlap = false; |
2469 if (dst->isSameAs(src)) { | 2476 if (dst->isSameAs(src)) { |
2470 selfOverlap = SkIRect::IntersectsNoEmptyCheck(dstRect, srcRect); | 2477 selfOverlap = SkIRect::IntersectsNoEmptyCheck(dstRect, srcRect); |
2471 } | 2478 } |
2472 | 2479 |
2473 if (!selfOverlap) { | 2480 if (!selfOverlap) { |
2474 GrGLuint dstFBO; | 2481 GrGLuint dstFBO; |
2475 GrGLuint srcFBO; | 2482 GrGLuint srcFBO; |
2476 GrGLIRect dstVP; | 2483 GrGLIRect dstVP; |
2477 GrGLIRect srcVP; | 2484 GrGLIRect srcVP; |
2478 dstFBO = bind_surface_as_fbo(this->glInterface(), dst, GR_GL_DRAW_FR
AMEBUFFER, &dstVP); | 2485 dstFBO = this->bindSurfaceAsFBO(dst, GR_GL_DRAW_FRAMEBUFFER, &dstVP)
; |
2479 srcFBO = bind_surface_as_fbo(this->glInterface(), src, GR_GL_READ_FR
AMEBUFFER, &srcVP); | 2486 srcFBO = this->bindSurfaceAsFBO(src, GR_GL_READ_FRAMEBUFFER, &srcVP)
; |
2480 // We modified the bound FBO | 2487 // We modified the bound FBO |
2481 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; | 2488 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; |
2482 GrGLIRect srcGLRect; | 2489 GrGLIRect srcGLRect; |
2483 GrGLIRect dstGLRect; | 2490 GrGLIRect dstGLRect; |
2484 srcGLRect.setRelativeTo(srcVP, | 2491 srcGLRect.setRelativeTo(srcVP, |
2485 srcRect.fLeft, | 2492 srcRect.fLeft, |
2486 srcRect.fTop, | 2493 srcRect.fTop, |
2487 srcRect.width(), | 2494 srcRect.width(), |
2488 srcRect.height(), | 2495 srcRect.height(), |
2489 src->origin()); | 2496 src->origin()); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2596 this->setVertexArrayID(gpu, 0); | 2603 this->setVertexArrayID(gpu, 0); |
2597 } | 2604 } |
2598 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2605 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2599 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2606 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2600 fDefaultVertexArrayAttribState.resize(attrCount); | 2607 fDefaultVertexArrayAttribState.resize(attrCount); |
2601 } | 2608 } |
2602 attribState = &fDefaultVertexArrayAttribState; | 2609 attribState = &fDefaultVertexArrayAttribState; |
2603 } | 2610 } |
2604 return attribState; | 2611 return attribState; |
2605 } | 2612 } |
OLD | NEW |