Index: tools/VisualBench/VisualBenchmarkStream.cpp |
diff --git a/tools/VisualBench/VisualBenchmarkStream.cpp b/tools/VisualBench/VisualBenchmarkStream.cpp |
index 906aab27886d44d9fbbaaf6bb6954595b3c33e6d..a6c6ee92f31976317d4a394e1b11eec0660eede6 100644 |
--- a/tools/VisualBench/VisualBenchmarkStream.cpp |
+++ b/tools/VisualBench/VisualBenchmarkStream.cpp |
@@ -17,6 +17,10 @@ |
#include "VisualFlags.h" |
#include "VisualSKPBench.h" |
+#if SK_SUPPORT_GPU |
+#include "GrContext.h" |
+#endif |
+ |
DEFINE_bool(cpu, false, "Run in CPU mode?"); |
DEFINE_string2(match, m, nullptr, |
"[~][^]substring[$] [...] of bench name to run.\n" |
@@ -52,6 +56,12 @@ private: |
for (int i = 0; i < loops; i++) { |
canvas->drawPath(fPath, paint); |
canvas->drawRect(rect, perlinPaint); |
+#if SK_SUPPORT_GPU |
+ // Ensure the GrContext doesn't batch across draw loops. |
+ if (GrContext* context = canvas->getGrContext()) { |
+ context->flush(); |
+ } |
+#endif |
} |
} |
SkPath fPath; |