Fix for nexus 5 crashing in GL benches
GLBenches do not expect gl state to change between onPerCanvasPreDraw and *PostDraw, but we do a clear and sometimes we clear as draw. This causes us to bind vertex objects / programs / etc.
This change creates two new virtual methods which are called right before and immediately after timing.
BUG=skia:
Review URL: https://codereview.chromium.org/1379853003
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 900ba4d..6328aa1 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -207,6 +207,7 @@
if (canvas) {
canvas->clear(SK_ColorWHITE);
}
+ bench->preDraw(canvas);
WallTimer timer;
timer.start();
canvas = target->beginTiming(canvas);
@@ -216,6 +217,7 @@
}
target->endTiming();
timer.end();
+ bench->postDraw(canvas);
return timer.fWall;
}
@@ -1164,7 +1166,7 @@
if (!configs.isEmpty()) {
log->bench(bench->getUniqueName(), bench->getSize().fX, bench->getSize().fY);
- bench->preDraw();
+ bench->delayedSetup();
}
for (int i = 0; i < configs.count(); ++i) {
Target* target = is_enabled(b, configs[i]);