| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 <ctype.h> | 8 #include <ctype.h> |
| 9 | 9 |
| 10 #include "nanobench.h" | 10 #include "nanobench.h" |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 #define kBogusContextOptions 0 | 395 #define kBogusContextOptions 0 |
| 396 #endif | 396 #endif |
| 397 | 397 |
| 398 static void create_config(const SkCommandLineConfig* config, SkTArray<Config>* c
onfigs) { | 398 static void create_config(const SkCommandLineConfig* config, SkTArray<Config>* c
onfigs) { |
| 399 | 399 |
| 400 #if SK_SUPPORT_GPU | 400 #if SK_SUPPORT_GPU |
| 401 if (const auto* gpuConfig = config->asConfigGpu()) { | 401 if (const auto* gpuConfig = config->asConfigGpu()) { |
| 402 if (!FLAGS_gpu) | 402 if (!FLAGS_gpu) |
| 403 return; | 403 return; |
| 404 | 404 |
| 405 const auto ctxOptions = gpuConfig->getUseNVPR() ? GrContextFactory::kEna
bleNVPR_ContextOptions | 405 auto ctxOptions = GrContextFactory::kNone_ContextOptions; |
| 406 : GrContextFactory::kNon
e_ContextOptions; | 406 if (gpuConfig->getUseNVPR()) { |
| 407 ctxOptions = static_cast<GrContextFactory::ContextOptions>( |
| 408 ctxOptions | GrContextFactory::kEnableNVPR_ContextOptions); |
| 409 } |
| 410 if (SkColorAndColorSpaceAreGammaCorrect(gpuConfig->getColorType(), |
| 411 gpuConfig->getColorSpace())) { |
| 412 ctxOptions = static_cast<GrContextFactory::ContextOptions>( |
| 413 ctxOptions | GrContextFactory::kRequireSRGBSupport_ContextOption
s); |
| 414 } |
| 407 const auto ctxType = gpuConfig->getContextType(); | 415 const auto ctxType = gpuConfig->getContextType(); |
| 408 const auto sampleCount = gpuConfig->getSamples(); | 416 const auto sampleCount = gpuConfig->getSamples(); |
| 409 | 417 |
| 410 if (const GrContext* ctx = gGrFactory->get(ctxType, ctxOptions)) { | 418 if (const GrContext* ctx = gGrFactory->get(ctxType, ctxOptions)) { |
| 411 const auto maxSampleCount = ctx->caps()->maxSampleCount(); | 419 const auto maxSampleCount = ctx->caps()->maxSampleCount(); |
| 412 if (sampleCount > ctx->caps()->maxSampleCount()) { | 420 if (sampleCount > ctx->caps()->maxSampleCount()) { |
| 413 SkDebugf("Configuration sample count %d exceeds maximum %d.\n", | 421 SkDebugf("Configuration sample count %d exceeds maximum %d.\n", |
| 414 sampleCount, maxSampleCount); | 422 sampleCount, maxSampleCount); |
| 415 return; | 423 return; |
| 416 } | 424 } |
| 417 } else { | 425 } else { |
| 418 SkDebugf("No context was available matching config type and options.
\n"); | 426 SkDebugf("No context was available matching config type and options.
\n"); |
| 419 return; | 427 return; |
| 420 } | 428 } |
| 421 | 429 |
| 422 Config target = { | 430 Config target = { |
| 423 gpuConfig->getTag(), | 431 gpuConfig->getTag(), |
| 424 Benchmark::kGPU_Backend, | 432 Benchmark::kGPU_Backend, |
| 425 kN32_SkColorType, | 433 gpuConfig->getColorType(), |
| 426 kPremul_SkAlphaType, | 434 kPremul_SkAlphaType, |
| 427 nullptr, | 435 sk_ref_sp(gpuConfig->getColorSpace()), |
| 428 sampleCount, | 436 sampleCount, |
| 429 ctxType, | 437 ctxType, |
| 430 ctxOptions, | 438 ctxOptions, |
| 431 gpuConfig->getUseDIText() | 439 gpuConfig->getUseDIText() |
| 432 }; | 440 }; |
| 433 | 441 |
| 434 configs->push_back(target); | 442 configs->push_back(target); |
| 435 return; | 443 return; |
| 436 } | 444 } |
| 437 #endif | 445 #endif |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1288 | 1296 |
| 1289 return 0; | 1297 return 0; |
| 1290 } | 1298 } |
| 1291 | 1299 |
| 1292 #if !defined SK_BUILD_FOR_IOS | 1300 #if !defined SK_BUILD_FOR_IOS |
| 1293 int main(int argc, char** argv) { | 1301 int main(int argc, char** argv) { |
| 1294 SkCommandLineFlags::Parse(argc, argv); | 1302 SkCommandLineFlags::Parse(argc, argv); |
| 1295 return nanobench_main(); | 1303 return nanobench_main(); |
| 1296 } | 1304 } |
| 1297 #endif | 1305 #endif |
| OLD | NEW |