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

Side by Side 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: fix errorneous config handling 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SK_COMMON_FLAGS_CONFIG_H
9 #define SK_COMMON_FLAGS_CONFIG_H
10
11 #include "SkCommandLineFlags.h"
12
13 DECLARE_string(config);
14
15 #if SK_SUPPORT_GPU
16 class SkCommandLineConfigGpu;
17 #endif
18
19 // SkCommandLineConfig represents a Skia rendering configuration string.
20 // The string has following form:
21 // [via-]*tag
22 // where 'tag' consists of chars excluding hyphen or "angle-gl"
23 // and each 'via' consists of chars excluding hyphen.
24 class SkCommandLineConfig {
25 public:
26 SkCommandLineConfig(const SkString& tag, const SkTArray<SkString>& viaParts) ;
27 virtual ~SkCommandLineConfig();
28 #if SK_SUPPORT_GPU
29 virtual const SkCommandLineConfigGpu* asConfigGpu() const { return nullptr; }
30 #endif
31 const SkString& getTag() const { return fTag; }
32 const SkTArray<SkString>& getViaParts() const { return fViaParts; }
33 private:
34 SkString fTag;
35 SkTArray<SkString> fViaParts;
36 };
37
38 #if SK_SUPPORT_GPU
39 // SkCommandLineConfigGpu is a SkCommandLineConfig that extracts information out of the tag. It is
40 // constructed configs that have:
41 // * tags of form "gpu(option=value,option2=value,...)"
42 // * tags that represent a shorthand of above (such as "msaa16" representing "gp u(samples=16)")
43 class SkCommandLineConfigGpu : public SkCommandLineConfig {
44 public:
45 enum API {
46 kNative_API,
47 kGL_API,
48 kGLES_API,
49 #if SK_ANGLE
50 #ifdef SK_BUILD_FOR_WIN
51 kANGLE_API,
52 #endif
53 kANGLE_GL_API,
54 #endif
55 #if SK_COMMAND_BUFFER
56 kCommandBuffer_API,
57 #endif
58 #if SK_MESA
59 kMESA_API,
60 #endif
61 kDebug_API,
62 kNull_API
63 };
64
65 SkCommandLineConfigGpu(const SkString& tag, const SkTArray<SkString>& viaPar ts, API api,
66 bool useNVPR, bool useDIText, int samples);
67 const SkCommandLineConfigGpu* asConfigGpu() const override { return this; }
68 API getAPI() const { return fAPI; }
69 bool getUseNVPR() const { return fUseNVPR; }
70 bool getUseDIText() const { return fUseDIText; }
71 int getSamples() const { return fSamples; }
72
73 private:
74 API fAPI;
75 bool fUseNVPR;
76 bool fUseDIText;
77 int fSamples;
78 };
79 #endif
80
81 typedef SkTArray<SkAutoTDelete<SkCommandLineConfig>, true> SkCommandLineConfigAr ray;
82 void ParseConfigs(const SkCommandLineFlags::StringArray& configList,
83 SkCommandLineConfigArray* outResult);
84
85 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698