Remove gpu stats tracking

Review URL: http://codereview.appspot.com/6300052/



git-svn-id: http://skia.googlecode.com/svn/trunk@4194 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bsalomon@google.com 2012-06-06 18:21:18 +00:00
parent d4340e2b35
commit 9923c2b29a
7 changed files with 1 additions and 120 deletions

View 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 {

View File

@ -327,14 +327,6 @@ inline void GrCrash(const char* msg) { GrPrintf(msg); GrAlwaysAssert(false); }
#define GR_DUMP_TEXTURE_UPLOAD 0
#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 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

View 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();

View 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);
}
}

View 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 {

View 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;
}