diff options
author | Brian Osman <brianosman@google.com> | 2018-05-31 14:27:17 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-31 18:59:44 +0000 |
commit | c7ad40f76f6f23b3acd73b53e989220fd71f2da2 (patch) | |
tree | 3a2372730179f1bd0dd2486b6e576ec308f1327b /bench | |
parent | 8103bb960933359f6536cbfd40d760e54b079e94 (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')
-rw-r--r-- | bench/CubicKLMBench.cpp | 4 | ||||
-rw-r--r-- | bench/GrCCGeometryBench.cpp | 4 | ||||
-rw-r--r-- | bench/GrMemoryPoolBench.cpp | 5 | ||||
-rw-r--r-- | bench/GrMipMapBench.cpp | 4 | ||||
-rw-r--r-- | bench/GrResourceCacheBench.cpp | 4 | ||||
-rw-r--r-- | bench/ImageCacheBudgetBench.cpp | 4 | ||||
-rw-r--r-- | bench/MultitextureImageBench.cpp | 3 | ||||
-rw-r--r-- | bench/RectanizerBench.cpp | 4 | ||||
-rw-r--r-- | bench/SKPBench.cpp | 9 | ||||
-rw-r--r-- | bench/nanobench.cpp | 49 | ||||
-rw-r--r-- | bench/nanobench.h | 11 |
11 files changed, 13 insertions, 88 deletions
diff --git a/bench/CubicKLMBench.cpp b/bench/CubicKLMBench.cpp index 191e1804aa..8e13a2de00 100644 --- a/bench/CubicKLMBench.cpp +++ b/bench/CubicKLMBench.cpp @@ -7,8 +7,6 @@ #include "Benchmark.h" -#if SK_SUPPORT_GPU - #include "GrPathUtils.h" #include "SkGeometry.h" @@ -63,5 +61,3 @@ DEF_BENCH( return new CubicKLMBench(285.625f, 499.687f, 411.625f, 808.188f, 1064.62f, 135.688f, 1042.63f, 585.187f); ) DEF_BENCH( return new CubicKLMBench(635.625f, 614.687f, 171.625f, 236.188f, 1064.62f, 135.688f, 516.625f, 570.187f); ) - -#endif diff --git a/bench/GrCCGeometryBench.cpp b/bench/GrCCGeometryBench.cpp index 0628644ab9..5406cea057 100644 --- a/bench/GrCCGeometryBench.cpp +++ b/bench/GrCCGeometryBench.cpp @@ -7,8 +7,6 @@ #include "Benchmark.h" -#if SK_SUPPORT_GPU - #include "ccpr/GrCCGeometry.h" #include "SkGeometry.h" @@ -93,5 +91,3 @@ DEF_BENCH( return new GrCCGeometryBench(513.049988f, 245.049988f, 73.750000f, 13 DEF_BENCH( return new GrCCGeometryBench(560.049988f, 364.049988f, 217.750000f, 314.049988f, 21.750000f, 364.950012f, 83.049988f, 624.950012f, "0_roots"); ) - -#endif diff --git a/bench/GrMemoryPoolBench.cpp b/bench/GrMemoryPoolBench.cpp index 55ba3e6af0..b4b05ccd2f 100644 --- a/bench/GrMemoryPoolBench.cpp +++ b/bench/GrMemoryPoolBench.cpp @@ -7,9 +7,6 @@ #include "SkTypes.h" -// This tests a Gr class -#if SK_SUPPORT_GPU - #include "Benchmark.h" #include "GrMemoryPool.h" #include "SkRandom.h" @@ -176,5 +173,3 @@ private: DEF_BENCH( return new GrMemoryPoolBenchStack(); ) DEF_BENCH( return new GrMemoryPoolBenchRandom(); ) DEF_BENCH( return new GrMemoryPoolBenchQueue(); ) - -#endif diff --git a/bench/GrMipMapBench.cpp b/bench/GrMipMapBench.cpp index e151fe519f..e756c13bb4 100644 --- a/bench/GrMipMapBench.cpp +++ b/bench/GrMipMapBench.cpp @@ -11,8 +11,6 @@ #include "SkPaint.h" #include "SkSurface.h" -#if SK_SUPPORT_GPU - class GrMipMapBench: public Benchmark { sk_sp<SkSurface> fSurface; SkString fName; @@ -75,5 +73,3 @@ DEF_BENCH( return new GrMipMapBench(511, 511); ) DEF_BENCH( return new GrMipMapBench(512, 511); ) DEF_BENCH( return new GrMipMapBench(511, 512); ) DEF_BENCH( return new GrMipMapBench(512, 512); ) - -#endif diff --git a/bench/GrResourceCacheBench.cpp b/bench/GrResourceCacheBench.cpp index cc185cf04f..527e0ffde2 100644 --- a/bench/GrResourceCacheBench.cpp +++ b/bench/GrResourceCacheBench.cpp @@ -7,8 +7,6 @@ #include "Benchmark.h" -#if SK_SUPPORT_GPU - #include "GrContext.h" #include "GrContextPriv.h" #include "GrGpu.h" @@ -184,5 +182,3 @@ DEF_BENCH( return new GrResourceCacheBenchFind(54); ) DEF_BENCH( return new GrResourceCacheBenchFind(55); ) DEF_BENCH( return new GrResourceCacheBenchFind(56); ) #endif - -#endif diff --git a/bench/ImageCacheBudgetBench.cpp b/bench/ImageCacheBudgetBench.cpp index a6ee430c61..d8f6cbbc25 100644 --- a/bench/ImageCacheBudgetBench.cpp +++ b/bench/ImageCacheBudgetBench.cpp @@ -11,8 +11,6 @@ #include "SkImage.h" #include "SkSurface.h" -#if SK_SUPPORT_GPU - #include "GrContext.h" #include "GrContextPriv.h" @@ -259,5 +257,3 @@ private: DEF_BENCH( return new ImageCacheBudgetDynamicBench(ImageCacheBudgetDynamicBench::Mode::kPingPong); ) DEF_BENCH( return new ImageCacheBudgetDynamicBench(ImageCacheBudgetDynamicBench::Mode::kFlipFlop); ) - -#endif diff --git a/bench/MultitextureImageBench.cpp b/bench/MultitextureImageBench.cpp index 2c87efb414..edbb4de4e9 100644 --- a/bench/MultitextureImageBench.cpp +++ b/bench/MultitextureImageBench.cpp @@ -6,7 +6,6 @@ */ #include "Benchmark.h" -#if SK_SUPPORT_GPU #include "GrContextOptions.h" #include "SkCanvas.h" @@ -135,5 +134,3 @@ DEF_BENCH(return new MultitextureImages(512, 512, true, true)); DEF_BENCH(return new MultitextureImages(512, 512, false, true)); DEF_BENCH(return new MultitextureImages(128, 32, true, true)); DEF_BENCH(return new MultitextureImages(128, 32, false, true)); - -#endif diff --git a/bench/RectanizerBench.cpp b/bench/RectanizerBench.cpp index b282313d1d..c5ec21d91c 100644 --- a/bench/RectanizerBench.cpp +++ b/bench/RectanizerBench.cpp @@ -10,8 +10,6 @@ #include "SkSize.h" #include "SkTDArray.h" -#if SK_SUPPORT_GPU - #include "GrRectanizer_pow2.h" #include "GrRectanizer_skyline.h" @@ -134,5 +132,3 @@ DEF_BENCH(return new RectanizerBench(RectanizerBench::kSkyline_RectanizerType, RectanizerBench::kRandPow2_RectType);) DEF_BENCH(return new RectanizerBench(RectanizerBench::kSkyline_RectanizerType, RectanizerBench::kSmallPow2_RectType);) - -#endif diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp index 1391b40cf6..2612021510 100644 --- a/bench/SKPBench.cpp +++ b/bench/SKPBench.cpp @@ -10,10 +10,8 @@ #include "SkMultiPictureDraw.h" #include "SkSurface.h" -#if SK_SUPPORT_GPU #include "GrContext.h" #include "GrContextPriv.h" -#endif // These CPU tile sizes are not good per se, but they are similar to what Chrome uses. DEFINE_int32(CPUbenchTileW, 256, "Tile width used for CPU SKP playback."); @@ -120,12 +118,10 @@ void SKPBench::onDraw(int loops, SkCanvas* canvas) { if (0 == --loops) { break; } -#if SK_SUPPORT_GPU // Ensure the GrContext doesn't combine ops across draw loops. if (GrContext* context = canvas->getGrContext()) { context->flush(); } -#endif } } @@ -158,7 +154,6 @@ void SKPBench::drawPicture() { } } -#if SK_SUPPORT_GPU #include "GrGpu.h" static void draw_pic_for_stats(SkCanvas* canvas, GrContext* context, const SkPicture* picture, SkTArray<SkString>* keys, SkTArray<double>* values, @@ -176,10 +171,8 @@ static void draw_pic_for_stats(SkCanvas* canvas, GrContext* context, const SkPic (*keys)[i].appendf("_%s", tag); } } -#endif void SKPBench::getGpuStats(SkCanvas* canvas, SkTArray<SkString>* keys, SkTArray<double>* values) { -#if SK_SUPPORT_GPU // we do a special single draw and then dump the key / value pairs GrContext* context = canvas->getGrContext(); if (!context) { @@ -195,6 +188,4 @@ void SKPBench::getGpuStats(SkCanvas* canvas, SkTArray<SkString>* keys, SkTArray< // draw second frame draw_pic_for_stats(canvas, context, fPic.get(), keys, values, "second_frame"); - -#endif } 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: "); diff --git a/bench/nanobench.h b/bench/nanobench.h index 45882cc043..5b95d59cbf 100644 --- a/bench/nanobench.h +++ b/bench/nanobench.h @@ -9,14 +9,11 @@ #define nanobench_DEFINED #include "Benchmark.h" +#include "GrContextFactory.h" #include "SkImageInfo.h" #include "SkSurface.h" #include "SkTypes.h" -#if SK_SUPPORT_GPU -#include "GrContextFactory.h" -#endif - class ResultsWriter; class SkBitmap; class SkCanvas; @@ -28,15 +25,9 @@ struct Config { SkAlphaType alpha; sk_sp<SkColorSpace> colorSpace; int samples; -#if SK_SUPPORT_GPU sk_gpu_test::GrContextFactory::ContextType ctxType; sk_gpu_test::GrContextFactory::ContextOverrides ctxOverrides; bool useDFText; -#else - int bogusInt; - int bogusIntOption; - bool bogusBool; -#endif }; struct Target { |