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
This commit is contained in:
parent
7fac5af5e9
commit
8a6697af95
@ -113,7 +113,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
int w = 40;
|
||||
int h = 40;
|
||||
makebm(&fBmp, w, h);
|
||||
|
@ -33,14 +33,22 @@ SkIPoint Benchmark::getSize() {
|
||||
return this->onGetSize();
|
||||
}
|
||||
|
||||
void Benchmark::preDraw() {
|
||||
this->onPreDraw();
|
||||
void Benchmark::delayedSetup() {
|
||||
this->onDelayedSetup();
|
||||
}
|
||||
|
||||
void Benchmark::perCanvasPreDraw(SkCanvas* canvas) {
|
||||
this->onPerCanvasPreDraw(canvas);
|
||||
}
|
||||
|
||||
void Benchmark::preDraw(SkCanvas* canvas) {
|
||||
this->onPreDraw(canvas);
|
||||
}
|
||||
|
||||
void Benchmark::postDraw(SkCanvas* canvas) {
|
||||
this->onPostDraw(canvas);
|
||||
}
|
||||
|
||||
void Benchmark::perCanvasPostDraw(SkCanvas* canvas) {
|
||||
this->onPerCanvasPostDraw(canvas);
|
||||
}
|
||||
|
@ -70,13 +70,17 @@ public:
|
||||
// Call before draw, allows the benchmark to do setup work outside of the
|
||||
// timer. When a benchmark is repeatedly drawn, this should be called once
|
||||
// before the initial draw.
|
||||
void preDraw();
|
||||
void delayedSetup();
|
||||
|
||||
// Called once before and after a series of draw calls to a single canvas.
|
||||
// The setup/break down in these calls is not timed.
|
||||
void perCanvasPreDraw(SkCanvas*);
|
||||
void perCanvasPostDraw(SkCanvas*);
|
||||
|
||||
// Called just before and after each call to draw(). Not timed.
|
||||
void preDraw(SkCanvas*);
|
||||
void postDraw(SkCanvas*);
|
||||
|
||||
// Bench framework can tune loops to be large enough for stable timing.
|
||||
void draw(const int loops, SkCanvas*);
|
||||
|
||||
@ -112,9 +116,11 @@ protected:
|
||||
|
||||
virtual const char* onGetName() = 0;
|
||||
virtual const char* onGetUniqueName() { return this->onGetName(); }
|
||||
virtual void onPreDraw() {}
|
||||
virtual void onDelayedSetup() {}
|
||||
virtual void onPerCanvasPreDraw(SkCanvas*) {}
|
||||
virtual void onPerCanvasPostDraw(SkCanvas*) {}
|
||||
virtual void onPreDraw(SkCanvas*) {}
|
||||
virtual void onPostDraw(SkCanvas*) {}
|
||||
// Each bench should do its main work in a loop like this:
|
||||
// for (int i = 0; i < loops; i++) { <work here> }
|
||||
virtual void onDraw(const int loops, SkCanvas*) = 0;
|
||||
|
@ -46,7 +46,7 @@ protected:
|
||||
return SkIPoint::Make(640, 100);
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
make_path(fPath);
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
SkBitmap bm;
|
||||
|
||||
if (kIndex_8_SkColorType == fColorType) {
|
||||
|
@ -67,7 +67,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
fBitmap.allocPixels();
|
||||
fBitmap.setAlphaType(kOpaque_SkAlphaType);
|
||||
fBitmap.eraseColor(SK_ColorBLACK);
|
||||
|
@ -53,7 +53,7 @@ bool BitmapRegionDecoderBench::isSuitableFor(Backend backend) {
|
||||
return kNonRendering_Backend == backend;
|
||||
}
|
||||
|
||||
void BitmapRegionDecoderBench::onPreDraw() {
|
||||
void BitmapRegionDecoderBench::onDelayedSetup() {
|
||||
SkStreamRewindable* stream = new SkMemoryStream(fData);
|
||||
fBRD.reset(SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(stream, fStrategy));
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ protected:
|
||||
const char* onGetName() override;
|
||||
bool isSuitableFor(Backend backend) override;
|
||||
void onDraw(const int n, SkCanvas* canvas) override;
|
||||
void onPreDraw() override;
|
||||
void onDelayedSetup() override;
|
||||
|
||||
private:
|
||||
SkString fName;
|
||||
|
@ -56,7 +56,7 @@ protected:
|
||||
fName.printf( "bitmap_scale_%s_%d_%d", name, fInputSize, fOutputSize );
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
fInputBitmap.allocN32Pixels(fInputSize, fInputSize, true);
|
||||
fInputBitmap.eraseColor(SK_ColorWHITE);
|
||||
|
||||
|
@ -35,7 +35,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
if (!fInitialized) {
|
||||
make_checkerboard();
|
||||
fInitialized = true;
|
||||
|
@ -32,7 +32,7 @@ bool CodecBench::isSuitableFor(Backend backend) {
|
||||
return kNonRendering_Backend == backend;
|
||||
}
|
||||
|
||||
void CodecBench::onPreDraw() {
|
||||
void CodecBench::onDelayedSetup() {
|
||||
SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(fData));
|
||||
|
||||
fInfo = codec->getInfo().makeColorType(fColorType);
|
||||
|
@ -26,7 +26,7 @@ protected:
|
||||
const char* onGetName() override;
|
||||
bool isSuitableFor(Backend backend) override;
|
||||
void onDraw(const int n, SkCanvas* canvas) override;
|
||||
void onPreDraw() override;
|
||||
void onDelayedSetup() override;
|
||||
|
||||
private:
|
||||
SkString fName;
|
||||
|
@ -31,7 +31,7 @@ protected:
|
||||
return "colorcube";
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
if (!SkToBool(fCubeData)) {
|
||||
this->makeCubeData();
|
||||
this->make_bitmap();
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
|
||||
const char* onGetName() override { return fName.c_str(); }
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
// A handful of random srcs and dsts.
|
||||
SkRandom rand;
|
||||
for (int i = 0; i < kInputs; i++) {
|
||||
|
@ -44,7 +44,7 @@ bool DecodingBench::isSuitableFor(Backend backend) {
|
||||
return kNonRendering_Backend == backend;
|
||||
}
|
||||
|
||||
void DecodingBench::onPreDraw() {
|
||||
void DecodingBench::onDelayedSetup() {
|
||||
// Allocate the pixels now, to remove it from the loop.
|
||||
SkAutoTDelete<SkStreamRewindable> stream(new SkMemoryStream(fData));
|
||||
SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream));
|
||||
|
@ -28,7 +28,7 @@ protected:
|
||||
const char* onGetName() override;
|
||||
bool isSuitableFor(Backend backend) override;
|
||||
void onDraw(const int n, SkCanvas* canvas) override;
|
||||
void onPreDraw() override;
|
||||
void onDelayedSetup() override;
|
||||
|
||||
private:
|
||||
SkString fName;
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
if (!fInitialized) {
|
||||
this->makeBitmap();
|
||||
this->makeCheckerboard();
|
||||
|
@ -32,7 +32,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
fBitmap.allocN32Pixels(200, 200);
|
||||
fBitmap.eraseARGB(255, 0, 255, 0);
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
if (nullptr == fPKMData) {
|
||||
SkDebugf("Failed to load PKM data!\n");
|
||||
return;
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
protected:
|
||||
const char* onGetName() override { return "fullscreen_rects"; }
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
if (!fInit) {
|
||||
SkRandom rand;
|
||||
static const SkScalar kMinOffset = 0;
|
||||
|
@ -32,7 +32,7 @@ const GrGLContext* GLBench::getGLContext(SkCanvas* canvas) {
|
||||
return this->onGetGLContext(ctx);
|
||||
}
|
||||
|
||||
void GLBench::onPerCanvasPreDraw(SkCanvas* canvas) {
|
||||
void GLBench::onPreDraw(SkCanvas* canvas) {
|
||||
// This bench exclusively tests GL calls directly
|
||||
const GrGLContext* ctx = this->getGLContext(canvas);
|
||||
if (!ctx) {
|
||||
@ -41,7 +41,7 @@ void GLBench::onPerCanvasPreDraw(SkCanvas* canvas) {
|
||||
this->setup(ctx);
|
||||
}
|
||||
|
||||
void GLBench::onPerCanvasPostDraw(SkCanvas* canvas) {
|
||||
void GLBench::onPostDraw(SkCanvas* canvas) {
|
||||
// This bench exclusively tests GL calls directly
|
||||
const GrGLContext* ctx = this->getGLContext(canvas);
|
||||
if (!ctx) {
|
||||
|
@ -29,9 +29,9 @@ public:
|
||||
protected:
|
||||
const GrGLContext* getGLContext(SkCanvas*);
|
||||
virtual const GrGLContext* onGetGLContext(const GrGLContext* ctx) { return ctx; }
|
||||
void onPerCanvasPreDraw(SkCanvas* canvas) override;
|
||||
void onPreDraw(SkCanvas*) override;
|
||||
virtual void setup(const GrGLContext*)=0;
|
||||
void onPerCanvasPostDraw(SkCanvas* canvas) override;
|
||||
void onPostDraw(SkCanvas* canvas) override;
|
||||
virtual void teardown(const GrGLInterface*)=0;
|
||||
void onDraw(const int loops, SkCanvas*) override;
|
||||
virtual void glDraw(const int loops, const GrGLContext*)=0;
|
||||
|
@ -78,7 +78,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
if (!fInitialized) {
|
||||
this->makeCheckerboard();
|
||||
this->makeAtlas();
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
protected:
|
||||
SkRect fRects[2048];
|
||||
|
||||
virtual void onPreDraw() {
|
||||
virtual void onDelayedSetup() {
|
||||
const SkScalar min = -100;
|
||||
const SkScalar max = 100;
|
||||
SkRandom rand;
|
||||
|
@ -115,7 +115,7 @@ protected:
|
||||
return fFullName.c_str();
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
fContext.reset(GrContext::CreateMockContext());
|
||||
if (!fContext) {
|
||||
return;
|
||||
|
@ -83,7 +83,7 @@ protected:
|
||||
return "image_filter_collapse_table";
|
||||
}
|
||||
|
||||
virtual void onPreDraw() override {
|
||||
virtual void onDelayedSetup() override {
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
int n = i >> 5;
|
||||
table1[i] = (n << 5) | (n << 2) | (n >> 1);
|
||||
@ -139,7 +139,7 @@ protected:
|
||||
return "image_filter_collapse_matrix";
|
||||
}
|
||||
|
||||
virtual void onPreDraw() override {
|
||||
virtual void onDelayedSetup() override {
|
||||
SkColorFilter* colorFilters[] = {
|
||||
make_brightness(0.1f),
|
||||
make_grayscale(),
|
||||
|
@ -26,7 +26,7 @@ protected:
|
||||
return fIsSmall ? "magnifier_small" : "magnifier_large";
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
if (!fInitialized) {
|
||||
make_checkerboard();
|
||||
fInitialized = true;
|
||||
|
@ -146,7 +146,7 @@ public:
|
||||
DecomposeMatrixBench() : INHERITED("decompose") {}
|
||||
|
||||
protected:
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
SkScalar rot0 = (fRandom.nextBool()) ? fRandom.nextRangeF(-180, 180) : 0.0f;
|
||||
SkScalar sx = fRandom.nextRangeF(-3000.f, 3000.f);
|
||||
|
@ -25,7 +25,7 @@ protected:
|
||||
return fIsSmall ? "merge_small" : "merge_large";
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
if (!fInitialized) {
|
||||
make_bitmap();
|
||||
make_checkerboard();
|
||||
|
@ -22,7 +22,7 @@ protected:
|
||||
|
||||
const char* onGetName() override { return "mipmap_build"; }
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
fBitmap.allocN32Pixels(1000, 1000, true);
|
||||
fBitmap.eraseColor(SK_ColorWHITE); // so we don't read uninitialized memory
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
this->setCubics();
|
||||
this->setColors();
|
||||
this->setTexCoords();
|
||||
|
@ -200,7 +200,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
this->setGrid();
|
||||
switch (fVertexMode) {
|
||||
case kTexCoords_VertexMode:
|
||||
|
@ -325,7 +325,7 @@ protected:
|
||||
return "path_create";
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
this->createData(10, 100);
|
||||
}
|
||||
|
||||
@ -354,7 +354,7 @@ protected:
|
||||
const char* onGetName() override {
|
||||
return "path_copy";
|
||||
}
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
this->createData(10, 100);
|
||||
fPaths.reset(kPathCnt);
|
||||
fCopies.reset(kPathCnt);
|
||||
@ -390,7 +390,7 @@ protected:
|
||||
return fInPlace ? "path_transform_in_place" : "path_transform_copy";
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
fMatrix.setScale(5 * SK_Scalar1, 6 * SK_Scalar1);
|
||||
this->createData(10, 100);
|
||||
fPaths.reset(kPathCnt);
|
||||
@ -438,7 +438,7 @@ protected:
|
||||
return "path_equality_50%";
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
fParity = 0;
|
||||
this->createData(10, 100);
|
||||
fPaths.reset(kPathCnt);
|
||||
@ -501,7 +501,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
// reversePathTo assumes a single contour path.
|
||||
bool allowMoves = kReversePathTo_AddType != fType;
|
||||
this->createData(10, 100, allowMoves);
|
||||
@ -769,7 +769,7 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
fQueryRects.setCount(kQueryRectCnt);
|
||||
|
||||
SkRandom rand;
|
||||
|
@ -139,8 +139,8 @@ public:
|
||||
: INHERITED("playback", maxLevel, maxPictureLevel) {
|
||||
}
|
||||
protected:
|
||||
void onPreDraw() override {
|
||||
this->INHERITED::onPreDraw();
|
||||
void onDelayedSetup() override {
|
||||
this->INHERITED::onDelayedSetup();
|
||||
|
||||
SkIPoint canvasSize = onGetSize();
|
||||
SkPictureRecorder recorder;
|
||||
|
@ -162,7 +162,7 @@ public:
|
||||
const char* onGetName() override { return fName.c_str(); }
|
||||
SkIPoint onGetSize() override { return SkIPoint::Make(1024,1024); }
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
SkAutoTDelete<SkBBHFactory> factory;
|
||||
switch (fBBH) {
|
||||
case kNone: break;
|
||||
|
@ -29,7 +29,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
SkImageInfo info = SkImageInfo::Make(W, H, fColorType, kUnpremul_SkAlphaType);
|
||||
fBmp1.allocPixels(info); // used in writePixels
|
||||
|
||||
|
@ -67,7 +67,7 @@ protected:
|
||||
const char* onGetName() override {
|
||||
return fName.c_str();
|
||||
}
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
SkRandom rand;
|
||||
SkAutoTMalloc<SkRect> rects(NUM_QUERY_RECTS);
|
||||
for (int i = 0; i < NUM_QUERY_RECTS; ++i) {
|
||||
|
@ -48,7 +48,7 @@ protected:
|
||||
|
||||
const char* onGetName() override { return computeName("rects"); }
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
SkRandom rand;
|
||||
const SkScalar offset = SK_Scalar1/3;
|
||||
for (int i = 0; i < N; i++) {
|
||||
|
@ -72,7 +72,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
SkASSERT(nullptr == fRectanizer.get());
|
||||
|
||||
if (kPow2_RectanizerType == fRectanizerType) {
|
||||
|
@ -108,7 +108,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
fBitmap.allocPixels();
|
||||
fBitmap.eraseColor(kOpaque_SkAlphaType == fAlphaType ? SK_ColorWHITE : 0);
|
||||
|
||||
|
@ -45,7 +45,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
SkString resourcePath = GetResourcePath();
|
||||
if (resourcePath.isEmpty()) {
|
||||
fValid = false;
|
||||
|
@ -119,7 +119,7 @@ protected:
|
||||
}
|
||||
|
||||
// Delayed initialization only done if onDraw will be called.
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
fUnsorted.reset(N);
|
||||
gRec[fType].fProc(fUnsorted.get());
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
if (fDoColorEmoji) {
|
||||
SkASSERT(kBW == fFQ);
|
||||
fColorEmojiTypeface.reset(GetResourceAsTypeface("/fonts/Funkster.ttf"));
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
void onPreDraw() override {
|
||||
void onDelayedSetup() override {
|
||||
fTypeface.reset(sk_tool_utils::create_portable_typeface("serif", SkTypeface::kNormal));
|
||||
// make textblob
|
||||
SkPaint paint;
|
||||
|
@ -207,6 +207,7 @@ static double time(int loops, Benchmark* bench, Target* target) {
|
||||
if (canvas) {
|
||||
canvas->clear(SK_ColorWHITE);
|
||||
}
|
||||
bench->preDraw(canvas);
|
||||
WallTimer timer;
|
||||
timer.start();
|
||||
canvas = target->beginTiming(canvas);
|
||||
@ -216,6 +217,7 @@ static double time(int loops, Benchmark* bench, Target* target) {
|
||||
}
|
||||
target->endTiming();
|
||||
timer.end();
|
||||
bench->postDraw(canvas);
|
||||
return timer.fWall;
|
||||
}
|
||||
|
||||
@ -1164,7 +1166,7 @@ int nanobench_main() {
|
||||
|
||||
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]);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user