aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/benchmain.cpp
diff options
context:
space:
mode:
authorGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-16 18:00:40 +0000
committerGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-16 18:00:40 +0000
commit13eaaaa75a16fa300fa212ec910107f77530ef2c (patch)
tree113425d1ac3e2f7f29fec7abf43d02020f5f97f6 /bench/benchmain.cpp
parentc3bebf4673f24330766a1ea6f79b5cd356baa70f (diff)
Allow specifying multiple configs for bench, e.g. -config 8888 -config GPU.
Patch courtesy of Guanqun Lu. http://codereview.appspot.com/6031057/ git-svn-id: http://skia.googlecode.com/svn/trunk@3696 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench/benchmain.cpp')
-rw-r--r--bench/benchmain.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp
index 7d7a35016b..8372ec0419 100644
--- a/bench/benchmain.cpp
+++ b/bench/benchmain.cpp
@@ -381,7 +381,8 @@ int main (int argc, char * const argv[]) {
GLHelper* glHelper = NULL;
const char* configName = "";
Backend backend = kRaster_Backend; // for warning
- int configCount = SK_ARRAY_COUNT(gConfigs);
+ SkTDArray<int> configs;
+ bool userConfig = false;
char* const* stop = argv + argc;
for (++argv; argv < stop; ++argv) {
@@ -486,11 +487,8 @@ int main (int argc, char * const argv[]) {
if (argv < stop) {
int index = findConfig(*argv);
if (index >= 0) {
- outConfig = gConfigs[index].fConfig;
- configName = gConfigs[index].fName;
- backend = gConfigs[index].fBackend;
- glHelper = gConfigs[index].fGLHelper;
- configCount = 1;
+ *configs.append() = index;
+ userConfig = true;
} else {
SkString str;
str.printf("unrecognized config %s\n", *argv);
@@ -523,6 +521,12 @@ int main (int argc, char * const argv[]) {
return -1;
}
}
+ if (!userConfig) {
+ // if no config is specified by user, we add them all.
+ for (unsigned int i = 0; i < SK_ARRAY_COUNT(gConfigs); ++i) {
+ *configs.append() = i;
+ }
+ }
// report our current settings
{
@@ -620,13 +624,13 @@ int main (int argc, char * const argv[]) {
log_progress(str);
}
- for (int configIndex = 0; configIndex < configCount; configIndex++) {
- if (configCount > 1) {
- outConfig = gConfigs[configIndex].fConfig;
- configName = gConfigs[configIndex].fName;
- backend = gConfigs[configIndex].fBackend;
- glHelper = gConfigs[configIndex].fGLHelper;
- }
+ for (int x = 0; x < configs.count(); ++x) {
+ int configIndex = configs[x];
+
+ outConfig = gConfigs[configIndex].fConfig;
+ configName = gConfigs[configIndex].fName;
+ backend = gConfigs[configIndex].fBackend;
+ glHelper = gConfigs[configIndex].fGLHelper;
if (kGPU_Backend == backend &&
(NULL == glHelper || !glHelper->isValid())) {