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

Side by Side Diff: gm/gmmain.cpp

Issue 376643002: gpu and cpu flags for gm and bench. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix indentation 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 | « bench/benchmain.cpp ('k') | no next file » | 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 /* 8 /*
9 * Code for the "gm" (Golden Master) rendering comparison tool. 9 * Code for the "gm" (Golden Master) rendering comparison tool.
10 * 10 *
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 } 1416 }
1417 1417
1418 // Macro magic to convert a numeric preprocessor token into a string. 1418 // Macro magic to convert a numeric preprocessor token into a string.
1419 // Adapted from http://stackoverflow.com/questions/240353/convert-a-preprocessor -token-to-a-string 1419 // Adapted from http://stackoverflow.com/questions/240353/convert-a-preprocessor -token-to-a-string
1420 // This should probably be moved into one of our common headers... 1420 // This should probably be moved into one of our common headers...
1421 #define TOSTRING_INTERNAL(x) #x 1421 #define TOSTRING_INTERNAL(x) #x
1422 #define TOSTRING(x) TOSTRING_INTERNAL(x) 1422 #define TOSTRING(x) TOSTRING_INTERNAL(x)
1423 1423
1424 // Alphabetized ignoring "no" prefix ("readPath", "noreplay", "resourcePath"). 1424 // Alphabetized ignoring "no" prefix ("readPath", "noreplay", "resourcePath").
1425 DEFINE_string(config, "", configUsage().c_str()); 1425 DEFINE_string(config, "", configUsage().c_str());
1426 DEFINE_bool(cpu, true, "Allows non-GPU configs to be run. Applied after --config .");
1426 DEFINE_string(pdfRasterizers, "default", pdfRasterizerUsage().c_str()); 1427 DEFINE_string(pdfRasterizers, "default", pdfRasterizerUsage().c_str());
1427 DEFINE_bool(deferred, false, "Exercise the deferred rendering test pass."); 1428 DEFINE_bool(deferred, false, "Exercise the deferred rendering test pass.");
1428 DEFINE_bool(dryRun, false, "Don't actually run the tests, just print what would have been done."); 1429 DEFINE_bool(dryRun, false, "Don't actually run the tests, just print what would have been done.");
1429 DEFINE_string(excludeConfig, "", "Space delimited list of configs to skip."); 1430 DEFINE_string(excludeConfig, "", "Space delimited list of configs to skip.");
1430 DEFINE_bool(forceBWtext, false, "Disable text anti-aliasing."); 1431 DEFINE_bool(forceBWtext, false, "Disable text anti-aliasing.");
1431 #if SK_SUPPORT_GPU 1432 #if SK_SUPPORT_GPU
1432 DEFINE_string(gpuAPI, "", "Force use of specific gpu API. Using \"gl\" " 1433 DEFINE_string(gpuAPI, "", "Force use of specific gpu API. Using \"gl\" "
1433 "forces OpenGL API. Using \"gles\" forces OpenGL ES API. " 1434 "forces OpenGL API. Using \"gles\" forces OpenGL ES API. "
1434 "Defaults to empty string, which selects the API native to the " 1435 "Defaults to empty string, which selects the API native to the "
1435 "system."); 1436 "system.");
1436 DEFINE_string(gpuCacheSize, "", "<bytes> <count>: Limit the gpu cache to byte si ze or " 1437 DEFINE_string(gpuCacheSize, "", "<bytes> <count>: Limit the gpu cache to byte si ze or "
1437 "object count. " TOSTRING(DEFAULT_CACHE_VALUE) " for either value means " 1438 "object count. " TOSTRING(DEFAULT_CACHE_VALUE) " for either value means "
1438 "use the default. 0 for either disables the cache."); 1439 "use the default. 0 for either disables the cache.");
1440 DEFINE_bool(gpu, true, "Allows GPU configs to be run. Applied after --config.");
1439 #endif 1441 #endif
1440 DEFINE_bool(hierarchy, false, "Whether to use multilevel directory structure " 1442 DEFINE_bool(hierarchy, false, "Whether to use multilevel directory structure "
1441 "when reading/writing files."); 1443 "when reading/writing files.");
1442 DEFINE_string(ignoreErrorTypes, kDefaultIgnorableErrorTypes.asString(" ").c_str( ), 1444 DEFINE_string(ignoreErrorTypes, kDefaultIgnorableErrorTypes.asString(" ").c_str( ),
1443 "Space-separated list of ErrorTypes that should be ignored. If any *other* error " 1445 "Space-separated list of ErrorTypes that should be ignored. If any *other* error "
1444 "types are encountered, the tool will exit with a nonzero return v alue."); 1446 "types are encountered, the tool will exit with a nonzero return v alue.");
1445 DEFINE_string(ignoreFailuresFile, "", "Path to file containing a list of tests f or which we " 1447 DEFINE_string(ignoreFailuresFile, "", "Path to file containing a list of tests f or which we "
1446 "should ignore failures.\n" 1448 "should ignore failures.\n"
1447 "The file should list one test per line, except for comment lines starting with #"); 1449 "The file should list one test per line, except for comment lines starting with #");
1448 DEFINE_bool2(leaks, l, false, "show leaked ref cnt'd objects."); 1450 DEFINE_bool2(leaks, l, false, "show leaked ref cnt'd objects.");
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
1993 // now remove any explicitly excluded configs 1995 // now remove any explicitly excluded configs
1994 for (int i = 0; i < excludeConfigs.count(); ++i) { 1996 for (int i = 0; i < excludeConfigs.count(); ++i) {
1995 int index = outConfigs->find(excludeConfigs[i]); 1997 int index = outConfigs->find(excludeConfigs[i]);
1996 if (index >= 0) { 1998 if (index >= 0) {
1997 outConfigs->remove(index); 1999 outConfigs->remove(index);
1998 // now assert that there was only one copy in configs[] 2000 // now assert that there was only one copy in configs[]
1999 SkASSERT(outConfigs->find(excludeConfigs[i]) < 0); 2001 SkASSERT(outConfigs->find(excludeConfigs[i]) < 0);
2000 } 2002 }
2001 } 2003 }
2002 2004
2003 #if SK_SUPPORT_GPU
2004 SkASSERT(grFactory != NULL);
2005 for (int i = 0; i < outConfigs->count(); ++i) { 2005 for (int i = 0; i < outConfigs->count(); ++i) {
2006 size_t index = (*outConfigs)[i]; 2006 size_t index = (*outConfigs)[i];
2007 if (kGPU_Backend == gRec[index].fBackend) { 2007 if (kGPU_Backend == gRec[index].fBackend) {
2008 #if SK_SUPPORT_GPU
2009 if (!FLAGS_gpu) {
2010 outConfigs->remove(i);
2011 --i;
2012 continue;
2013 }
2014 #endif
2015 } else if (!FLAGS_cpu) {
2016 outConfigs->remove(i);
2017 --i;
2018 continue;
2019 }
2020 #if SK_SUPPORT_GPU
2021 SkASSERT(grFactory != NULL);
2022 if (kGPU_Backend == gRec[index].fBackend) {
2008 GrContext* ctx = grFactory->get(gRec[index].fGLContextType, gpuAPI); 2023 GrContext* ctx = grFactory->get(gRec[index].fGLContextType, gpuAPI);
2009 if (NULL == ctx) { 2024 if (NULL == ctx) {
2010 SkDebugf("GrContext could not be created for config %s. Config w ill be skipped.\n", 2025 SkDebugf("GrContext could not be created for config %s. Config w ill be skipped.\n",
2011 gRec[index].fName); 2026 gRec[index].fName);
2012 outConfigs->remove(i); 2027 outConfigs->remove(i);
2013 --i; 2028 --i;
2014 continue; 2029 continue;
2015 } 2030 }
2016 if (gRec[index].fSampleCnt > ctx->getMaxSampleCount()) { 2031 if (gRec[index].fSampleCnt > ctx->getMaxSampleCount()) {
2017 SkDebugf("Sample count (%d) of config %s is not supported." 2032 SkDebugf("Sample count (%d) of config %s is not supported."
2018 " Config will be skipped.\n", 2033 " Config will be skipped.\n",
2019 gRec[index].fSampleCnt, gRec[index].fName); 2034 gRec[index].fSampleCnt, gRec[index].fName);
2020 outConfigs->remove(i); 2035 outConfigs->remove(i);
2021 --i; 2036 --i;
2022 } 2037 }
2023 } 2038 }
2039 #endif
2024 } 2040 }
2025 #endif
2026 2041
2027 if (outConfigs->isEmpty()) { 2042 if (outConfigs->isEmpty()) {
2028 SkDebugf("No configs to run."); 2043 SkDebugf("No configs to run.");
2029 return false; 2044 return false;
2030 } 2045 }
2031 2046
2032 // now show the user the set of configs that will be run. 2047 // now show the user the set of configs that will be run.
2033 SkString configStr("These configs will be run:"); 2048 SkString configStr("These configs will be run:");
2034 // show the user the config that will run. 2049 // show the user the config that will run.
2035 for (int i = 0; i < outConfigs->count(); ++i) { 2050 for (int i = 0; i < outConfigs->count(); ++i) {
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
2479 if (FLAGS_forceBWtext) { 2494 if (FLAGS_forceBWtext) {
2480 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); 2495 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref();
2481 } 2496 }
2482 } 2497 }
2483 2498
2484 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 2499 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
2485 int main(int argc, char * const argv[]) { 2500 int main(int argc, char * const argv[]) {
2486 return tool_main(argc, (char**) argv); 2501 return tool_main(argc, (char**) argv);
2487 } 2502 }
2488 #endif 2503 #endif
OLDNEW
« no previous file with comments | « bench/benchmain.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698