aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode
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 /samplecode
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 'samplecode')
-rw-r--r--samplecode/SampleApp.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 9be7567ea0..07a7a87b7f 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -2257,6 +2257,12 @@ void SampleView::onDraw(SkCanvas* canvas) {
for (int i = 0; i < fRepeatCount; i++) {
SkAutoCanvasRestore acr(canvas, true);
this->onDrawContent(canvas);
+#if SK_SUPPORT_GPU
+ // Ensure the GrContext doesn't batch across draw loops.
+ if (GrContext* context = canvas->getGrContext()) {
+ context->flush();
+ }
+#endif
}
}