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 #include "SkImageInfo.h" | 9 #include "SkImageInfo.h" |
10 | 10 |
11 #include <stdlib.h> | 11 #include <stdlib.h> |
12 | 12 |
13 #if SK_SUPPORT_GPU | 13 #if SK_SUPPORT_GPU |
14 using sk_gpu_test::GrContextFactory; | 14 using sk_gpu_test::GrContextFactory; |
15 #endif | 15 #endif |
16 | 16 |
17 static const char defaultConfigs[] = | 17 static const char defaultConfigs[] = |
18 "8888 gpu nonrendering" | 18 "8888 gpu nonrendering" |
19 #if defined(SK_BUILD_FOR_WIN) | 19 #if SK_ANGLE |
20 " angle_d3d11_es2" | 20 #ifdef SK_BUILD_FOR_WIN |
| 21 " angle" |
| 22 #endif |
21 #endif | 23 #endif |
22 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 24 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
23 " hwui" | 25 " hwui" |
24 #endif | 26 #endif |
25 ; | 27 ; |
26 | 28 |
27 static const struct { | 29 static const struct { |
28 const char* predefinedConfig; | 30 const char* predefinedConfig; |
29 const char* backend; | 31 const char* backend; |
30 const char* options; | 32 const char* options; |
31 } gPredefinedConfigs[] ={ | 33 } gPredefinedConfigs[] ={ |
32 #if SK_SUPPORT_GPU | 34 #if SK_SUPPORT_GPU |
33 { "gpu", "gpu", "" }, | 35 { "gpu", "gpu", "" }, |
34 { "gl", "gpu", "api=gl" }, | 36 { "gl", "gpu", "api=gl" }, |
35 { "msaa4", "gpu", "samples=4" }, | 37 { "msaa4", "gpu", "samples=4" }, |
36 { "glmsaa4", "gpu", "api=gl,samples=4" }, | 38 { "glmsaa4", "gpu", "api=gl,samples=4" }, |
37 { "msaa16", "gpu", "samples=16" }, | 39 { "msaa16", "gpu", "samples=16" }, |
38 { "nvpr4", "gpu", "nvpr=true,samples=4" }, | 40 { "nvpr4", "gpu", "nvpr=true,samples=4" }, |
39 { "glnvpr4", "gpu", "api=gl,nvpr=true,samples=4" }, | 41 { "glnvpr4", "gpu", "api=gl,nvpr=true,samples=4" }, |
40 { "nvpr16", "gpu", "nvpr=true,samples=16" }, | 42 { "nvpr16", "gpu", "nvpr=true,samples=16" }, |
41 { "nvprdit4", "gpu", "nvpr=true,samples=4,dit=true" }, | 43 { "nvprdit4", "gpu", "nvpr=true,samples=4,dit=true" }, |
42 { "glnvprdit4", "gpu", "api=gl,nvpr=true,samples=4,dit=true" }, | 44 { "glnvprdit4", "gpu", "api=gl,nvpr=true,samples=4,dit=true" }, |
43 { "nvprdit16", "gpu", "nvpr=true,samples=16,dit=true" }, | 45 { "nvprdit16", "gpu", "nvpr=true,samples=16,dit=true" }, |
44 { "glinst", "gpu", "api=gl,inst=true" }, | 46 { "glinst", "gpu", "api=gl,inst=true" }, |
45 { "glinst4", "gpu", "api=gl,inst=true,samples=4" }, | 47 { "glinst4", "gpu", "api=gl,inst=true,samples=4" }, |
46 { "glinstdit4", "gpu", "api=gl,inst=true,samples=4,dit=true" }, | 48 { "glinstdit4", "gpu", "api=gl,inst=true,samples=4,dit=true" }, |
47 { "glinst16", "gpu", "api=gl,inst=true,samples=16" }, | 49 { "glinst16", "gpu", "api=gl,inst=true,samples=16" }, |
48 { "glinstdit16", "gpu", "api=gl,inst=true,samples=16,dit=true" }, | 50 { "glinstdit16", "gpu", "api=gl,inst=true,samples=16,dit=true" }, |
49 { "esinst", "gpu", "api=gles,inst=true" }, | 51 { "esinst", "gpu", "api=gles,inst=true" }, |
50 { "esinst4", "gpu", "api=gles,inst=true,samples=4" }, | 52 { "esinst4", "gpu", "api=gles,inst=true,samples=4" }, |
51 { "esinstdit4", "gpu", "api=gles,inst=true,samples=4,dit=true" }, | 53 { "esinstdit4", "gpu", "api=gles,inst=true,samples=4,dit=true" }, |
52 { "gpuf16", "gpu", "color=f16" }, | 54 { "gpuf16", "gpu", "color=f16" }, |
53 { "gpusrgb", "gpu", "color=srgb" }, | 55 { "gpusrgb", "gpu", "color=srgb" }, |
54 { "glsrgb", "gpu", "api=gl,color=srgb" }, | 56 { "glsrgb", "gpu", "api=gl,color=srgb" }, |
55 { "glwide", "gpu", "api=gl,color=f16_wide" }, | 57 { "glwide", "gpu", "api=gl,color=f16_wide" }, |
56 { "gpudft", "gpu", "dit=true" }, | 58 { "gpudft", "gpu", "dit=true" }, |
57 { "gpudebug", "gpu", "api=debug" }, | 59 { "gpudebug", "gpu", "api=debug" }, |
58 { "gpunull", "gpu", "api=null" }, | 60 { "gpunull", "gpu", "api=null" }, |
59 { "debug", "gpu", "api=debug" }, | 61 { "debug", "gpu", "api=debug" }, |
60 { "nullgpu", "gpu", "api=null" }, | 62 { "nullgpu", "gpu", "api=null" } |
61 { "angle_d3d11_es2", "gpu", "api=angle_d3d11_es2" }, | 63 #if SK_ANGLE |
62 { "angle_gl_es2", "gpu", "api=angle_gl_es2" }, | 64 #ifdef SK_BUILD_FOR_WIN |
63 { "commandbuffer", "gpu", "api=commandbuffer" } | 65 ,{ "angle", "gpu", "api=angle" } |
| 66 #endif |
| 67 ,{ "angle-gl", "gpu", "api=angle-gl" } |
| 68 #endif |
| 69 ,{ "commandbuffer", "gpu", "api=commandbuffer" } |
64 #if SK_MESA | 70 #if SK_MESA |
65 ,{ "mesa", "gpu", "api=mesa" } | 71 ,{ "mesa", "gpu", "api=mesa" } |
66 #endif | 72 #endif |
67 #ifdef SK_VULKAN | 73 #ifdef SK_VULKAN |
68 ,{ "vk", "gpu", "api=vulkan" } | 74 ,{ "vk", "gpu", "api=vulkan" } |
69 ,{ "vksrgb", "gpu", "api=vulkan,color=srgb" } | 75 ,{ "vksrgb", "gpu", "api=vulkan,color=srgb" } |
70 ,{ "vkwide", "gpu", "api=vulkan,color=f16_wide" } | 76 ,{ "vkwide", "gpu", "api=vulkan,color=f16_wide" } |
71 ,{ "vkmsaa4", "gpu", "api=vulkan,samples=4" } | 77 ,{ "vkmsaa4", "gpu", "api=vulkan,samples=4" } |
72 ,{ "vkmsaa16", "gpu", "api=vulkan,samples=16" } | 78 ,{ "vkmsaa16", "gpu", "api=vulkan,samples=16" } |
73 #endif | 79 #endif |
74 | 80 |
75 #else | 81 #else |
76 { "", "", "" } | 82 { "", "", "" } |
77 #endif | 83 #endif |
78 }; | 84 }; |
79 | 85 |
80 static const char configHelp[] = | 86 static const char configHelp[] = |
81 "Options: 565 8888 srgb f16 nonrendering null pdf pdfa skp pipe svg xps" | 87 "Options: 565 8888 srgb f16 nonrendering null pdf pdfa skp pipe svg xps" |
82 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 88 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
(...skipping 18 matching lines...) Expand all Loading... |
101 "\n" | 107 "\n" |
102 "gpu[api=string,color=string,dit=bool,nvpr=bool,inst=bool,samples=int]\n" | 108 "gpu[api=string,color=string,dit=bool,nvpr=bool,inst=bool,samples=int]\n" |
103 "\tapi\ttype: string\tdefault: native.\n" | 109 "\tapi\ttype: string\tdefault: native.\n" |
104 "\t Select graphics API to use with gpu backend.\n" | 110 "\t Select graphics API to use with gpu backend.\n" |
105 "\t Options:\n" | 111 "\t Options:\n" |
106 "\t\tnative\t\t\tUse platform default OpenGL or OpenGL ES backend.\n" | 112 "\t\tnative\t\t\tUse platform default OpenGL or OpenGL ES backend.\n" |
107 "\t\tgl \t\t\tUse OpenGL.\n" | 113 "\t\tgl \t\t\tUse OpenGL.\n" |
108 "\t\tgles \t\t\tUse OpenGL ES.\n" | 114 "\t\tgles \t\t\tUse OpenGL ES.\n" |
109 "\t\tdebug \t\t\tUse debug OpenGL.\n" | 115 "\t\tdebug \t\t\tUse debug OpenGL.\n" |
110 "\t\tnull \t\t\tUse null OpenGL.\n" | 116 "\t\tnull \t\t\tUse null OpenGL.\n" |
111 "\t\tangle_d3d9_es2\t\t\tUse OpenGL ES2 on the ANGLE Direct3D9 backend.\n" | 117 #if SK_ANGLE |
112 "\t\tangle_d3d11_es2\t\t\tUse OpenGL ES2 on the ANGLE Direct3D11 backend.\n" | 118 #ifdef SK_BUILD_FOR_WIN |
113 "\t\tangle_d3d11_es3\t\t\tUse OpenGL ES3 on the ANGLE Direct3D11 backend.\n" | 119 "\t\tangle\t\t\tUse ANGLE DirectX.\n" |
114 "\t\tangle_gl_es2\t\t\tUse OpenGL ES2 on the ANGLE OpenGL backend.\n" | 120 #endif |
115 "\t\tangle_gl_es3\t\t\tUse OpenGL ES3 on the ANGLE OpenGL backend.\n" | 121 "\t\tangle-gl\t\t\tUse ANGLE OpenGL.\n" |
| 122 #endif |
116 "\t\tcommandbuffer\t\tUse command buffer.\n" | 123 "\t\tcommandbuffer\t\tUse command buffer.\n" |
117 #if SK_MESA | 124 #if SK_MESA |
118 "\t\tmesa\t\t\tUse MESA.\n" | 125 "\t\tmesa\t\t\tUse MESA.\n" |
119 #endif | 126 #endif |
120 #ifdef SK_VULKAN | 127 #ifdef SK_VULKAN |
121 "\t\tvulkan\t\t\tUse Vulkan.\n" | 128 "\t\tvulkan\t\t\tUse Vulkan.\n" |
122 #endif | 129 #endif |
123 "\tcolor\ttype: string\tdefault: 8888.\n" | 130 "\tcolor\ttype: string\tdefault: 8888.\n" |
124 "\t Select framebuffer color format.\n" | 131 "\t Select framebuffer color format.\n" |
125 "\t Options:\n" | 132 "\t Options:\n" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 return true; | 226 return true; |
220 } | 227 } |
221 if (value.equals("debug")) { | 228 if (value.equals("debug")) { |
222 *outContextType = GrContextFactory::kDebugGL_ContextType; | 229 *outContextType = GrContextFactory::kDebugGL_ContextType; |
223 return true; | 230 return true; |
224 } | 231 } |
225 if (value.equals("null")) { | 232 if (value.equals("null")) { |
226 *outContextType = GrContextFactory::kNullGL_ContextType; | 233 *outContextType = GrContextFactory::kNullGL_ContextType; |
227 return true; | 234 return true; |
228 } | 235 } |
229 if (value.equals("angle_d3d9_es2")) { | 236 #if SK_ANGLE |
230 *outContextType = GrContextFactory::kANGLE_D3D9_ES2_ContextType; | 237 #ifdef SK_BUILD_FOR_WIN |
| 238 if (value.equals("angle")) { |
| 239 *outContextType = GrContextFactory::kANGLE_ContextType; |
231 return true; | 240 return true; |
232 } | 241 } |
233 if (value.equals("angle_d3d11_es2")) { | 242 #endif |
234 *outContextType = GrContextFactory::kANGLE_D3D11_ES2_ContextType; | 243 if (value.equals("angle-gl")) { |
| 244 *outContextType = GrContextFactory::kANGLE_GL_ContextType; |
235 return true; | 245 return true; |
236 } | 246 } |
237 if (value.equals("angle_d3d11_es3")) { | 247 #endif |
238 *outContextType = GrContextFactory::kANGLE_D3D11_ES3_ContextType; | |
239 return true; | |
240 } | |
241 if (value.equals("angle_gl_es2")) { | |
242 *outContextType = GrContextFactory::kANGLE_GL_ES2_ContextType; | |
243 return true; | |
244 } | |
245 if (value.equals("angle_gl_es3")) { | |
246 *outContextType = GrContextFactory::kANGLE_GL_ES3_ContextType; | |
247 return true; | |
248 } | |
249 if (value.equals("commandbuffer")) { | 248 if (value.equals("commandbuffer")) { |
250 *outContextType = GrContextFactory::kCommandBuffer_ContextType; | 249 *outContextType = GrContextFactory::kCommandBuffer_ContextType; |
251 return true; | 250 return true; |
252 } | 251 } |
253 #if SK_MESA | 252 #if SK_MESA |
254 if (value.equals("mesa")) { | 253 if (value.equals("mesa")) { |
255 *outContextType = GrContextFactory::kMESA_ContextType; | 254 *outContextType = GrContextFactory::kMESA_ContextType; |
256 return true; | 255 return true; |
257 } | 256 } |
258 #endif | 257 #endif |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 } | 399 } |
401 } | 400 } |
402 | 401 |
403 if (extendedBackend.isEmpty()) { | 402 if (extendedBackend.isEmpty()) { |
404 simpleBackend = tag; | 403 simpleBackend = tag; |
405 SkStrSplit(tag.c_str(), "-", kStrict_SkStrSplitMode, &vias); | 404 SkStrSplit(tag.c_str(), "-", kStrict_SkStrSplitMode, &vias); |
406 if (vias.count()) { | 405 if (vias.count()) { |
407 simpleBackend = vias[vias.count() - 1]; | 406 simpleBackend = vias[vias.count() - 1]; |
408 vias.pop_back(); | 407 vias.pop_back(); |
409 } | 408 } |
| 409 // Note: no #if SK_ANGLE: this is a special rule in the via-tag gram
mar. |
| 410 if (vias.count() && simpleBackend.equals("gl") && |
| 411 vias[vias.count() - 1].equals("angle")) { |
| 412 simpleBackend = "angle-gl"; |
| 413 vias.pop_back(); |
| 414 } |
| 415 |
410 for (auto& predefinedConfig : gPredefinedConfigs) { | 416 for (auto& predefinedConfig : gPredefinedConfigs) { |
411 if (simpleBackend.equals(predefinedConfig.predefinedConfig)) { | 417 if (simpleBackend.equals(predefinedConfig.predefinedConfig)) { |
412 extendedBackend = predefinedConfig.backend; | 418 extendedBackend = predefinedConfig.backend; |
413 extendedOptions = predefinedConfig.options; | 419 extendedOptions = predefinedConfig.options; |
414 break; | 420 break; |
415 } | 421 } |
416 } | 422 } |
417 } | 423 } |
418 SkCommandLineConfig* parsedConfig = nullptr; | 424 SkCommandLineConfig* parsedConfig = nullptr; |
419 #if SK_SUPPORT_GPU | 425 #if SK_SUPPORT_GPU |
420 if (extendedBackend.equals("gpu")) { | 426 if (extendedBackend.equals("gpu")) { |
421 parsedConfig = parse_command_line_config_gpu(tag, vias, extendedOpti
ons); | 427 parsedConfig = parse_command_line_config_gpu(tag, vias, extendedOpti
ons); |
422 } | 428 } |
423 #endif | 429 #endif |
424 if (!parsedConfig) { | 430 if (!parsedConfig) { |
425 parsedConfig = new SkCommandLineConfig(tag, simpleBackend, vias); | 431 parsedConfig = new SkCommandLineConfig(tag, simpleBackend, vias); |
426 } | 432 } |
427 outResult->emplace_back(parsedConfig); | 433 outResult->emplace_back(parsedConfig); |
428 } | 434 } |
429 } | 435 } |
OLD | NEW |