From c7ad40f76f6f23b3acd73b53e989220fd71f2da2 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Thu, 31 May 2018 14:27:17 -0400 Subject: 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 Reviewed-by: Brian Salomon Commit-Queue: Brian Osman --- tools/flags/SkCommonFlags.cpp | 4 ---- tools/flags/SkCommonFlagsConfig.cpp | 16 ---------------- tools/flags/SkCommonFlagsConfig.h | 9 --------- tools/flags/SkCommonFlagsGpu.h | 4 ---- 4 files changed, 33 deletions(-) (limited to 'tools/flags') diff --git a/tools/flags/SkCommonFlags.cpp b/tools/flags/SkCommonFlags.cpp index 42a5cdee7c..73b0eb4f12 100644 --- a/tools/flags/SkCommonFlags.cpp +++ b/tools/flags/SkCommonFlags.cpp @@ -150,8 +150,6 @@ bool CollectImages(SkCommandLineFlags::StringArray images, SkTArray* o return true; } -#if SK_SUPPORT_GPU - #include "SkCommonFlagsGpu.h" DEFINE_int32(gpuThreads, 2, "Create this many extra threads to assist with GPU work, " @@ -175,5 +173,3 @@ void SetCtxOptionsFromCommonFlags(GrContextOptions* ctxOptions) { ctxOptions->fGpuPathRenderers = CollectGpuPathRenderersFromFlags(); ctxOptions->fDisableDriverCorrectnessWorkarounds = FLAGS_disableDriverCorrectnessWorkarounds; } - -#endif diff --git a/tools/flags/SkCommonFlagsConfig.cpp b/tools/flags/SkCommonFlagsConfig.cpp index 7e826c6f61..ba07ec84c7 100644 --- a/tools/flags/SkCommonFlagsConfig.cpp +++ b/tools/flags/SkCommonFlagsConfig.cpp @@ -11,9 +11,7 @@ #include -#if SK_SUPPORT_GPU using sk_gpu_test::GrContextFactory; -#endif #if defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_IOS) # define DEFAULT_GPU_CONFIG "gles" @@ -35,7 +33,6 @@ static const struct { const char* backend; const char* options; } gPredefinedConfigs[] = { -#if SK_SUPPORT_GPU { "gl", "gpu", "api=gl" }, { "gles", "gpu", "api=gles" }, { "glmsaa4", "gpu", "api=gl,samples=4" }, @@ -96,9 +93,6 @@ static const struct { ,{ "mtlmsaa4", "gpu", "api=metal,samples=4" } ,{ "mtlmsaa8", "gpu", "api=metal,samples=8" } #endif -#else - { "", "", "" } -#endif }; static const char configHelp[] = @@ -117,7 +111,6 @@ static const char* config_help_fn() { static const char configExtendedHelp[] = "Extended form: 'backend(option=value,...)'\n\n" "Possible backends and options:\n" -#if SK_SUPPORT_GPU "\n" "gpu[api=string,color=string,dit=bool,nvpr=bool,inst=bool,samples=int]\n" "\tapi\ttype: string\trequired\n" @@ -171,7 +164,6 @@ static const char configExtendedHelp[] = "\n" "Predefined configs:\n\n" // Help text for pre-defined configs is auto-generated from gPredefinedConfigs -#endif ; static const char* config_extended_help_fn() { @@ -217,7 +209,6 @@ static bool parse_option_bool(const SkString& value, bool* outBool) { } return false; } -#if SK_SUPPORT_GPU static bool parse_option_gpu_api(const SkString& value, SkCommandLineConfigGpu::ContextType* outContextType) { if (value.equals("gl")) { @@ -337,7 +328,6 @@ static bool parse_option_gpu_surf_type(const SkString& value, } return false; } -#endif // Extended options take form --config item[key1=value1,key2=value2,...] // Example: --config gpu[api=gl,color=8888] @@ -366,7 +356,6 @@ public: *outParseSucceeded = true; } -#if SK_SUPPORT_GPU bool get_option_gpu_color(const char* optionKey, SkColorType* outColorType, SkAlphaType* alphaType, @@ -398,7 +387,6 @@ public: } return parse_option_gpu_surf_type(*optionValue, outSurfType); } -#endif bool get_option_int(const char* optionKey, int* outInt, bool optional = true) const { SkString* optionValue = fOptionsMap.find(SkString(optionKey)); @@ -420,7 +408,6 @@ private: SkTHashMap fOptionsMap; }; -#if SK_SUPPORT_GPU SkCommandLineConfigGpu::SkCommandLineConfigGpu( const SkString& tag, const SkTArray& viaParts, ContextType contextType, bool useNVPR, bool useDIText, int samples, SkColorType colorType, SkAlphaType alphaType, @@ -499,7 +486,6 @@ SkCommandLineConfigGpu* parse_command_line_config_gpu(const SkString& tag, colorType, alphaType, colorSpace, useStencils, testThreading, surfType); } -#endif SkCommandLineConfigSvg::SkCommandLineConfigSvg(const SkString& tag, const SkTArray& viaParts, int pageIndex) @@ -570,11 +556,9 @@ void ParseConfigs(const SkCommandLineFlags::StringArray& configs, } } SkCommandLineConfig* parsedConfig = nullptr; -#if SK_SUPPORT_GPU if (extendedBackend.equals("gpu")) { parsedConfig = parse_command_line_config_gpu(tag, vias, extendedOptions); } -#endif if (extendedBackend.equals("svg")) { parsedConfig = parse_command_line_config_svg(tag, vias, extendedOptions); } diff --git a/tools/flags/SkCommonFlagsConfig.h b/tools/flags/SkCommonFlagsConfig.h index 3f1056d113..7c097ea888 100644 --- a/tools/flags/SkCommonFlagsConfig.h +++ b/tools/flags/SkCommonFlagsConfig.h @@ -9,16 +9,11 @@ #define SK_COMMON_FLAGS_CONFIG_H #include "SkCommandLineFlags.h" - -#if SK_SUPPORT_GPU #include "GrContextFactory.h" -#endif DECLARE_string(config); -#if SK_SUPPORT_GPU class SkCommandLineConfigGpu; -#endif class SkCommandLineConfigSvg; // SkCommandLineConfig represents a Skia rendering configuration string. @@ -32,9 +27,7 @@ class SkCommandLineConfig { SkCommandLineConfig(const SkString& tag, const SkString& backend, const SkTArray& viaParts); virtual ~SkCommandLineConfig(); -#if SK_SUPPORT_GPU virtual const SkCommandLineConfigGpu* asConfigGpu() const { return nullptr; } -#endif virtual const SkCommandLineConfigSvg* asConfigSvg() const { return nullptr; } const SkString& getTag() const { return fTag; } const SkString& getBackend() const { return fBackend; } @@ -45,7 +38,6 @@ class SkCommandLineConfig { SkTArray fViaParts; }; -#if SK_SUPPORT_GPU // SkCommandLineConfigGpu is a SkCommandLineConfig that extracts information out of the backend // part of the tag. It is constructed tags that have: // * backends of form "gpu[option=value,option2=value,...]" @@ -94,7 +86,6 @@ private: bool fTestThreading; SurfType fSurfType; }; -#endif // SkCommandLineConfigSvg is a SkCommandLineConfig that extracts information out of the backend // part of the tag. It is constructed tags that have: diff --git a/tools/flags/SkCommonFlagsGpu.h b/tools/flags/SkCommonFlagsGpu.h index 92986e9c3e..23800ec911 100644 --- a/tools/flags/SkCommonFlagsGpu.h +++ b/tools/flags/SkCommonFlagsGpu.h @@ -8,8 +8,6 @@ #ifndef SK_COMMON_FLAGS_GPU_H #define SK_COMMON_FLAGS_GPU_H -#if SK_SUPPORT_GPU - #include "GrTypesPriv.h" #include "SkCommandLineFlags.h" #include "SkTypes.h" @@ -67,6 +65,4 @@ inline GpuPathRenderers CollectGpuPathRenderersFromFlags() { */ void SetCtxOptionsFromCommonFlags(struct GrContextOptions*); -#endif // SK_SUPPORT_GPU - #endif -- cgit v1.2.3