aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench
diff options
context:
space:
mode:
authorGravatar cdalton <cdalton@nvidia.com>2015-10-26 13:45:29 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-10-26 13:45:29 -0700
commite6d2024c689199b09df0d7048fc5252179d52aff (patch)
treefd967ae58aa7566d6d8418fe6c1ebf7e84de1ffe /bench
parentc70483f5ab83aaa29c0697398aeca3432f3591b6 (diff)
Flush GrContext between benchmark draw loops
This change updates a small subset of benchmarks to flush the GrContext between draw loops (specifically SKP benchmarks, SampleApp, and the warmup in visualbench). This helps improve timing accuracy by not allowing the gpu to batch across draw boundaries in the affected benchmarks. BUG=skia: Review URL: https://codereview.chromium.org/1427533002
Diffstat (limited to 'bench')
-rw-r--r--bench/SKPBench.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp
index 44261335da..910af6b802 100644
--- a/bench/SKPBench.cpp
+++ b/bench/SKPBench.cpp
@@ -10,6 +10,10 @@
#include "SkMultiPictureDraw.h"
#include "SkSurface.h"
+#if SK_SUPPORT_GPU
+#include "GrContext.h"
+#endif
+
// These CPU tile sizes are not good per se, but they are similar to what Chrome uses.
DEFINE_int32(CPUbenchTileW, 256, "Tile width used for CPU SKP playback.");
DEFINE_int32(CPUbenchTileH, 256, "Tile height used for CPU SKP playback.");
@@ -115,6 +119,12 @@ void SKPBench::onDraw(int loops, SkCanvas* canvas) {
this->drawPicture();
}
}
+#if SK_SUPPORT_GPU
+ // Ensure the GrContext doesn't batch across draw loops.
+ if (GrContext* context = canvas->getGrContext()) {
+ context->flush();
+ }
+#endif
}
void SKPBench::drawMPDPicture() {