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

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

Issue 553583008: Add counting of some GL calls (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update for merge conflict Created 6 years, 3 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/gl/GrGpuGL.h ('k') | src/gpu/gl/builders/GrGLFragmentShaderBuilder.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 5d4bd8b7b74f308aa5fbc1e56670884972e622dc..ebc34572fed1f1660e43246f7601edfd47afdc4c 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -870,6 +870,7 @@ bool GrGpuGL::createRenderTargetObjects(int width, int height,
width, height)) {
goto FAILED;
}
+ fGPUStats.incRenderTargetBinds();
GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, desc->fRTFBOID));
GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
GR_GL_COLOR_ATTACHMENT0,
@@ -884,6 +885,7 @@ bool GrGpuGL::createRenderTargetObjects(int width, int height,
fGLContext.caps()->markConfigAsValidColorAttachment(desc->fConfig);
}
}
+ fGPUStats.incRenderTargetBinds();
GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, desc->fTexFBOID));
if (this->glCaps().usesImplicitMSAAResolve() && desc->fSampleCnt > 0) {
@@ -1245,6 +1247,7 @@ bool GrGpuGL::attachStencilBufferToRenderTarget(GrStencilBuffer* sb, GrRenderTar
GrGLuint rb = glsb->renderbufferID();
fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID;
+ fGPUStats.incRenderTargetBinds();
GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, fbo));
GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
GR_GL_STENCIL_ATTACHMENT,
@@ -1438,6 +1441,7 @@ void GrGpuGL::discard(GrRenderTarget* renderTarget) {
GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(renderTarget);
if (renderTarget->getUniqueID() != fHWBoundRenderTargetUniqueID) {
fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID;
+ fGPUStats.incRenderTargetBinds();
GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, glRT->renderFBOID()));
}
switch (this->glCaps().invalidateFBType()) {
@@ -1601,6 +1605,7 @@ bool GrGpuGL::onReadPixels(GrRenderTarget* target,
case GrGLRenderTarget::kCanResolve_ResolveType:
this->onResolveRenderTarget(tgt);
// we don't track the state of the READ FBO ID.
+ fGPUStats.incRenderTargetBinds();
GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER,
tgt->textureFBOID()));
break;
@@ -1698,6 +1703,7 @@ void GrGpuGL::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bound)
uint32_t rtID = target->getUniqueID();
if (fHWBoundRenderTargetUniqueID != rtID) {
+ fGPUStats.incRenderTargetBinds();
GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, target->renderFBOID()));
#ifdef SK_DEBUG
// don't do this check in Chromium -- this is causing
@@ -1800,6 +1806,8 @@ void GrGpuGL::onResolveRenderTarget(GrRenderTarget* target) {
// Some extensions automatically resolves the texture when it is read.
if (this->glCaps().usesMSAARenderBuffers()) {
SkASSERT(rt->textureFBOID() != rt->renderFBOID());
+ fGPUStats.incRenderTargetBinds();
+ fGPUStats.incRenderTargetBinds();
GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, rt->renderFBOID()));
GL_CALL(BindFramebuffer(GR_GL_DRAW_FRAMEBUFFER, rt->textureFBOID()));
// make sure we go through flushRenderTarget() since we've modified
@@ -2363,38 +2371,37 @@ inline bool can_copy_texsubimage(const GrSurface* dst,
}
}
+}
+
// If a temporary FBO was created, its non-zero ID is returned. The viewport that the copy rect is
// relative to is output.
-inline GrGLuint bind_surface_as_fbo(const GrGLInterface* gl,
- GrSurface* surface,
- GrGLenum fboTarget,
- GrGLIRect* viewport) {
+GrGLuint GrGpuGL::bindSurfaceAsFBO(GrSurface* surface, GrGLenum fboTarget, GrGLIRect* viewport) {
GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(surface->asRenderTarget());
GrGLuint tempFBOID;
if (NULL == rt) {
SkASSERT(surface->asTexture());
GrGLuint texID = static_cast<GrGLTexture*>(surface->asTexture())->textureID();
- GR_GL_CALL(gl, GenFramebuffers(1, &tempFBOID));
- GR_GL_CALL(gl, BindFramebuffer(fboTarget, tempFBOID));
- GR_GL_CALL(gl, FramebufferTexture2D(fboTarget,
- GR_GL_COLOR_ATTACHMENT0,
- GR_GL_TEXTURE_2D,
- texID,
- 0));
+ GR_GL_CALL(this->glInterface(), GenFramebuffers(1, &tempFBOID));
+ fGPUStats.incRenderTargetBinds();
+ GR_GL_CALL(this->glInterface(), BindFramebuffer(fboTarget, tempFBOID));
+ GR_GL_CALL(this->glInterface(), FramebufferTexture2D(fboTarget,
+ GR_GL_COLOR_ATTACHMENT0,
+ GR_GL_TEXTURE_2D,
+ texID,
+ 0));
viewport->fLeft = 0;
viewport->fBottom = 0;
viewport->fWidth = surface->width();
viewport->fHeight = surface->height();
} else {
tempFBOID = 0;
- GR_GL_CALL(gl, BindFramebuffer(fboTarget, rt->renderFBOID()));
+ fGPUStats.incRenderTargetBinds();
+ GR_GL_CALL(this->glInterface(), BindFramebuffer(fboTarget, rt->renderFBOID()));
*viewport = rt->getViewport();
}
return tempFBOID;
}
-}
-
void GrGpuGL::initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* desc) {
// Check for format issues with glCopyTexSubImage2D
if (kGLES_GrGLStandard == this->glStandard() && this->glCaps().bgraIsInternalFormat() &&
@@ -2432,7 +2439,7 @@ bool GrGpuGL::onCopySurface(GrSurface* dst,
(!wouldNeedTempFBO || !inheritedCouldCopy)) {
GrGLuint srcFBO;
GrGLIRect srcVP;
- srcFBO = bind_surface_as_fbo(this->glInterface(), src, GR_GL_FRAMEBUFFER, &srcVP);
+ srcFBO = this->bindSurfaceAsFBO(src, GR_GL_FRAMEBUFFER, &srcVP);
GrGLTexture* dstTex = static_cast<GrGLTexture*>(dst->asTexture());
SkASSERT(dstTex);
// We modified the bound FBO
@@ -2475,8 +2482,8 @@ bool GrGpuGL::onCopySurface(GrSurface* dst,
GrGLuint srcFBO;
GrGLIRect dstVP;
GrGLIRect srcVP;
- dstFBO = bind_surface_as_fbo(this->glInterface(), dst, GR_GL_DRAW_FRAMEBUFFER, &dstVP);
- srcFBO = bind_surface_as_fbo(this->glInterface(), src, GR_GL_READ_FRAMEBUFFER, &srcVP);
+ dstFBO = this->bindSurfaceAsFBO(dst, GR_GL_DRAW_FRAMEBUFFER, &dstVP);
+ srcFBO = this->bindSurfaceAsFBO(src, GR_GL_READ_FRAMEBUFFER, &srcVP);
// We modified the bound FBO
fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID;
GrGLIRect srcGLRect;
« no previous file with comments | « src/gpu/gl/GrGpuGL.h ('k') | src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698