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

Unified Diff: bench/nanobench.cpp

Issue 465073002: Add entry point for passing options to the GrContextFactory (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gm/gmmain.cpp » ('j') | include/gpu/GrContextFactory.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/nanobench.cpp
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index a5353aa6e845bf0717fe4432eb4340d0d5a246bd..ab7981ff63c48e1c157f2389614413028a0b0cf0 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -26,7 +26,7 @@
#if SK_SUPPORT_GPU
#include "gl/GrGLDefines.h"
#include "GrContextFactory.h"
- GrContextFactory gGrFactory;
+ GrContextFactory* gGrFactory;
#endif
bsalomon 2014/08/13 00:49:33 Maybe just make this the autotdelete? I think it h
krajcevski 2014/08/13 14:46:00 Done.
__SK_FORCE_IMAGE_DECODER_LINKING;
@@ -288,7 +288,7 @@ static bool is_gpu_config_allowed(const char* name, GrContextFactory::GLContextT
if (!is_cpu_config_allowed(name)) {
return false;
}
- if (const GrContext* ctx = gGrFactory.get(ctxType)) {
+ if (const GrContext* ctx = gGrFactory->get(ctxType)) {
return sampleCnt <= ctx->getMaxSampleCount();
}
return false;
@@ -362,9 +362,9 @@ static Target* is_enabled(Benchmark* bench, const Config& config) {
}
#if SK_SUPPORT_GPU
else if (Benchmark::kGPU_Backend == config.backend) {
- target->surface.reset(SkSurface::NewRenderTarget(gGrFactory.get(config.ctxType), info,
+ target->surface.reset(SkSurface::NewRenderTarget(gGrFactory->get(config.ctxType), info,
config.samples));
- target->gl = gGrFactory.getGLContext(config.ctxType);
+ target->gl = gGrFactory->getGLContext(config.ctxType);
}
#endif
@@ -528,6 +528,13 @@ int nanobench_main() {
SetupCrashHandler();
SkAutoGraphics ag;
+#if SK_SUPPORT_GPU
+ // Setup GrContextFactory
+ SkAutoTDelete<GrContextFactory> gGrFactoryPtr;
+ gGrFactoryPtr.reset(SkNEW_ARGS(GrContextFactory, (GrContext::Options())));
+ gGrFactory = gGrFactoryPtr.get();
+#endif
+
if (kAutoTuneLoops != FLAGS_loops) {
FLAGS_samples = 1;
FLAGS_gpuFrameLag = 0;
@@ -671,10 +678,10 @@ int nanobench_main() {
#if SK_SUPPORT_GPU
if (FLAGS_abandonGpuContext) {
- gGrFactory.abandonContexts();
+ gGrFactory->abandonContexts();
}
if (FLAGS_resetGpuContext || FLAGS_abandonGpuContext) {
- gGrFactory.destroyContexts();
+ gGrFactory->destroyContexts();
}
#endif
}
« no previous file with comments | « no previous file | gm/gmmain.cpp » ('j') | include/gpu/GrContextFactory.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698