Add stencil buffer create tracking to GPU stats.
authorbsalomon <bsalomon@google.com>
Mon, 23 Feb 2015 18:01:36 +0000 (10:01 -0800)
committerCommit bot <commit-bot@chromium.org>
Mon, 23 Feb 2015 18:01:36 +0000 (10:01 -0800)
Review URL: https://codereview.chromium.org/949953002

src/gpu/GrClipMaskManager.h
src/gpu/GrGpu.h
src/gpu/GrTest.cpp
src/gpu/gl/GrGLGpu.cpp

index bc164da..7fcfa50 100644 (file)
@@ -166,9 +166,8 @@ private:
     void setupCache(const SkClipStack& clip,
                     const SkIRect& bounds);
     /**
-     * Called prior to return control back the GrGpu in setupClipping. It
-     * updates the GrGpu with stencil settings that account stencil-based
-     * clipping.
+     * Called prior to return control back the GrGpu in setupClipping. It updates the
+     * GrPipelineBuilder with stencil settings that account for stencil-based clipping.
      */
     void setPipelineBuilderStencil(GrPipelineBuilder*, GrPipelineBuilder::AutoRestoreStencil*);
 
index eb97b4f..95bbc6e 100644 (file)
@@ -358,6 +358,7 @@ public:
             fShaderCompilations = 0;
             fTextureCreates = 0;
             fTextureUploads = 0;
+            fStencilBufferCreates = 0;
         }
 
         int renderTargetBinds() const { return fRenderTargetBinds; }
@@ -368,6 +369,7 @@ public:
         void incTextureCreates() { fTextureCreates++; }
         int textureUploads() const { return fTextureUploads; }
         void incTextureUploads() { fTextureUploads++; }
+        void incStencilBufferCreates() { fStencilBufferCreates++; }
         void dump(SkString*);
 
     private:
@@ -375,12 +377,14 @@ public:
         int fShaderCompilations;
         int fTextureCreates;
         int fTextureUploads;
+        int fStencilBufferCreates;
 #else
         void dump(SkString*) {};
         void incRenderTargetBinds() {}
         void incShaderCompilations() {}
         void incTextureCreates() {}
         void incTextureUploads() {}
+        void incStencilBufferCreates() {}
 #endif
     };
 
index 9ddc97d..d5fb532 100644 (file)
@@ -72,6 +72,7 @@ void GrGpu::Stats::dump(SkString* out) {
     out->appendf("Shader Compilations: %d\n", fShaderCompilations);
     out->appendf("Textures Created: %d\n", fTextureCreates);
     out->appendf("Texture Uploads: %d\n", fTextureUploads);
+    out->appendf("Stencil Buffer Creates: %d\n", fStencilBufferCreates);
 }
 #endif
 
index 9c0f772..a952c4f 100644 (file)
@@ -1172,7 +1172,7 @@ bool GrGLGpu::createStencilBufferForRenderTarget(GrRenderTarget* rt, int width,
             created = (GR_GL_NO_ERROR == check_alloc_error(rt->desc(), this->glInterface()));
         }
         if (created) {
-
+            fStats.incStencilBufferCreates();
             // After sized formats we attempt an unsized format and take
             // whatever sizes GL gives us. In that case we query for the size.
             GrGLStencilBuffer::Format format = sFmt;