destroyContexts after each bench instead of before
authorMike Klein <mtklein@google.com>
Tue, 15 Jul 2014 17:40:19 +0000 (13:40 -0400)
committerMike Klein <mtklein@google.com>
Tue, 15 Jul 2014 17:40:19 +0000 (13:40 -0400)
BUG=skia:

Review URL: https://codereview.chromium.org/394893002

bench/nanobench.cpp

index 69e5de9..8f3d4aa 100644 (file)
@@ -219,9 +219,6 @@ 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)) {                    \
@@ -360,6 +357,12 @@ int tool_main(int argc, char** argv) {
             }
         }
         targets.deleteAll();
+
+    #if SK_SUPPORT_GPU
+        if (FLAGS_resetGpuContext) {
+            gGrFactory.destroyContexts();
+        }
+    #endif
     }
 
     return 0;