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

Unified Diff: tools/flags/SkCommonFlagsConfig.h

Issue 1490113005: Add config options to run different GPU APIs to dm and nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@commandbuffer-as-api-03-context-factory-glcontext-type
Patch Set: win angle Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: tools/flags/SkCommonFlagsConfig.h
diff --git a/tools/flags/SkCommonFlagsConfig.h b/tools/flags/SkCommonFlagsConfig.h
new file mode 100644
index 0000000000000000000000000000000000000000..4fc1ed9bf1510e53b8ff11806757ea5484857bc6
--- /dev/null
+++ b/tools/flags/SkCommonFlagsConfig.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SK_COMMON_FLAGS_CONFIG_H
+#define SK_COMMON_FLAGS_CONFIG_H
+
+#include "SkCommandLineFlags.h"
+
+DECLARE_string(config);
+
+class SkCommandLineConfigGpu;
scroggo 2015/12/03 19:02:59 Should this be in #if SK_SUPPORT_GPU?
Kimmo Kinnunen 2015/12/04 14:26:19 Done.
+// SkCommandLineConfig represents a Skia rendering configuration string.
scroggo 2015/12/03 19:02:59 nit: newline before comment block
Kimmo Kinnunen 2015/12/04 14:26:19 Done.
+// The string has following form:
+// [via-]*tag
+// where 'tag' consists of chars excluding hyphen or "angle-gl"
+// and each 'via' consists of chars excluding hyphen.
+class SkCommandLineConfig {
+ public:
+ SkCommandLineConfig(const SkString& tag, const SkTArray<SkString>& viaParts);
+ virtual ~SkCommandLineConfig();
+#if SK_SUPPORT_GPU
+ virtual const SkCommandLineConfigGpu* asConfigGpu() const { return nullptr; }
+#endif
+ const SkString& getTag() const { return fTag; }
+ const SkTArray<SkString>& getViaParts() const { return fViaParts; }
+ private:
+ SkString fTag;
+ SkTArray<SkString> fViaParts;
+};
+
+#if SK_SUPPORT_GPU
+// SkCommandLineConfigGpu is a SkCommandLineConfig that extracts information out of the tag. It is
+// constructed configs that have:
+// * tags of form "gpu(option=value,option2=value,...)"
+// * tags that represent a shorthand of above (such as "msaa16" representing "gpu(samples=16)")
+class SkCommandLineConfigGpu : public SkCommandLineConfig {
+ public:
+ enum API {
+ kNative_API,
+ kGL_API,
+ kGLES_API,
+#if SK_ANGLE
+#if SK_BUILD_FOR_WIN
+ kANGLE_API,
+#endif
+ kANGLE_GL_API,
+#endif
+#if SK_COMMAND_BUFFER
+ kCommandBuffer_API,
+#endif
+#if SK_MESA
+ kMESA_API,
+#endif
+ kDebug_API,
+ kNull_API
+ };
+
+ SkCommandLineConfigGpu(const SkString& tag, const SkTArray<SkString>& viaParts, API api, bool useNVPR, bool useDIText, int samples);
scroggo 2015/12/03 19:02:59 100 chars
Kimmo Kinnunen 2015/12/04 14:26:19 Done.
+ const SkCommandLineConfigGpu* asConfigGpu() const override { return this; }
+ API getAPI() const { return fAPI; }
+ bool getUseNVPR() const { return fUseNVPR; }
+ bool getUseDIText() const { return fUseDIText; }
+ int getSamples() const { return fSamples; }
+
+ private:
+ API fAPI;
+ bool fUseNVPR;
+ bool fUseDIText;
+ int fSamples;
+};
+#endif
+
+typedef SkTArray<SkAutoTDelete<SkCommandLineConfig>, true> SkCommandLineConfigArray;
+void ParseConfigs(const SkCommandLineFlags::StringArray& configList, SkCommandLineConfigArray* outResult);
scroggo 2015/12/03 19:02:59 100 chars
Kimmo Kinnunen 2015/12/04 14:26:19 Done.
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698