Chromium Code Reviews| 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" | 4 #include "Benchmark.h" |
| 5 #include "CrashHandler.h" | 5 #include "CrashHandler.h" |
| 6 #include "SkCommandLineFlags.h" | 6 #include "SkCommonFlags.h" |
| 7 #include "SkForceLinking.h" | 7 #include "SkForceLinking.h" |
| 8 #include "SkGraphics.h" | 8 #include "SkGraphics.h" |
| 9 #include "SkPicture.h" | 9 #include "SkPicture.h" |
| 10 #include "SkString.h" | 10 #include "SkString.h" |
| 11 #include "Test.h" | 11 #include "Test.h" |
| 12 #include "gm.h" | 12 #include "gm.h" |
| 13 | 13 |
| 14 #include "DMBenchTask.h" | 14 #include "DMBenchTask.h" |
| 15 #include "DMCpuGMTask.h" | 15 #include "DMCpuGMTask.h" |
| 16 #include "DMGpuGMTask.h" | 16 #include "DMGpuGMTask.h" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 33 #include <ctype.h> | 33 #include <ctype.h> |
| 34 | 34 |
| 35 using skiagm::GM; | 35 using skiagm::GM; |
| 36 using skiagm::GMRegistry; | 36 using skiagm::GMRegistry; |
| 37 using skiatest::Test; | 37 using skiatest::Test; |
| 38 using skiatest::TestRegistry; | 38 using skiatest::TestRegistry; |
| 39 | 39 |
| 40 static const char kGpuAPINameGL[] = "gl"; | 40 static const char kGpuAPINameGL[] = "gl"; |
| 41 static const char kGpuAPINameGLES[] = "gles"; | 41 static const char kGpuAPINameGLES[] = "gles"; |
| 42 | 42 |
| 43 DEFINE_int32(threads, -1, "Threads for CPU work. Default NUM_CPUS."); | |
| 44 DEFINE_int32(gpuThreads, 1, "Threads for GPU work."); | 43 DEFINE_int32(gpuThreads, 1, "Threads for GPU work."); |
| 45 DEFINE_string(gpuAPI, "", "Force use of specific gpu API. Using \"gl\" " | 44 DEFINE_string(gpuAPI, "", "Force use of specific gpu API. Using \"gl\" " |
| 46 "forces OpenGL API. Using \"gles\" forces OpenGL ES API. " | 45 "forces OpenGL API. Using \"gles\" forces OpenGL ES API. " |
| 47 "Defaults to empty string, which selects the API native to the " | 46 "Defaults to empty string, which selects the API native to the " |
| 48 "system."); | 47 "system."); |
| 49 DEFINE_string2(expectations, r, "", | 48 DEFINE_string2(expectations, r, "", |
| 50 "If a directory, compare generated images against images under th is path. " | 49 "If a directory, compare generated images against images under th is path. " |
| 51 "If a file, compare generated images against JSON expectations at this path." | 50 "If a file, compare generated images against JSON expectations at this path." |
| 52 ); | 51 ); |
| 53 DEFINE_string2(resources, i, "resources", "Path to resources directory."); | 52 |
| 54 DEFINE_string(match, "", "[~][^]substring[$] [...] of GM name to run.\n" | |
| 55 "Multiple matches may be separated by spaces.\n" | |
| 56 "~ causes a matching GM to always be skipped\n" | |
| 57 "^ requires the start of the GM to match\n" | |
| 58 "$ requires the end of the GM to match\n" | |
| 59 "^ and $ requires an exact match\n" | |
| 60 "If a GM does not match any list entry,\n" | |
| 61 "it is skipped unless some list entry starts with ~"); | |
| 62 DEFINE_string(config, "565 8888 pdf gpu nonrendering", | 53 DEFINE_string(config, "565 8888 pdf gpu nonrendering", |
| 63 "Options: 565 8888 pdf gpu nonrendering msaa4 msaa16 nvprmsaa4 nvp rmsaa16 " | 54 "Options: 565 8888 pdf gpu nonrendering msaa4 msaa16 nvprmsaa4 nvp rmsaa16 " |
| 64 "gpunull gpudebug angle mesa"); | 55 "gpunull gpudebug angle mesa"); |
| 65 DEFINE_bool(dryRun, false, | |
| 66 "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?"); | |
| 68 DEFINE_string(skps, "", "Directory to read skps from."); | 56 DEFINE_string(skps, "", "Directory to read skps from."); |
| 69 | 57 |
| 70 DEFINE_bool(gms, true, "Run GMs?"); | 58 DEFINE_bool(gms, true, "Run GMs?"); |
| 71 DEFINE_bool(benches, true, "Run benches? Does not run GMs-as-benches."); | 59 DEFINE_bool(benches, true, "Run benches? Does not run GMs-as-benches."); |
| 72 DEFINE_bool(tests, true, "Run tests?"); | 60 DEFINE_bool(tests, true, "Run tests?"); |
| 73 | 61 |
| 74 DECLARE_bool(verbose); | |
| 75 | |
| 76 __SK_FORCE_IMAGE_DECODER_LINKING; | 62 __SK_FORCE_IMAGE_DECODER_LINKING; |
| 77 | 63 |
| 78 // "FooBar" -> "foobar". Obviously, ASCII only. | 64 // "FooBar" -> "foobar". Obviously, ASCII only. |
| 79 static SkString lowercase(SkString s) { | 65 static SkString lowercase(SkString s) { |
| 80 for (size_t i = 0; i < s.size(); i++) { | 66 for (size_t i = 0; i < s.size(); i++) { |
| 81 s[i] = tolower(s[i]); | 67 s[i] = tolower(s[i]); |
| 82 } | 68 } |
| 83 return s; | 69 return s; |
| 84 } | 70 } |
| 85 | 71 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 227 template <typename T, typename Registry> | 213 template <typename T, typename Registry> |
| 228 static void append_matching_factories(Registry* head, SkTDArray<typename Registr y::Factory>* out) { | 214 static void append_matching_factories(Registry* head, SkTDArray<typename Registr y::Factory>* out) { |
| 229 for (const Registry* reg = head; reg != NULL; reg = reg->next()) { | 215 for (const Registry* reg = head; reg != NULL; reg = reg->next()) { |
| 230 SkAutoTDelete<T> forName(reg->factory()(NULL)); | 216 SkAutoTDelete<T> forName(reg->factory()(NULL)); |
| 231 if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, forName->getName())) { | 217 if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, forName->getName())) { |
| 232 *out->append() = reg->factory(); | 218 *out->append() = reg->factory(); |
| 233 } | 219 } |
| 234 } | 220 } |
| 235 } | 221 } |
| 236 | 222 |
| 237 int tool_main(int argc, char** argv); | 223 int dm_main(int argc, char** argv); |
| 238 int tool_main(int argc, char** argv) { | 224 int dm_main(int argc, char** argv) { |
|
scroggo
2014/07/14 13:24:16
argc and argv are no longer used.
caryclark
2014/07/14 15:07:12
Done.
| |
| 239 SetupCrashHandler(); | 225 SetupCrashHandler(); |
| 240 SkAutoGraphics ag; | 226 SkAutoGraphics ag; |
| 241 SkCommandLineFlags::Parse(argc, argv); | |
| 242 | 227 |
| 243 if (FLAGS_dryRun) { | 228 if (FLAGS_dryRun) { |
| 244 FLAGS_verbose = true; | 229 FLAGS_verbose = true; |
| 245 } | 230 } |
| 246 #if SK_ENABLE_INST_COUNT | 231 #if SK_ENABLE_INST_COUNT |
| 247 gPrintInstCount = FLAGS_leaks; | 232 gPrintInstCount = FLAGS_leaks; |
| 248 #endif | 233 #endif |
| 249 | 234 |
| 250 SkTArray<SkString> configs; | 235 SkTArray<SkString> configs; |
| 251 for (int i = 0; i < FLAGS_config.count(); i++) { | 236 for (int i = 0; i < FLAGS_config.count(); i++) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 SkDebugf("\n"); | 277 SkDebugf("\n"); |
| 293 | 278 |
| 294 SkTArray<SkString> failures; | 279 SkTArray<SkString> failures; |
| 295 reporter.getFailures(&failures); | 280 reporter.getFailures(&failures); |
| 296 report_failures(failures); | 281 report_failures(failures); |
| 297 return failures.count() > 0; | 282 return failures.count() > 0; |
| 298 } | 283 } |
| 299 | 284 |
| 300 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 285 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 301 int main(int argc, char** argv) { | 286 int main(int argc, char** argv) { |
| 302 return tool_main(argc, argv); | 287 SkCommandLineFlags::Parse(argc, argv); |
| 288 return dm_main(argc, argv); | |
| 303 } | 289 } |
| 304 #endif | 290 #endif |
| OLD | NEW |