diff options
-rw-r--r-- | bench/benchmain.cpp | 16 | ||||
-rw-r--r-- | gm/gmmain.cpp | 21 |
2 files changed, 34 insertions, 3 deletions
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp index 3a9f0c2a46..c1c1e3fb0c 100644 --- a/bench/benchmain.cpp +++ b/bench/benchmain.cpp @@ -237,6 +237,9 @@ DEFINE_string(gpuAPI, "", "Force use of specific gpu API. Using \"gl\" " DEFINE_int32(gpuCacheBytes, -1, "GPU cache size limit in bytes. 0 to disable cache."); DEFINE_int32(gpuCacheCount, -1, "GPU cache size limit in object count. 0 to disable cache."); +DEFINE_bool(gpu, true, "Allows GPU configs to be run. Applied after --configs."); +DEFINE_bool(cpu, true, "Allows non-GPU configs to be run. Applied after --config."); + DEFINE_bool2(leaks, l, false, "show leaked ref cnt'd objects."); DEFINE_string(match, "", "[~][^]substring[$] [...] of test name to run.\n" "Multiple matches may be separated by spaces.\n" @@ -353,6 +356,19 @@ int tool_main(int argc, char** argv) { } } } + // Apply the gpu/cpu only flags + for (int i = 0; i < configs.count(); ++i) { + const Config& config = gConfigs[configs[i]]; + if (config.backend == Benchmark::kGPU_Backend) { + if (!FLAGS_gpu) { + configs.remove(i, 1); + --i; + } + } else if (!FLAGS_cpu) { + configs.remove(i, 1); + --i; + } + } #if SK_SUPPORT_GPU GrGLStandard gpuAPI = kNone_GrGLStandard; diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp index 96a3454bec..d4ec45eb9b 100644 --- a/gm/gmmain.cpp +++ b/gm/gmmain.cpp @@ -1423,6 +1423,7 @@ static SkString pdfRasterizerUsage() { // Alphabetized ignoring "no" prefix ("readPath", "noreplay", "resourcePath"). DEFINE_string(config, "", configUsage().c_str()); +DEFINE_bool(cpu, true, "Allows non-GPU configs to be run. Applied after --config."); DEFINE_string(pdfRasterizers, "default", pdfRasterizerUsage().c_str()); DEFINE_bool(deferred, false, "Exercise the deferred rendering test pass."); DEFINE_bool(dryRun, false, "Don't actually run the tests, just print what would have been done."); @@ -1436,6 +1437,7 @@ DEFINE_string(gpuAPI, "", "Force use of specific gpu API. Using \"gl\" " DEFINE_string(gpuCacheSize, "", "<bytes> <count>: Limit the gpu cache to byte size or " "object count. " TOSTRING(DEFAULT_CACHE_VALUE) " for either value means " "use the default. 0 for either disables the cache."); +DEFINE_bool(gpu, true, "Allows GPU configs to be run. Applied after --config."); #endif DEFINE_bool(hierarchy, false, "Whether to use multilevel directory structure " "when reading/writing files."); @@ -2000,11 +2002,24 @@ static bool parse_flags_configs(SkTDArray<size_t>* outConfigs, } } -#if SK_SUPPORT_GPU - SkASSERT(grFactory != NULL); for (int i = 0; i < outConfigs->count(); ++i) { size_t index = (*outConfigs)[i]; if (kGPU_Backend == gRec[index].fBackend) { +#if SK_SUPPORT_GPU + if (!FLAGS_gpu) { + outConfigs->remove(i); + --i; + continue; + } +#endif + } else if (!FLAGS_cpu) { + outConfigs->remove(i); + --i; + continue; + } +#if SK_SUPPORT_GPU + SkASSERT(grFactory != NULL); + if (kGPU_Backend == gRec[index].fBackend) { GrContext* ctx = grFactory->get(gRec[index].fGLContextType, gpuAPI); if (NULL == ctx) { SkDebugf("GrContext could not be created for config %s. Config will be skipped.\n", @@ -2021,8 +2036,8 @@ static bool parse_flags_configs(SkTDArray<size_t>* outConfigs, --i; } } - } #endif + } if (outConfigs->isEmpty()) { SkDebugf("No configs to run."); |