Remove gpu stats tracking
authorbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 6 Jun 2012 18:21:18 +0000 (18:21 +0000)
committerbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 6 Jun 2012 18:21:18 +0000 (18:21 +0000)
Review URL: http://codereview.appspot.com/6300052/

git-svn-id: http://skia.googlecode.com/svn/trunk@4194 2bbb7eff-a529-9590-31e7-b0007b416f81

experimental/iOSSampleApp/SkSampleUIView.mm
include/gpu/GrConfig.h
include/gpu/GrContext.h
src/gpu/GrContext.cpp
src/gpu/GrGpu.cpp
src/gpu/GrGpu.h
src/gpu/gl/GrGpuGL.cpp

index b1ec537..5417787 100644 (file)
@@ -354,14 +354,6 @@ static FPSState gFPS;
     glBindRenderbuffer(GL_RENDERBUFFER, fGL.fRenderbuffer);
     [fGL.fContext presentRenderbuffer:GL_RENDERBUFFER];
     
-#if GR_COLLECT_STATS
-    //    static int frame = 0;
-    //    if (!(frame % 100)) {
-    //        ctx->printStats();
-    //    }
-    //    ctx->resetStats();
-    //    ++frame;
-#endif
 }
 
 - (void)drawInRaster {
index e25859b..eecce79 100644 (file)
@@ -328,14 +328,6 @@ inline void GrCrash(const char* msg) { GrPrintf(msg); GrAlwaysAssert(false); }
 #endif
 
 /**
- *  GR_COLLECT_STATS controls whether the GrGpu class collects stats.
- *  If not already defined then collect in debug build but not release.
- */
-#if !defined(GR_COLLECT_STATS)
-    #define GR_COLLECT_STATS GR_DEBUG
-#endif
-
-/**
  *  GR_STATIC_RECT_VB controls whether rects are drawn by issuing a vertex
  *  for each corner or using a static vb that is positioned by modifying the
  *  view / texture matrix.
index adceb77..33a3abf 100644 (file)
@@ -21,7 +21,6 @@ class GrDrawState;
 class GrDrawTarget;
 class GrFontCache;
 class GrGpu;
-struct GrGpuStats;
 class GrIndexBuffer;
 class GrIndexBufferAllocPool;
 class GrInOrderDrawBuffer;
@@ -665,9 +664,7 @@ public:
     GrFontCache* getFontCache() { return fFontCache; }
     GrDrawTarget* getTextTarget(const GrPaint& paint);
     const GrIndexBuffer* getQuadIndexBuffer() const;
-    void resetStats();
-    const GrGpuStats& getStats() const;
-    void printStats() const;
+
     /**
      * Stencil buffers add themselves to the cache using
      * addAndLockStencilBuffer. When a SB's RT-attachment count
index 072bc47..bbca09a 100644 (file)
@@ -1898,18 +1898,6 @@ static inline intptr_t setOrClear(intptr_t bits, int shift, intptr_t pred) {
     return bits;
 }
 
-void GrContext::resetStats() {
-    fGpu->resetStats();
-}
-
-const GrGpuStats& GrContext::getStats() const {
-    return fGpu->getStats();
-}
-
-void GrContext::printStats() const {
-    fGpu->printStats();
-}
-
 GrContext::GrContext(GrGpu* gpu) {
     fGpu = gpu;
     fGpu->ref();
index a873fe7..9e26135 100644 (file)
@@ -53,7 +53,6 @@ GrGpu::GrGpu()
     poolState.fPoolIndexBuffer = (GrIndexBuffer*)DEBUG_INVAL_BUFFER;
     poolState.fPoolStartIndex = DEBUG_INVAL_START_IDX;
 #endif
-    resetStats();
 
     for (int i = 0; i < kGrPixelConfigCount; ++i) {
         fConfigRenderSupport[i] = false;
@@ -415,12 +414,6 @@ void GrGpu::onDrawIndexed(GrPrimitiveType type,
         return;
     }
 
-#if GR_COLLECT_STATS
-    fStats.fVertexCnt += vertexCount;
-    fStats.fIndexCnt  += indexCount;
-    fStats.fDrawCnt   += 1;
-#endif
-
     int sVertex = startVertex;
     int sIndex = startIndex;
     setupGeometry(&sVertex, &sIndex, vertexCount, indexCount);
@@ -437,10 +430,6 @@ void GrGpu::onDrawNonIndexed(GrPrimitiveType type,
     if (!this->setupClipAndFlushState(type)) {
         return;
     }
-#if GR_COLLECT_STATS
-    fStats.fVertexCnt += vertexCount;
-    fStats.fDrawCnt   += 1;
-#endif
 
     int sVertex = startVertex;
     setupGeometry(&sVertex, NULL, vertexCount, 0);
@@ -586,30 +575,3 @@ void GrGpu::releaseIndexArray() {
     --fIndexPoolUseCnt;
 }
 
-////////////////////////////////////////////////////////////////////////////////
-
-const GrGpuStats& GrGpu::getStats() const {
-    return fStats;
-}
-
-void GrGpu::resetStats() {
-    memset(&fStats, 0, sizeof(fStats));
-}
-
-void GrGpu::printStats() const {
-    if (GR_COLLECT_STATS) {
-     GrPrintf(
-     "-v-------------------------GPU STATS----------------------------v-\n"
-     "Stats collection is: %s\n"
-     "Draws: %04d, Verts: %04d, Indices: %04d\n"
-     "ProgChanges: %04d, TexChanges: %04d, RTChanges: %04d\n"
-     "TexCreates: %04d, RTCreates:%04d\n"
-     "-^--------------------------------------------------------------^-\n",
-     (GR_COLLECT_STATS ? "ON" : "OFF"),
-    fStats.fDrawCnt, fStats.fVertexCnt, fStats.fIndexCnt,
-    fStats.fProgChngCnt, fStats.fTextureChngCnt, fStats.fRenderTargetChngCnt,
-    fStats.fTextureCreateCnt, fStats.fRenderTargetCreateCnt);
-    }
-}
-
-
index f14c17f..baca824 100644 (file)
@@ -24,34 +24,6 @@ class GrResource;
 class GrStencilBuffer;
 class GrVertexBufferAllocPool;
 
-/**
- * Gpu usage statistics.
- */
-struct GrGpuStats {
-    uint32_t fVertexCnt;  //<! Number of vertices drawn
-    uint32_t fIndexCnt;   //<! Number of indices drawn
-    uint32_t fDrawCnt;    //<! Number of draws
-
-    uint32_t fProgChngCnt;//<! Number of program changes
-
-    /**
-     *  Number of times the texture is set in 3D API
-     */
-    uint32_t fTextureChngCnt;
-    /**
-     *  Number of times the render target is set in 3D API
-     */
-    uint32_t fRenderTargetChngCnt;
-    /**
-     *  Number of textures created (includes textures that are rendertargets).
-     */
-    uint32_t fTextureCreateCnt;
-    /**
-     *  Number of rendertargets created.
-     */
-    uint32_t fRenderTargetCreateCnt;
-};
-
 class GrGpu : public GrDrawTarget {
 
 public:
@@ -286,10 +258,6 @@ public:
                             GrPixelConfig config, const void* buffer,
                             size_t rowBytes);
 
-    const GrGpuStats& getStats() const;
-    void resetStats();
-    void printStats() const;
-
     /**
      * Called to tell Gpu object that all GrResources have been lost and should
      * be abandoned. Overrides must call INHERITED::abandonResources().
@@ -391,8 +359,6 @@ protected:
     // and the client isn't using the stencil test.
     static const GrStencilSettings* GetClipStencilSettings();
 
-    GrGpuStats fStats;
-
     GrClipMaskManager           fClipMaskManager;
 
     struct GeometryPoolState {
index f9d4cbb..82a65fd 100644 (file)
@@ -1002,10 +1002,6 @@ GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc,
                                     const void* srcData,
                                     size_t rowBytes) {
 
-#if GR_COLLECT_STATS
-    ++fStats.fTextureCreateCnt;
-#endif
-
     GrGLTexture::Desc glTexDesc;
     GrGLRenderTarget::Desc  glRTDesc;
 
@@ -1093,9 +1089,6 @@ GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc,
 
     GrGLTexture* tex;
     if (renderTarget) {
-#if GR_COLLECT_STATS
-        ++fStats.fRenderTargetCreateCnt;
-#endif
         // unbind the texture from the texture unit before binding it to the frame buffer
         GL_CALL(BindTexture(GR_GL_TEXTURE_2D, 0));
 
@@ -1613,9 +1606,6 @@ void GrGpuGL::flushRenderTarget(const GrIRect* bound) {
 
     if (fHWBoundRenderTarget != rt) {
         GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, rt->renderFBOID()));
-    #if GR_COLLECT_STATS
-        ++fStats.fRenderTargetChngCnt;
-    #endif
     #if GR_DEBUG
         GrGLenum status;
         GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER));
@@ -1737,9 +1727,6 @@ void GrGpuGL::onResolveRenderTarget(GrRenderTarget* target) {
                                 rt->renderFBOID()));
         GL_CALL(BindFramebuffer(GR_GL_DRAW_FRAMEBUFFER,
                                 rt->textureFBOID()));
-    #if GR_COLLECT_STATS
-        ++fStats.fRenderTargetChngCnt;
-    #endif
         // make sure we go through flushRenderTarget() since we've modified
         // the bound DRAW FBO ID.
         fHWBoundRenderTarget = NULL;
@@ -2134,9 +2121,6 @@ void GrGpuGL::flushBoundTextureAndParams(int stage) {
     if (fHWBoundTextures[stage] != nextTexture) {
         this->setTextureUnit(stage);
         GL_CALL(BindTexture(GR_GL_TEXTURE_2D, nextTexture->textureID()));
-    #if GR_COLLECT_STATS
-        ++fStats.fTextureChngCnt;
-    #endif
         //GrPrintf("---- bindtexture %d\n", nextTexture->textureID());
         fHWBoundTextures[stage] = nextTexture;
     }