Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: tools/VisualBench.h

Issue 1159213002: Expand VisualBench to a real benching tool (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/views/unix/SkOSWindow_Unix.cpp ('k') | tools/VisualBench.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 * 6 *
7 */ 7 */
8 8
9 #ifndef VisualBench_DEFINED 9 #ifndef VisualBench_DEFINED
10 #define VisualBench_DEFINED 10 #define VisualBench_DEFINED
11 11
12 #include "SkWindow.h" 12 #include "SkWindow.h"
13 13
14 #include "SkPicture.h" 14 #include "SkPicture.h"
15 #include "SkSurface.h" 15 #include "SkSurface.h"
16 #include "Timer.h"
16 #include "gl/SkGLContext.h" 17 #include "gl/SkGLContext.h"
17 18
18 class GrContext; 19 class GrContext;
19 struct GrGLInterface; 20 struct GrGLInterface;
20 class GrRenderTarget; 21 class GrRenderTarget;
21 class SkCanvas; 22 class SkCanvas;
22 23
23 /* 24 /*
24 * A Visual benchmarking tool for gpu benchmarking 25 * A Visual benchmarking tool for gpu benchmarking
25 */ 26 */
26 class VisualBench : public SkOSWindow { 27 class VisualBench : public SkOSWindow {
27 public: 28 public:
28 VisualBench(void* hwnd, int argc, char** argv); 29 VisualBench(void* hwnd, int argc, char** argv);
29 ~VisualBench() override; 30 ~VisualBench() override;
30 31
31 protected: 32 protected:
32 SkSurface* createSurface() override; 33 SkSurface* createSurface() override;
33 34
34 void draw(SkCanvas* canvas) override; 35 void draw(SkCanvas* canvas) override;
35 36
36 void onSizeChange() override; 37 void onSizeChange() override;
37 38
38 private: 39 private:
39 void setTitle(); 40 void setTitle();
40 bool setupBackend(); 41 bool setupBackend();
42 void resetContext();
41 void setupRenderTarget(); 43 void setupRenderTarget();
42 bool onHandleChar(SkUnichar unichar) override; 44 bool onHandleChar(SkUnichar unichar) override;
45 void printStats();
46 inline void timePicture(SkCanvas*);
47 inline void renderFrame(SkCanvas*);
43 48
44 int fCurrentLoops; 49 struct Timing {
50 SkString fName;
51 SkTArray<double> fMeasurements;
52 };
53
54 enum State {
55 kPreWarm_State,
56 kTiming_State,
57 };
58
59 int fLoop;
45 int fCurrentPicture; 60 int fCurrentPicture;
46 int fCurrentFrame; 61 int fCurrentSample;
62 SkTArray<Timing> fTimings;
47 SkTArray<SkPicture*> fPictures; 63 SkTArray<SkPicture*> fPictures;
64 WallTimer fTimer;
65 State fState;
48 66
49 // support framework 67 // support framework
50 SkAutoTUnref<SkSurface> fSurface; 68 SkAutoTUnref<SkSurface> fSurface;
51 SkAutoTUnref<GrContext> fContext; 69 SkAutoTUnref<GrContext> fContext;
52 SkAutoTUnref<GrRenderTarget> fRenderTarget; 70 SkAutoTUnref<GrRenderTarget> fRenderTarget;
53 AttachmentInfo fAttachmentInfo; 71 AttachmentInfo fAttachmentInfo;
54 SkAutoTUnref<const GrGLInterface> fInterface; 72 SkAutoTUnref<const GrGLInterface> fInterface;
55 73
56 typedef SkOSWindow INHERITED; 74 typedef SkOSWindow INHERITED;
57 }; 75 };
58 76
59 #endif 77 #endif
OLDNEW
« no previous file with comments | « src/views/unix/SkOSWindow_Unix.cpp ('k') | tools/VisualBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698