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 /tools | |
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 'tools')
-rw-r--r-- | tools/DDLPromiseImageHelper.cpp | 4 | ||||
-rw-r--r-- | tools/DDLPromiseImageHelper.h | 3 | ||||
-rw-r--r-- | tools/DDLTileHelper.cpp | 4 | ||||
-rw-r--r-- | tools/DDLTileHelper.h | 3 | ||||
-rw-r--r-- | tools/debugger/SkDebugCanvas.cpp | 22 | ||||
-rw-r--r-- | tools/flags/SkCommonFlags.cpp | 4 | ||||
-rw-r--r-- | tools/flags/SkCommonFlagsConfig.cpp | 16 | ||||
-rw-r--r-- | tools/flags/SkCommonFlagsConfig.h | 9 | ||||
-rw-r--r-- | tools/flags/SkCommonFlagsGpu.h | 4 | ||||
-rw-r--r-- | tools/skiaserve/Request.cpp | 14 | ||||
-rw-r--r-- | tools/skiaserve/Request.h | 2 |
11 files changed, 0 insertions, 85 deletions
diff --git a/tools/DDLPromiseImageHelper.cpp b/tools/DDLPromiseImageHelper.cpp index 1eed565331..43a2546f0e 100644 --- a/tools/DDLPromiseImageHelper.cpp +++ b/tools/DDLPromiseImageHelper.cpp @@ -7,8 +7,6 @@ #include "DDLPromiseImageHelper.h" -#if SK_SUPPORT_GPU - #include "GrContext.h" #include "GrContextPriv.h" #include "GrGpu.h" @@ -177,5 +175,3 @@ int DDLPromiseImageHelper::findOrDefineImage(SkImage* image) { SkASSERT(this->isValidID(newID)); return newID; } - -#endif diff --git a/tools/DDLPromiseImageHelper.h b/tools/DDLPromiseImageHelper.h index b4b51a4f5b..5bc97afc34 100644 --- a/tools/DDLPromiseImageHelper.h +++ b/tools/DDLPromiseImageHelper.h @@ -11,8 +11,6 @@ #include "SkBitmap.h" #include "SkTArray.h" -#if SK_SUPPORT_GPU - #include "GrBackendSurface.h" class GrContext; @@ -141,4 +139,3 @@ private: }; #endif -#endif diff --git a/tools/DDLTileHelper.cpp b/tools/DDLTileHelper.cpp index 462915aafc..3f5482bc99 100644 --- a/tools/DDLTileHelper.cpp +++ b/tools/DDLTileHelper.cpp @@ -7,8 +7,6 @@ #include "DDLTileHelper.h" -#if SK_SUPPORT_GPU - #include "DDLPromiseImageHelper.h" #include "SkCanvas.h" #include "SkDeferredDisplayListRecorder.h" @@ -162,5 +160,3 @@ void DDLTileHelper::resetAllTiles() { fTiles[i].reset(); } } - -#endif diff --git a/tools/DDLTileHelper.h b/tools/DDLTileHelper.h index fa6f8115bc..669eded484 100644 --- a/tools/DDLTileHelper.h +++ b/tools/DDLTileHelper.h @@ -12,8 +12,6 @@ #include "SkRefCnt.h" #include "SkSurfaceCharacterization.h" -#if SK_SUPPORT_GPU - class DDLPromiseImageHelper; class SkCanvas; class SkData; @@ -77,4 +75,3 @@ private: }; #endif -#endif diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp index d9e9871942..8026eed479 100644 --- a/tools/debugger/SkDebugCanvas.cpp +++ b/tools/debugger/SkDebugCanvas.cpp @@ -14,11 +14,9 @@ #include "SkTextBlob.h" #include "SkClipOpPriv.h" -#if SK_SUPPORT_GPU #include "GrAuditTrail.h" #include "GrContext.h" #include "GrRenderTargetContext.h" -#endif #define SKDEBUGCANVAS_VERSION 1 #define SKDEBUGCANVAS_ATTRIBUTE_VERSION "version" @@ -112,17 +110,14 @@ void SkDebugCanvas::drawTo(SkCanvas* originalCanvas, int index, int m) { DebugPaintFilterCanvas filterCanvas(originalCanvas, fOverdrawViz); -#if SK_SUPPORT_GPU // If we have a GPU backend we can also visualize the op information GrAuditTrail* at = nullptr; if (fDrawGpuOpBounds || m != -1) { // The audit trail must be obtained from the original canvas. at = this->getAuditTrail(originalCanvas); } -#endif for (int i = 0; i <= index; i++) { -#if SK_SUPPORT_GPU // We need to flush any pending operations, or they might combine with commands below. // Previous operations were not registered with the audit trail when they were // created, so if we allow them to combine, the audit trail will fail to find them. @@ -132,16 +127,13 @@ void SkDebugCanvas::drawTo(SkCanvas* originalCanvas, int index, int m) { if (at) { acb = new GrAuditTrail::AutoCollectOps(at, i); } -#endif if (fCommandVector[i]->isVisible()) { fCommandVector[i]->execute(&filterCanvas); } -#if SK_SUPPORT_GPU if (at && acb) { delete acb; } -#endif } if (SkColorGetA(fClipVizColor) != 0) { @@ -160,7 +152,6 @@ void SkDebugCanvas::drawTo(SkCanvas* originalCanvas, int index, int m) { fClip = filterCanvas.getDeviceClipBounds(); filterCanvas.restoreToCount(saveCount); -#if SK_SUPPORT_GPU // draw any ops if required and issue a full reset onto GrAuditTrail if (at) { // just in case there is global reordering, we flush the canvas before querying @@ -208,7 +199,6 @@ void SkDebugCanvas::drawTo(SkCanvas* originalCanvas, int index, int m) { } } } -#endif this->cleanupAuditTrail(originalCanvas); } @@ -225,17 +215,14 @@ SkDrawCommand* SkDebugCanvas::getDrawCommandAt(int index) { GrAuditTrail* SkDebugCanvas::getAuditTrail(SkCanvas* canvas) { GrAuditTrail* at = nullptr; -#if SK_SUPPORT_GPU GrContext* ctx = canvas->getGrContext(); if (ctx) { at = ctx->contextPriv().getAuditTrail(); } -#endif return at; } void SkDebugCanvas::drawAndCollectOps(int n, SkCanvas* canvas) { -#if SK_SUPPORT_GPU GrAuditTrail* at = this->getAuditTrail(canvas); if (at) { // loop over all of the commands and draw them, this is to collect reordering @@ -251,16 +238,13 @@ void SkDebugCanvas::drawAndCollectOps(int n, SkCanvas* canvas) { canvas->flush(); } } -#endif } void SkDebugCanvas::cleanupAuditTrail(SkCanvas* canvas) { GrAuditTrail* at = this->getAuditTrail(canvas); if (at) { -#if SK_SUPPORT_GPU GrAuditTrail::AutoEnable ae(at); at->fullReset(); -#endif } } @@ -268,15 +252,12 @@ Json::Value SkDebugCanvas::toJSON(UrlDataManager& urlDataManager, int n, SkCanva this->drawAndCollectOps(n, canvas); // now collect json -#if SK_SUPPORT_GPU GrAuditTrail* at = this->getAuditTrail(canvas); -#endif Json::Value result = Json::Value(Json::objectValue); result[SKDEBUGCANVAS_ATTRIBUTE_VERSION] = Json::Value(SKDEBUGCANVAS_VERSION); Json::Value commands = Json::Value(Json::arrayValue); for (int i = 0; i < this->getSize() && i <= n; i++) { commands[i] = this->getDrawCommandAt(i)->toJSON(urlDataManager); -#if SK_SUPPORT_GPU if (at) { // TODO if this is inefficient we could add a method to GrAuditTrail which takes // a Json::Value and is only compiled in this file @@ -286,7 +267,6 @@ Json::Value SkDebugCanvas::toJSON(UrlDataManager& urlDataManager, int n, SkCanva commands[i][SKDEBUGCANVAS_ATTRIBUTE_AUDITTRAIL] = parsedFromString; } -#endif } this->cleanupAuditTrail(canvas); result[SKDEBUGCANVAS_ATTRIBUTE_COMMANDS] = commands; @@ -297,14 +277,12 @@ Json::Value SkDebugCanvas::toJSONOpList(int n, SkCanvas* canvas) { this->drawAndCollectOps(n, canvas); Json::Value parsedFromString; -#if SK_SUPPORT_GPU GrAuditTrail* at = this->getAuditTrail(canvas); if (at) { GrAuditTrail::AutoManageOpList enable(at); Json::Reader reader; SkAssertResult(reader.parse(at->toJson().c_str(), parsedFromString)); } -#endif this->cleanupAuditTrail(canvas); return parsedFromString; } 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<SkString>* 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 <stdlib.h> -#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<SkString, SkString> fOptionsMap; }; -#if SK_SUPPORT_GPU SkCommandLineConfigGpu::SkCommandLineConfigGpu( const SkString& tag, const SkTArray<SkString>& 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<SkString>& 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<SkString>& 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<SkString> 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 diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp index 7808638c3b..61f79f1389 100644 --- a/tools/skiaserve/Request.cpp +++ b/tools/skiaserve/Request.cpp @@ -27,20 +27,14 @@ Request::Request(SkString rootUrl) , fOverdraw(false) , fColorMode(0) { // create surface -#if SK_SUPPORT_GPU GrContextOptions grContextOpts; fContextFactory = new GrContextFactory(grContextOpts); -#else - fContextFactory = nullptr; -#endif } Request::~Request() { -#if SK_SUPPORT_GPU if (fContextFactory) { delete fContextFactory; } -#endif } SkBitmap* Request::getBitmapFromCanvas(SkCanvas* canvas) { @@ -70,7 +64,6 @@ sk_sp<SkData> Request::writeCanvasToPng(SkCanvas* canvas) { } SkCanvas* Request::getCanvas() { -#if SK_SUPPORT_GPU GrContextFactory* factory = fContextFactory; GLTestContext* gl = factory->getContextInfo(GrContextFactory::kGL_ContextType, GrContextFactory::ContextOverrides::kNone).glContext(); @@ -81,7 +74,6 @@ SkCanvas* Request::getCanvas() { if (gl) { gl->makeCurrent(); } -#endif SkASSERT(fDebugCanvas); // create the appropriate surface if necessary @@ -117,7 +109,6 @@ sk_sp<SkData> Request::writeOutSkp() { } GrContext* Request::getContext() { -#if SK_SUPPORT_GPU GrContext* result = fContextFactory->get(GrContextFactory::kGL_ContextType, GrContextFactory::ContextOverrides::kNone); if (!result) { @@ -125,9 +116,6 @@ GrContext* Request::getContext() { GrContextFactory::ContextOverrides::kNone); } return result; -#else - return nullptr; -#endif } SkIRect Request::getBounds() { @@ -135,11 +123,9 @@ SkIRect Request::getBounds() { if (fPicture) { bounds = fPicture->cullRect().roundOut(); if (fGPUEnabled) { -#if SK_SUPPORT_GPU int maxRTSize = this->getContext()->maxRenderTargetSize(); bounds = SkIRect::MakeWH(SkTMin(bounds.width(), maxRTSize), SkTMin(bounds.height(), maxRTSize)); -#endif } } else { bounds = SkIRect::MakeWH(kDefaultWidth, kDefaultHeight); diff --git a/tools/skiaserve/Request.h b/tools/skiaserve/Request.h index 7f41748c02..44df83d466 100644 --- a/tools/skiaserve/Request.h +++ b/tools/skiaserve/Request.h @@ -10,9 +10,7 @@ #include "SkTypes.h" -#if SK_SUPPORT_GPU #include "GrContextFactory.h" -#endif #include "SkDebugCanvas.h" #include "SkPicture.h" |