| 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 "SkCommandLineFlags.h" | 6 #include "SkCommandLineFlags.h" |
| 7 #include "SkForceLinking.h" | 7 #include "SkForceLinking.h" |
| 8 #include "SkGraphics.h" | 8 #include "SkGraphics.h" |
| 9 #include "gm.h" | 9 #include "gm.h" |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 native; | 77 native; |
| 78 #endif | 78 #endif |
| 79 const GrContextFactory::GLContextType mesa = | 79 const GrContextFactory::GLContextType mesa = |
| 80 #if SK_MESA | 80 #if SK_MESA |
| 81 GLContextFactory::kMESA_GLContextType; | 81 GLContextFactory::kMESA_GLContextType; |
| 82 #else | 82 #else |
| 83 native; | 83 native; |
| 84 #endif | 84 #endif |
| 85 | 85 |
| 86 for (int i = 0; i < gms.count(); i++) { | 86 for (int i = 0; i < gms.count(); i++) { |
| 87 SkAutoTDelete<GM> gmForName(gms[i](NULL)); | |
| 88 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, gmForName->shortName()))
continue; | |
| 89 | |
| 90 #define START(name, type, ...)
\ | 87 #define START(name, type, ...)
\ |
| 91 if (lowercase(configs[j]).equals(name)) {
\ | 88 if (lowercase(configs[j]).equals(name)) {
\ |
| 92 tasks->add(SkNEW_ARGS(DM::type,
\ | 89 tasks->add(SkNEW_ARGS(DM::type,
\ |
| 93 (name, reporter, tasks, expectations, gms[i], __VA_ARGS__)))
; \ | 90 (name, reporter, tasks, expectations, gms[i], __VA_ARGS__)))
; \ |
| 94 } | 91 } |
| 95 for (int j = 0; j < configs.count(); j++) { | 92 for (int j = 0; j < configs.count(); j++) { |
| 96 START("565", CpuTask, _565); | 93 START("565", CpuTask, _565); |
| 97 START("8888", CpuTask, _8888); | 94 START("8888", CpuTask, _8888); |
| 98 START("gpu", GpuTask, _8888, native, 0); | 95 START("gpu", GpuTask, _8888, native, 0); |
| 99 START("msaa4", GpuTask, _8888, native, 4); | 96 START("msaa4", GpuTask, _8888, native, 4); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 132 |
| 136 SkCommandLineFlags::Parse(argc, argv); | 133 SkCommandLineFlags::Parse(argc, argv); |
| 137 GM::SetResourcePath(FLAGS_resources[0]); | 134 GM::SetResourcePath(FLAGS_resources[0]); |
| 138 SkTArray<SkString> configs; | 135 SkTArray<SkString> configs; |
| 139 for (int i = 0; i < FLAGS_config.count(); i++) { | 136 for (int i = 0; i < FLAGS_config.count(); i++) { |
| 140 split(FLAGS_config[i], ", ", &configs); | 137 split(FLAGS_config[i], ", ", &configs); |
| 141 } | 138 } |
| 142 | 139 |
| 143 SkTDArray<GMRegistry::Factory> gms; | 140 SkTDArray<GMRegistry::Factory> gms; |
| 144 for (const GMRegistry* reg = GMRegistry::Head(); reg != NULL; reg = reg->nex
t()) { | 141 for (const GMRegistry* reg = GMRegistry::Head(); reg != NULL; reg = reg->nex
t()) { |
| 145 *gms.append() = reg->factory(); | 142 SkAutoTDelete<GM> gmForName(reg->factory()(NULL)); |
| 143 if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, gmForName->shortName())
) { |
| 144 *gms.append() = reg->factory(); |
| 145 } |
| 146 } | 146 } |
| 147 SkDebugf("%d GMs x %d configs\n", gms.count(), configs.count()); | 147 SkDebugf("%d GMs x %d configs\n", gms.count(), configs.count()); |
| 148 | 148 |
| 149 SkAutoTUnref<ExpectationsSource> expectations(SkNEW(NoExpectations)); | 149 SkAutoTUnref<ExpectationsSource> expectations(SkNEW(NoExpectations)); |
| 150 if (FLAGS_expectations.count() > 0) { | 150 if (FLAGS_expectations.count() > 0) { |
| 151 expectations.reset(SkNEW_ARGS(JsonExpectationsSource, (FLAGS_expectation
s[0]))); | 151 expectations.reset(SkNEW_ARGS(JsonExpectationsSource, (FLAGS_expectation
s[0]))); |
| 152 } | 152 } |
| 153 | 153 |
| 154 DM::Reporter reporter; | 154 DM::Reporter reporter; |
| 155 DM::TaskRunner tasks(FLAGS_cpuThreads, FLAGS_gpuThreads); | 155 DM::TaskRunner tasks(FLAGS_cpuThreads, FLAGS_gpuThreads); |
| 156 kick_off_tasks(gms, configs, *expectations, &reporter, &tasks); | 156 kick_off_tasks(gms, configs, *expectations, &reporter, &tasks); |
| 157 tasks.wait(); | 157 tasks.wait(); |
| 158 | 158 |
| 159 reporter.updateStatusLine(); | 159 reporter.updateStatusLine(); |
| 160 SkDebugf("\n"); | 160 SkDebugf("\n"); |
| 161 report_failures(reporter); | 161 report_failures(reporter); |
| 162 | 162 |
| 163 SkGraphics::Term(); | 163 SkGraphics::Term(); |
| 164 | 164 |
| 165 return reporter.failed() > 0; | 165 return reporter.failed() > 0; |
| 166 } | 166 } |
| 167 | 167 |
| 168 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 168 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 169 int main(int argc, char** argv) { | 169 int main(int argc, char** argv) { |
| 170 return tool_main(argc, argv); | 170 return tool_main(argc, argv); |
| 171 } | 171 } |
| 172 #endif | 172 #endif |
| OLD | NEW |