Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: bench/benchmain.cpp

Issue 341433007: Revert of Support using OpenGL ES context on desktop (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | dm/DM.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 30 matching lines...) Expand all
41 kDeferredSilent_BenchMode, 41 kDeferredSilent_BenchMode,
42 kRecord_BenchMode, 42 kRecord_BenchMode,
43 kPictureRecord_BenchMode 43 kPictureRecord_BenchMode
44 }; 44 };
45 const char* BenchMode_Name[] = { 45 const char* BenchMode_Name[] = {
46 "normal", "deferred", "deferredSilent", "record", "picturerecord" 46 "normal", "deferred", "deferredSilent", "record", "picturerecord"
47 }; 47 };
48 48
49 static const char kDefaultsConfigStr[] = "defaults"; 49 static const char kDefaultsConfigStr[] = "defaults";
50 50
51 #if SK_SUPPORT_GPU
52 static const char kGpuAPINameGL[] = "gl";
53 static const char kGpuAPINameGLES[] = "gles";
54 #endif
55
56 /////////////////////////////////////////////////////////////////////////////// 51 ///////////////////////////////////////////////////////////////////////////////
57 52
58 class Iter { 53 class Iter {
59 public: 54 public:
60 Iter() : fBenches(BenchRegistry::Head()), fGMs(skiagm::GMRegistry::Head()) { } 55 Iter() : fBenches(BenchRegistry::Head()), fGMs(skiagm::GMRegistry::Head()) { }
61 56
62 Benchmark* next() { 57 Benchmark* next() {
63 if (fBenches) { 58 if (fBenches) {
64 BenchRegistry::Factory f = fBenches->factory(); 59 BenchRegistry::Factory f = fBenches->factory();
65 fBenches = fBenches->next(); 60 fBenches = fBenches->next();
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 218
224 DEFINE_bool(rotate, false, "Rotate canvas before bench run?"); 219 DEFINE_bool(rotate, false, "Rotate canvas before bench run?");
225 DEFINE_bool(scale, false, "Scale canvas before bench run?"); 220 DEFINE_bool(scale, false, "Scale canvas before bench run?");
226 DEFINE_bool(clip, false, "Clip canvas before bench run?"); 221 DEFINE_bool(clip, false, "Clip canvas before bench run?");
227 222
228 DEFINE_bool(forceAA, true, "Force anti-aliasing?"); 223 DEFINE_bool(forceAA, true, "Force anti-aliasing?");
229 DEFINE_bool(forceFilter, false, "Force bitmap filtering?"); 224 DEFINE_bool(forceFilter, false, "Force bitmap filtering?");
230 DEFINE_string(forceDither, "default", "Force dithering: true, false, or default? "); 225 DEFINE_string(forceDither, "default", "Force dithering: true, false, or default? ");
231 DEFINE_bool(forceBlend, false, "Force alpha blending?"); 226 DEFINE_bool(forceBlend, false, "Force alpha blending?");
232 227
233 DEFINE_string(gpuAPI, "", "Force use of specific gpu API. Using \"gl\" "
234 "forces OpenGL API. Using \"gles\" forces OpenGL ES API. "
235 "Defaults to empty string, which selects the API native to the "
236 "system.");
237 DEFINE_int32(gpuCacheBytes, -1, "GPU cache size limit in bytes. 0 to disable ca che."); 228 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."); 229 DEFINE_int32(gpuCacheCount, -1, "GPU cache size limit in object count. 0 to dis able cache.");
239 230
240 DEFINE_bool2(leaks, l, false, "show leaked ref cnt'd objects."); 231 DEFINE_bool2(leaks, l, false, "show leaked ref cnt'd objects.");
241 DEFINE_string(match, "", "[~][^]substring[$] [...] of test name to run.\n" 232 DEFINE_string(match, "", "[~][^]substring[$] [...] of test name to run.\n"
242 "Multiple matches may be separated by spaces.\n" 233 "Multiple matches may be separated by spaces.\n"
243 "~ causes a matching test to always be skipped\n" 234 "~ causes a matching test to always be skipped\n"
244 "^ requires the start of the test to match\n" 235 "^ requires the start of the test to match\n"
245 "$ requires the end of the test to match\n" 236 "$ requires the end of the test to match\n"
246 "^ and $ requires an exact match\n" 237 "^ and $ requires an exact match\n"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 for (int i = 0; i < configs.count(); ++i) { 339 for (int i = 0; i < configs.count(); ++i) {
349 const Config& config = gConfigs[configs[i]]; 340 const Config& config = gConfigs[configs[i]];
350 if (Benchmark::kNonRendering_Backend == config.backend) { 341 if (Benchmark::kNonRendering_Backend == config.backend) {
351 configs.remove(i, 1); 342 configs.remove(i, 1);
352 --i; 343 --i;
353 } 344 }
354 } 345 }
355 } 346 }
356 347
357 #if SK_SUPPORT_GPU 348 #if SK_SUPPORT_GPU
358 GrGLStandard gpuAPI = kNone_GrGLStandard;
359 if (1 == FLAGS_gpuAPI.count()) {
360 if (FLAGS_gpuAPI.contains(kGpuAPINameGL)) {
361 gpuAPI = kGL_GrGLStandard;
362 } else if (FLAGS_gpuAPI.contains(kGpuAPINameGLES)) {
363 gpuAPI = kGLES_GrGLStandard;
364 } else {
365 SkDebugf("Selected gpu API could not be used. Using the default.\n") ;
366 }
367 } else if (FLAGS_gpuAPI.count() > 1) {
368 SkDebugf("Selected gpu API could not be used. Using the default.\n");
369 }
370
371 for (int i = 0; i < configs.count(); ++i) { 349 for (int i = 0; i < configs.count(); ++i) {
372 const Config& config = gConfigs[configs[i]]; 350 const Config& config = gConfigs[configs[i]];
373 351
374 if (Benchmark::kGPU_Backend == config.backend) { 352 if (Benchmark::kGPU_Backend == config.backend) {
375 GrContext* context = gContextFactory.get(config.contextType, gpuAPI) ; 353 GrContext* context = gContextFactory.get(config.contextType);
376 if (NULL == context) { 354 if (NULL == context) {
377 SkDebugf("GrContext could not be created for config %s. Config w ill be skipped.\n", 355 SkDebugf("GrContext could not be created for config %s. Config w ill be skipped.\n",
378 config.name); 356 config.name);
379 configs.remove(i); 357 configs.remove(i);
380 --i; 358 --i;
381 continue; 359 continue;
382 } 360 }
383 if (config.sampleCount > context->getMaxSampleCount()){ 361 if (config.sampleCount > context->getMaxSampleCount()){
384 SkDebugf( 362 SkDebugf(
385 "Sample count (%d) for config %s is not supported. Config wi ll be skipped.\n", 363 "Sample count (%d) for config %s is not supported. Config wi ll be skipped.\n",
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 writer.option("build", "RELEASE"); 403 writer.option("build", "RELEASE");
426 #endif 404 #endif
427 405
428 // Set texture cache limits if non-default. 406 // Set texture cache limits if non-default.
429 for (size_t i = 0; i < SK_ARRAY_COUNT(gConfigs); ++i) { 407 for (size_t i = 0; i < SK_ARRAY_COUNT(gConfigs); ++i) {
430 #if SK_SUPPORT_GPU 408 #if SK_SUPPORT_GPU
431 const Config& config = gConfigs[i]; 409 const Config& config = gConfigs[i];
432 if (Benchmark::kGPU_Backend != config.backend) { 410 if (Benchmark::kGPU_Backend != config.backend) {
433 continue; 411 continue;
434 } 412 }
435 GrContext* context = gContextFactory.get(config.contextType, gpuAPI); 413 GrContext* context = gContextFactory.get(config.contextType);
436 if (NULL == context) { 414 if (NULL == context) {
437 continue; 415 continue;
438 } 416 }
439 417
440 size_t bytes; 418 size_t bytes;
441 int count; 419 int count;
442 context->getResourceCacheLimits(&count, &bytes); 420 context->getResourceCacheLimits(&count, &bytes);
443 if (-1 != FLAGS_gpuCacheBytes) { 421 if (-1 != FLAGS_gpuCacheBytes) {
444 bytes = static_cast<size_t>(FLAGS_gpuCacheBytes); 422 bytes = static_cast<size_t>(FLAGS_gpuCacheBytes);
445 } 423 }
(...skipping 25 matching lines...) Expand all
471 const Config& config = gConfigs[configIndex]; 449 const Config& config = gConfigs[configIndex];
472 450
473 if (!bench->isSuitableFor(config.backend)) { 451 if (!bench->isSuitableFor(config.backend)) {
474 continue; 452 continue;
475 } 453 }
476 454
477 GrContext* context = NULL; 455 GrContext* context = NULL;
478 #if SK_SUPPORT_GPU 456 #if SK_SUPPORT_GPU
479 SkGLContextHelper* glContext = NULL; 457 SkGLContextHelper* glContext = NULL;
480 if (Benchmark::kGPU_Backend == config.backend) { 458 if (Benchmark::kGPU_Backend == config.backend) {
481 context = gContextFactory.get(config.contextType, gpuAPI); 459 context = gContextFactory.get(config.contextType);
482 if (NULL == context) { 460 if (NULL == context) {
483 continue; 461 continue;
484 } 462 }
485 glContext = gContextFactory.getGLContext(config.contextType); 463 glContext = gContextFactory.getGLContext(config.contextType);
486 } 464 }
487 #endif 465 #endif
488 466
489 SkAutoTUnref<SkCanvas> canvas; 467 SkAutoTUnref<SkCanvas> canvas;
490 SkAutoTUnref<SkPicture> recordFrom; 468 SkAutoTUnref<SkPicture> recordFrom;
491 SkPictureRecorder recorderTo; 469 SkPictureRecorder recorderTo;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 gContextFactory.destroyContexts(); 675 gContextFactory.destroyContexts();
698 #endif 676 #endif
699 return 0; 677 return 0;
700 } 678 }
701 679
702 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 680 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
703 int main(int argc, char * const argv[]) { 681 int main(int argc, char * const argv[]) {
704 return tool_main(argc, (char**) argv); 682 return tool_main(argc, (char**) argv);
705 } 683 }
706 #endif 684 #endif
OLDNEW
« no previous file with comments | « no previous file | dm/DM.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698