aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/flags/SkCommandLineFlags.h
diff options
context:
space:
mode:
authorGravatar kkinnunen <kkinnunen@nvidia.com>2015-12-23 01:33:00 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-23 01:33:01 -0800
commit3e980c3d88fbc509b79e7ccef16ca38f5bbfb180 (patch)
tree459161dd5ca1ca4e727d583a2d45106bd1324deb /tools/flags/SkCommandLineFlags.h
parent20b4ca12114d0676da2fd61b99f1577678d33abe (diff)
Add config options to run different GPU APIs to dm and nanobench
Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd Review URL: https://codereview.chromium.org/1490113005
Diffstat (limited to 'tools/flags/SkCommandLineFlags.h')
-rw-r--r--tools/flags/SkCommandLineFlags.h38
1 files changed, 30 insertions, 8 deletions
diff --git a/tools/flags/SkCommandLineFlags.h b/tools/flags/SkCommandLineFlags.h
index 5909413523..909718d3e7 100644
--- a/tools/flags/SkCommandLineFlags.h
+++ b/tools/flags/SkCommandLineFlags.h
@@ -76,6 +76,11 @@
* as its value. All strings that follow the flag on the command line (until
* a string that begins with '-') will be entries in the array.
*
+ * DEFINE_extended_string(args, .., .., extendedHelpString);
+ *
+ * creates a similar string array flag as DEFINE_string. The flag will have extended help text
+ * (extendedHelpString) that can the user can see with '--help <args>' flag.
+ *
* Any flag can be referenced from another file after using the following:
*
* DECLARE_x(name);
@@ -114,6 +119,10 @@ public:
*/
class StringArray {
public:
+ StringArray() { }
+ explicit StringArray(const SkTArray<SkString>& strings)
+ : fStrings(strings) {
+ }
const char* operator[](int i) const {
SkASSERT(i >= 0 && i < fStrings.count());
return fStrings[i].c_str();
@@ -204,7 +213,15 @@ SK_UNUSED static bool unused_##name = SkFlagInfo::CreateStringFlag(TO_STRING(nam
nullptr, \
&FLAGS_##name, \
defaultValue, \
- helpString)
+ helpString, nullptr)
+#define DEFINE_extended_string(name, defaultValue, helpString, extendedHelpString) \
+SkCommandLineFlags::StringArray FLAGS_##name; \
+SK_UNUSED static bool unused_##name = SkFlagInfo::CreateStringFlag(TO_STRING(name), \
+ nullptr, \
+ &FLAGS_##name, \
+ defaultValue, \
+ helpString, \
+ extendedHelpString)
// string2 allows specifying a short name. There is an assert that shortName
// is only 1 character.
@@ -214,7 +231,7 @@ SK_UNUSED static bool unused_##name = SkFlagInfo::CreateStringFlag(TO_STRING(nam
TO_STRING(shortName), \
&FLAGS_##name, \
defaultValue, \
- helpString)
+ helpString, nullptr)
#define DECLARE_string(name) extern SkCommandLineFlags::StringArray FLAGS_##name;
@@ -273,7 +290,7 @@ public:
*/
static bool CreateBoolFlag(const char* name, const char* shortName, bool* pBool,
bool defaultValue, const char* helpString) {
- SkFlagInfo* info = new SkFlagInfo(name, shortName, kBool_FlagType, helpString);
+ SkFlagInfo* info = new SkFlagInfo(name, shortName, kBool_FlagType, helpString, nullptr);
info->fBoolValue = pBool;
*info->fBoolValue = info->fDefaultBool = defaultValue;
return true;
@@ -287,14 +304,15 @@ public:
*/
static bool CreateStringFlag(const char* name, const char* shortName,
SkCommandLineFlags::StringArray* pStrings,
- const char* defaultValue, const char* helpString);
+ const char* defaultValue, const char* helpString,
+ const char* extendedHelpString);
/**
* See comments for CreateBoolFlag.
*/
static bool CreateIntFlag(const char* name, int32_t* pInt,
int32_t defaultValue, const char* helpString) {
- SkFlagInfo* info = new SkFlagInfo(name, nullptr, kInt_FlagType, helpString);
+ SkFlagInfo* info = new SkFlagInfo(name, nullptr, kInt_FlagType, helpString, nullptr);
info->fIntValue = pInt;
*info->fIntValue = info->fDefaultInt = defaultValue;
return true;
@@ -302,7 +320,7 @@ public:
static bool CreateIntFlag(const char* name, const char* shortName, int32_t* pInt,
int32_t defaultValue, const char* helpString) {
- SkFlagInfo* info = new SkFlagInfo(name, shortName, kInt_FlagType, helpString);
+ SkFlagInfo* info = new SkFlagInfo(name, shortName, kInt_FlagType, helpString, nullptr);
info->fIntValue = pInt;
*info->fIntValue = info->fDefaultInt = defaultValue;
return true;
@@ -313,7 +331,7 @@ public:
*/
static bool CreateDoubleFlag(const char* name, double* pDouble,
double defaultValue, const char* helpString) {
- SkFlagInfo* info = new SkFlagInfo(name, nullptr, kDouble_FlagType, helpString);
+ SkFlagInfo* info = new SkFlagInfo(name, nullptr, kDouble_FlagType, helpString, nullptr);
info->fDoubleValue = pDouble;
*info->fDoubleValue = info->fDefaultDouble = defaultValue;
return true;
@@ -383,6 +401,7 @@ public:
const SkString& shortName() const { return fShortName; }
const SkString& help() const { return fHelpString; }
+ const SkString& extendedHelp() const { return fExtendedHelpString; }
SkString defaultValue() const {
SkString result;
@@ -421,11 +440,13 @@ public:
}
private:
- SkFlagInfo(const char* name, const char* shortName, FlagTypes type, const char* helpString)
+ SkFlagInfo(const char* name, const char* shortName, FlagTypes type, const char* helpString,
+ const char* extendedHelpString)
: fName(name)
, fShortName(shortName)
, fFlagType(type)
, fHelpString(helpString)
+ , fExtendedHelpString(extendedHelpString)
, fBoolValue(nullptr)
, fDefaultBool(false)
, fIntValue(nullptr)
@@ -453,6 +474,7 @@ private:
SkString fShortName;
FlagTypes fFlagType;
SkString fHelpString;
+ SkString fExtendedHelpString;
bool* fBoolValue;
bool fDefaultBool;
int32_t* fIntValue;