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

Side by Side Diff: tools/kilobench/kilobench.cpp

Issue 1845923004: Rename enums in GrContextFactory to remove "GL" (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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 | « tools/gpu/GrContextFactory.cpp ('k') | tools/skiaserve/Request.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 2016 Google Inc. 2 * Copyright 2016 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 "GrCaps.h" 8 #include "GrCaps.h"
9 #include "GrContextFactory.h" 9 #include "GrContextFactory.h"
10 #include "Benchmark.h" 10 #include "Benchmark.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 bool needsFrameTiming(int* maxFrameLag) const { 169 bool needsFrameTiming(int* maxFrameLag) const {
170 if (!fGL->getMaxGpuFrameLag(maxFrameLag)) { 170 if (!fGL->getMaxGpuFrameLag(maxFrameLag)) {
171 // Frame lag is unknown. 171 // Frame lag is unknown.
172 *maxFrameLag = FLAGS_gpuFrameLag; 172 *maxFrameLag = FLAGS_gpuFrameLag;
173 } 173 }
174 return true; 174 return true;
175 } 175 }
176 176
177 bool init(Benchmark* bench, GrContextFactory* factory, bool useDfText, 177 bool init(Benchmark* bench, GrContextFactory* factory, bool useDfText,
178 GrContextFactory::GLContextType ctxType, 178 GrContextFactory::ContextType ctxType,
179 GrContextFactory::GLContextOptions ctxOptions, int numSamples) { 179 GrContextFactory::ContextOptions ctxOptions, int numSamples) {
180 GrContext* context = factory->get(ctxType, ctxOptions); 180 GrContext* context = factory->get(ctxType, ctxOptions);
181 int maxRTSize = context->caps()->maxRenderTargetSize(); 181 int maxRTSize = context->caps()->maxRenderTargetSize();
182 SkImageInfo info = SkImageInfo::Make(SkTMin(bench->getSize().fX, maxRTSi ze), 182 SkImageInfo info = SkImageInfo::Make(SkTMin(bench->getSize().fX, maxRTSi ze),
183 SkTMin(bench->getSize().fY, maxRTSi ze), 183 SkTMin(bench->getSize().fY, maxRTSi ze),
184 kN32_SkColorType, kPremul_SkAlphaT ype); 184 kN32_SkColorType, kPremul_SkAlphaT ype);
185 uint32_t flags = useDfText ? SkSurfaceProps::kUseDeviceIndependentFonts_ Flag : 185 uint32_t flags = useDfText ? SkSurfaceProps::kUseDeviceIndependentFonts_ Flag :
186 0; 186 0;
187 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); 187 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
188 fSurface.reset(SkSurface::MakeRenderTarget(context, 188 fSurface.reset(SkSurface::MakeRenderTarget(context,
189 SkBudgeted::kNo, info, 189 SkBudgeted::kNo, info,
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 471
472 return loops; 472 return loops;
473 } 473 }
474 474
475 struct AutoSetupContextBenchAndTarget { 475 struct AutoSetupContextBenchAndTarget {
476 AutoSetupContextBenchAndTarget(Benchmark* bench) : fBenchmark(bench) { 476 AutoSetupContextBenchAndTarget(Benchmark* bench) : fBenchmark(bench) {
477 GrContextOptions grContextOpts; 477 GrContextOptions grContextOpts;
478 fCtxFactory.reset(new GrContextFactory(grContextOpts)); 478 fCtxFactory.reset(new GrContextFactory(grContextOpts));
479 479
480 SkAssertResult(fTarget.init(bench, fCtxFactory, false, 480 SkAssertResult(fTarget.init(bench, fCtxFactory, false,
481 GrContextFactory::kNative_GLContextType, 481 GrContextFactory::kNativeGL_ContextType,
482 GrContextFactory::kNone_GLContextOptions, 0) ); 482 GrContextFactory::kNone_ContextOptions, 0));
483 483
484 fCanvas = fTarget.getCanvas(); 484 fCanvas = fTarget.getCanvas();
485 fTarget.setup(); 485 fTarget.setup();
486 486
487 bench->perCanvasPreDraw(fCanvas); 487 bench->perCanvasPreDraw(fCanvas);
488 fTarget.needsFrameTiming(&fMaxFrameLag); 488 fTarget.needsFrameTiming(&fMaxFrameLag);
489 } 489 }
490 490
491 int getLoops() { return setup_gpu_bench(&fTarget, fBenchmark, fMaxFrameLag); } 491 int getLoops() { return setup_gpu_bench(&fTarget, fBenchmark, fMaxFrameLag); }
492 492
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 } 648 }
649 return 0; 649 return 0;
650 } 650 }
651 651
652 #if !defined SK_BUILD_FOR_IOS 652 #if !defined SK_BUILD_FOR_IOS
653 int main(int argc, char** argv) { 653 int main(int argc, char** argv) {
654 SkCommandLineFlags::Parse(argc, argv); 654 SkCommandLineFlags::Parse(argc, argv);
655 return kilobench_main(); 655 return kilobench_main();
656 } 656 }
657 #endif 657 #endif
OLDNEW
« no previous file with comments | « tools/gpu/GrContextFactory.cpp ('k') | tools/skiaserve/Request.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698