DEFINE_bool(mpd, true, "Use MultiPictureDraw for the SKPs?");
DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run.");
DEFINE_bool(resetGpuContext, true, "Reset the GrContext before running each test.");
+DEFINE_bool(gpuStats, false, "Print GPU stats after each gpu benchmark?");
static SkString humanize(double ms) {
if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6));
, bench->getUniqueName()
);
}
-#if SK_SUPPORT_GPU && GR_CACHE_STATS
- if (FLAGS_veryVerbose &&
+#if SK_SUPPORT_GPU
+ if (FLAGS_gpuStats &&
Benchmark::kGPU_Backend == targets[j]->config.backend) {
gGrFactory->get(targets[j]->config.ctxType)->printCacheStats();
+ gGrFactory->get(targets[j]->config.ctxType)->printGpuStats();
}
#endif
}
if (!this->caps()->reuseScratchTextures() && !isRT) {
tex->cacheAccess().removeScratchKey();
}
+ if (tex) {
+ fStats.incTextureCreates();
+ if (srcData) {
+ fStats.incTextureUploads();
+ }
+ }
return tex;
}
GrPixelConfig config, const void* buffer,
size_t rowBytes) {
this->handleDirtyContext();
- return this->onWriteTexturePixels(texture, left, top, width, height,
- config, buffer, rowBytes);
+ if (this->onWriteTexturePixels(texture, left, top, width, height,
+ config, buffer, rowBytes)) {
+ fStats.incTextureUploads();
+ return true;
+ }
+ return false;
}
void GrGpu::resolveRenderTarget(GrRenderTarget* target) {
#if GR_GPU_STATS
Stats() { this->reset(); }
- void reset() { fRenderTargetBinds = 0; fShaderCompilations = 0; }
+ void reset() {
+ fRenderTargetBinds = 0;
+ fShaderCompilations = 0;
+ fTextureCreates = 0;
+ fTextureUploads = 0;
+ }
int renderTargetBinds() const { return fRenderTargetBinds; }
void incRenderTargetBinds() { fRenderTargetBinds++; }
int shaderCompilations() const { return fShaderCompilations; }
void incShaderCompilations() { fShaderCompilations++; }
+ int textureCreates() const { return fTextureCreates; }
+ void incTextureCreates() { fTextureCreates++; }
+ int textureUploads() const { return fTextureUploads; }
+ void incTextureUploads() { fTextureUploads++; }
void dump(SkString*);
private:
int fRenderTargetBinds;
int fShaderCompilations;
+ int fTextureCreates;
+ int fTextureUploads;
#else
void dump(SkString*) {};
void incRenderTargetBinds() {}
void incShaderCompilations() {}
+ void incTextureCreates() {}
+ void incTextureUploads() {}
#endif
};
void GrGpu::Stats::dump(SkString* out) {
out->appendf("Render Target Binds: %d\n", fRenderTargetBinds);
out->appendf("Shader Compilations: %d\n", fShaderCompilations);
+ out->appendf("Textures Created: %d\n", fTextureCreates);
+ out->appendf("Texture Uploads: %d\n", fTextureUploads);
}
#endif