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/tools/VisualBench/VisualInteractiveModule.cpp b/tools/VisualBench/VisualInteractiveModule.cpp
index 538dda7..af922a9 100755
--- a/tools/VisualBench/VisualInteractiveModule.cpp
+++ b/tools/VisualBench/VisualInteractiveModule.cpp
@@ -98,7 +98,7 @@
// clear both buffers
fOwner->clear(canvas, SK_ColorWHITE, 2);
- fBenchmark->preDraw();
+ fBenchmark->delayedSetup();
return true;
}
@@ -125,6 +125,7 @@
}
case kPreTiming_State: {
fBenchmark->perCanvasPreDraw(canvas);
+ fBenchmark->preDraw(canvas);
fCurrentFrame = 0;
fTimer.start();
fState = kTiming_State;
@@ -148,6 +149,7 @@
void VisualInteractiveModule::perCanvasPreDraw(SkCanvas* canvas, State nextState) {
fBenchmark->perCanvasPreDraw(canvas);
+ fBenchmark->preDraw(canvas);
fCurrentFrame = 0;
this->nextState(nextState);
}
@@ -206,6 +208,7 @@
}
void VisualInteractiveModule::postDraw(SkCanvas* canvas) {
+ fBenchmark->postDraw(canvas);
fBenchmark->perCanvasPostDraw(canvas);
fBenchmark.reset(nullptr);
fLoops = 1;