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

Unified Diff: src/gpu/gl/GrGpuGL.cpp

Issue 474623002: Add new API to allow layer hoisting/atlasing across picture piles Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more cleanup Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/gpu/gl/SkGLContextHelper.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGpuGL.cpp
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 3c22d17b64a4be858eaeffb20eb5dd6c7fe821ea..90789db3061f41e7cae048a8cea434d23329a21e 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -13,6 +13,8 @@
#include "SkStrokeRec.h"
#include "SkTemplates.h"
+int gBindFrameBufferCount = 0;
+
#define GL_CALL(X) GR_GL_CALL(this->glInterface(), X)
#define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X)
@@ -869,6 +871,7 @@ bool GrGpuGL::createRenderTargetObjects(int width, int height,
width, height)) {
goto FAILED;
}
+ gBindFrameBufferCount++;
GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, desc->fRTFBOID));
GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
GR_GL_COLOR_ATTACHMENT0,
@@ -883,6 +886,7 @@ bool GrGpuGL::createRenderTargetObjects(int width, int height,
fGLContext.caps()->markConfigAsValidColorAttachment(desc->fConfig);
}
}
+ gBindFrameBufferCount++;
GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, desc->fTexFBOID));
if (this->glCaps().usesImplicitMSAAResolve() && desc->fSampleCnt > 0) {
@@ -1244,6 +1248,7 @@ bool GrGpuGL::attachStencilBufferToRenderTarget(GrStencilBuffer* sb, GrRenderTar
GrGLuint rb = glsb->renderbufferID();
fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID;
+ gBindFrameBufferCount++;
GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, fbo));
GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
GR_GL_STENCIL_ATTACHMENT,
@@ -1446,6 +1451,7 @@ void GrGpuGL::discard(GrRenderTarget* renderTarget) {
GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(renderTarget);
if (renderTarget->getUniqueID() != fHWBoundRenderTargetUniqueID) {
fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID;
+ gBindFrameBufferCount++;
GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, glRT->renderFBOID()));
}
switch (this->glCaps().invalidateFBType()) {
@@ -1611,6 +1617,7 @@ bool GrGpuGL::onReadPixels(GrRenderTarget* target,
case GrGLRenderTarget::kCanResolve_ResolveType:
this->onResolveRenderTarget(tgt);
// we don't track the state of the READ FBO ID.
+ gBindFrameBufferCount++;
GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER,
tgt->textureFBOID()));
break;
@@ -1710,6 +1717,7 @@ void GrGpuGL::flushRenderTarget(const SkIRect* bound) {
uint32_t rtID = rt->getUniqueID();
if (fHWBoundRenderTargetUniqueID != rtID) {
+ gBindFrameBufferCount++;
GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, rt->renderFBOID()));
#ifdef SK_DEBUG
// don't do this check in Chromium -- this is causing
@@ -1812,7 +1820,9 @@ void GrGpuGL::onResolveRenderTarget(GrRenderTarget* target) {
// Some extensions automatically resolves the texture when it is read.
if (this->glCaps().usesMSAARenderBuffers()) {
SkASSERT(rt->textureFBOID() != rt->renderFBOID());
+ gBindFrameBufferCount++;
GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, rt->renderFBOID()));
+ gBindFrameBufferCount++;
GL_CALL(BindFramebuffer(GR_GL_DRAW_FRAMEBUFFER, rt->textureFBOID()));
// make sure we go through flushRenderTarget() since we've modified
// the bound DRAW FBO ID.
@@ -2388,6 +2398,7 @@ inline GrGLuint bind_surface_as_fbo(const GrGLInterface* gl,
SkASSERT(NULL != surface->asTexture());
GrGLuint texID = static_cast<GrGLTexture*>(surface->asTexture())->textureID();
GR_GL_CALL(gl, GenFramebuffers(1, &tempFBOID));
+ gBindFrameBufferCount++;
GR_GL_CALL(gl, BindFramebuffer(fboTarget, tempFBOID));
GR_GL_CALL(gl, FramebufferTexture2D(fboTarget,
GR_GL_COLOR_ATTACHMENT0,
@@ -2400,6 +2411,7 @@ inline GrGLuint bind_surface_as_fbo(const GrGLInterface* gl,
viewport->fHeight = surface->height();
} else {
tempFBOID = 0;
+ gBindFrameBufferCount++;
GR_GL_CALL(gl, BindFramebuffer(fboTarget, rt->renderFBOID()));
*viewport = rt->getViewport();
}
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/gpu/gl/SkGLContextHelper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698