OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "BenchLogger.h" | 8 #include "BenchLogger.h" |
9 #include "Benchmark.h" | 9 #include "Benchmark.h" |
10 #include "CrashHandler.h" | 10 #include "CrashHandler.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 }; | 218 }; |
219 | 219 |
220 DEFINE_string(outDir, "", "If given, image of each bench will be put in outDir."
); | 220 DEFINE_string(outDir, "", "If given, image of each bench will be put in outDir."
); |
221 DEFINE_string(timers, "cg", "Timers to display. " | 221 DEFINE_string(timers, "cg", "Timers to display. " |
222 "Options: w(all) W(all, truncated) c(pu) C(pu, truncated) g(pu)"); | 222 "Options: w(all) W(all, truncated) c(pu) C(pu, truncated) g(pu)"); |
223 | 223 |
224 DEFINE_bool(rotate, false, "Rotate canvas before bench run?"); | 224 DEFINE_bool(rotate, false, "Rotate canvas before bench run?"); |
225 DEFINE_bool(scale, false, "Scale canvas before bench run?"); | 225 DEFINE_bool(scale, false, "Scale canvas before bench run?"); |
226 DEFINE_bool(clip, false, "Clip canvas before bench run?"); | 226 DEFINE_bool(clip, false, "Clip canvas before bench run?"); |
227 | 227 |
228 DEFINE_bool(forceAA, true, "Force anti-aliasing?"); | |
229 DEFINE_bool(forceFilter, false, "Force bitmap filtering?"); | |
230 DEFINE_string(forceDither, "default", "Force dithering: true, false, or default?
"); | 228 DEFINE_string(forceDither, "default", "Force dithering: true, false, or default?
"); |
231 DEFINE_bool(forceBlend, false, "Force alpha blending?"); | 229 DEFINE_bool(forceBlend, false, "Force alpha blending?"); |
232 | 230 |
233 DEFINE_string(gpuAPI, "", "Force use of specific gpu API. Using \"gl\" " | 231 DEFINE_string(gpuAPI, "", "Force use of specific gpu API. Using \"gl\" " |
234 "forces OpenGL API. Using \"gles\" forces OpenGL ES API. " | 232 "forces OpenGL API. Using \"gles\" forces OpenGL ES API. " |
235 "Defaults to empty string, which selects the API native to the " | 233 "Defaults to empty string, which selects the API native to the " |
236 "system."); | 234 "system."); |
237 DEFINE_int32(gpuCacheBytes, -1, "GPU cache size limit in bytes. 0 to disable ca
che."); | 235 DEFINE_int32(gpuCacheBytes, -1, "GPU cache size limit in bytes. 0 to disable ca
che."); |
238 DEFINE_int32(gpuCacheCount, -1, "GPU cache size limit in object count. 0 to dis
able cache."); | 236 DEFINE_int32(gpuCacheCount, -1, "GPU cache size limit in object count. 0 to dis
able cache."); |
239 | 237 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 } | 406 } |
409 #endif | 407 #endif |
410 | 408 |
411 // All flags should be parsed now. Report our settings. | 409 // All flags should be parsed now. Report our settings. |
412 if (FLAGS_runOnce) { | 410 if (FLAGS_runOnce) { |
413 logger.logError("bench was run with --runOnce, so we're going to hide th
e times." | 411 logger.logError("bench was run with --runOnce, so we're going to hide th
e times." |
414 " It's for your own good!\n"); | 412 " It's for your own good!\n"); |
415 } | 413 } |
416 writer.option("mode", FLAGS_mode[0]); | 414 writer.option("mode", FLAGS_mode[0]); |
417 writer.option("alpha", SkStringPrintf("0x%02X", alpha).c_str()); | 415 writer.option("alpha", SkStringPrintf("0x%02X", alpha).c_str()); |
418 writer.option("antialias", SkStringPrintf("%d", FLAGS_forceAA).c_str()); | |
419 writer.option("filter", SkStringPrintf("%d", FLAGS_forceFilter).c_str()); | |
420 writer.option("dither", SkTriState::Name[dither]); | 416 writer.option("dither", SkTriState::Name[dither]); |
421 | 417 |
422 writer.option("rotate", SkStringPrintf("%d", FLAGS_rotate).c_str()); | 418 writer.option("rotate", SkStringPrintf("%d", FLAGS_rotate).c_str()); |
423 writer.option("scale", SkStringPrintf("%d", FLAGS_scale).c_str()); | 419 writer.option("scale", SkStringPrintf("%d", FLAGS_scale).c_str()); |
424 writer.option("clip", SkStringPrintf("%d", FLAGS_clip).c_str()); | 420 writer.option("clip", SkStringPrintf("%d", FLAGS_clip).c_str()); |
425 | 421 |
426 #if defined(SK_BUILD_FOR_WIN32) | 422 #if defined(SK_BUILD_FOR_WIN32) |
427 writer.option("system", "WIN32"); | 423 writer.option("system", "WIN32"); |
428 #elif defined(SK_BUILD_FOR_MAC) | 424 #elif defined(SK_BUILD_FOR_MAC) |
429 writer.option("system", "MAC"); | 425 writer.option("system", "MAC"); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 // Run each bench in each configuration it supports and we asked for. | 465 // Run each bench in each configuration it supports and we asked for. |
470 Iter iter; | 466 Iter iter; |
471 Benchmark* bench; | 467 Benchmark* bench; |
472 while ((bench = iter.next()) != NULL) { | 468 while ((bench = iter.next()) != NULL) { |
473 SkAutoTUnref<Benchmark> benchUnref(bench); | 469 SkAutoTUnref<Benchmark> benchUnref(bench); |
474 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getName())) { | 470 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getName())) { |
475 continue; | 471 continue; |
476 } | 472 } |
477 | 473 |
478 bench->setForceAlpha(alpha); | 474 bench->setForceAlpha(alpha); |
479 bench->setForceAA(FLAGS_forceAA); | |
480 bench->setForceFilter(FLAGS_forceFilter); | |
481 bench->setDither(dither); | 475 bench->setDither(dither); |
482 bench->preDraw(); | 476 bench->preDraw(); |
483 | 477 |
484 bool loggedBenchName = false; | 478 bool loggedBenchName = false; |
485 for (int i = 0; i < configs.count(); ++i) { | 479 for (int i = 0; i < configs.count(); ++i) { |
486 const int configIndex = configs[i]; | 480 const int configIndex = configs[i]; |
487 const Config& config = gConfigs[configIndex]; | 481 const Config& config = gConfigs[configIndex]; |
488 | 482 |
489 if (!bench->isSuitableFor(config.backend)) { | 483 if (!bench->isSuitableFor(config.backend)) { |
490 continue; | 484 continue; |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 gContextFactory.destroyContexts(); | 707 gContextFactory.destroyContexts(); |
714 #endif | 708 #endif |
715 return 0; | 709 return 0; |
716 } | 710 } |
717 | 711 |
718 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 712 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
719 int main(int argc, char * const argv[]) { | 713 int main(int argc, char * const argv[]) { |
720 return tool_main(argc, (char**) argv); | 714 return tool_main(argc, (char**) argv); |
721 } | 715 } |
722 #endif | 716 #endif |
OLD | NEW |