aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench
diff options
context:
space:
mode:
authorGravatar krajcevski <krajcevski@google.com>2014-08-13 10:46:31 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-08-13 10:46:31 -0700
commit69a5560ea5a8d26b120f5158e506a163d32b4a27 (patch)
tree2c43838d65a47c770a22604e7d3ec038c8701320 /bench
parentb3f319fbb01c74e757846d9fcfbf1da174c0cb17 (diff)
Add entry point for passing options to the GrContextFactory
R=bsalomon@google.com, mtklein@google.com, robertphillips@google.com Author: krajcevski@google.com Review URL: https://codereview.chromium.org/465073002
Diffstat (limited to 'bench')
-rw-r--r--bench/nanobench.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index a5353aa6e8..3522c4acb2 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;
+ SkAutoTDelete<GrContextFactory> gGrFactory;
#endif
__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,10 @@ int nanobench_main() {
SetupCrashHandler();
SkAutoGraphics ag;
+#if SK_SUPPORT_GPU
+ gGrFactory.reset(SkNEW_ARGS(GrContextFactory, (GrContext::Options())));
+#endif
+
if (kAutoTuneLoops != FLAGS_loops) {
FLAGS_samples = 1;
FLAGS_gpuFrameLag = 0;
@@ -671,10 +675,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
}