OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #include <ctype.h> | 8 #include <ctype.h> |
9 | 9 |
10 #include "nanobench.h" | 10 #include "nanobench.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "SubsetSingleBench.h" | 24 #include "SubsetSingleBench.h" |
25 #include "SubsetTranslateBench.h" | 25 #include "SubsetTranslateBench.h" |
26 #include "SubsetZoomBench.h" | 26 #include "SubsetZoomBench.h" |
27 #include "Stats.h" | 27 #include "Stats.h" |
28 | 28 |
29 #include "SkBitmapRegionDecoder.h" | 29 #include "SkBitmapRegionDecoder.h" |
30 #include "SkBBoxHierarchy.h" | 30 #include "SkBBoxHierarchy.h" |
31 #include "SkCanvas.h" | 31 #include "SkCanvas.h" |
32 #include "SkCodec.h" | 32 #include "SkCodec.h" |
33 #include "SkCommonFlags.h" | 33 #include "SkCommonFlags.h" |
| 34 #include "SkCommonFlagsConfig.h" |
34 #include "SkData.h" | 35 #include "SkData.h" |
35 #include "SkForceLinking.h" | 36 #include "SkForceLinking.h" |
36 #include "SkGraphics.h" | 37 #include "SkGraphics.h" |
37 #include "SkOSFile.h" | 38 #include "SkOSFile.h" |
38 #include "SkPictureRecorder.h" | 39 #include "SkPictureRecorder.h" |
39 #include "SkPictureUtils.h" | 40 #include "SkPictureUtils.h" |
40 #include "SkString.h" | 41 #include "SkString.h" |
41 #include "SkSurface.h" | 42 #include "SkSurface.h" |
42 #include "SkTaskGroup.h" | 43 #include "SkTaskGroup.h" |
43 | 44 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // Frame lag is unknown. | 164 // Frame lag is unknown. |
164 *maxFrameLag = FLAGS_gpuFrameLag; | 165 *maxFrameLag = FLAGS_gpuFrameLag; |
165 } | 166 } |
166 return true; | 167 return true; |
167 } | 168 } |
168 bool init(SkImageInfo info, Benchmark* bench) override { | 169 bool init(SkImageInfo info, Benchmark* bench) override { |
169 uint32_t flags = this->config.useDFText ? SkSurfaceProps::kUseDeviceInde
pendentFonts_Flag : | 170 uint32_t flags = this->config.useDFText ? SkSurfaceProps::kUseDeviceInde
pendentFonts_Flag : |
170 0; | 171 0; |
171 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); | 172 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); |
172 this->surface.reset(SkSurface::NewRenderTarget(gGrFactory->get(this->con
fig.ctxType, | 173 this->surface.reset(SkSurface::NewRenderTarget(gGrFactory->get(this->con
fig.ctxType, |
173 kNone_GrG
LStandard, | |
174 this->con
fig.ctxOptions), | 174 this->con
fig.ctxOptions), |
175 SkSurface::kNo_Budgeted
, info, | 175 SkSurface::kNo_Budgeted
, info, |
176 this->config.samples, &
props)); | 176 this->config.samples, &
props)); |
177 this->gl = gGrFactory->getContextInfo(this->config.ctxType, kNone_GrGLSt
andard, | 177 this->gl = gGrFactory->getContextInfo(this->config.ctxType, |
178 this->config.ctxOptions)->fGLConte
xt; | 178 this->config.ctxOptions)->fGLConte
xt; |
179 if (!this->surface.get()) { | 179 if (!this->surface.get()) { |
180 return false; | 180 return false; |
181 } | 181 } |
182 if (!this->gl->fenceSyncSupport()) { | 182 if (!this->gl->fenceSyncSupport()) { |
183 SkDebugf("WARNING: GL context for config \"%s\" does not support fen
ce sync. " | 183 SkDebugf("WARNING: GL context for config \"%s\" does not support fen
ce sync. " |
184 "Timings might not be accurate.\n", this->config.name); | 184 "Timings might not be accurate.\n", this->config.name); |
185 } | 185 } |
186 return true; | 186 return true; |
187 } | 187 } |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 return false; | 385 return false; |
386 } | 386 } |
387 | 387 |
388 #if SK_SUPPORT_GPU | 388 #if SK_SUPPORT_GPU |
389 static bool is_gpu_config_allowed(const char* name, GrContextFactory::GLContextT
ype ctxType, | 389 static bool is_gpu_config_allowed(const char* name, GrContextFactory::GLContextT
ype ctxType, |
390 GrContextFactory::GLContextOptions ctxOptions, | 390 GrContextFactory::GLContextOptions ctxOptions, |
391 int sampleCnt) { | 391 int sampleCnt) { |
392 if (!is_cpu_config_allowed(name)) { | 392 if (!is_cpu_config_allowed(name)) { |
393 return false; | 393 return false; |
394 } | 394 } |
395 if (const GrContext* ctx = gGrFactory->get(ctxType, kNone_GrGLStandard, ctxO
ptions)) { | 395 if (const GrContext* ctx = gGrFactory->get(ctxType, ctxOptions)) { |
396 return sampleCnt <= ctx->caps()->maxSampleCount(); | 396 return sampleCnt <= ctx->caps()->maxSampleCount(); |
397 } | 397 } |
398 return false; | 398 return false; |
399 } | 399 } |
400 #endif | 400 #endif |
401 | 401 |
402 #if SK_SUPPORT_GPU | 402 #if SK_SUPPORT_GPU |
403 #define kBogusGLContextType GrContextFactory::kNative_GLContextType | 403 #define kBogusGLContextType GrContextFactory::kNative_GLContextType |
404 #define kBogusGLContextOptions GrContextFactory::kNone_GLContextOptions | 404 #define kBogusGLContextOptions GrContextFactory::kNone_GLContextOptions |
405 #else | 405 #else |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 , stddev_percent | 1247 , stddev_percent |
1248 , FLAGS_ms ? to_string(samples.count()).c_str() : stats.
plot.c_str() | 1248 , FLAGS_ms ? to_string(samples.count()).c_str() : stats.
plot.c_str() |
1249 , config | 1249 , config |
1250 , bench->getUniqueName() | 1250 , bench->getUniqueName() |
1251 ); | 1251 ); |
1252 } | 1252 } |
1253 #if SK_SUPPORT_GPU | 1253 #if SK_SUPPORT_GPU |
1254 if (FLAGS_gpuStats && | 1254 if (FLAGS_gpuStats && |
1255 Benchmark::kGPU_Backend == configs[i].backend) { | 1255 Benchmark::kGPU_Backend == configs[i].backend) { |
1256 GrContext* context = gGrFactory->get(configs[i].ctxType, | 1256 GrContext* context = gGrFactory->get(configs[i].ctxType, |
1257 kNone_GrGLStandard, configs
[i].ctxOptions); | 1257 configs[i].ctxOptions); |
1258 context->printCacheStats(); | 1258 context->printCacheStats(); |
1259 context->printGpuStats(); | 1259 context->printGpuStats(); |
1260 } | 1260 } |
1261 #endif | 1261 #endif |
1262 if (FLAGS_verbose) { | 1262 if (FLAGS_verbose) { |
1263 SkDebugf("Samples: "); | 1263 SkDebugf("Samples: "); |
1264 for (int i = 0; i < samples.count(); i++) { | 1264 for (int i = 0; i < samples.count(); i++) { |
1265 SkDebugf("%s ", HUMANIZE(samples[i])); | 1265 SkDebugf("%s ", HUMANIZE(samples[i])); |
1266 } | 1266 } |
1267 SkDebugf("%s\n", bench->getUniqueName()); | 1267 SkDebugf("%s\n", bench->getUniqueName()); |
(...skipping 14 matching lines...) Expand all Loading... |
1282 | 1282 |
1283 return 0; | 1283 return 0; |
1284 } | 1284 } |
1285 | 1285 |
1286 #if !defined SK_BUILD_FOR_IOS | 1286 #if !defined SK_BUILD_FOR_IOS |
1287 int main(int argc, char** argv) { | 1287 int main(int argc, char** argv) { |
1288 SkCommandLineFlags::Parse(argc, argv); | 1288 SkCommandLineFlags::Parse(argc, argv); |
1289 return nanobench_main(); | 1289 return nanobench_main(); |
1290 } | 1290 } |
1291 #endif | 1291 #endif |
OLD | NEW |