aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm
diff options
context:
space:
mode:
Diffstat (limited to 'dm')
-rw-r--r--dm/DM.cpp16
-rw-r--r--dm/DMGpuSupport.h92
-rw-r--r--dm/DMGpuTestProcs.cpp12
-rw-r--r--dm/DMSrcSink.cpp28
-rw-r--r--dm/DMSrcSink.h3
5 files changed, 2 insertions, 149 deletions
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 3551a8c8f2..69c2504191 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -857,17 +857,8 @@ static void push_sink(const SkCommandLineConfig& config, Sink* s) {
ts.tag = config.getTag();
}
-static bool gpu_supported() {
-#if SK_SUPPORT_GPU
- return FLAGS_gpu;
-#else
- return false;
-#endif
-}
-
static Sink* create_sink(const GrContextOptions& grCtxOptions, const SkCommandLineConfig* config) {
-#if SK_SUPPORT_GPU
- if (gpu_supported()) {
+ if (FLAGS_gpu) {
if (const SkCommandLineConfigGpu* gpuConfig = config->asConfigGpu()) {
GrContextFactory::ContextType contextType = gpuConfig->getContextType();
GrContextFactory::ContextOverrides contextOverrides = gpuConfig->getContextOverrides();
@@ -892,7 +883,6 @@ static Sink* create_sink(const GrContextOptions& grCtxOptions, const SkCommandLi
}
}
}
-#endif
if (const SkCommandLineConfigSvg* svgConfig = config->asConfigSvg()) {
int pageIndex = svgConfig->getPageIndex();
return new SVGSink(pageIndex);
@@ -1273,7 +1263,7 @@ static void gather_tests() {
if (SkCommandLineFlags::ShouldSkip(FLAGS_match, test.name)) {
continue;
}
- if (test.needsGpu && gpu_supported()) {
+ if (test.needsGpu && FLAGS_gpu) {
(FLAGS_gpu_threading ? gParallelTests : gSerialTests).push(test);
} else if (!test.needsGpu && FLAGS_cpu) {
gParallelTests.push(test);
@@ -1366,9 +1356,7 @@ int main(int argc, char** argv) {
}
GrContextOptions grCtxOptions;
-#if SK_SUPPORT_GPU
SetCtxOptionsFromCommonFlags(&grCtxOptions);
-#endif
JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing.
SkAutoGraphics ag;
diff --git a/dm/DMGpuSupport.h b/dm/DMGpuSupport.h
deleted file mode 100644
index 1ed00953c1..0000000000
--- a/dm/DMGpuSupport.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef DMGpuSupport_DEFINED
-#define DMGpuSupport_DEFINED
-
-// Provides Ganesh to DM,
-// or if it's not available, fakes it enough so most code doesn't have to know that.
-
-#include "SkSurface.h"
-
-// This should be safe to include even in no-gpu builds. Include by relative path so it
-// can be found in non-gpu builds.
-#include "../include/gpu/GrContextOptions.h"
-
-#if SK_SUPPORT_GPU
-
-// Ganesh is available. Yippee!
-
-# include "GrContext.h"
-# include "GrContextFactory.h"
-
-namespace DM {
-
-static const bool kGPUDisabled = false;
-
-} // namespace DM
-
-#else// !SK_SUPPORT_GPU
-
-// Ganesh is not available. Fake it.
-
-enum GrGLStandard {
- kNone_GrGLStandard,
- kGL_GrGLStandard,
- kGLES_GrGLStandard
-};
-static const int kGrGLStandardCnt = 3;
-
-class GrContext {
-public:
- void dumpCacheStats(SkString*) const {}
- void dumpGpuStats(SkString*) const {}
-};
-
-class SkCommandLineConfigGpu {
-public:
- enum class SurfType;
-};
-
-namespace sk_gpu_test {
-class GrContextFactory {
-public:
- GrContextFactory() {}
- explicit GrContextFactory(const GrContextOptions&) {}
-
- typedef int ContextType;
-
- static const ContextType kANGLE_ContextType = 0,
- kANGLE_GL_ContextType = 0,
- kCommandBuffer_ContextType = 0,
- kDebugGL_ContextType = 0,
- kNVPR_ContextType = 0,
- kNativeGL_ContextType = 0,
- kGL_ContextType = 0,
- kGLES_ContextType = 0,
- kNullGL_ContextType = 0,
- kVulkan_ContextType = 0,
- kMetal_ContextType = 0;
- static const int kContextTypeCnt = 1;
- enum class ContextOverrides {};
- void destroyContexts() {}
-
- void abandonContexts() {}
-
- void releaseResourcesAndAbandonContexts() {}
-};
-} // namespace sk_gpu_test
-
-namespace DM {
-
-static const bool kGPUDisabled = true;
-
-} // namespace DM
-
-#endif//SK_SUPPORT_GPU
-
-#endif//DMGpuSupport_DEFINED
diff --git a/dm/DMGpuTestProcs.cpp b/dm/DMGpuTestProcs.cpp
index ef55c0ab55..abae62806f 100644
--- a/dm/DMGpuTestProcs.cpp
+++ b/dm/DMGpuTestProcs.cpp
@@ -11,11 +11,8 @@ using sk_gpu_test::GrContextFactory;
using sk_gpu_test::GLTestContext;
using sk_gpu_test::ContextInfo;
-// TODO: currently many GPU tests are declared outside SK_SUPPORT_GPU guards.
-// Thus we export the empty RunWithGPUTestContexts when SK_SUPPORT_GPU=0.
namespace skiatest {
-#if SK_SUPPORT_GPU
bool IsGLContextType(sk_gpu_test::GrContextFactory::ContextType type) {
return kOpenGL_GrBackend == GrContextFactory::ContextTypeBackend(type);
}
@@ -28,17 +25,9 @@ bool IsRenderingGLContextType(sk_gpu_test::GrContextFactory::ContextType type) {
bool IsNullGLContextType(sk_gpu_test::GrContextFactory::ContextType type) {
return type == GrContextFactory::kNullGL_ContextType;
}
-#else
-bool IsGLContextType(int) { return false; }
-bool IsVulkanContextType(int) { return false; }
-bool IsRenderingGLContextType(int) { return false; }
-bool IsNullGLContextType(int) { return false; }
-#endif
void RunWithGPUTestContexts(GrContextTestFn* test, GrContextTypeFilterFn* contextTypeFilter,
Reporter* reporter, const GrContextOptions& options) {
-#if SK_SUPPORT_GPU
-
#if defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_FOR_MAC)
static constexpr auto kNativeGLType = GrContextFactory::kGL_ContextType;
#else
@@ -78,6 +67,5 @@ void RunWithGPUTestContexts(GrContextTestFn* test, GrContextTypeFilterFn* contex
ctxInfo.grContext()->flush();
}
}
-#endif
}
} // namespace skiatest
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index e111ecc0f0..5b93de3ed9 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -75,11 +75,9 @@
#include "../third_party/skcms/skcms.h"
-#if SK_SUPPORT_GPU
#include "GrBackendSurface.h"
#include "GrContextPriv.h"
#include "GrGpu.h"
-#endif
DEFINE_bool(multiPage, false, "For document-type backends, render the source"
" into multiple pages");
@@ -1500,7 +1498,6 @@ Error GPUSink::onDraw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log,
SkImageInfo info =
SkImageInfo::Make(size.width(), size.height(), fColorType, fAlphaType, fColorSpace);
sk_sp<SkSurface> surface;
-#if SK_SUPPORT_GPU
GrContext* context = factory.getContextInfo(fContextType, fContextOverrides).grContext();
const int maxDimension = context->contextPriv().caps()->maxTextureSize();
if (maxDimension < SkTMax(size.width(), size.height())) {
@@ -1537,7 +1534,6 @@ Error GPUSink::onDraw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log,
}
break;
}
-#endif
if (!surface) {
return "Could not create a surface.";
@@ -1552,10 +1548,8 @@ Error GPUSink::onDraw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log,
}
canvas->flush();
if (FLAGS_gpuStats) {
-#if SK_SUPPORT_GPU
canvas->getGrContext()->contextPriv().dumpCacheStats(log);
canvas->getGrContext()->contextPriv().dumpGpuStats(log);
-#endif
}
if (info.colorType() == kRGB_565_SkColorType || info.colorType() == kARGB_4444_SkColorType ||
info.colorType() == kRGB_888x_SkColorType) {
@@ -1571,7 +1565,6 @@ Error GPUSink::onDraw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log,
} else if (FLAGS_releaseAndAbandonGpuContext) {
factory.releaseResourcesAndAbandonContexts();
}
-#if SK_SUPPORT_GPU
if (!context->contextPriv().abandoned()) {
surface.reset();
if (backendTexture.isValid()) {
@@ -1581,7 +1574,6 @@ Error GPUSink::onDraw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log,
context->contextPriv().getGpu()->deleteTestingOnlyBackendRenderTarget(backendRT);
}
}
-#endif
return "";
}
@@ -1599,11 +1591,7 @@ GPUThreadTestingSink::GPUThreadTestingSink(GrContextFactory::ContextType ct,
const GrContextOptions& grCtxOptions)
: INHERITED(ct, overrides, surfType, samples, diText, colorType, alphaType,
std::move(colorSpace), threaded, grCtxOptions)
-#if SK_SUPPORT_GPU
, fExecutor(SkExecutor::MakeFIFOThreadPool(FLAGS_gpuThreads)) {
-#else
- , fExecutor(nullptr) {
-#endif
SkASSERT(fExecutor);
}
@@ -1613,10 +1601,8 @@ Error GPUThreadTestingSink::draw(const Src& src, SkBitmap* dst, SkWStream* wStre
// Also, force us to only use the software path renderer, so we really stress-test the threaded
// version of that code.
GrContextOptions contextOptions = this->baseContextOptions();
-#if SK_SUPPORT_GPU
contextOptions.fGpuPathRenderers = GpuPathRenderers::kNone;
contextOptions.fExecutor = fExecutor.get();
-#endif
Error err = this->onDraw(src, dst, wStream, log, contextOptions);
if (!err.isEmpty() || !dst) {
@@ -1626,9 +1612,7 @@ Error GPUThreadTestingSink::draw(const Src& src, SkBitmap* dst, SkWStream* wStre
SkBitmap reference;
SkString refLog;
SkDynamicMemoryWStream refStream;
-#if SK_SUPPORT_GPU
contextOptions.fExecutor = nullptr;
-#endif
Error refErr = this->onDraw(src, &reference, &refStream, &refLog, contextOptions);
if (!refErr.isEmpty()) {
return refErr;
@@ -2008,8 +1992,6 @@ Error ViaTiles::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStri
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#if SK_SUPPORT_GPU
-
ViaDDL::ViaDDL(int numDivisions, Sink* sink)
: Via(sink)
, fNumDivisions(numDivisions) {
@@ -2071,16 +2053,6 @@ Error ViaDDL::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString
});
}
-#else
-
-ViaDDL::ViaDDL(int numDivisions, Sink* sink) : Via(sink) { }
-
-Error ViaDDL::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) const {
- return "ViaDDL is GPU only";
-}
-
-#endif
-
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
Error ViaPicture::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) const {
diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h
index 982040469c..9c31c0ab22 100644
--- a/dm/DMSrcSink.h
+++ b/dm/DMSrcSink.h
@@ -8,7 +8,6 @@
#ifndef DMSrcSink_DEFINED
#define DMSrcSink_DEFINED
-#include "DMGpuSupport.h"
#include "SkBBHFactory.h"
#include "SkBBoxHierarchy.h"
#include "SkBitmap.h"
@@ -528,9 +527,7 @@ public:
ViaDDL(int numDivisions, Sink* sink);
Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
private:
-#if SK_SUPPORT_GPU
const int fNumDivisions;
-#endif
};
class ViaSVG : public Via {