diff options
author | 2014-09-18 13:52:08 -0700 | |
---|---|---|
committer | 2014-09-18 13:52:08 -0700 | |
commit | 754f4e98d94d7c9ed76cd128cf983f9323a1885b (patch) | |
tree | 7bccf648c19e30ce9950292effb7f072d455c431 /tools | |
parent | 855d83ff79c6c822b2ad653f2f890178ad0f637b (diff) |
Add counting of some GL calls
I would like this facility for tracking FBO switch improvements.
R=bsalomon@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/553583008
Diffstat (limited to 'tools')
-rw-r--r-- | tools/PictureBenchmark.h | 1 | ||||
-rw-r--r-- | tools/bench_pictures_main.cpp | 14 | ||||
-rw-r--r-- | tools/render_pictures_main.cpp | 11 |
3 files changed, 26 insertions, 0 deletions
diff --git a/tools/PictureBenchmark.h b/tools/PictureBenchmark.h index 1ddd18ea16..2b1ccb5383 100644 --- a/tools/PictureBenchmark.h +++ b/tools/PictureBenchmark.h @@ -49,6 +49,7 @@ public: bool preprocess() const { return fPreprocess; } PictureRenderer* setRenderer(PictureRenderer*); + PictureRenderer* renderer() { return fRenderer; } void setTimerResultType(TimerData::Result resultType) { fTimerResult = resultType; } diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp index 2eda73c40f..ade93fc3e6 100644 --- a/tools/bench_pictures_main.cpp +++ b/tools/bench_pictures_main.cpp @@ -54,6 +54,11 @@ DEFINE_bool(trackDeferredCaching, false, "Only meaningful with --deferImageDecod "SK_LAZY_CACHE_STATS set to true. Report percentage of cache hits when using " "deferred image decoding."); +#if GR_GPU_STATS +DEFINE_bool(gpuStats, false, "Only meaningful with gpu configurations. " + "Report some GPU call statistics."); +#endif + DEFINE_bool(preprocess, false, "If true, perform device specific preprocessing before timing."); // Buildbot-specific parameters @@ -476,6 +481,15 @@ int tool_main(int argc, char** argv) { (double) gTotalCacheHits / (gTotalCacheHits + gTotalCacheMisses)); } #endif + +#if GR_GPU_STATS + if (FLAGS_gpuStats && benchmark.renderer()->isUsingGpuDevice()) { + GrContext* ctx = benchmark.renderer()->getGrContext(); + SkDebugf("RenderTarget Binds: %d\n", ctx->gpuStats()->renderTargetBinds()); + SkDebugf("Shader Compilations: %d\n", ctx->gpuStats()->shaderCompilations()); + } +#endif + gWriter.end(); return 0; } diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp index 4fb83521c8..d7a213cb47 100644 --- a/tools/render_pictures_main.cpp +++ b/tools/render_pictures_main.cpp @@ -36,6 +36,10 @@ DEFINE_int32(maxComponentDiff, 256, "Maximum diff on a component, 0 - 256. Compo "Requires --validate."); DEFINE_string(mismatchPath, "", "Write images for tests that failed due to " "pixel mismatches into this directory."); +#if GR_GPU_STATS +DEFINE_bool(gpuStats, false, "Only meaningful with gpu configurations. " + "Report some GPU call statistics."); +#endif DEFINE_bool(preprocess, false, "If true, perform device specific preprocessing before rendering."); DEFINE_string(readJsonSummaryPath, "", "JSON file to read image expectations from."); DECLARE_string(readPath); @@ -496,6 +500,13 @@ int tool_main(int argc, char** argv) { #endif } #endif +#if GR_GPU_STATS + if (FLAGS_gpuStats && renderer->isUsingGpuDevice()) { + GrContext* ctx = renderer->getGrContext(); + SkDebugf("RenderTarget Binds: %d\n", ctx->gpuStats()->renderTargetBinds()); + SkDebugf("Shader Compilations: %d\n", ctx->gpuStats()->shaderCompilations()); + } +#endif #endif if (FLAGS_writeJsonSummaryPath.count() == 1) { // If there were any descriptions on the command line, insert them now. |