OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 * | 6 * |
7 */ | 7 */ |
8 | 8 |
9 #include <VisualBench/VisualBenchmarkStream.h> | 9 #include <VisualBench/VisualBenchmarkStream.h> |
10 #include <VisualBench/WrappedBenchmark.h> | 10 #include <VisualBench/WrappedBenchmark.h> |
11 #include "GMBench.h" | 11 #include "GMBench.h" |
12 #include "SkOSFile.h" | 12 #include "SkOSFile.h" |
13 #include "SkPath.h" | 13 #include "SkPath.h" |
14 #include "SkPictureRecorder.h" | 14 #include "SkPictureRecorder.h" |
15 #include "SkStream.h" | 15 #include "SkStream.h" |
16 #include "sk_tool_utils.h" | 16 #include "sk_tool_utils.h" |
17 #include "VisualFlags.h" | 17 #include "VisualFlags.h" |
18 #include "VisualSKPBench.h" | 18 #include "VisualSKPBench.h" |
19 | 19 |
20 #if SK_SUPPORT_GPU | 20 #if SK_SUPPORT_GPU |
21 #include "GrContext.h" | 21 #include "GrContext.h" |
22 #endif | 22 #endif |
23 | 23 |
24 DEFINE_bool(cpu, false, "Run in CPU mode?"); | |
25 DEFINE_string2(match, m, nullptr, | 24 DEFINE_string2(match, m, nullptr, |
26 "[~][^]substring[$] [...] of bench name to run.\n" | 25 "[~][^]substring[$] [...] of bench name to run.\n" |
27 "Multiple matches may be separated by spaces.\n" | 26 "Multiple matches may be separated by spaces.\n" |
28 "~ causes a matching bench to always be skipped\n" | 27 "~ causes a matching bench to always be skipped\n" |
29 "^ requires the start of the bench to match\n" | 28 "^ requires the start of the bench to match\n" |
30 "$ requires the end of the bench to match\n" | 29 "$ requires the end of the bench to match\n" |
31 "^ and $ requires an exact match\n" | 30 "^ and $ requires an exact match\n" |
32 "If a bench does not match any list entry,\n" | 31 "If a bench does not match any list entry,\n" |
33 "it is skipped unless some list entry starts with ~"); | 32 "it is skipped unless some list entry starts with ~"); |
34 DEFINE_string(skps, "skps", "Directory to read skps from."); | 33 DEFINE_string(skps, "skps", "Directory to read skps from."); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 while ((bench = this->innerNext()) && | 129 while ((bench = this->innerNext()) && |
131 (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName
()) || | 130 (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName
()) || |
132 !bench->isSuitableFor(Benchmark::kGPU_Backend))) { | 131 !bench->isSuitableFor(Benchmark::kGPU_Backend))) { |
133 bench->unref(); | 132 bench->unref(); |
134 } | 133 } |
135 } | 134 } |
136 | 135 |
137 // TODO move this all to --config | 136 // TODO move this all to --config |
138 if (bench && FLAGS_cpu) { | 137 if (bench && FLAGS_cpu) { |
139 bench = new CpuWrappedBenchmark(fSurfaceProps, bench); | 138 bench = new CpuWrappedBenchmark(fSurfaceProps, bench); |
140 } else if (bench && 0 != FLAGS_nvpr) { | 139 } else if (bench && FLAGS_offscreen) { |
141 bench = new NvprWrappedBenchmark(fSurfaceProps, bench, FLAGS_nvpr); | 140 bench = new GpuWrappedBenchmark(fSurfaceProps, bench, FLAGS_msaa); |
142 } | 141 } |
143 | 142 |
144 fBenchmark.reset(bench); | 143 fBenchmark.reset(bench); |
145 return fBenchmark; | 144 return fBenchmark; |
146 } | 145 } |
147 | 146 |
148 Benchmark* VisualBenchmarkStream::innerNext() { | 147 Benchmark* VisualBenchmarkStream::innerNext() { |
149 while (fBenches) { | 148 while (fBenches) { |
150 Benchmark* bench = fBenches->factory()(nullptr); | 149 Benchmark* bench = fBenches->factory()(nullptr); |
151 fBenches = fBenches->next(); | 150 fBenches = fBenches->next(); |
(...skipping 24 matching lines...) Expand all Loading... |
176 } | 175 } |
177 | 176 |
178 SkString name = SkOSPath::Basename(path.c_str()); | 177 SkString name = SkOSPath::Basename(path.c_str()); |
179 fSourceType = "skp"; | 178 fSourceType = "skp"; |
180 fBenchType = "playback"; | 179 fBenchType = "playback"; |
181 return new VisualSKPBench(name.c_str(), pic.get()); | 180 return new VisualSKPBench(name.c_str(), pic.get()); |
182 } | 181 } |
183 | 182 |
184 return nullptr; | 183 return nullptr; |
185 } | 184 } |
OLD | NEW |