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

Side by Side Diff: tools/flags/SkCommonFlagsConfig.cpp

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

Powered by Google App Engine
This is Rietveld 408576698