aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2014-07-15 08:27:06 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-07-15 08:27:06 -0700
commit1e319f734275b166fefe121ac9f4783ab70bc03b (patch)
treeae9730f12fecea3f506de73a1acdb3ce3764e2b4 /bench
parentc09e8c2ec9c5cdd9e147b6f48527970b4518fb76 (diff)
Add --resetGpuContext to both DM and nanobench.
Defaulting to true to be conservative for now. BUG=skia: NOTREECHECKS=true R=mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/398483005
Diffstat (limited to 'bench')
-rw-r--r--bench/nanobench.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index be8cc4a45f..e2a785e465 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -49,6 +49,7 @@ DEFINE_bool(cpu, true, "Master switch for CPU-bound work.");
DEFINE_bool(gpu, true, "Master switch for GPU-bound work.");
DEFINE_string(outResultsFile, "", "If given, write results here as JSON.");
+DEFINE_bool(resetGpuContext, true, "Reset the GrContext before running each bench.");
static SkString humanize(double ms) {
@@ -214,6 +215,10 @@ static void create_targets(Benchmark* bench, SkTDArray<Target*>* targets) {
}
#if SK_SUPPORT_GPU
+ if (FLAGS_resetGpuContext) {
+ gGrFactory.destroyContexts();
+ }
+
#define GPU_TARGET(config, ctxType, info, samples) \
if (Target* t = is_enabled(bench, Benchmark::kGPU_Backend, #config)) { \
t->surface.reset(SkSurface::NewRenderTarget(gGrFactory.get(ctxType), info, samples)); \