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

Side by Side Diff: bench/nanobench.cpp

Issue 1856703002: Revert of Rename enums in GrContextFactory to remove "GL" (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 | « bench/nanobench.h ('k') | dm/DM.cpp » ('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 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // Pretty much the same deal as the calibration: do some warmup to make 378 // Pretty much the same deal as the calibration: do some warmup to make
379 // sure we're timing steady-state pipelined frames. 379 // sure we're timing steady-state pipelined frames.
380 for (int i = 0; i < maxGpuFrameLag - 1; i++) { 380 for (int i = 0; i < maxGpuFrameLag - 1; i++) {
381 time(loops, bench, target); 381 time(loops, bench, target);
382 } 382 }
383 383
384 return loops; 384 return loops;
385 } 385 }
386 386
387 #if SK_SUPPORT_GPU 387 #if SK_SUPPORT_GPU
388 #define kBogusContextType GrContextFactory::kNativeGL_ContextType 388 #define kBogusGLContextType GrContextFactory::kNative_GLContextType
389 #define kBogusContextOptions GrContextFactory::kNone_ContextOptions 389 #define kBogusGLContextOptions GrContextFactory::kNone_GLContextOptions
390 #else 390 #else
391 #define kBogusContextType 0 391 #define kBogusGLContextType 0
392 #define kBogusContextOptions 0 392 #define kBogusGLContextOptions 0
393 #endif 393 #endif
394 394
395 static void create_config(const SkCommandLineConfig* config, SkTArray<Config>* c onfigs) { 395 static void create_config(const SkCommandLineConfig* config, SkTArray<Config>* c onfigs) {
396 396
397 #if SK_SUPPORT_GPU 397 #if SK_SUPPORT_GPU
398 if (const auto* gpuConfig = config->asConfigGpu()) { 398 if (const auto* gpuConfig = config->asConfigGpu()) {
399 if (!FLAGS_gpu) 399 if (!FLAGS_gpu)
400 return; 400 return;
401 401
402 const auto ctxOptions = gpuConfig->getUseNVPR() ? GrContextFactory::kEna bleNVPR_ContextOptions 402 const auto ctxOptions = gpuConfig->getUseNVPR() ? GrContextFactory::kEna bleNVPR_GLContextOptions
403 : GrContextFactory::kNon e_ContextOptions; 403 : GrContextFactory::kNon e_GLContextOptions;
404 const auto ctxType = gpuConfig->getContextType(); 404 const auto ctxType = gpuConfig->getContextType();
405 const auto sampleCount = gpuConfig->getSamples(); 405 const auto sampleCount = gpuConfig->getSamples();
406 406
407 if (const GrContext* ctx = gGrFactory->get(ctxType, ctxOptions)) { 407 if (const GrContext* ctx = gGrFactory->get(ctxType, ctxOptions)) {
408 const auto maxSampleCount = ctx->caps()->maxSampleCount(); 408 const auto maxSampleCount = ctx->caps()->maxSampleCount();
409 if (sampleCount > ctx->caps()->maxSampleCount()) { 409 if (sampleCount > ctx->caps()->maxSampleCount()) {
410 SkDebugf("Configuration sample count %d exceeds maximum %d.\n", 410 SkDebugf("Configuration sample count %d exceeds maximum %d.\n",
411 sampleCount, maxSampleCount); 411 sampleCount, maxSampleCount);
412 return; 412 return;
413 } 413 }
(...skipping 16 matching lines...) Expand all
430 430
431 configs->push_back(target); 431 configs->push_back(target);
432 return; 432 return;
433 } 433 }
434 #endif 434 #endif
435 435
436 #define CPU_CONFIG(name, backend, color, alpha, profile) \ 436 #define CPU_CONFIG(name, backend, color, alpha, profile) \
437 if (config->getTag().equals(#name)) { \ 437 if (config->getTag().equals(#name)) { \
438 Config config = { \ 438 Config config = { \
439 SkString(#name), Benchmark::backend, color, alpha, profile, \ 439 SkString(#name), Benchmark::backend, color, alpha, profile, \
440 0, kBogusContextType, kBogusContextOptions, false \ 440 0, kBogusGLContextType, kBogusGLContextOptions, false \
441 }; \ 441 }; \
442 configs->push_back(config); \ 442 configs->push_back(config); \
443 return; \ 443 return; \
444 } 444 }
445 445
446 if (FLAGS_cpu) { 446 if (FLAGS_cpu) {
447 CPU_CONFIG(nonrendering, kNonRendering_Backend, 447 CPU_CONFIG(nonrendering, kNonRendering_Backend,
448 kUnknown_SkColorType, kUnpremul_SkAlphaType, kLinear_SkColorP rofileType); 448 kUnknown_SkColorType, kUnpremul_SkAlphaType, kLinear_SkColorP rofileType);
449 449
450 CPU_CONFIG(8888, kRaster_Backend, 450 CPU_CONFIG(8888, kRaster_Backend,
451 kN32_SkColorType, kPremul_SkAlphaType, kLinear_SkColorProfile Type) 451 kN32_SkColorType, kPremul_SkAlphaType, kLinear_SkColorProfile Type)
452 CPU_CONFIG(565, kRaster_Backend, 452 CPU_CONFIG(565, kRaster_Backend,
453 kRGB_565_SkColorType, kOpaque_SkAlphaType, kLinear_SkColorPro fileType) 453 kRGB_565_SkColorType, kOpaque_SkAlphaType, kLinear_SkColorPro fileType)
454 CPU_CONFIG(srgb, kRaster_Backend, 454 CPU_CONFIG(srgb, kRaster_Backend,
455 kN32_SkColorType, kPremul_SkAlphaType, kSRGB_SkColorProfileT ype) 455 kN32_SkColorType, kPremul_SkAlphaType, kSRGB_SkColorProfileT ype)
456 CPU_CONFIG(f16, kRaster_Backend, 456 CPU_CONFIG(f16, kRaster_Backend,
457 kRGBA_F16_SkColorType, kPremul_SkAlphaType, kLinear_SkColorPr ofileType) 457 kRGBA_F16_SkColorType, kPremul_SkAlphaType, kLinear_SkColorPr ofileType)
458 } 458 }
459 459
460 #undef CPU_CONFIG 460 #undef CPU_CONFIG
461 461
462 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 462 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
463 if (config->getTag().equals("hwui")) { 463 if (config->getTag().equals("hwui")) {
464 Config config = { SkString("hwui"), Benchmark::kHWUI_Backend, 464 Config config = { SkString("hwui"), Benchmark::kHWUI_Backend,
465 kRGBA_8888_SkColorType, kPremul_SkAlphaType, kLinear_S kColorProfileType, 465 kRGBA_8888_SkColorType, kPremul_SkAlphaType, kLinear_S kColorProfileType,
466 0, kBogusContextType, kBogusContextOptions, false }; 466 0, kBogusGLContextType, kBogusGLContextOptions, false };
467 configs->push_back(config); 467 configs->push_back(config);
468 } 468 }
469 #endif 469 #endif
470 } 470 }
471 471
472 // Append all configs that are enabled and supported. 472 // Append all configs that are enabled and supported.
473 void create_configs(SkTArray<Config>* configs) { 473 void create_configs(SkTArray<Config>* configs) {
474 SkCommandLineConfigArray array; 474 SkCommandLineConfigArray array;
475 ParseConfigs(FLAGS_config, &array); 475 ParseConfigs(FLAGS_config, &array);
476 for (int i = 0; i < array.count(); ++i) { 476 for (int i = 0; i < array.count(); ++i) {
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 1283
1284 return 0; 1284 return 0;
1285 } 1285 }
1286 1286
1287 #if !defined SK_BUILD_FOR_IOS 1287 #if !defined SK_BUILD_FOR_IOS
1288 int main(int argc, char** argv) { 1288 int main(int argc, char** argv) {
1289 SkCommandLineFlags::Parse(argc, argv); 1289 SkCommandLineFlags::Parse(argc, argv);
1290 return nanobench_main(); 1290 return nanobench_main();
1291 } 1291 }
1292 #endif 1292 #endif
OLDNEW
« no previous file with comments | « bench/nanobench.h ('k') | dm/DM.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698