OLD | NEW |
1 // Main binary for DM. | 1 // Main binary for DM. |
2 // For a high-level overview, please see dm/README. | 2 // For a high-level overview, please see dm/README. |
3 | 3 |
4 #include "GrContext.h" | 4 #include "GrContext.h" |
5 #include "GrContextFactory.h" | 5 #include "GrContextFactory.h" |
6 #include "SkBenchmark.h" | 6 #include "SkBenchmark.h" |
7 #include "SkCommandLineFlags.h" | 7 #include "SkCommandLineFlags.h" |
8 #include "SkForceLinking.h" | 8 #include "SkForceLinking.h" |
9 #include "SkGraphics.h" | 9 #include "SkGraphics.h" |
10 #include "SkString.h" | 10 #include "SkString.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 DEFINE_string2(resources, i, "resources", "Path to resources directory."); | 35 DEFINE_string2(resources, i, "resources", "Path to resources directory."); |
36 DEFINE_string(match, "", "[~][^]substring[$] [...] of GM name to run.\n" | 36 DEFINE_string(match, "", "[~][^]substring[$] [...] of GM name to run.\n" |
37 "Multiple matches may be separated by spaces.\n" | 37 "Multiple matches may be separated by spaces.\n" |
38 "~ causes a matching GM to always be skipped\n" | 38 "~ causes a matching GM to always be skipped\n" |
39 "^ requires the start of the GM to match\n" | 39 "^ requires the start of the GM to match\n" |
40 "$ requires the end of the GM to match\n" | 40 "$ requires the end of the GM to match\n" |
41 "^ and $ requires an exact match\n" | 41 "^ and $ requires an exact match\n" |
42 "If a GM does not match any list entry,\n" | 42 "If a GM does not match any list entry,\n" |
43 "it is skipped unless some list entry starts with ~"); | 43 "it is skipped unless some list entry starts with ~"); |
44 DEFINE_string(config, "565 8888 gpu nonrendering", | 44 DEFINE_string(config, "565 8888 gpu nonrendering", |
45 "Options: 565 8888 gpu nonrendering msaa4 msaa16 gpunull gpudebug
angle mesa"); | 45 "Options: 565 8888 gpu nonrendering msaa4 msaa16 nvprmsaa4 nvprmsa
a16 gpunull gpudebug angle mesa"); |
46 DEFINE_bool(leaks, false, "Print leaked instance-counted objects at exit?"); | 46 DEFINE_bool(leaks, false, "Print leaked instance-counted objects at exit?"); |
47 | 47 |
48 DEFINE_bool(gms, true, "Run GMs?"); | 48 DEFINE_bool(gms, true, "Run GMs?"); |
49 DEFINE_bool(benches, true, "Run benches? Does not run GMs-as-benches."); | 49 DEFINE_bool(benches, true, "Run benches? Does not run GMs-as-benches."); |
50 DEFINE_bool(tests, true, "Run tests?"); | 50 DEFINE_bool(tests, true, "Run tests?"); |
51 | 51 |
52 __SK_FORCE_IMAGE_DECODER_LINKING; | 52 __SK_FORCE_IMAGE_DECODER_LINKING; |
53 | 53 |
54 // "FooBar" -> "foobar". Obviously, ASCII only. | 54 // "FooBar" -> "foobar". Obviously, ASCII only. |
55 static SkString lowercase(SkString s) { | 55 static SkString lowercase(SkString s) { |
56 for (size_t i = 0; i < s.size(); i++) { | 56 for (size_t i = 0; i < s.size(); i++) { |
57 s[i] = tolower(s[i]); | 57 s[i] = tolower(s[i]); |
58 } | 58 } |
59 return s; | 59 return s; |
60 } | 60 } |
61 | 61 |
62 static const GrContextFactory::GLContextType native = GrContextFactory::kNative_
GLContextType; | 62 static const GrContextFactory::GLContextType native = GrContextFactory::kNative_
GLContextType; |
| 63 static const GrContextFactory::GLContextType nvpr = GrContextFactory::kNVPR_GLCo
ntextType; |
63 static const GrContextFactory::GLContextType null = GrContextFactory::kNull_GL
ContextType; | 64 static const GrContextFactory::GLContextType null = GrContextFactory::kNull_GL
ContextType; |
64 static const GrContextFactory::GLContextType debug = GrContextFactory::kDebug_G
LContextType; | 65 static const GrContextFactory::GLContextType debug = GrContextFactory::kDebug_G
LContextType; |
65 static const GrContextFactory::GLContextType angle = | 66 static const GrContextFactory::GLContextType angle = |
66 #if SK_ANGLE | 67 #if SK_ANGLE |
67 GrContextFactory::kANGLE_GLContextType; | 68 GrContextFactory::kANGLE_GLContextType; |
68 #else | 69 #else |
69 native; | 70 native; |
70 #endif | 71 #endif |
71 static const GrContextFactory::GLContextType mesa = | 72 static const GrContextFactory::GLContextType mesa = |
72 #if SK_MESA | 73 #if SK_MESA |
(...skipping 12 matching lines...) Expand all Loading... |
85 tasks->add(SkNEW_ARGS(DM::type,
\ | 86 tasks->add(SkNEW_ARGS(DM::type,
\ |
86 (name, reporter, tasks, expectations, gms[i], ## __VA_ARGS__
))); \ | 87 (name, reporter, tasks, expectations, gms[i], ## __VA_ARGS__
))); \ |
87 } | 88 } |
88 for (int i = 0; i < gms.count(); i++) { | 89 for (int i = 0; i < gms.count(); i++) { |
89 for (int j = 0; j < configs.count(); j++) { | 90 for (int j = 0; j < configs.count(); j++) { |
90 START("565", CpuGMTask, kRGB_565_SkColorType); | 91 START("565", CpuGMTask, kRGB_565_SkColorType); |
91 START("8888", CpuGMTask, kPMColor_SkColorType); | 92 START("8888", CpuGMTask, kPMColor_SkColorType); |
92 START("gpu", GpuGMTask, native, 0); | 93 START("gpu", GpuGMTask, native, 0); |
93 START("msaa4", GpuGMTask, native, 4); | 94 START("msaa4", GpuGMTask, native, 4); |
94 START("msaa16", GpuGMTask, native, 16); | 95 START("msaa16", GpuGMTask, native, 16); |
| 96 START("nvprmsaa4", GpuGMTask, nvpr, 4); |
| 97 START("nvprmsaa16", GpuGMTask, nvpr, 16); |
95 START("gpunull", GpuGMTask, null, 0); | 98 START("gpunull", GpuGMTask, null, 0); |
96 START("gpudebug", GpuGMTask, debug, 0); | 99 START("gpudebug", GpuGMTask, debug, 0); |
97 START("angle", GpuGMTask, angle, 0); | 100 START("angle", GpuGMTask, angle, 0); |
98 START("mesa", GpuGMTask, mesa, 0); | 101 START("mesa", GpuGMTask, mesa, 0); |
99 } | 102 } |
100 } | 103 } |
101 #undef START | 104 #undef START |
102 } | 105 } |
103 | 106 |
104 static void kick_off_benches(const SkTDArray<BenchRegistry::Factory>& benches, | 107 static void kick_off_benches(const SkTDArray<BenchRegistry::Factory>& benches, |
105 const SkTArray<SkString>& configs, | 108 const SkTArray<SkString>& configs, |
106 DM::Reporter* reporter, | 109 DM::Reporter* reporter, |
107 DM::TaskRunner* tasks) { | 110 DM::TaskRunner* tasks) { |
108 #define START(name, type, ...)
\ | 111 #define START(name, type, ...)
\ |
109 if (lowercase(configs[j]).equals(name)) {
\ | 112 if (lowercase(configs[j]).equals(name)) {
\ |
110 tasks->add(SkNEW_ARGS(DM::type, (name, reporter, tasks, benches[i], ## _
_VA_ARGS__))); \ | 113 tasks->add(SkNEW_ARGS(DM::type, (name, reporter, tasks, benches[i], ## _
_VA_ARGS__))); \ |
111 } | 114 } |
112 for (int i = 0; i < benches.count(); i++) { | 115 for (int i = 0; i < benches.count(); i++) { |
113 for (int j = 0; j < configs.count(); j++) { | 116 for (int j = 0; j < configs.count(); j++) { |
114 START("nonrendering", NonRenderingBenchTask); | 117 START("nonrendering", NonRenderingBenchTask); |
115 START("565", CpuBenchTask, kRGB_565_SkColorType); | 118 START("565", CpuBenchTask, kRGB_565_SkColorType); |
116 START("8888", CpuBenchTask, kPMColor_SkColorType); | 119 START("8888", CpuBenchTask, kPMColor_SkColorType); |
117 START("gpu", GpuBenchTask, native, 0); | 120 START("gpu", GpuBenchTask, native, 0); |
118 START("msaa4", GpuBenchTask, native, 4); | 121 START("msaa4", GpuBenchTask, native, 4); |
119 START("msaa16", GpuBenchTask, native, 16); | 122 START("msaa16", GpuBenchTask, native, 16); |
| 123 START("nvprmsaa4", GpuBenchTask, nvpr, 4); |
| 124 START("nvprmsaa16", GpuBenchTask, nvpr, 16); |
120 START("gpunull", GpuBenchTask, null, 0); | 125 START("gpunull", GpuBenchTask, null, 0); |
121 START("gpudebug", GpuBenchTask, debug, 0); | 126 START("gpudebug", GpuBenchTask, debug, 0); |
122 START("angle", GpuBenchTask, angle, 0); | 127 START("angle", GpuBenchTask, angle, 0); |
123 START("mesa", GpuBenchTask, mesa, 0); | 128 START("mesa", GpuBenchTask, mesa, 0); |
124 } | 129 } |
125 } | 130 } |
126 #undef START | 131 #undef START |
127 } | 132 } |
128 | 133 |
129 static void kick_off_tests(const SkTDArray<TestRegistry::Factory>& tests, | 134 static void kick_off_tests(const SkTDArray<TestRegistry::Factory>& tests, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 SkGraphics::Term(); | 224 SkGraphics::Term(); |
220 | 225 |
221 return reporter.failed() > 0; | 226 return reporter.failed() > 0; |
222 } | 227 } |
223 | 228 |
224 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 229 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
225 int main(int argc, char** argv) { | 230 int main(int argc, char** argv) { |
226 return tool_main(argc, argv); | 231 return tool_main(argc, argv); |
227 } | 232 } |
228 #endif | 233 #endif |
OLD | NEW |