| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 // sure we're timing steady-state pipelined frames. | 383 // sure we're timing steady-state pipelined frames. |
| 384 for (int i = 0; i < maxGpuFrameLag - 1; i++) { | 384 for (int i = 0; i < maxGpuFrameLag - 1; i++) { |
| 385 time(loops, bench, target); | 385 time(loops, bench, target); |
| 386 } | 386 } |
| 387 | 387 |
| 388 return loops; | 388 return loops; |
| 389 } | 389 } |
| 390 | 390 |
| 391 #if SK_SUPPORT_GPU | 391 #if SK_SUPPORT_GPU |
| 392 #define kBogusContextType GrContextFactory::kNativeGL_ContextType | 392 #define kBogusContextType GrContextFactory::kNativeGL_ContextType |
| 393 #define kBogusContextOptions GrContextFactory::kNone_ContextOptions | 393 #define kBogusContextOptions GrContextFactory::ContextOptions::kNone |
| 394 #else | 394 #else |
| 395 #define kBogusContextType 0 | 395 #define kBogusContextType 0 |
| 396 #define kBogusContextOptions 0 | 396 #define kBogusContextOptions 0 |
| 397 #endif | 397 #endif |
| 398 | 398 |
| 399 static void create_config(const SkCommandLineConfig* config, SkTArray<Config>* c
onfigs) { | 399 static void create_config(const SkCommandLineConfig* config, SkTArray<Config>* c
onfigs) { |
| 400 | 400 |
| 401 #if SK_SUPPORT_GPU | 401 #if SK_SUPPORT_GPU |
| 402 if (const auto* gpuConfig = config->asConfigGpu()) { | 402 if (const auto* gpuConfig = config->asConfigGpu()) { |
| 403 if (!FLAGS_gpu) | 403 if (!FLAGS_gpu) |
| 404 return; | 404 return; |
| 405 | 405 |
| 406 auto ctxOptions = GrContextFactory::kNone_ContextOptions; | |
| 407 if (gpuConfig->getUseNVPR()) { | |
| 408 ctxOptions = static_cast<GrContextFactory::ContextOptions>( | |
| 409 ctxOptions | GrContextFactory::kEnableNVPR_ContextOptions); | |
| 410 } | |
| 411 if (gpuConfig->getUseInstanced()) { | |
| 412 ctxOptions = static_cast<GrContextFactory::ContextOptions>( | |
| 413 ctxOptions | GrContextFactory::kUseInstanced_ContextOptions); | |
| 414 } | |
| 415 if (SkColorAndColorSpaceAreGammaCorrect(gpuConfig->getColorType(), | |
| 416 gpuConfig->getColorSpace())) { | |
| 417 ctxOptions = static_cast<GrContextFactory::ContextOptions>( | |
| 418 ctxOptions | GrContextFactory::kRequireSRGBSupport_ContextOption
s); | |
| 419 } | |
| 420 const auto ctxType = gpuConfig->getContextType(); | 406 const auto ctxType = gpuConfig->getContextType(); |
| 407 const auto ctxOptions = gpuConfig->getContextOptions(); |
| 421 const auto sampleCount = gpuConfig->getSamples(); | 408 const auto sampleCount = gpuConfig->getSamples(); |
| 422 | 409 |
| 423 if (const GrContext* ctx = gGrFactory->get(ctxType, ctxOptions)) { | 410 if (const GrContext* ctx = gGrFactory->get(ctxType, ctxOptions)) { |
| 424 const auto maxSampleCount = ctx->caps()->maxSampleCount(); | 411 const auto maxSampleCount = ctx->caps()->maxSampleCount(); |
| 425 if (sampleCount > ctx->caps()->maxSampleCount()) { | 412 if (sampleCount > ctx->caps()->maxSampleCount()) { |
| 426 SkDebugf("Configuration sample count %d exceeds maximum %d.\n", | 413 SkDebugf("Configuration sample count %d exceeds maximum %d.\n", |
| 427 sampleCount, maxSampleCount); | 414 sampleCount, maxSampleCount); |
| 428 return; | 415 return; |
| 429 } | 416 } |
| 430 } else { | 417 } else { |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1303 | 1290 |
| 1304 return 0; | 1291 return 0; |
| 1305 } | 1292 } |
| 1306 | 1293 |
| 1307 #if !defined SK_BUILD_FOR_IOS | 1294 #if !defined SK_BUILD_FOR_IOS |
| 1308 int main(int argc, char** argv) { | 1295 int main(int argc, char** argv) { |
| 1309 SkCommandLineFlags::Parse(argc, argv); | 1296 SkCommandLineFlags::Parse(argc, argv); |
| 1310 return nanobench_main(); | 1297 return nanobench_main(); |
| 1311 } | 1298 } |
| 1312 #endif | 1299 #endif |
| OLD | NEW |