Index: tools/VisualBench/VisualBench.cpp |
diff --git a/tools/VisualBench/VisualBench.cpp b/tools/VisualBench/VisualBench.cpp |
index 893dba6ab3ff9741207654664716d90da69d60c6..c16f4cc835100d1867c9e175ccaae384c7f5bd18 100644 |
--- a/tools/VisualBench/VisualBench.cpp |
+++ b/tools/VisualBench/VisualBench.cpp |
@@ -29,6 +29,26 @@ VisualBench::VisualBench(void* hwnd, int argc, char** argv) |
: INHERITED(hwnd) { |
SkCommandLineFlags::Parse(argc, argv); |
+ for (int i = 0; i < FLAGS_config.count(); i++) { |
+ SkString configStr(FLAGS_config[i]); |
+ |
+ Configs::Config& config = fConfigs.push_back(); |
+ |
+ if (configStr.contains("gpu")) { |
+ config.fType = Configs::Config::kGpu_Type; |
+ config.fNumSamples = 0; |
+ } else if (configStr.contains("msaa")) { |
+ config.fType = Configs::Config::kMsaa_Type; |
+ SkAssertResult(scanf("msaa%d", &config.fNumSamples)); |
+ } else if (configStr.contains("cpu")) { |
+ config.fType = Configs::Config::kCpu_Type; |
+ config.fNumSamples = 0; |
+ } else if (configStr.contains("nvprmsaa")) { |
+ config.fType = Configs::Config::kNvpr_Type; |
+ SkAssertResult(scanf("nvprmsaa%d", &config.fNumSamples)); |
+ } |
+ } |
+ |
// this has to happen after commandline parsing |
fModule.reset(new VisualLightweightBenchModule(this)); |
if (FLAGS_interactive) { |
@@ -79,7 +99,10 @@ void VisualBench::resetContext() { |
} |
void VisualBench::setupContext() { |
- if (!this->attach(kNativeGL_BackEndType, FLAGS_msaa, &fAttachmentInfo)) { |
+ // We only set the number of samples on the base render target for MSAA |
+ int numSamples = fConfigs.current().fType == Configs::Config::kMsaa_Type ? |
+ fConfigs.current().fNumSamples : 0; |
+ if (!this->attach(kNativeGL_BackEndType, numSamples, &fAttachmentInfo)) { |
SkDebugf("Not possible to create backend.\n"); |
INHERITED::detach(); |
SkFAIL("Could not create backend\n"); |
@@ -91,8 +114,7 @@ void VisualBench::setupContext() { |
fInterface.reset(GrGLCreateNativeInterface()); |
- // TODO use the GLContext creation factories and also set this all up in configs |
- if (!FLAGS_nvpr) { |
+ if (!fConfigs.current().fType == Configs::Config::kNvpr_Type) { |
fInterface.reset(GrGLInterfaceRemoveNVPR(fInterface)); |
} |
SkASSERT(fInterface); |