aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/nanobench.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2018-05-31 14:27:17 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-31 18:59:44 +0000
commitc7ad40f76f6f23b3acd73b53e989220fd71f2da2 (patch)
tree3a2372730179f1bd0dd2486b6e576ec308f1327b /bench/nanobench.cpp
parent8103bb960933359f6536cbfd40d760e54b079e94 (diff)
Remove SK_SUPPORT_GPU checks in tool-only code
Most of this is (obviously) not necessary to do, but once I started, I figured I'd just get it all. Tools (nanobench, DM, skiaserve), all GMs, benches, and unit tests, plus support code (command line parsing and config stuff). This is almost entirely mechanical. Bug: skia: Change-Id: I209500f8df8c5bd43f8298ff26440d1c4d7425fb Reviewed-on: https://skia-review.googlesource.com/131153 Reviewed-by: Mike Klein <mtklein@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'bench/nanobench.cpp')
-rw-r--r--bench/nanobench.cpp49
1 files changed, 12 insertions, 37 deletions
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 8c89ec716c..0376bdbec3 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -60,23 +60,19 @@ extern bool gSkForceRasterPipelineBlitter;
#endif
-#if SK_SUPPORT_GPU
- #include "GrCaps.h"
- #include "GrContextFactory.h"
- #include "GrContextPriv.h"
- #include "SkGr.h"
- #include "gl/GrGLDefines.h"
- #include "gl/GrGLGpu.h"
- #include "gl/GrGLUtil.h"
-
- using sk_gpu_test::ContextInfo;
- using sk_gpu_test::GrContextFactory;
- using sk_gpu_test::TestContext;
-
- GrContextOptions grContextOpts;
-#endif
+#include "GrCaps.h"
+#include "GrContextFactory.h"
+#include "GrContextPriv.h"
+#include "SkGr.h"
+#include "gl/GrGLDefines.h"
+#include "gl/GrGLGpu.h"
+#include "gl/GrGLUtil.h"
+
+using sk_gpu_test::ContextInfo;
+using sk_gpu_test::GrContextFactory;
+using sk_gpu_test::TestContext;
- struct GrContextOptions;
+GrContextOptions grContextOpts;
static const int kAutoTuneLoops = 0;
@@ -171,7 +167,6 @@ bool Target::capturePixels(SkBitmap* bmp) {
return true;
}
-#if SK_SUPPORT_GPU
struct GPUTarget : public Target {
explicit GPUTarget(const Config& c) : Target(c) {}
ContextInfo contextInfo;
@@ -243,8 +238,6 @@ struct GPUTarget : public Target {
}
};
-#endif
-
static double time(int loops, Benchmark* bench, Target* target) {
SkCanvas* canvas = target->getCanvas();
if (canvas) {
@@ -409,17 +402,10 @@ static int setup_gpu_bench(Target* target, Benchmark* bench, int maxGpuFrameLag)
return loops;
}
-#if SK_SUPPORT_GPU
#define kBogusContextType GrContextFactory::kGL_ContextType
#define kBogusContextOverrides GrContextFactory::ContextOverrides::kNone
-#else
-#define kBogusContextType 0
-#define kBogusContextOverrides 0
-#endif
static void create_config(const SkCommandLineConfig* config, SkTArray<Config>* configs) {
-
-#if SK_SUPPORT_GPU
if (const auto* gpuConfig = config->asConfigGpu()) {
if (!FLAGS_gpu) {
SkDebugf("Skipping config '%s' as requested.\n", config->getTag().c_str());
@@ -468,7 +454,6 @@ static void create_config(const SkCommandLineConfig* config, SkTArray<Config>* c
configs->push_back(target);
return;
}
-#endif
#define CPU_CONFIG(name, backend, color, alpha, colorSpace) \
if (config->getTag().equals(#name)) { \
@@ -544,11 +529,9 @@ static Target* is_enabled(Benchmark* bench, const Config& config) {
Target* target = nullptr;
switch (config.backend) {
-#if SK_SUPPORT_GPU
case Benchmark::kGPU_Backend:
target = new GPUTarget(config);
break;
-#endif
default:
target = new Target(config);
break;
@@ -1141,9 +1124,7 @@ int main(int argc, char** argv) {
SkAutoGraphics ag;
SkTaskGroup::Enabler enabled(FLAGS_threads);
-#if SK_SUPPORT_GPU
SetCtxOptionsFromCommonFlags(&grContextOpts);
-#endif
if (FLAGS_veryVerbose) {
FLAGS_verbose = true;
@@ -1295,7 +1276,6 @@ int main(int argc, char** argv) {
}
}
-#if SK_SUPPORT_GPU
SkTArray<SkString> keys;
SkTArray<double> values;
bool gpuStatsDump = FLAGS_gpuStatsDump && Benchmark::kGPU_Backend == configs[i].backend;
@@ -1303,7 +1283,6 @@ int main(int argc, char** argv) {
// TODO cache stats
bench->getGpuStats(canvas, &keys, &values);
}
-#endif
bench->perCanvasPostDraw(canvas);
@@ -1322,7 +1301,6 @@ int main(int argc, char** argv) {
target->fillOptions(log.get());
log->metric("min_ms", stats.min);
log->metrics("samples", samples);
-#if SK_SUPPORT_GPU
if (gpuStatsDump) {
// dump to json, only SKPBench currently returns valid keys / values
SkASSERT(keys.count() == values.count());
@@ -1330,7 +1308,6 @@ int main(int argc, char** argv) {
log->metric(keys[i].c_str(), values[i]);
}
}
-#endif
if (runs++ % FLAGS_flushEvery == 0) {
log->flush();
@@ -1382,11 +1359,9 @@ int main(int argc, char** argv) {
);
}
-#if SK_SUPPORT_GPU
if (FLAGS_gpuStats && Benchmark::kGPU_Backend == configs[i].backend) {
target->dumpStats();
}
-#endif
if (FLAGS_verbose) {
SkDebugf("Samples: ");