OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkCommonFlagsConfig.h" | 8 #include "SkCommonFlagsConfig.h" |
9 | 9 |
10 #include <stdlib.h> | 10 #include <stdlib.h> |
(...skipping 26 matching lines...) Expand all Loading... |
37 #endif | 37 #endif |
38 #if SK_COMMAND_BUFFER | 38 #if SK_COMMAND_BUFFER |
39 " commandbuffer" | 39 " commandbuffer" |
40 #endif | 40 #endif |
41 #if SK_MESA | 41 #if SK_MESA |
42 " mesa" | 42 " mesa" |
43 #endif | 43 #endif |
44 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 44 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
45 " hwui" | 45 " hwui" |
46 #endif | 46 #endif |
| 47 #ifdef SK_VULKAN |
| 48 " vk" |
| 49 #endif |
47 " or use extended form 'backend(option=value,...)'.\n"; | 50 " or use extended form 'backend(option=value,...)'.\n"; |
48 | 51 |
49 static const char configExtendedHelp[] = | 52 static const char configExtendedHelp[] = |
50 "Extended form: 'backend(option=value,...)'\n\n" | 53 "Extended form: 'backend(option=value,...)'\n\n" |
51 "Possible backends and options:\n" | 54 "Possible backends and options:\n" |
52 #if SK_SUPPORT_GPU | 55 #if SK_SUPPORT_GPU |
53 "\n" | 56 "\n" |
54 "gpu(api=string,color=string,dit=bool,nvpr=bool,samples=int)\tGPU backend\n" | 57 "gpu(api=string,color=string,dit=bool,nvpr=bool,samples=int)\tGPU backend\n" |
55 "\tapi\ttype: string\tdefault: native.\n" | 58 "\tapi\ttype: string\tdefault: native.\n" |
56 "\t Select graphics API to use with gpu backend.\n" | 59 "\t Select graphics API to use with gpu backend.\n" |
57 "\t Options:\n" | 60 "\t Options:\n" |
58 "\t\tnative\t\t\tUse platform default OpenGL or OpenGL ES backend.\n" | 61 "\t\tnative\t\t\tUse platform default OpenGL or OpenGL ES backend.\n" |
59 "\t\tgl \t\t\tUse OpenGL.\n" | 62 "\t\tgl \t\t\tUse OpenGL.\n" |
60 "\t\tgles \t\t\tUse OpenGL ES.\n" | 63 "\t\tgles \t\t\tUse OpenGL ES.\n" |
61 "\t\tdebug \t\t\tUse debug OpenGL.\n" | 64 "\t\tdebug \t\t\tUse debug OpenGL.\n" |
62 "\t\tnull \t\t\tUse null OpenGL.\n" | 65 "\t\tnull \t\t\tUse null OpenGL.\n" |
63 #if SK_ANGLE | 66 #if SK_ANGLE |
64 #ifdef SK_BUILD_FOR_WIN | 67 #ifdef SK_BUILD_FOR_WIN |
65 "\t\tangle\t\t\tUse ANGLE DirectX.\n" | 68 "\t\tangle\t\t\tUse ANGLE DirectX.\n" |
66 #endif | 69 #endif |
67 "\t\tangle-gl\t\t\tUse ANGLE OpenGL.\n" | 70 "\t\tangle-gl\t\t\tUse ANGLE OpenGL.\n" |
68 #endif | 71 #endif |
69 #if SK_COMMAND_BUFFER | 72 #if SK_COMMAND_BUFFER |
70 "\t\tcommandbuffer\t\tUse command buffer.\n" | 73 "\t\tcommandbuffer\t\tUse command buffer.\n" |
71 #endif | 74 #endif |
72 #if SK_MESA | 75 #if SK_MESA |
73 "\t\tmesa\t\t\tUse MESA.\n" | 76 "\t\tmesa\t\t\tUse MESA.\n" |
74 #endif | 77 #endif |
| 78 #ifdef SK_VULKAN |
| 79 "\t\tvulkan\t\t\tUse Vulkan.\n" |
| 80 #endif |
75 "\tcolor\ttype: string\tdefault: 8888.\n" | 81 "\tcolor\ttype: string\tdefault: 8888.\n" |
76 "\t Select framebuffer color format.\n" | 82 "\t Select framebuffer color format.\n" |
77 "\t Options:\n" | 83 "\t Options:\n" |
78 "\t\t8888\t\t\tLinear 8888.\n" | 84 "\t\t8888\t\t\tLinear 8888.\n" |
79 "\t\tf16 \t\t\tLinear 16-bit floating point.\n" | 85 "\t\tf16 \t\t\tLinear 16-bit floating point.\n" |
80 "\t\tsrgb\t\t\tsRGB 8888.\n" | 86 "\t\tsrgb\t\t\tsRGB 8888.\n" |
81 "\tdit\ttype: bool\tdefault: false.\n" | 87 "\tdit\ttype: bool\tdefault: false.\n" |
82 "\t Use device independent text.\n" | 88 "\t Use device independent text.\n" |
83 "\tnvpr\ttype: bool\tdefault: false.\n" | 89 "\tnvpr\ttype: bool\tdefault: false.\n" |
84 "\t Use NV_path_rendering OpenGL and OpenGL ES extension.\n" | 90 "\t Use NV_path_rendering OpenGL and OpenGL ES extension.\n" |
(...skipping 25 matching lines...) Expand all Loading... |
110 "\tangle \t= gpu(api=angle)\n" | 116 "\tangle \t= gpu(api=angle)\n" |
111 #endif | 117 #endif |
112 "\tangle-gl \t= gpu(api=angle-gl)\n" | 118 "\tangle-gl \t= gpu(api=angle-gl)\n" |
113 #endif | 119 #endif |
114 #if SK_COMMAND_BUFFER | 120 #if SK_COMMAND_BUFFER |
115 "\tcommandbuffer\t= gpu(api=commandbuffer)\n" | 121 "\tcommandbuffer\t= gpu(api=commandbuffer)\n" |
116 #endif | 122 #endif |
117 #if SK_MESA | 123 #if SK_MESA |
118 "\tmesa \t= gpu(api=mesa)\n" | 124 "\tmesa \t= gpu(api=mesa)\n" |
119 #endif | 125 #endif |
| 126 #ifdef SK_VULKAN |
| 127 "\vk \t= gpu(api=vulkan)\n" |
| 128 #endif |
120 #endif | 129 #endif |
121 ; | 130 ; |
122 | 131 |
123 DEFINE_extended_string(config, defaultConfigs, configHelp, configExtendedHelp); | 132 DEFINE_extended_string(config, defaultConfigs, configHelp, configExtendedHelp); |
124 | 133 |
125 static const struct { | 134 static const struct { |
126 const char* predefinedConfig; | 135 const char* predefinedConfig; |
127 const char* backend; | 136 const char* backend; |
128 const char* options; | 137 const char* options; |
129 } gPredefinedConfigs[] = { | 138 } gPredefinedConfigs[] = { |
(...skipping 22 matching lines...) Expand all Loading... |
152 , { "angle", "gpu", "api=angle" } | 161 , { "angle", "gpu", "api=angle" } |
153 #endif | 162 #endif |
154 , { "angle-gl", "gpu", "api=angle-gl" } | 163 , { "angle-gl", "gpu", "api=angle-gl" } |
155 #endif | 164 #endif |
156 #if SK_COMMAND_BUFFER | 165 #if SK_COMMAND_BUFFER |
157 , { "commandbuffer", "gpu", "api=commandbuffer" } | 166 , { "commandbuffer", "gpu", "api=commandbuffer" } |
158 #endif | 167 #endif |
159 #if SK_MESA | 168 #if SK_MESA |
160 , { "mesa", "gpu", "api=mesa" } | 169 , { "mesa", "gpu", "api=mesa" } |
161 #endif | 170 #endif |
| 171 #ifdef SK_VULKAN |
| 172 , { "vk", "gpu", "api=vulkan" } |
| 173 #endif |
| 174 |
162 #else | 175 #else |
163 { "", "", "" } | 176 { "", "", "" } |
164 #endif | 177 #endif |
165 }; | 178 }; |
166 | 179 |
167 SkCommandLineConfig::SkCommandLineConfig(const SkString& tag, const SkString& ba
ckend, | 180 SkCommandLineConfig::SkCommandLineConfig(const SkString& tag, const SkString& ba
ckend, |
168 const SkTArray<SkString>& viaParts) | 181 const SkTArray<SkString>& viaParts) |
169 : fTag(tag) | 182 : fTag(tag) |
170 , fBackend(backend) | 183 , fBackend(backend) |
171 , fViaParts(viaParts) { | 184 , fViaParts(viaParts) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 *outContextType = GrContextFactory::kCommandBuffer_ContextType; | 257 *outContextType = GrContextFactory::kCommandBuffer_ContextType; |
245 return true; | 258 return true; |
246 } | 259 } |
247 #endif | 260 #endif |
248 #if SK_MESA | 261 #if SK_MESA |
249 if (value.equals("mesa")) { | 262 if (value.equals("mesa")) { |
250 *outContextType = GrContextFactory::kMESA_ContextType; | 263 *outContextType = GrContextFactory::kMESA_ContextType; |
251 return true; | 264 return true; |
252 } | 265 } |
253 #endif | 266 #endif |
| 267 #ifdef SK_VULKAN |
| 268 if (value.equals("vulkan")) { |
| 269 *outContextType = GrContextFactory::kVulkan_ContextType; |
| 270 return true; |
| 271 } |
| 272 #endif |
254 return false; | 273 return false; |
255 } | 274 } |
256 static bool parse_option_gpu_color(const SkString& value, | 275 static bool parse_option_gpu_color(const SkString& value, |
257 SkColorType* outColorType, | 276 SkColorType* outColorType, |
258 SkColorProfileType* outProfileType) { | 277 SkColorProfileType* outProfileType) { |
259 if (value.equals("8888")) { | 278 if (value.equals("8888")) { |
260 *outColorType = kN32_SkColorType; | 279 *outColorType = kN32_SkColorType; |
261 *outProfileType = kLinear_SkColorProfileType; | 280 *outProfileType = kLinear_SkColorProfileType; |
262 return true; | 281 return true; |
263 } | 282 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 if (extendedBackend.equals("gpu")) { | 400 if (extendedBackend.equals("gpu")) { |
382 parsedConfig = parse_command_line_config_gpu(tag, vias, extendedOpti
ons); | 401 parsedConfig = parse_command_line_config_gpu(tag, vias, extendedOpti
ons); |
383 } | 402 } |
384 #endif | 403 #endif |
385 if (!parsedConfig) { | 404 if (!parsedConfig) { |
386 parsedConfig = new SkCommandLineConfig(tag, simpleBackend, vias); | 405 parsedConfig = new SkCommandLineConfig(tag, simpleBackend, vias); |
387 } | 406 } |
388 outResult->emplace_back(parsedConfig); | 407 outResult->emplace_back(parsedConfig); |
389 } | 408 } |
390 } | 409 } |
OLD | NEW |