Chromium Code Reviews| 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 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 " angle" | 21 " angle" |
| 22 #endif | 22 #endif |
| 23 #endif | 23 #endif |
| 24 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 24 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
| 25 " hwui" | 25 " hwui" |
| 26 #endif | 26 #endif |
| 27 ; | 27 ; |
| 28 | 28 |
| 29 static const char configHelp[] = | 29 static const char configHelp[] = |
| 30 "Options: 565 8888 debug gpu gl gpudebug gpudft gpunull " | 30 "Options: 565 8888 debug gpu gl gpudebug gpudft gpunull " |
| 31 "msaa16 msaa4 glmsaa4 gpuf16 gpusrgb glsrgb nonrendering null nullgpu " | 31 "msaa16 msaa4 glmsaa4 gpuf16 gpusrgb gpuwide glsrgb nonrendering null nullgp u " |
| 32 "nvpr16 nvpr4 nvprdit16 nvprdit4 glnvpr4 glnvprdit4 pdf skp svg xps" | 32 "nvpr16 nvpr4 nvprdit16 nvprdit4 glnvpr4 glnvprdit4 pdf skp svg xps " |
| 33 "glinst glinst4 glinstdit4 glinst16 glinstdit16 esinst esinst4 esinsdit4" | 33 "glinst glinst4 glinstdit4 glinst16 glinstdit16 esinst esinst4 esinsdit4" |
| 34 #if SK_ANGLE | 34 #if SK_ANGLE |
| 35 #ifdef SK_BUILD_FOR_WIN | 35 #ifdef SK_BUILD_FOR_WIN |
| 36 " angle" | 36 " angle" |
| 37 #endif | 37 #endif |
| 38 " angle-gl" | 38 " angle-gl" |
| 39 #endif | 39 #endif |
| 40 #if SK_COMMAND_BUFFER | 40 #if SK_COMMAND_BUFFER |
| 41 " commandbuffer" | 41 " commandbuffer" |
| 42 #endif | 42 #endif |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 #if SK_MESA | 77 #if SK_MESA |
| 78 "\t\tmesa\t\t\tUse MESA.\n" | 78 "\t\tmesa\t\t\tUse MESA.\n" |
| 79 #endif | 79 #endif |
| 80 #ifdef SK_VULKAN | 80 #ifdef SK_VULKAN |
| 81 "\t\tvulkan\t\t\tUse Vulkan.\n" | 81 "\t\tvulkan\t\t\tUse Vulkan.\n" |
| 82 #endif | 82 #endif |
| 83 "\tcolor\ttype: string\tdefault: 8888.\n" | 83 "\tcolor\ttype: string\tdefault: 8888.\n" |
| 84 "\t Select framebuffer color format.\n" | 84 "\t Select framebuffer color format.\n" |
| 85 "\t Options:\n" | 85 "\t Options:\n" |
| 86 "\t\t8888\t\t\tLinear 8888.\n" | 86 "\t\t8888\t\t\tLinear 8888.\n" |
| 87 "\t\tf16 \t\t\tLinear 16-bit floating point.\n" | 87 "\t\tf16{_gamut}\t\tLinear 16-bit floating point.\n" |
| 88 "\t\tsrgb\t\t\tsRGB 8888.\n" | 88 "\t\tsrgb{_gamut}\t\tsRGB 8888.\n" |
| 89 "\t gamut\ttype: string\tdefault: srgb.\n" | |
| 90 "\t Select color gamut for f16 or sRGB format buffers.\n" | |
| 91 "\t Options:\n" | |
| 92 "\t\tsrgb\t\t\tsRGB gamut.\n" | |
| 93 "\t\twide\t\t\tWide Gamut RGB.\n" | |
| 89 "\tdit\ttype: bool\tdefault: false.\n" | 94 "\tdit\ttype: bool\tdefault: false.\n" |
| 90 "\t Use device independent text.\n" | 95 "\t Use device independent text.\n" |
| 91 "\tnvpr\ttype: bool\tdefault: false.\n" | 96 "\tnvpr\ttype: bool\tdefault: false.\n" |
| 92 "\t Use NV_path_rendering OpenGL and OpenGL ES extension.\n" | 97 "\t Use NV_path_rendering OpenGL and OpenGL ES extension.\n" |
| 93 "\tsamples\ttype: int\tdefault: 0.\n" | 98 "\tsamples\ttype: int\tdefault: 0.\n" |
| 94 "\t Use multisampling with N samples.\n" | 99 "\t Use multisampling with N samples.\n" |
| 95 "\n" | 100 "\n" |
| 96 "Predefined configs:\n\n" | 101 "Predefined configs:\n\n" |
| 97 "\tgpu \t= gpu()\n" | 102 "\tgpu \t= gpu()\n" |
| 98 "\tgl \t= gpu(api=gl)\n" | 103 "\tgl \t= gpu(api=gl)\n" |
| 99 "\tmsaa4 \t= gpu(samples=4)\n" | 104 "\tmsaa4 \t= gpu(samples=4)\n" |
| 100 "\tglmsaa4 \t= gpu(api=gl,samples=4)\n" | 105 "\tglmsaa4 \t= gpu(api=gl,samples=4)\n" |
| 101 "\tmsaa16 \t= gpu(samples=16)\n" | 106 "\tmsaa16 \t= gpu(samples=16)\n" |
| 102 "\tnvpr4 \t= gpu(nvpr=true,samples=4)\n" | 107 "\tnvpr4 \t= gpu(nvpr=true,samples=4)\n" |
| 103 "\tglnvpr4 \t= gpu(api=gl,nvpr=true,samples=4)\n" | 108 "\tglnvpr4 \t= gpu(api=gl,nvpr=true,samples=4)\n" |
| 104 "\tnvpr16 \t= gpu(nvpr=true,samples=16)\n" | 109 "\tnvpr16 \t= gpu(nvpr=true,samples=16)\n" |
| 105 "\tnvprdit4 \t= gpu(nvpr=true,samples=4,dit=true)\n" | 110 "\tnvprdit4 \t= gpu(nvpr=true,samples=4,dit=true)\n" |
| 106 "\tglnvprdit4\t= gpu(api=gl,nvpr=true,samples=4,dit=true)\n" | 111 "\tglnvprdit4\t= gpu(api=gl,nvpr=true,samples=4,dit=true)\n" |
| 107 "\tnvprdit16 \t= gpu(nvpr=true,samples=16,dit=true)\n" | 112 "\tnvprdit16 \t= gpu(nvpr=true,samples=16,dit=true)\n" |
| 108 "\tgpuf16 \t= gpu(color=f16)\n" | 113 "\tgpuf16 \t= gpu(color=f16)\n" |
| 109 "\tgpusrgb \t= gpu(color=srgb)\n" | 114 "\tgpusrgb \t= gpu(color=srgb)\n" |
| 115 "\tgpuwide \t= gpu(color=f16_wide)\n" | |
| 110 "\tglsrgb \t= gpu(api=gl,color=srgb)\n" | 116 "\tglsrgb \t= gpu(api=gl,color=srgb)\n" |
| 111 "\tgpudft \t= gpu(dit=true)\n" | 117 "\tgpudft \t= gpu(dit=true)\n" |
| 112 "\tgpudebug \t= gpu(api=debug)\n" | 118 "\tgpudebug \t= gpu(api=debug)\n" |
| 113 "\tgpunull \t= gpu(api=null)\n" | 119 "\tgpunull \t= gpu(api=null)\n" |
| 114 "\tdebug \t= gpu(api=debug)\n" | 120 "\tdebug \t= gpu(api=debug)\n" |
| 115 "\tnullgpu \t= gpu(api=null)\n" | 121 "\tnullgpu \t= gpu(api=null)\n" |
| 116 #if SK_ANGLE | 122 #if SK_ANGLE |
| 117 #ifdef SK_BUILD_FOR_WIN | 123 #ifdef SK_BUILD_FOR_WIN |
| 118 "\tangle \t= gpu(api=angle)\n" | 124 "\tangle \t= gpu(api=angle)\n" |
| 119 #endif | 125 #endif |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 { "glinst", "gpu", "api=gl,inst=true" }, | 162 { "glinst", "gpu", "api=gl,inst=true" }, |
| 157 { "glinst4", "gpu", "api=gl,inst=true,samples=4" }, | 163 { "glinst4", "gpu", "api=gl,inst=true,samples=4" }, |
| 158 { "glinstdit4", "gpu", "api=gl,inst=true,samples=4,dit=true" }, | 164 { "glinstdit4", "gpu", "api=gl,inst=true,samples=4,dit=true" }, |
| 159 { "glinst16", "gpu", "api=gl,inst=true,samples=16" }, | 165 { "glinst16", "gpu", "api=gl,inst=true,samples=16" }, |
| 160 { "glinstdit16", "gpu", "api=gl,inst=true,samples=16,dit=true" }, | 166 { "glinstdit16", "gpu", "api=gl,inst=true,samples=16,dit=true" }, |
| 161 { "esinst", "gpu", "api=gles,inst=true" }, | 167 { "esinst", "gpu", "api=gles,inst=true" }, |
| 162 { "esinst4", "gpu", "api=gles,inst=true,samples=4" }, | 168 { "esinst4", "gpu", "api=gles,inst=true,samples=4" }, |
| 163 { "esinstdit4", "gpu", "api=gles,inst=true,samples=4,dit=true" }, | 169 { "esinstdit4", "gpu", "api=gles,inst=true,samples=4,dit=true" }, |
| 164 { "gpuf16", "gpu", "color=f16" }, | 170 { "gpuf16", "gpu", "color=f16" }, |
| 165 { "gpusrgb", "gpu", "color=srgb" }, | 171 { "gpusrgb", "gpu", "color=srgb" }, |
| 172 { "gpuwide", "gpu", "color=f16_wide" }, | |
| 166 { "glsrgb", "gpu", "api=gl,color=srgb" }, | 173 { "glsrgb", "gpu", "api=gl,color=srgb" }, |
| 167 { "gpudft", "gpu", "dit=true" }, | 174 { "gpudft", "gpu", "dit=true" }, |
| 168 { "gpudebug", "gpu", "api=debug" }, | 175 { "gpudebug", "gpu", "api=debug" }, |
| 169 { "gpunull", "gpu", "api=null" }, | 176 { "gpunull", "gpu", "api=null" }, |
| 170 { "debug", "gpu", "api=debug" }, | 177 { "debug", "gpu", "api=debug" }, |
| 171 { "nullgpu", "gpu", "api=null" } | 178 { "nullgpu", "gpu", "api=null" } |
| 172 #if SK_ANGLE | 179 #if SK_ANGLE |
| 173 #ifdef SK_BUILD_FOR_WIN | 180 #ifdef SK_BUILD_FOR_WIN |
| 174 , { "angle", "gpu", "api=angle" } | 181 , { "angle", "gpu", "api=angle" } |
| 175 #endif | 182 #endif |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 return false; | 305 return false; |
| 299 } | 306 } |
| 300 static bool parse_option_gpu_color(const SkString& value, | 307 static bool parse_option_gpu_color(const SkString& value, |
| 301 SkColorType* outColorType, | 308 SkColorType* outColorType, |
| 302 sk_sp<SkColorSpace>* outColorSpace) { | 309 sk_sp<SkColorSpace>* outColorSpace) { |
| 303 if (value.equals("8888")) { | 310 if (value.equals("8888")) { |
| 304 *outColorType = kN32_SkColorType; | 311 *outColorType = kN32_SkColorType; |
| 305 *outColorSpace = nullptr; | 312 *outColorSpace = nullptr; |
| 306 return true; | 313 return true; |
| 307 } | 314 } |
| 308 if (value.equals("f16")) { | 315 |
| 316 SkTArray<SkString> commands; | |
| 317 SkStrSplit(value.c_str(), "_", &commands); | |
|
Brian Osman
2016/09/19 19:39:19
I realize this is unfortunate (introducing a new m
| |
| 318 if (commands.count() < 1 || commands.count() > 2) { | |
| 319 return false; | |
| 320 } | |
| 321 | |
| 322 // First, figure out color gamut that we'll work in (default to sRGB) | |
| 323 sk_sp<SkColorSpace> colorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_ Named); | |
| 324 if (commands.count() == 2) { | |
| 325 if (commands[1].equals("srgb")) { | |
| 326 // sRGB gamut (which is our default) | |
| 327 } else if (commands[1].equals("wide")) { | |
| 328 // WideGamut RGB | |
| 329 const float gWideGamutRGB_toXYZD50[]{ | |
| 330 0.7161046f, 0.1009296f, 0.1471858f, // -> X | |
| 331 0.2581874f, 0.7249378f, 0.0168748f, // -> Y | |
| 332 0.0000000f, 0.0517813f, 0.7734287f, // -> Z | |
| 333 }; | |
| 334 SkMatrix44 wideGamutRGBMatrix(SkMatrix44::kUninitialized_Constructor ); | |
| 335 wideGamutRGBMatrix.set3x3RowMajorf(gWideGamutRGB_toXYZD50); | |
| 336 colorSpace = SkColorSpace::NewRGB(SkColorSpace::kSRGB_RenderTargetGa mma, | |
| 337 wideGamutRGBMatrix); | |
| 338 } else { | |
| 339 // Unknown color gamut | |
| 340 return false; | |
| 341 } | |
| 342 } | |
| 343 | |
| 344 // Now pick a color type | |
| 345 if (commands[0].equals("f16")) { | |
| 309 *outColorType = kRGBA_F16_SkColorType; | 346 *outColorType = kRGBA_F16_SkColorType; |
| 310 *outColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named)->make LinearGamma(); | 347 *outColorSpace = colorSpace->makeLinearGamma(); |
| 311 return true; | 348 return true; |
| 312 } | 349 } |
| 313 if (value.equals("srgb")) { | 350 if (commands[0].equals("srgb")) { |
| 314 *outColorType = kN32_SkColorType; | 351 *outColorType = kN32_SkColorType; |
| 315 *outColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); | 352 *outColorSpace = colorSpace; |
| 316 return true; | 353 return true; |
| 317 } | 354 } |
| 318 return false; | 355 return false; |
| 319 } | 356 } |
| 320 | 357 |
| 321 SkCommandLineConfigGpu* parse_command_line_config_gpu(const SkString& tag, | 358 SkCommandLineConfigGpu* parse_command_line_config_gpu(const SkString& tag, |
| 322 const SkTArray<SkString>& vias, | 359 const SkTArray<SkString>& vias, |
| 323 const SkString& options) { | 360 const SkString& options) { |
| 324 // Defaults for GPU backend. | 361 // Defaults for GPU backend. |
| 325 bool seenAPI = false; | 362 bool seenAPI = false; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 if (extendedBackend.equals("gpu")) { | 467 if (extendedBackend.equals("gpu")) { |
| 431 parsedConfig = parse_command_line_config_gpu(tag, vias, extendedOpti ons); | 468 parsedConfig = parse_command_line_config_gpu(tag, vias, extendedOpti ons); |
| 432 } | 469 } |
| 433 #endif | 470 #endif |
| 434 if (!parsedConfig) { | 471 if (!parsedConfig) { |
| 435 parsedConfig = new SkCommandLineConfig(tag, simpleBackend, vias); | 472 parsedConfig = new SkCommandLineConfig(tag, simpleBackend, vias); |
| 436 } | 473 } |
| 437 outResult->emplace_back(parsedConfig); | 474 outResult->emplace_back(parsedConfig); |
| 438 } | 475 } |
| 439 } | 476 } |
| OLD | NEW |