From e6d2024c689199b09df0d7048fc5252179d52aff Mon Sep 17 00:00:00 2001 From: cdalton Date: Mon, 26 Oct 2015 13:45:29 -0700 Subject: 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 --- bench/SKPBench.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'bench/SKPBench.cpp') 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() { -- cgit v1.2.3