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 "SkBenchmark.h" | 4 #include "SkBenchmark.h" |
5 #include "SkCommandLineFlags.h" | 5 #include "SkCommandLineFlags.h" |
6 #include "SkForceLinking.h" | 6 #include "SkForceLinking.h" |
7 #include "SkGraphics.h" | 7 #include "SkGraphics.h" |
8 #include "SkPicture.h" | 8 #include "SkPicture.h" |
9 #include "SkString.h" | 9 #include "SkString.h" |
10 #include "Test.h" | 10 #include "Test.h" |
11 #include "gm.h" | 11 #include "gm.h" |
12 | 12 |
13 #include "DMBenchTask.h" | 13 #include "DMBenchTask.h" |
14 #include "DMCpuGMTask.h" | 14 #include "DMCpuGMTask.h" |
15 #include "DMGpuGMTask.h" | 15 #include "DMGpuGMTask.h" |
16 #include "DMGpuSupport.h" | 16 #include "DMGpuSupport.h" |
| 17 #include "DMPDFTask.h" |
17 #include "DMReporter.h" | 18 #include "DMReporter.h" |
18 #include "DMSKPTask.h" | 19 #include "DMSKPTask.h" |
19 #include "DMTask.h" | 20 #include "DMTask.h" |
20 #include "DMTaskRunner.h" | 21 #include "DMTaskRunner.h" |
21 #include "DMTestTask.h" | 22 #include "DMTestTask.h" |
22 #include "DMWriteTask.h" | 23 #include "DMWriteTask.h" |
23 | 24 |
| 25 #ifdef SK_BUILD_POPPLER |
| 26 # include "SkPDFRasterizer.h" |
| 27 # define RASTERIZE_PDF_PROC SkPopplerRasterizePDF |
| 28 #else |
| 29 # define RASTERIZE_PDF_PROC NULL |
| 30 #endif |
| 31 |
24 #include <ctype.h> | 32 #include <ctype.h> |
25 | 33 |
26 using skiagm::GM; | 34 using skiagm::GM; |
27 using skiagm::GMRegistry; | 35 using skiagm::GMRegistry; |
28 using skiatest::Test; | 36 using skiatest::Test; |
29 using skiatest::TestRegistry; | 37 using skiatest::TestRegistry; |
30 | 38 |
31 DEFINE_int32(threads, -1, "Threads for CPU work. Default NUM_CPUS."); | 39 DEFINE_int32(threads, -1, "Threads for CPU work. Default NUM_CPUS."); |
32 DEFINE_int32(gpuThreads, 1, "Threads for GPU work."); | 40 DEFINE_int32(gpuThreads, 1, "Threads for GPU work."); |
33 #ifdef SK_BUILD_JSON_WRITER | 41 #ifdef SK_BUILD_JSON_WRITER |
34 DEFINE_string2(expectations, r, "", | 42 DEFINE_string2(expectations, r, "", |
35 "If a directory, compare generated images against images under th
is path. " | 43 "If a directory, compare generated images against images under th
is path. " |
36 "If a file, compare generated images against JSON expectations at
this path." | 44 "If a file, compare generated images against JSON expectations at
this path." |
37 ); | 45 ); |
38 #else | 46 #else |
39 DEFINE_string2(expectations, r, "", | 47 DEFINE_string2(expectations, r, "", |
40 "If a directory, compare generated images against images under th
is path. " | 48 "If a directory, compare generated images against images under th
is path. " |
41 ); | 49 ); |
42 #endif | 50 #endif |
43 DEFINE_string2(resources, i, "resources", "Path to resources directory."); | 51 DEFINE_string2(resources, i, "resources", "Path to resources directory."); |
44 DEFINE_string(match, "", "[~][^]substring[$] [...] of GM name to run.\n" | 52 DEFINE_string(match, "", "[~][^]substring[$] [...] of GM name to run.\n" |
45 "Multiple matches may be separated by spaces.\n" | 53 "Multiple matches may be separated by spaces.\n" |
46 "~ causes a matching GM to always be skipped\n" | 54 "~ causes a matching GM to always be skipped\n" |
47 "^ requires the start of the GM to match\n" | 55 "^ requires the start of the GM to match\n" |
48 "$ requires the end of the GM to match\n" | 56 "$ requires the end of the GM to match\n" |
49 "^ and $ requires an exact match\n" | 57 "^ and $ requires an exact match\n" |
50 "If a GM does not match any list entry,\n" | 58 "If a GM does not match any list entry,\n" |
51 "it is skipped unless some list entry starts with ~"); | 59 "it is skipped unless some list entry starts with ~"); |
52 DEFINE_string(config, "565 8888 gpu nonrendering", | 60 DEFINE_string(config, "565 8888 pdf gpu nonrendering", |
53 "Options: 565 8888 gpu nonrendering msaa4 msaa16 nvprmsaa4 nvprmsa
a16 gpunull gpudebug angle mesa"); | 61 "Options: 565 8888 pdf gpu nonrendering msaa4 msaa16 nvprmsaa4 nvp
rmsaa16 " |
54 DEFINE_bool(dryRun, false, "Just print the tests that would be run, without actu
ally running them."); | 62 "gpunull gpudebug angle mesa"); |
| 63 DEFINE_bool(dryRun, false, |
| 64 "Just print the tests that would be run, without actually running th
em."); |
55 DEFINE_bool(leaks, false, "Print leaked instance-counted objects at exit?"); | 65 DEFINE_bool(leaks, false, "Print leaked instance-counted objects at exit?"); |
56 DEFINE_string(skps, "", "Directory to read skps from."); | 66 DEFINE_string(skps, "", "Directory to read skps from."); |
57 | 67 |
58 DEFINE_bool(gms, true, "Run GMs?"); | 68 DEFINE_bool(gms, true, "Run GMs?"); |
59 DEFINE_bool(benches, true, "Run benches? Does not run GMs-as-benches."); | 69 DEFINE_bool(benches, true, "Run benches? Does not run GMs-as-benches."); |
60 DEFINE_bool(tests, true, "Run tests?"); | 70 DEFINE_bool(tests, true, "Run tests?"); |
61 | 71 |
62 DECLARE_bool(verbose); | 72 DECLARE_bool(verbose); |
63 | 73 |
64 __SK_FORCE_IMAGE_DECODER_LINKING; | 74 __SK_FORCE_IMAGE_DECODER_LINKING; |
(...skipping 28 matching lines...) Expand all Loading... |
93 const DM::Expectations& expectations, | 103 const DM::Expectations& expectations, |
94 DM::Reporter* reporter, | 104 DM::Reporter* reporter, |
95 DM::TaskRunner* tasks) { | 105 DM::TaskRunner* tasks) { |
96 #define START(name, type, ...)
\ | 106 #define START(name, type, ...)
\ |
97 if (lowercase(configs[j]).equals(name)) {
\ | 107 if (lowercase(configs[j]).equals(name)) {
\ |
98 tasks->add(SkNEW_ARGS(DM::type,
\ | 108 tasks->add(SkNEW_ARGS(DM::type,
\ |
99 (name, reporter, tasks, expectations, gms[i], ## __VA_ARGS__
))); \ | 109 (name, reporter, tasks, expectations, gms[i], ## __VA_ARGS__
))); \ |
100 } | 110 } |
101 for (int i = 0; i < gms.count(); i++) { | 111 for (int i = 0; i < gms.count(); i++) { |
102 for (int j = 0; j < configs.count(); j++) { | 112 for (int j = 0; j < configs.count(); j++) { |
103 START("565", CpuGMTask, kRGB_565_SkColorType); | 113 START("565", CpuGMTask, kRGB_565_SkColorType); |
104 START("8888", CpuGMTask, kN32_SkColorType); | 114 START("8888", CpuGMTask, kN32_SkColorType); |
105 START("gpu", GpuGMTask, native, 0); | 115 START("gpu", GpuGMTask, native, 0); |
106 START("msaa4", GpuGMTask, native, 4); | 116 START("msaa4", GpuGMTask, native, 4); |
107 START("msaa16", GpuGMTask, native, 16); | 117 START("msaa16", GpuGMTask, native, 16); |
108 START("nvprmsaa4", GpuGMTask, nvpr, 4); | 118 START("nvprmsaa4", GpuGMTask, nvpr, 4); |
109 START("nvprmsaa16", GpuGMTask, nvpr, 16); | 119 START("nvprmsaa16", GpuGMTask, nvpr, 16); |
110 START("gpunull", GpuGMTask, null, 0); | 120 START("gpunull", GpuGMTask, null, 0); |
111 START("gpudebug", GpuGMTask, debug, 0); | 121 START("gpudebug", GpuGMTask, debug, 0); |
112 START("angle", GpuGMTask, angle, 0); | 122 START("angle", GpuGMTask, angle, 0); |
113 START("mesa", GpuGMTask, mesa, 0); | 123 START("mesa", GpuGMTask, mesa, 0); |
| 124 START("pdf", PDFTask, RASTERIZE_PDF_PROC); |
114 } | 125 } |
115 } | 126 } |
116 #undef START | 127 #undef START |
117 } | 128 } |
118 | 129 |
119 static void kick_off_benches(const SkTDArray<BenchRegistry::Factory>& benches, | 130 static void kick_off_benches(const SkTDArray<BenchRegistry::Factory>& benches, |
120 const SkTArray<SkString>& configs, | 131 const SkTArray<SkString>& configs, |
121 DM::Reporter* reporter, | 132 DM::Reporter* reporter, |
122 DM::TaskRunner* tasks) { | 133 DM::TaskRunner* tasks) { |
123 #define START(name, type, ...)
\ | 134 #define START(name, type, ...)
\ |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 reporter.getFailures(&failures); | 281 reporter.getFailures(&failures); |
271 report_failures(failures); | 282 report_failures(failures); |
272 return failures.count() > 0; | 283 return failures.count() > 0; |
273 } | 284 } |
274 | 285 |
275 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 286 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
276 int main(int argc, char** argv) { | 287 int main(int argc, char** argv) { |
277 return tool_main(argc, argv); | 288 return tool_main(argc, argv); |
278 } | 289 } |
279 #endif | 290 #endif |
OLD | NEW |