| 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 "Benchmark.h" | |
| 5 #include "CrashHandler.h" | 4 #include "CrashHandler.h" |
| 6 #include "SkCommandLineFlags.h" | 5 #include "SkCommandLineFlags.h" |
| 7 #include "SkForceLinking.h" | 6 #include "SkForceLinking.h" |
| 8 #include "SkGraphics.h" | 7 #include "SkGraphics.h" |
| 9 #include "SkPicture.h" | 8 #include "SkPicture.h" |
| 10 #include "SkString.h" | 9 #include "SkString.h" |
| 11 #include "Test.h" | 10 #include "Test.h" |
| 12 #include "gm.h" | 11 #include "gm.h" |
| 13 | 12 |
| 14 #include "DMBenchTask.h" | |
| 15 #include "DMCpuGMTask.h" | 13 #include "DMCpuGMTask.h" |
| 16 #include "DMGpuGMTask.h" | 14 #include "DMGpuGMTask.h" |
| 17 #include "DMGpuSupport.h" | 15 #include "DMGpuSupport.h" |
| 18 #include "DMPDFTask.h" | 16 #include "DMPDFTask.h" |
| 19 #include "DMReporter.h" | 17 #include "DMReporter.h" |
| 20 #include "DMSKPTask.h" | 18 #include "DMSKPTask.h" |
| 21 #include "DMTask.h" | 19 #include "DMTask.h" |
| 22 #include "DMTaskRunner.h" | 20 #include "DMTaskRunner.h" |
| 23 #include "DMTestTask.h" | 21 #include "DMTestTask.h" |
| 24 #include "DMWriteTask.h" | 22 #include "DMWriteTask.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 "it is skipped unless some list entry starts with ~"); | 59 "it is skipped unless some list entry starts with ~"); |
| 62 DEFINE_string(config, "565 8888 pdf gpu nonrendering", | 60 DEFINE_string(config, "565 8888 pdf gpu nonrendering", |
| 63 "Options: 565 8888 pdf gpu nonrendering msaa4 msaa16 nvprmsaa4 nvp
rmsaa16 " | 61 "Options: 565 8888 pdf gpu nonrendering msaa4 msaa16 nvprmsaa4 nvp
rmsaa16 " |
| 64 "gpunull gpudebug angle mesa"); | 62 "gpunull gpudebug angle mesa"); |
| 65 DEFINE_bool(dryRun, false, | 63 DEFINE_bool(dryRun, false, |
| 66 "Just print the tests that would be run, without actually running th
em."); | 64 "Just print the tests that would be run, without actually running th
em."); |
| 67 DEFINE_bool(leaks, false, "Print leaked instance-counted objects at exit?"); | 65 DEFINE_bool(leaks, false, "Print leaked instance-counted objects at exit?"); |
| 68 DEFINE_string(skps, "", "Directory to read skps from."); | 66 DEFINE_string(skps, "", "Directory to read skps from."); |
| 69 | 67 |
| 70 DEFINE_bool(gms, true, "Run GMs?"); | 68 DEFINE_bool(gms, true, "Run GMs?"); |
| 71 DEFINE_bool(benches, true, "Run benches? Does not run GMs-as-benches."); | |
| 72 DEFINE_bool(tests, true, "Run tests?"); | 69 DEFINE_bool(tests, true, "Run tests?"); |
| 73 | 70 |
| 74 DECLARE_bool(verbose); | 71 DECLARE_bool(verbose); |
| 75 | 72 |
| 76 __SK_FORCE_IMAGE_DECODER_LINKING; | 73 __SK_FORCE_IMAGE_DECODER_LINKING; |
| 77 | 74 |
| 78 // "FooBar" -> "foobar". Obviously, ASCII only. | 75 // "FooBar" -> "foobar". Obviously, ASCII only. |
| 79 static SkString lowercase(SkString s) { | 76 static SkString lowercase(SkString s) { |
| 80 for (size_t i = 0; i < s.size(); i++) { | 77 for (size_t i = 0; i < s.size(); i++) { |
| 81 s[i] = tolower(s[i]); | 78 s[i] = tolower(s[i]); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 START("gpunull", GpuGMTask, expectations, null, gpuAPI, 0); | 120 START("gpunull", GpuGMTask, expectations, null, gpuAPI, 0); |
| 124 START("gpudebug", GpuGMTask, expectations, debug, gpuAPI, 0); | 121 START("gpudebug", GpuGMTask, expectations, debug, gpuAPI, 0); |
| 125 START("angle", GpuGMTask, expectations, angle, gpuAPI, 0); | 122 START("angle", GpuGMTask, expectations, angle, gpuAPI, 0); |
| 126 START("mesa", GpuGMTask, expectations, mesa, gpuAPI, 0); | 123 START("mesa", GpuGMTask, expectations, mesa, gpuAPI, 0); |
| 127 START("pdf", PDFTask, RASTERIZE_PDF_PROC); | 124 START("pdf", PDFTask, RASTERIZE_PDF_PROC); |
| 128 } | 125 } |
| 129 } | 126 } |
| 130 #undef START | 127 #undef START |
| 131 } | 128 } |
| 132 | 129 |
| 133 static void kick_off_benches(const SkTDArray<BenchRegistry::Factory>& benches, | |
| 134 const SkTArray<SkString>& configs, | |
| 135 GrGLStandard gpuAPI, | |
| 136 DM::Reporter* reporter, | |
| 137 DM::TaskRunner* tasks) { | |
| 138 #define START(name, type, ...)
\ | |
| 139 if (lowercase(configs[j]).equals(name)) {
\ | |
| 140 tasks->add(SkNEW_ARGS(DM::type, (name, reporter, tasks, benches[i], ## _
_VA_ARGS__))); \ | |
| 141 } | |
| 142 for (int i = 0; i < benches.count(); i++) { | |
| 143 for (int j = 0; j < configs.count(); j++) { | |
| 144 START("nonrendering", NonRenderingBenchTask); | |
| 145 START("565", CpuBenchTask, kRGB_565_SkColorType); | |
| 146 START("8888", CpuBenchTask, kN32_SkColorType); | |
| 147 START("gpu", GpuBenchTask, native, gpuAPI, 0); | |
| 148 START("msaa4", GpuBenchTask, native, gpuAPI, 4); | |
| 149 START("msaa16", GpuBenchTask, native, gpuAPI, 16); | |
| 150 START("nvprmsaa4", GpuBenchTask, nvpr, gpuAPI, 4); | |
| 151 START("nvprmsaa16", GpuBenchTask, nvpr, gpuAPI, 16); | |
| 152 START("gpunull", GpuBenchTask, null, gpuAPI, 0); | |
| 153 START("gpudebug", GpuBenchTask, debug, gpuAPI, 0); | |
| 154 START("angle", GpuBenchTask, angle, gpuAPI, 0); | |
| 155 START("mesa", GpuBenchTask, mesa, gpuAPI, 0); | |
| 156 } | |
| 157 } | |
| 158 #undef START | |
| 159 } | |
| 160 | |
| 161 static void kick_off_tests(const SkTDArray<TestRegistry::Factory>& tests, | 130 static void kick_off_tests(const SkTDArray<TestRegistry::Factory>& tests, |
| 162 DM::Reporter* reporter, | 131 DM::Reporter* reporter, |
| 163 DM::TaskRunner* tasks) { | 132 DM::TaskRunner* tasks) { |
| 164 for (int i = 0; i < tests.count(); i++) { | 133 for (int i = 0; i < tests.count(); i++) { |
| 165 SkAutoTDelete<Test> test(tests[i](NULL)); | 134 SkAutoTDelete<Test> test(tests[i](NULL)); |
| 166 if (test->isGPUTest()) { | 135 if (test->isGPUTest()) { |
| 167 tasks->add(SkNEW_ARGS(DM::GpuTestTask, (reporter, tasks, tests[i])))
; | 136 tasks->add(SkNEW_ARGS(DM::GpuTestTask, (reporter, tasks, tests[i])))
; |
| 168 } else { | 137 } else { |
| 169 tasks->add(SkNEW_ARGS(DM::CpuTestTask, (reporter, tasks, tests[i])))
; | 138 tasks->add(SkNEW_ARGS(DM::CpuTestTask, (reporter, tasks, tests[i])))
; |
| 170 } | 139 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 if (FLAGS_expectations.count() > 0) { | 231 if (FLAGS_expectations.count() > 0) { |
| 263 const char* path = FLAGS_expectations[0]; | 232 const char* path = FLAGS_expectations[0]; |
| 264 if (sk_isdir(path)) { | 233 if (sk_isdir(path)) { |
| 265 expectations.reset(SkNEW_ARGS(DM::WriteTask::Expectations, (path
))); | 234 expectations.reset(SkNEW_ARGS(DM::WriteTask::Expectations, (path
))); |
| 266 } else { | 235 } else { |
| 267 expectations.reset(SkNEW_ARGS(DM::JsonExpectations, (path))); | 236 expectations.reset(SkNEW_ARGS(DM::JsonExpectations, (path))); |
| 268 } | 237 } |
| 269 } | 238 } |
| 270 } | 239 } |
| 271 | 240 |
| 272 SkTDArray<BenchRegistry::Factory> benches; | |
| 273 if (FLAGS_benches) { | |
| 274 append_matching_factories<Benchmark>(BenchRegistry::Head(), &benches); | |
| 275 } | |
| 276 | |
| 277 SkTDArray<TestRegistry::Factory> tests; | 241 SkTDArray<TestRegistry::Factory> tests; |
| 278 if (FLAGS_tests) { | 242 if (FLAGS_tests) { |
| 279 append_matching_factories<Test>(TestRegistry::Head(), &tests); | 243 append_matching_factories<Test>(TestRegistry::Head(), &tests); |
| 280 } | 244 } |
| 281 | 245 |
| 282 SkDebugf("(%d GMs, %d benches) x %d configs, %d tests\n", | 246 SkDebugf("%d GMs x %d configs, %d tests\n", |
| 283 gms.count(), benches.count(), configs.count(), tests.count()); | 247 gms.count(), configs.count(), tests.count()); |
| 284 DM::Reporter reporter; | 248 DM::Reporter reporter; |
| 285 DM::TaskRunner tasks(FLAGS_threads, FLAGS_gpuThreads); | 249 DM::TaskRunner tasks(FLAGS_threads, FLAGS_gpuThreads); |
| 286 kick_off_gms(gms, configs, gpuAPI, *expectations, &reporter, &tasks); | 250 kick_off_gms(gms, configs, gpuAPI, *expectations, &reporter, &tasks); |
| 287 kick_off_benches(benches, configs, gpuAPI, &reporter, &tasks); | |
| 288 kick_off_tests(tests, &reporter, &tasks); | 251 kick_off_tests(tests, &reporter, &tasks); |
| 289 kick_off_skps(&reporter, &tasks); | 252 kick_off_skps(&reporter, &tasks); |
| 290 tasks.wait(); | 253 tasks.wait(); |
| 291 | 254 |
| 292 SkDebugf("\n"); | 255 SkDebugf("\n"); |
| 293 | 256 |
| 294 SkTArray<SkString> failures; | 257 SkTArray<SkString> failures; |
| 295 reporter.getFailures(&failures); | 258 reporter.getFailures(&failures); |
| 296 report_failures(failures); | 259 report_failures(failures); |
| 297 return failures.count() > 0; | 260 return failures.count() > 0; |
| 298 } | 261 } |
| 299 | 262 |
| 300 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 263 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 301 int main(int argc, char** argv) { | 264 int main(int argc, char** argv) { |
| 302 return tool_main(argc, argv); | 265 return tool_main(argc, argv); |
| 303 } | 266 } |
| 304 #endif | 267 #endif |
| OLD | NEW |