aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/VisualBench
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-09-30 12:11:07 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-09-30 12:11:07 -0700
commit8a6697af95b340aad6dee7e6228048fa305c1e59 (patch)
tree08b4c39b0bc264940ff65b97a83c95d3d9bc1bbf /tools/VisualBench
parent7fac5af5e9310826721ff416bdbe71294d607b2a (diff)
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
Diffstat (limited to 'tools/VisualBench')
-rwxr-xr-xtools/VisualBench/VisualInteractiveModule.cpp5
-rw-r--r--tools/VisualBench/VisualLightweightBenchModule.cpp4
2 files changed, 7 insertions, 2 deletions
diff --git a/tools/VisualBench/VisualInteractiveModule.cpp b/tools/VisualBench/VisualInteractiveModule.cpp
index 538dda7a44..af922a92bf 100755
--- a/tools/VisualBench/VisualInteractiveModule.cpp
+++ b/tools/VisualBench/VisualInteractiveModule.cpp
@@ -98,7 +98,7 @@ bool VisualInteractiveModule::advanceRecordIfNecessary(SkCanvas* canvas) {
// clear both buffers
fOwner->clear(canvas, SK_ColorWHITE, 2);
- fBenchmark->preDraw();
+ fBenchmark->delayedSetup();
return true;
}
@@ -125,6 +125,7 @@ void VisualInteractiveModule::draw(SkCanvas* canvas) {
}
case kPreTiming_State: {
fBenchmark->perCanvasPreDraw(canvas);
+ fBenchmark->preDraw(canvas);
fCurrentFrame = 0;
fTimer.start();
fState = kTiming_State;
@@ -148,6 +149,7 @@ inline void VisualInteractiveModule::nextState(State nextState) {
void VisualInteractiveModule::perCanvasPreDraw(SkCanvas* canvas, State nextState) {
fBenchmark->perCanvasPreDraw(canvas);
+ fBenchmark->preDraw(canvas);
fCurrentFrame = 0;
this->nextState(nextState);
}
@@ -206,6 +208,7 @@ void VisualInteractiveModule::recordMeasurement() {
}
void VisualInteractiveModule::postDraw(SkCanvas* canvas) {
+ fBenchmark->postDraw(canvas);
fBenchmark->perCanvasPostDraw(canvas);
fBenchmark.reset(nullptr);
fLoops = 1;
diff --git a/tools/VisualBench/VisualLightweightBenchModule.cpp b/tools/VisualBench/VisualLightweightBenchModule.cpp
index d5e4e5b8b6..d54c788ae7 100644
--- a/tools/VisualBench/VisualLightweightBenchModule.cpp
+++ b/tools/VisualBench/VisualLightweightBenchModule.cpp
@@ -169,7 +169,7 @@ bool VisualLightweightBenchModule::advanceRecordIfNecessary(SkCanvas* canvas) {
fOwner->clear(canvas, SK_ColorWHITE, 2);
- fBenchmark->preDraw();
+ fBenchmark->delayedSetup();
fRecords.push_back();
// Log bench name
@@ -184,6 +184,7 @@ inline void VisualLightweightBenchModule::nextState(State nextState) {
void VisualLightweightBenchModule::perCanvasPreDraw(SkCanvas* canvas, State nextState) {
fBenchmark->perCanvasPreDraw(canvas);
+ fBenchmark->preDraw(canvas);
fCurrentFrame = 0;
this->nextState(nextState);
}
@@ -293,6 +294,7 @@ void VisualLightweightBenchModule::recordMeasurement() {
}
void VisualLightweightBenchModule::postDraw(SkCanvas* canvas) {
+ fBenchmark->postDraw(canvas);
fBenchmark->perCanvasPostDraw(canvas);
fBenchmark.reset(nullptr);
fCurrentSample = 0;