kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 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 | |
Brian Osman | a66f4da | 2018-06-28 17:52:02 +0000 | [diff] [blame] | 8 | #include "SkColorSpacePriv.h" |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 9 | #include "SkCommonFlagsConfig.h" |
csmartdalton | 6270e55 | 2016-09-13 10:41:49 -0700 | [diff] [blame] | 10 | #include "SkImageInfo.h" |
Bryce Thomas | 95a7b76 | 2018-03-02 13:54:21 -0800 | [diff] [blame] | 11 | #include "SkTHash.h" |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 12 | |
| 13 | #include <stdlib.h> |
| 14 | |
bsalomon | 3724e57 | 2016-03-30 18:56:19 -0700 | [diff] [blame] | 15 | using sk_gpu_test::GrContextFactory; |
bsalomon | 3724e57 | 2016-03-30 18:56:19 -0700 | [diff] [blame] | 16 | |
Brian Salomon | 6405e71 | 2017-03-20 08:54:16 -0400 | [diff] [blame] | 17 | #if defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_IOS) |
| 18 | # define DEFAULT_GPU_CONFIG "gles" |
| 19 | #else |
| 20 | # define DEFAULT_GPU_CONFIG "gl" |
| 21 | #endif |
| 22 | |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 23 | static const char defaultConfigs[] = |
Brian Salomon | 6405e71 | 2017-03-20 08:54:16 -0400 | [diff] [blame] | 24 | "8888 " DEFAULT_GPU_CONFIG " nonrendering " |
bsalomon | 11abd8d | 2016-10-14 08:13:48 -0700 | [diff] [blame] | 25 | #if defined(SK_BUILD_FOR_WIN) |
| 26 | " angle_d3d11_es2" |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 27 | #endif |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 28 | ; |
| 29 | |
Brian Salomon | 6405e71 | 2017-03-20 08:54:16 -0400 | [diff] [blame] | 30 | #undef DEFAULT_GPU_CONFIG |
| 31 | |
Brian Salomon | 00a5eb8 | 2018-07-11 15:32:05 -0400 | [diff] [blame] | 32 | // clang-format off |
brianosman | 37e2334 | 2016-09-20 08:06:30 -0700 | [diff] [blame] | 33 | static const struct { |
| 34 | const char* predefinedConfig; |
| 35 | const char* backend; |
| 36 | const char* options; |
Brian Salomon | f865b05 | 2018-03-09 09:01:53 -0500 | [diff] [blame] | 37 | } gPredefinedConfigs[] = { |
Brian Salomon | 002c120 | 2016-10-18 11:28:20 -0400 | [diff] [blame] | 38 | { "gl", "gpu", "api=gl" }, |
Brian Salomon | 50f66d8 | 2017-03-17 14:32:05 -0400 | [diff] [blame] | 39 | { "gles", "gpu", "api=gles" }, |
Brian Salomon | 002c120 | 2016-10-18 11:28:20 -0400 | [diff] [blame] | 40 | { "glmsaa4", "gpu", "api=gl,samples=4" }, |
Brian Salomon | dcf0ab0 | 2017-03-20 11:10:21 -0400 | [diff] [blame] | 41 | { "glmsaa8" , "gpu", "api=gl,samples=8" }, |
Brian Salomon | 50f66d8 | 2017-03-17 14:32:05 -0400 | [diff] [blame] | 42 | { "glesmsaa4", "gpu", "api=gles,samples=4" }, |
Brian Salomon | 002c120 | 2016-10-18 11:28:20 -0400 | [diff] [blame] | 43 | { "glnvpr4", "gpu", "api=gl,nvpr=true,samples=4" }, |
Brian Salomon | dcf0ab0 | 2017-03-20 11:10:21 -0400 | [diff] [blame] | 44 | { "glnvpr8" , "gpu", "api=gl,nvpr=true,samples=8" }, |
Brian Salomon | 50f66d8 | 2017-03-17 14:32:05 -0400 | [diff] [blame] | 45 | { "glesnvpr4", "gpu", "api=gles,nvpr=true,samples=4" }, |
Brian Salomon | f865b05 | 2018-03-09 09:01:53 -0500 | [diff] [blame] | 46 | { "glbetex", "gpu", "api=gl,surf=betex" }, |
| 47 | { "glesbetex", "gpu", "api=gles,surf=betex" }, |
| 48 | { "glbert", "gpu", "api=gl,surf=bert" }, |
| 49 | { "glesbert", "gpu", "api=gles,surf=bert" }, |
Brian Salomon | ce5ee60 | 2017-07-17 11:31:31 -0400 | [diff] [blame] | 50 | { "gl4444", "gpu", "api=gl,color=4444" }, |
Brian Osman | a15cedb | 2018-05-30 15:36:38 -0400 | [diff] [blame] | 51 | { "gles4444", "gpu", "api=gles,color=4444" }, |
Brian Salomon | ce5ee60 | 2017-07-17 11:31:31 -0400 | [diff] [blame] | 52 | { "gl565", "gpu", "api=gl,color=565" }, |
Brian Salomon | 5fba7ad | 2018-03-22 10:01:16 -0400 | [diff] [blame] | 53 | { "gl888x", "gpu", "api=gl,color=888x" }, |
Brian Osman | a15cedb | 2018-05-30 15:36:38 -0400 | [diff] [blame] | 54 | { "gles888x", "gpu", "api=gles,color=888x" }, |
Brian Osman | 10fc6fd | 2018-03-02 11:01:10 -0500 | [diff] [blame] | 55 | { "gl1010102", "gpu", "api=gl,color=1010102" }, |
Brian Osman | a15cedb | 2018-05-30 15:36:38 -0400 | [diff] [blame] | 56 | { "gles1010102", "gpu", "api=gles,color=1010102" }, |
Brian Salomon | 6405e71 | 2017-03-20 08:54:16 -0400 | [diff] [blame] | 57 | { "glsrgb", "gpu", "api=gl,color=srgb" }, |
Brian Osman | a76b7a9 | 2018-07-18 14:36:43 -0400 | [diff] [blame] | 58 | { "glp3", "gpu", "api=gl,color=p3" }, |
Brian Osman | a66f4da | 2018-06-28 17:52:02 +0000 | [diff] [blame] | 59 | { "glesrgb", "gpu", "api=gl,color=esrgb" }, |
| 60 | { "glnarrow", "gpu", "api=gl,color=narrow" }, |
| 61 | { "glenarrow", "gpu", "api=gl,color=enarrow" }, |
Brian Osman | a15cedb | 2018-05-30 15:36:38 -0400 | [diff] [blame] | 62 | { "glf16", "gpu", "api=gl,color=f16" }, |
Brian Salomon | 6405e71 | 2017-03-20 08:54:16 -0400 | [diff] [blame] | 63 | { "glessrgb", "gpu", "api=gles,color=srgb" }, |
Brian Osman | a66f4da | 2018-06-28 17:52:02 +0000 | [diff] [blame] | 64 | { "glesesrgb", "gpu", "api=gles,color=esrgb" }, |
| 65 | { "glesnarrow", "gpu", "api=gles,color=narrow" }, |
| 66 | { "glesenarrow", "gpu", "api=gles,color=enarrow" }, |
| 67 | { "glesf16", "gpu", "api=gles,color=f16" }, |
Eric Karl | 5c77975 | 2017-05-08 12:02:07 -0700 | [diff] [blame] | 68 | { "glnostencils", "gpu", "api=gl,stencils=false" }, |
Brian Salomon | 50f66d8 | 2017-03-17 14:32:05 -0400 | [diff] [blame] | 69 | { "gldft", "gpu", "api=gl,dit=true" }, |
| 70 | { "glesdft", "gpu", "api=gles,dit=true" }, |
Brian Osman | f981066 | 2017-08-30 10:02:10 -0400 | [diff] [blame] | 71 | { "gltestthreading", "gpu", "api=gl,testThreading=true" }, |
Brian Salomon | 00a5eb8 | 2018-07-11 15:32:05 -0400 | [diff] [blame] | 72 | { "gltestpersistentcache", "gpu", "api=gl,testPersistentCache=true" }, |
Brian Salomon | 6405e71 | 2017-03-20 08:54:16 -0400 | [diff] [blame] | 73 | { "nullgl", "gpu", "api=nullgl" }, |
Brian Salomon | 002c120 | 2016-10-18 11:28:20 -0400 | [diff] [blame] | 74 | { "angle_d3d11_es2", "gpu", "api=angle_d3d11_es2" }, |
Brian Osman | 21d742d | 2017-01-10 13:31:33 -0500 | [diff] [blame] | 75 | { "angle_d3d11_es3", "gpu", "api=angle_d3d11_es3" }, |
Brian Salomon | 002c120 | 2016-10-18 11:28:20 -0400 | [diff] [blame] | 76 | { "angle_d3d9_es2", "gpu", "api=angle_d3d9_es2" }, |
| 77 | { "angle_d3d11_es2_msaa4", "gpu", "api=angle_d3d11_es2,samples=4" }, |
Brian Salomon | 528ca9b | 2017-03-24 11:15:09 -0400 | [diff] [blame] | 78 | { "angle_d3d11_es2_msaa8", "gpu", "api=angle_d3d11_es2,samples=8" }, |
Brian Salomon | 8c86588 | 2017-06-22 09:56:24 -0400 | [diff] [blame] | 79 | { "angle_d3d11_es3_msaa4", "gpu", "api=angle_d3d11_es3,samples=4" }, |
| 80 | { "angle_d3d11_es3_msaa8", "gpu", "api=angle_d3d11_es3,samples=8" }, |
Brian Salomon | 002c120 | 2016-10-18 11:28:20 -0400 | [diff] [blame] | 81 | { "angle_gl_es2", "gpu", "api=angle_gl_es2" }, |
Brian Osman | 21d742d | 2017-01-10 13:31:33 -0500 | [diff] [blame] | 82 | { "angle_gl_es3", "gpu", "api=angle_gl_es3" }, |
Ben Wagner | 7464a26 | 2018-04-19 15:49:18 -0400 | [diff] [blame] | 83 | { "angle_gl_es2_msaa8", "gpu", "api=angle_gl_es2,samples=8" }, |
| 84 | { "angle_gl_es3_msaa8", "gpu", "api=angle_gl_es3,samples=8" }, |
Brian Salomon | 8fe2427 | 2017-07-07 12:56:11 -0400 | [diff] [blame] | 85 | { "commandbuffer", "gpu", "api=commandbuffer" }, |
Ethan Nicholas | 92e01cf | 2018-12-19 13:12:10 -0500 | [diff] [blame] | 86 | { "mock", "gpu", "api=mock" }, |
brianosman | 37e2334 | 2016-09-20 08:06:30 -0700 | [diff] [blame] | 87 | #ifdef SK_VULKAN |
Ethan Nicholas | 92e01cf | 2018-12-19 13:12:10 -0500 | [diff] [blame] | 88 | { "vk", "gpu", "api=vulkan" }, |
| 89 | { "vknostencils", "gpu", "api=vulkan,stencils=false" }, |
| 90 | { "vk1010102", "gpu", "api=vulkan,color=1010102" }, |
| 91 | { "vksrgb", "gpu", "api=vulkan,color=srgb" }, |
| 92 | { "vkesrgb", "gpu", "api=vulkan,color=esrgb" }, |
| 93 | { "vknarrow", "gpu", "api=vulkan,color=narrow" }, |
| 94 | { "vkenarrow", "gpu", "api=vulkan,color=enarrow" }, |
| 95 | { "vkf16", "gpu", "api=vulkan,color=f16" }, |
| 96 | { "vkmsaa4", "gpu", "api=vulkan,samples=4" }, |
| 97 | { "vkmsaa8", "gpu", "api=vulkan,samples=8" }, |
| 98 | { "vkbetex", "gpu", "api=vulkan,surf=betex" }, |
| 99 | { "vkbert", "gpu", "api=vulkan,surf=bert" }, |
| 100 | { "vktestpersistentcache", "gpu", "api=vulkan,testPersistentCache=true" }, |
brianosman | 37e2334 | 2016-09-20 08:06:30 -0700 | [diff] [blame] | 101 | #endif |
Greg Daniel | 2811aa2 | 2017-07-13 15:34:56 -0400 | [diff] [blame] | 102 | #ifdef SK_METAL |
Ethan Nicholas | 92e01cf | 2018-12-19 13:12:10 -0500 | [diff] [blame] | 103 | { "mtl", "gpu", "api=metal" }, |
| 104 | { "mtl1010102", "gpu", "api=metal,color=1010102" }, |
| 105 | { "mtlmsaa4", "gpu", "api=metal,samples=4" }, |
| 106 | { "mtlmsaa8", "gpu", "api=metal,samples=8" }, |
Greg Daniel | 2811aa2 | 2017-07-13 15:34:56 -0400 | [diff] [blame] | 107 | #endif |
brianosman | 37e2334 | 2016-09-20 08:06:30 -0700 | [diff] [blame] | 108 | }; |
Brian Salomon | 00a5eb8 | 2018-07-11 15:32:05 -0400 | [diff] [blame] | 109 | // clang-format on |
brianosman | 37e2334 | 2016-09-20 08:06:30 -0700 | [diff] [blame] | 110 | |
| 111 | static const char configHelp[] = |
Derek Sollenberger | c65386a | 2017-01-05 09:50:22 -0500 | [diff] [blame] | 112 | "Options: 565 8888 srgb f16 nonrendering null pdf pdfa skp pipe svg xps"; |
brianosman | 37e2334 | 2016-09-20 08:06:30 -0700 | [diff] [blame] | 113 | |
| 114 | static const char* config_help_fn() { |
| 115 | static SkString helpString; |
| 116 | helpString.set(configHelp); |
| 117 | for (const auto& config : gPredefinedConfigs) { |
| 118 | helpString.appendf(" %s", config.predefinedConfig); |
| 119 | } |
bsalomon | 808ecbb | 2016-09-28 12:40:22 -0700 | [diff] [blame] | 120 | helpString.append(" or use extended form 'backend[option=value,...]'.\n"); |
brianosman | 37e2334 | 2016-09-20 08:06:30 -0700 | [diff] [blame] | 121 | return helpString.c_str(); |
| 122 | } |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 123 | |
| 124 | static const char configExtendedHelp[] = |
Brian Salomon | 00a5eb8 | 2018-07-11 15:32:05 -0400 | [diff] [blame] | 125 | "Extended form: 'backend(option=value,...)'\n\n" |
| 126 | "Possible backends and options:\n" |
| 127 | "\n" |
| 128 | "gpu[api=string,color=string,dit=bool,nvpr=bool,inst=bool,samples=int]\n" |
| 129 | "\tapi\ttype: string\trequired\n" |
| 130 | "\t Select graphics API to use with gpu backend.\n" |
| 131 | "\t Options:\n" |
| 132 | "\t\tgl \t\t\tUse OpenGL.\n" |
| 133 | "\t\tgles \t\t\tUse OpenGL ES.\n" |
Brian Salomon | 00a5eb8 | 2018-07-11 15:32:05 -0400 | [diff] [blame] | 134 | "\t\tnullgl \t\t\tUse null OpenGL.\n" |
| 135 | "\t\tangle_d3d9_es2\t\tUse OpenGL ES2 on the ANGLE Direct3D9 backend.\n" |
| 136 | "\t\tangle_d3d11_es2\t\tUse OpenGL ES2 on the ANGLE Direct3D11 backend.\n" |
| 137 | "\t\tangle_d3d11_es3\t\tUse OpenGL ES3 on the ANGLE Direct3D11 backend.\n" |
| 138 | "\t\tangle_gl_es2\t\tUse OpenGL ES2 on the ANGLE OpenGL backend.\n" |
| 139 | "\t\tangle_gl_es3\t\tUse OpenGL ES3 on the ANGLE OpenGL backend.\n" |
| 140 | "\t\tcommandbuffer\t\tUse command buffer.\n" |
| 141 | "\t\tmock\t\t\tUse mock context.\n" |
bsalomon | dc0fcd4 | 2016-04-11 14:21:33 -0700 | [diff] [blame] | 142 | #ifdef SK_VULKAN |
Brian Salomon | 00a5eb8 | 2018-07-11 15:32:05 -0400 | [diff] [blame] | 143 | "\t\tvulkan\t\t\tUse Vulkan.\n" |
bsalomon | dc0fcd4 | 2016-04-11 14:21:33 -0700 | [diff] [blame] | 144 | #endif |
Greg Daniel | 2811aa2 | 2017-07-13 15:34:56 -0400 | [diff] [blame] | 145 | #ifdef SK_METAL |
Brian Salomon | 00a5eb8 | 2018-07-11 15:32:05 -0400 | [diff] [blame] | 146 | "\t\tmetal\t\t\tUse Metal.\n" |
Greg Daniel | 2811aa2 | 2017-07-13 15:34:56 -0400 | [diff] [blame] | 147 | #endif |
Brian Salomon | 00a5eb8 | 2018-07-11 15:32:05 -0400 | [diff] [blame] | 148 | "\tcolor\ttype: string\tdefault: 8888.\n" |
| 149 | "\t Select framebuffer color format.\n" |
| 150 | "\t Options:\n" |
| 151 | "\t\t8888\t\t\tLinear 8888.\n" |
| 152 | "\t\t888x\t\t\tLinear 888x.\n" |
| 153 | "\t\t4444\t\t\tLinear 4444.\n" |
| 154 | "\t\t565\t\t\tLinear 565.\n" |
| 155 | "\t\t1010102\t\t\tLinear 1010102.\n" |
| 156 | "\t\tsrgb\t\t\tsRGB 8888.\n" |
| 157 | "\t\tesrgb\t\t\tsRGB 16-bit floating point.\n" |
| 158 | "\t\tnarrow\t\t\tNarrow gamut 8888.\n" |
| 159 | "\t\tenarrow\t\t\tNarrow gamut 16-bit floating point.\n" |
| 160 | "\t\tf16\t\t\tLinearly blended 16-bit floating point.\n" |
| 161 | "\tdit\ttype: bool\tdefault: false.\n" |
| 162 | "\t Use device independent text.\n" |
| 163 | "\tnvpr\ttype: bool\tdefault: false.\n" |
| 164 | "\t Use NV_path_rendering OpenGL and OpenGL ES extension.\n" |
| 165 | "\tsamples\ttype: int\tdefault: 0.\n" |
| 166 | "\t Use multisampling with N samples.\n" |
| 167 | "\tstencils\ttype: bool\tdefault: true.\n" |
| 168 | "\t Allow the use of stencil buffers.\n" |
| 169 | "\ttestThreading\ttype: bool\tdefault: false.\n" |
| 170 | "\t Run with and without worker threads, check that results match.\n" |
| 171 | "\ttestPersistentCache\ttype: bool\tdefault: false.\n" |
| 172 | "\t Run using a pre-warmed GrContextOption::fPersistentCache.\n" |
| 173 | "\tsurf\ttype: string\tdefault: default.\n" |
| 174 | "\t Controls the type of backing store for SkSurfaces.\n" |
| 175 | "\t Options:\n" |
| 176 | "\t\tdefault\t\t\tA renderable texture created in Skia's resource cache.\n" |
| 177 | "\t\tbetex\t\t\tA wrapped backend texture.\n" |
| 178 | "\t\tbert\t\t\tA wrapped backend render target\n" |
| 179 | "\n" |
| 180 | "Predefined configs:\n\n" |
| 181 | // Help text for pre-defined configs is auto-generated from gPredefinedConfigs |
| 182 | ; |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 183 | |
brianosman | 37e2334 | 2016-09-20 08:06:30 -0700 | [diff] [blame] | 184 | static const char* config_extended_help_fn() { |
| 185 | static SkString helpString; |
| 186 | helpString.set(configExtendedHelp); |
| 187 | for (const auto& config : gPredefinedConfigs) { |
| 188 | helpString.appendf("\t%-10s\t= gpu(%s)\n", config.predefinedConfig, config.options); |
| 189 | } |
| 190 | return helpString.c_str(); |
| 191 | } |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 192 | |
brianosman | 37e2334 | 2016-09-20 08:06:30 -0700 | [diff] [blame] | 193 | DEFINE_extended_string(config, defaultConfigs, config_help_fn(), config_extended_help_fn()); |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 194 | |
| 195 | SkCommandLineConfig::SkCommandLineConfig(const SkString& tag, const SkString& backend, |
| 196 | const SkTArray<SkString>& viaParts) |
| 197 | : fTag(tag) |
| 198 | , fBackend(backend) |
| 199 | , fViaParts(viaParts) { |
| 200 | } |
| 201 | SkCommandLineConfig::~SkCommandLineConfig() { |
| 202 | } |
| 203 | |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 204 | static bool parse_option_int(const SkString& value, int* outInt) { |
| 205 | if (value.isEmpty()) { |
| 206 | return false; |
| 207 | } |
| 208 | char* endptr = nullptr; |
| 209 | long intValue = strtol(value.c_str(), &endptr, 10); |
| 210 | if (*endptr != '\0') { |
| 211 | return false; |
| 212 | } |
| 213 | *outInt = static_cast<int>(intValue); |
| 214 | return true; |
| 215 | } |
| 216 | static bool parse_option_bool(const SkString& value, bool* outBool) { |
| 217 | if (value.equals("true")) { |
| 218 | *outBool = true; |
| 219 | return true; |
| 220 | } |
| 221 | if (value.equals("false")) { |
| 222 | *outBool = false; |
| 223 | return true; |
| 224 | } |
| 225 | return false; |
| 226 | } |
| 227 | static bool parse_option_gpu_api(const SkString& value, |
| 228 | SkCommandLineConfigGpu::ContextType* outContextType) { |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 229 | if (value.equals("gl")) { |
bsalomon | 85b4b53 | 2016-04-05 11:06:27 -0700 | [diff] [blame] | 230 | *outContextType = GrContextFactory::kGL_ContextType; |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 231 | return true; |
| 232 | } |
| 233 | if (value.equals("gles")) { |
bsalomon | 85b4b53 | 2016-04-05 11:06:27 -0700 | [diff] [blame] | 234 | *outContextType = GrContextFactory::kGLES_ContextType; |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 235 | return true; |
| 236 | } |
Brian Salomon | 6405e71 | 2017-03-20 08:54:16 -0400 | [diff] [blame] | 237 | if (value.equals("nullgl")) { |
bsalomon | 85b4b53 | 2016-04-05 11:06:27 -0700 | [diff] [blame] | 238 | *outContextType = GrContextFactory::kNullGL_ContextType; |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 239 | return true; |
| 240 | } |
bsalomon | 11abd8d | 2016-10-14 08:13:48 -0700 | [diff] [blame] | 241 | if (value.equals("angle_d3d9_es2")) { |
| 242 | *outContextType = GrContextFactory::kANGLE_D3D9_ES2_ContextType; |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 243 | return true; |
| 244 | } |
bsalomon | 11abd8d | 2016-10-14 08:13:48 -0700 | [diff] [blame] | 245 | if (value.equals("angle_d3d11_es2")) { |
| 246 | *outContextType = GrContextFactory::kANGLE_D3D11_ES2_ContextType; |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 247 | return true; |
| 248 | } |
bsalomon | 11abd8d | 2016-10-14 08:13:48 -0700 | [diff] [blame] | 249 | if (value.equals("angle_d3d11_es3")) { |
| 250 | *outContextType = GrContextFactory::kANGLE_D3D11_ES3_ContextType; |
| 251 | return true; |
| 252 | } |
| 253 | if (value.equals("angle_gl_es2")) { |
| 254 | *outContextType = GrContextFactory::kANGLE_GL_ES2_ContextType; |
| 255 | return true; |
| 256 | } |
| 257 | if (value.equals("angle_gl_es3")) { |
| 258 | *outContextType = GrContextFactory::kANGLE_GL_ES3_ContextType; |
| 259 | return true; |
| 260 | } |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 261 | if (value.equals("commandbuffer")) { |
bsalomon | 85b4b53 | 2016-04-05 11:06:27 -0700 | [diff] [blame] | 262 | *outContextType = GrContextFactory::kCommandBuffer_ContextType; |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 263 | return true; |
| 264 | } |
Brian Salomon | 8fe2427 | 2017-07-07 12:56:11 -0400 | [diff] [blame] | 265 | if (value.equals("mock")) { |
| 266 | *outContextType = GrContextFactory::kMock_ContextType; |
| 267 | return true; |
| 268 | } |
bsalomon | dc0fcd4 | 2016-04-11 14:21:33 -0700 | [diff] [blame] | 269 | #ifdef SK_VULKAN |
| 270 | if (value.equals("vulkan")) { |
| 271 | *outContextType = GrContextFactory::kVulkan_ContextType; |
| 272 | return true; |
| 273 | } |
| 274 | #endif |
Greg Daniel | 2811aa2 | 2017-07-13 15:34:56 -0400 | [diff] [blame] | 275 | #ifdef SK_METAL |
| 276 | if (value.equals("metal")) { |
| 277 | *outContextType = GrContextFactory::kMetal_ContextType; |
| 278 | return true; |
| 279 | } |
| 280 | #endif |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 281 | return false; |
| 282 | } |
Brian Salomon | f865b05 | 2018-03-09 09:01:53 -0500 | [diff] [blame] | 283 | |
brianosman | d93c120 | 2016-03-10 07:49:08 -0800 | [diff] [blame] | 284 | static bool parse_option_gpu_color(const SkString& value, |
| 285 | SkColorType* outColorType, |
Brian Salomon | ce5ee60 | 2017-07-17 11:31:31 -0400 | [diff] [blame] | 286 | SkAlphaType* alphaType, |
brianosman | b109b8c | 2016-06-16 13:03:24 -0700 | [diff] [blame] | 287 | sk_sp<SkColorSpace>* outColorSpace) { |
Brian Salomon | ce5ee60 | 2017-07-17 11:31:31 -0400 | [diff] [blame] | 288 | // We always use premul unless the color type is 565. |
| 289 | *alphaType = kPremul_SkAlphaType; |
| 290 | |
brianosman | d93c120 | 2016-03-10 07:49:08 -0800 | [diff] [blame] | 291 | if (value.equals("8888")) { |
bsalomon | 3306925 | 2016-09-28 08:49:53 -0700 | [diff] [blame] | 292 | *outColorType = kRGBA_8888_SkColorType; |
brianosman | b109b8c | 2016-06-16 13:03:24 -0700 | [diff] [blame] | 293 | *outColorSpace = nullptr; |
Brian Salomon | 5fba7ad | 2018-03-22 10:01:16 -0400 | [diff] [blame] | 294 | } else if (value.equals("888x")) { |
| 295 | *outColorType = kRGB_888x_SkColorType; |
| 296 | *outColorSpace = nullptr; |
Brian Salomon | ce5ee60 | 2017-07-17 11:31:31 -0400 | [diff] [blame] | 297 | } else if (value.equals("4444")) { |
| 298 | *outColorType = kARGB_4444_SkColorType; |
| 299 | *outColorSpace = nullptr; |
Brian Salomon | ce5ee60 | 2017-07-17 11:31:31 -0400 | [diff] [blame] | 300 | } else if (value.equals("565")) { |
| 301 | *outColorType = kRGB_565_SkColorType; |
| 302 | *alphaType = kOpaque_SkAlphaType; |
| 303 | *outColorSpace = nullptr; |
Brian Osman | 10fc6fd | 2018-03-02 11:01:10 -0500 | [diff] [blame] | 304 | } else if (value.equals("1010102")) { |
| 305 | *outColorType = kRGBA_1010102_SkColorType; |
| 306 | *outColorSpace = nullptr; |
Brian Osman | a15cedb | 2018-05-30 15:36:38 -0400 | [diff] [blame] | 307 | } else if (value.equals("srgb")) { |
Brian Osman | a15cedb | 2018-05-30 15:36:38 -0400 | [diff] [blame] | 308 | *outColorType = kRGBA_8888_SkColorType; |
| 309 | *outColorSpace = SkColorSpace::MakeSRGB(); |
Brian Osman | a76b7a9 | 2018-07-18 14:36:43 -0400 | [diff] [blame] | 310 | } else if (value.equals("p3")) { |
| 311 | *outColorType = kRGBA_8888_SkColorType; |
Brian Osman | 82ebe04 | 2019-01-04 17:03:00 -0500 | [diff] [blame] | 312 | *outColorSpace = SkColorSpace::MakeRGB(SkNamedTransferFn::kSRGB, SkNamedGamut::kDCIP3); |
Brian Osman | a66f4da | 2018-06-28 17:52:02 +0000 | [diff] [blame] | 313 | } else if (value.equals("esrgb")) { |
| 314 | *outColorType = kRGBA_F16_SkColorType; |
Brian Osman | a15cedb | 2018-05-30 15:36:38 -0400 | [diff] [blame] | 315 | *outColorSpace = SkColorSpace::MakeSRGB(); |
Brian Osman | a66f4da | 2018-06-28 17:52:02 +0000 | [diff] [blame] | 316 | } else if (value.equals("narrow") || value.equals("enarrow")) { |
Brian Osman | a66f4da | 2018-06-28 17:52:02 +0000 | [diff] [blame] | 317 | *outColorType = value.equals("narrow") ? kRGBA_8888_SkColorType : kRGBA_F16_SkColorType; |
Brian Osman | 82ebe04 | 2019-01-04 17:03:00 -0500 | [diff] [blame] | 318 | *outColorSpace = SkColorSpace::MakeRGB(SkNamedTransferFn::k2Dot2, gNarrow_toXYZD50); |
Brian Osman | a15cedb | 2018-05-30 15:36:38 -0400 | [diff] [blame] | 319 | } else if (value.equals("f16")) { |
| 320 | *outColorType = kRGBA_F16_SkColorType; |
| 321 | *outColorSpace = SkColorSpace::MakeSRGBLinear(); |
Brian Osman | a15cedb | 2018-05-30 15:36:38 -0400 | [diff] [blame] | 322 | } else { |
brianosman | 4562f6e | 2016-09-19 14:42:04 -0700 | [diff] [blame] | 323 | return false; |
| 324 | } |
Brian Osman | a15cedb | 2018-05-30 15:36:38 -0400 | [diff] [blame] | 325 | return true; |
brianosman | d93c120 | 2016-03-10 07:49:08 -0800 | [diff] [blame] | 326 | } |
Brian Salomon | f865b05 | 2018-03-09 09:01:53 -0500 | [diff] [blame] | 327 | |
| 328 | static bool parse_option_gpu_surf_type(const SkString& value, |
| 329 | SkCommandLineConfigGpu::SurfType* surfType) { |
| 330 | if (value.equals("default")) { |
| 331 | *surfType = SkCommandLineConfigGpu::SurfType::kDefault; |
| 332 | return true; |
| 333 | } |
| 334 | if (value.equals("betex")) { |
| 335 | *surfType = SkCommandLineConfigGpu::SurfType::kBackendTexture; |
| 336 | return true; |
| 337 | } |
| 338 | if (value.equals("bert")) { |
| 339 | *surfType = SkCommandLineConfigGpu::SurfType::kBackendRenderTarget; |
| 340 | return true; |
| 341 | } |
| 342 | return false; |
| 343 | } |
Bryce Thomas | 95a7b76 | 2018-03-02 13:54:21 -0800 | [diff] [blame] | 344 | |
| 345 | // Extended options take form --config item[key1=value1,key2=value2,...] |
| 346 | // Example: --config gpu[api=gl,color=8888] |
| 347 | class ExtendedOptions { |
| 348 | public: |
| 349 | ExtendedOptions(const SkString& optionsString, bool* outParseSucceeded) { |
| 350 | SkTArray<SkString> optionParts; |
| 351 | SkStrSplit(optionsString.c_str(), ",", kStrict_SkStrSplitMode, &optionParts); |
| 352 | for (int i = 0; i < optionParts.count(); ++i) { |
| 353 | SkTArray<SkString> keyValueParts; |
| 354 | SkStrSplit(optionParts[i].c_str(), "=", kStrict_SkStrSplitMode, &keyValueParts); |
| 355 | if (keyValueParts.count() != 2) { |
| 356 | *outParseSucceeded = false; |
| 357 | return; |
| 358 | } |
| 359 | const SkString& key = keyValueParts[0]; |
| 360 | const SkString& value = keyValueParts[1]; |
| 361 | if (fOptionsMap.find(key) == nullptr) { |
| 362 | fOptionsMap.set(key, value); |
| 363 | } else { |
| 364 | // Duplicate values are not allowed. |
| 365 | *outParseSucceeded = false; |
| 366 | return; |
| 367 | } |
| 368 | } |
| 369 | *outParseSucceeded = true; |
| 370 | } |
| 371 | |
Bryce Thomas | 95a7b76 | 2018-03-02 13:54:21 -0800 | [diff] [blame] | 372 | bool get_option_gpu_color(const char* optionKey, |
| 373 | SkColorType* outColorType, |
| 374 | SkAlphaType* alphaType, |
| 375 | sk_sp<SkColorSpace>* outColorSpace, |
| 376 | bool optional = true) const { |
| 377 | SkString* optionValue = fOptionsMap.find(SkString(optionKey)); |
| 378 | if (optionValue == nullptr) { |
| 379 | return optional; |
| 380 | } |
| 381 | return parse_option_gpu_color(*optionValue, outColorType, alphaType, outColorSpace); |
| 382 | } |
| 383 | |
| 384 | bool get_option_gpu_api(const char* optionKey, |
| 385 | SkCommandLineConfigGpu::ContextType* outContextType, |
| 386 | bool optional = true) const { |
| 387 | SkString* optionValue = fOptionsMap.find(SkString(optionKey)); |
| 388 | if (optionValue == nullptr) { |
| 389 | return optional; |
| 390 | } |
| 391 | return parse_option_gpu_api(*optionValue, outContextType); |
| 392 | } |
Brian Salomon | f865b05 | 2018-03-09 09:01:53 -0500 | [diff] [blame] | 393 | |
| 394 | bool get_option_gpu_surf_type(const char* optionKey, |
| 395 | SkCommandLineConfigGpu::SurfType* outSurfType, |
| 396 | bool optional = true) const { |
| 397 | SkString* optionValue = fOptionsMap.find(SkString(optionKey)); |
| 398 | if (optionValue == nullptr) { |
| 399 | return optional; |
| 400 | } |
| 401 | return parse_option_gpu_surf_type(*optionValue, outSurfType); |
| 402 | } |
Bryce Thomas | 95a7b76 | 2018-03-02 13:54:21 -0800 | [diff] [blame] | 403 | |
| 404 | bool get_option_int(const char* optionKey, int* outInt, bool optional = true) const { |
| 405 | SkString* optionValue = fOptionsMap.find(SkString(optionKey)); |
| 406 | if (optionValue == nullptr) { |
| 407 | return optional; |
| 408 | } |
| 409 | return parse_option_int(*optionValue, outInt); |
| 410 | } |
| 411 | |
| 412 | bool get_option_bool(const char* optionKey, bool* outBool, bool optional = true) const { |
| 413 | SkString* optionValue = fOptionsMap.find(SkString(optionKey)); |
| 414 | if (optionValue == nullptr) { |
| 415 | return optional; |
| 416 | } |
| 417 | return parse_option_bool(*optionValue, outBool); |
| 418 | } |
| 419 | |
| 420 | private: |
| 421 | SkTHashMap<SkString, SkString> fOptionsMap; |
| 422 | }; |
| 423 | |
Bryce Thomas | 95a7b76 | 2018-03-02 13:54:21 -0800 | [diff] [blame] | 424 | SkCommandLineConfigGpu::SkCommandLineConfigGpu( |
Brian Salomon | f865b05 | 2018-03-09 09:01:53 -0500 | [diff] [blame] | 425 | const SkString& tag, const SkTArray<SkString>& viaParts, ContextType contextType, |
| 426 | bool useNVPR, bool useDIText, int samples, SkColorType colorType, SkAlphaType alphaType, |
| 427 | sk_sp<SkColorSpace> colorSpace, bool useStencilBuffers, bool testThreading, |
Brian Salomon | 00a5eb8 | 2018-07-11 15:32:05 -0400 | [diff] [blame] | 428 | bool testPersistentCache, SurfType surfType) |
Bryce Thomas | 95a7b76 | 2018-03-02 13:54:21 -0800 | [diff] [blame] | 429 | : SkCommandLineConfig(tag, SkString("gpu"), viaParts) |
| 430 | , fContextType(contextType) |
| 431 | , fContextOverrides(ContextOverrides::kNone) |
| 432 | , fUseDIText(useDIText) |
| 433 | , fSamples(samples) |
| 434 | , fColorType(colorType) |
| 435 | , fAlphaType(alphaType) |
| 436 | , fColorSpace(std::move(colorSpace)) |
Brian Salomon | f865b05 | 2018-03-09 09:01:53 -0500 | [diff] [blame] | 437 | , fTestThreading(testThreading) |
Brian Salomon | 00a5eb8 | 2018-07-11 15:32:05 -0400 | [diff] [blame] | 438 | , fTestPersistentCache(testPersistentCache) |
Brian Salomon | f865b05 | 2018-03-09 09:01:53 -0500 | [diff] [blame] | 439 | , fSurfType(surfType) { |
Bryce Thomas | 95a7b76 | 2018-03-02 13:54:21 -0800 | [diff] [blame] | 440 | if (useNVPR) { |
| 441 | fContextOverrides |= ContextOverrides::kRequireNVPRSupport; |
| 442 | } else { |
| 443 | // We don't disable NVPR for instanced configs. Otherwise the caps wouldn't use mixed |
| 444 | // samples and we couldn't test the mixed samples backend for simple shapes. |
| 445 | fContextOverrides |= ContextOverrides::kDisableNVPR; |
| 446 | } |
Bryce Thomas | 95a7b76 | 2018-03-02 13:54:21 -0800 | [diff] [blame] | 447 | if (!useStencilBuffers) { |
| 448 | fContextOverrides |= ContextOverrides::kAvoidStencilBuffers; |
| 449 | } |
| 450 | } |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 451 | |
| 452 | SkCommandLineConfigGpu* parse_command_line_config_gpu(const SkString& tag, |
| 453 | const SkTArray<SkString>& vias, |
| 454 | const SkString& options) { |
| 455 | // Defaults for GPU backend. |
Brian Salomon | 6405e71 | 2017-03-20 08:54:16 -0400 | [diff] [blame] | 456 | SkCommandLineConfigGpu::ContextType contextType = GrContextFactory::kGL_ContextType; |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 457 | bool useNVPR = false; |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 458 | bool useDIText = false; |
Brian Salomon | bdecacf | 2018-02-02 20:32:49 -0500 | [diff] [blame] | 459 | int samples = 1; |
bsalomon | 3306925 | 2016-09-28 08:49:53 -0700 | [diff] [blame] | 460 | SkColorType colorType = kRGBA_8888_SkColorType; |
Brian Salomon | ce5ee60 | 2017-07-17 11:31:31 -0400 | [diff] [blame] | 461 | SkAlphaType alphaType = kPremul_SkAlphaType; |
brianosman | b109b8c | 2016-06-16 13:03:24 -0700 | [diff] [blame] | 462 | sk_sp<SkColorSpace> colorSpace = nullptr; |
Eric Karl | 5c77975 | 2017-05-08 12:02:07 -0700 | [diff] [blame] | 463 | bool useStencils = true; |
Brian Osman | f981066 | 2017-08-30 10:02:10 -0400 | [diff] [blame] | 464 | bool testThreading = false; |
Brian Salomon | 00a5eb8 | 2018-07-11 15:32:05 -0400 | [diff] [blame] | 465 | bool testPersistentCache = false; |
Brian Salomon | f865b05 | 2018-03-09 09:01:53 -0500 | [diff] [blame] | 466 | SkCommandLineConfigGpu::SurfType surfType = SkCommandLineConfigGpu::SurfType::kDefault; |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 467 | |
Bryce Thomas | 95a7b76 | 2018-03-02 13:54:21 -0800 | [diff] [blame] | 468 | bool parseSucceeded = false; |
| 469 | ExtendedOptions extendedOptions(options, &parseSucceeded); |
| 470 | if (!parseSucceeded) { |
Brian Salomon | 6405e71 | 2017-03-20 08:54:16 -0400 | [diff] [blame] | 471 | return nullptr; |
| 472 | } |
Bryce Thomas | 95a7b76 | 2018-03-02 13:54:21 -0800 | [diff] [blame] | 473 | |
| 474 | bool validOptions = |
| 475 | extendedOptions.get_option_gpu_api("api", &contextType, false) && |
| 476 | extendedOptions.get_option_bool("nvpr", &useNVPR) && |
| 477 | extendedOptions.get_option_bool("dit", &useDIText) && |
| 478 | extendedOptions.get_option_int("samples", &samples) && |
| 479 | extendedOptions.get_option_gpu_color("color", &colorType, &alphaType, &colorSpace) && |
| 480 | extendedOptions.get_option_bool("stencils", &useStencils) && |
Brian Salomon | f865b05 | 2018-03-09 09:01:53 -0500 | [diff] [blame] | 481 | extendedOptions.get_option_bool("testThreading", &testThreading) && |
Brian Salomon | 00a5eb8 | 2018-07-11 15:32:05 -0400 | [diff] [blame] | 482 | extendedOptions.get_option_bool("testPersistentCache", &testPersistentCache) && |
Brian Salomon | f865b05 | 2018-03-09 09:01:53 -0500 | [diff] [blame] | 483 | extendedOptions.get_option_gpu_surf_type("surf", &surfType); |
Bryce Thomas | 95a7b76 | 2018-03-02 13:54:21 -0800 | [diff] [blame] | 484 | |
Brian Salomon | 00a5eb8 | 2018-07-11 15:32:05 -0400 | [diff] [blame] | 485 | // testing threading and the persistent cache are mutually exclusive. |
| 486 | if (!validOptions || (testThreading && testPersistentCache)) { |
Bryce Thomas | 95a7b76 | 2018-03-02 13:54:21 -0800 | [diff] [blame] | 487 | return nullptr; |
| 488 | } |
| 489 | |
Brian Salomon | f865b05 | 2018-03-09 09:01:53 -0500 | [diff] [blame] | 490 | return new SkCommandLineConfigGpu(tag, vias, contextType, useNVPR, useDIText, samples, |
| 491 | colorType, alphaType, colorSpace, useStencils, testThreading, |
Brian Salomon | 00a5eb8 | 2018-07-11 15:32:05 -0400 | [diff] [blame] | 492 | testPersistentCache, surfType); |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 493 | } |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 494 | |
Bryce Thomas | 95a7b76 | 2018-03-02 13:54:21 -0800 | [diff] [blame] | 495 | SkCommandLineConfigSvg::SkCommandLineConfigSvg(const SkString& tag, |
| 496 | const SkTArray<SkString>& viaParts, int pageIndex) |
| 497 | : SkCommandLineConfig(tag, SkString("svg"), viaParts), fPageIndex(pageIndex) {} |
| 498 | |
| 499 | SkCommandLineConfigSvg* parse_command_line_config_svg(const SkString& tag, |
| 500 | const SkTArray<SkString>& vias, |
| 501 | const SkString& options) { |
| 502 | // Defaults for SVG backend. |
| 503 | int pageIndex = 0; |
| 504 | |
| 505 | bool parseSucceeded = false; |
| 506 | ExtendedOptions extendedOptions(options, &parseSucceeded); |
| 507 | if (!parseSucceeded) { |
| 508 | return nullptr; |
| 509 | } |
| 510 | |
| 511 | bool validOptions = extendedOptions.get_option_int("page", &pageIndex); |
| 512 | |
| 513 | if (!validOptions) { |
| 514 | return nullptr; |
| 515 | } |
| 516 | |
| 517 | return new SkCommandLineConfigSvg(tag, vias, pageIndex); |
| 518 | } |
| 519 | |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 520 | void ParseConfigs(const SkCommandLineFlags::StringArray& configs, |
| 521 | SkCommandLineConfigArray* outResult) { |
| 522 | outResult->reset(); |
| 523 | for (int i = 0; i < configs.count(); ++i) { |
| 524 | SkString extendedBackend; |
| 525 | SkString extendedOptions; |
| 526 | SkString simpleBackend; |
| 527 | SkTArray<SkString> vias; |
| 528 | |
| 529 | SkString tag(configs[i]); |
| 530 | SkTArray<SkString> parts; |
bsalomon | 808ecbb | 2016-09-28 12:40:22 -0700 | [diff] [blame] | 531 | SkStrSplit(tag.c_str(), "[", kStrict_SkStrSplitMode, &parts); |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 532 | if (parts.count() == 2) { |
| 533 | SkTArray<SkString> parts2; |
bsalomon | 808ecbb | 2016-09-28 12:40:22 -0700 | [diff] [blame] | 534 | SkStrSplit(parts[1].c_str(), "]", kStrict_SkStrSplitMode, &parts2); |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 535 | if (parts2.count() == 2 && parts2[1].isEmpty()) { |
| 536 | SkStrSplit(parts[0].c_str(), "-", kStrict_SkStrSplitMode, &vias); |
| 537 | if (vias.count()) { |
| 538 | extendedBackend = vias[vias.count() - 1]; |
| 539 | vias.pop_back(); |
| 540 | } else { |
| 541 | extendedBackend = parts[0]; |
| 542 | } |
| 543 | extendedOptions = parts2[0]; |
bsalomon | 808ecbb | 2016-09-28 12:40:22 -0700 | [diff] [blame] | 544 | simpleBackend.printf("%s[%s]", extendedBackend.c_str(), extendedOptions.c_str()); |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 545 | } |
| 546 | } |
| 547 | |
| 548 | if (extendedBackend.isEmpty()) { |
| 549 | simpleBackend = tag; |
| 550 | SkStrSplit(tag.c_str(), "-", kStrict_SkStrSplitMode, &vias); |
| 551 | if (vias.count()) { |
| 552 | simpleBackend = vias[vias.count() - 1]; |
| 553 | vias.pop_back(); |
| 554 | } |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 555 | for (auto& predefinedConfig : gPredefinedConfigs) { |
| 556 | if (simpleBackend.equals(predefinedConfig.predefinedConfig)) { |
| 557 | extendedBackend = predefinedConfig.backend; |
| 558 | extendedOptions = predefinedConfig.options; |
| 559 | break; |
| 560 | } |
| 561 | } |
| 562 | } |
| 563 | SkCommandLineConfig* parsedConfig = nullptr; |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 564 | if (extendedBackend.equals("gpu")) { |
| 565 | parsedConfig = parse_command_line_config_gpu(tag, vias, extendedOptions); |
| 566 | } |
Bryce Thomas | 95a7b76 | 2018-03-02 13:54:21 -0800 | [diff] [blame] | 567 | if (extendedBackend.equals("svg")) { |
| 568 | parsedConfig = parse_command_line_config_svg(tag, vias, extendedOptions); |
| 569 | } |
kkinnunen | 3e980c3 | 2015-12-23 01:33:00 -0800 | [diff] [blame] | 570 | if (!parsedConfig) { |
| 571 | parsedConfig = new SkCommandLineConfig(tag, simpleBackend, vias); |
| 572 | } |
| 573 | outResult->emplace_back(parsedConfig); |
| 574 | } |
| 575 | } |