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>
This commit is contained in:
Brian Osman 2018-05-31 14:27:17 -04:00 committed by Skia Commit-Bot
parent 8103bb9609
commit c7ad40f76f
143 changed files with 37 additions and 906 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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"
#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;
using sk_gpu_test::ContextInfo;
using sk_gpu_test::GrContextFactory;
using sk_gpu_test::TestContext;
GrContextOptions grContextOpts;
#endif
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: ");

View File

@ -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 {

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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 {

View File

@ -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 {

View File

@ -10,8 +10,6 @@
#include "gm.h"
#include "sk_tool_utils.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrOpFlushState.h"
#include "GrPathUtils.h"
@ -638,5 +636,3 @@ DEF_GM(return new BezierCubicEffects;)
DEF_GM(return new BezierConicEffects;)
DEF_GM(return new BezierQuadEffects;)
}
#endif

View File

@ -7,7 +7,6 @@
#include "gm.h"
#include "sk_tool_utils.h"
#if SK_SUPPORT_GPU
#include "GrCaps.h"
#include "GrContext.h"
#include "GrRenderTargetContextPriv.h"
@ -129,4 +128,3 @@ DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeRectXY(SkRect::MakeIWH(kSize
DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeRectXY(SkRect::MakeIWH(kSize - 1, kSize - 10), kSize/2.f - 10.f, kSize/2.f - 15.f), "elliptical_corner"); )
}
#endif

View File

@ -11,11 +11,9 @@
#include "SkShader.h"
#include "sk_tool_utils.h"
#if SK_SUPPORT_GPU
#include "GrCaps.h"
#include "GrContext.h"
#include "GrContextPriv.h"
#endif
namespace skiagm {
@ -121,11 +119,9 @@ DEF_SIMPLE_GM(hugebitmapshader, canvas, 100, 100) {
// (See https://skia-review.googlesource.com/c/skia/+/73200)
int bitmapW = 1;
int bitmapH = 60000;
#if SK_SUPPORT_GPU
if (auto* ctx = canvas->getGrContext()) {
bitmapH = ctx->contextPriv().caps()->maxTextureSize() + 1;
}
#endif
bitmap.setInfo(SkImageInfo::MakeA8(bitmapW, bitmapH), bitmapW);
uint8_t* pixels = new uint8_t[bitmapH];
for(int i = 0; i < bitmapH; ++i) {

View File

@ -7,7 +7,6 @@
#include "gm.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
// This test exercises Ganesh's drawing of tiled bitmaps. In particular, that the offsets and the
@ -71,5 +70,3 @@ DEF_SIMPLE_GM_BG(bitmaptiled_fractional_horizontal, canvas, 1124, 365, SK_ColorB
DEF_SIMPLE_GM_BG(bitmaptiled_fractional_vertical, canvas, 365, 1124, SK_ColorBLACK) {
draw_tile_bitmap_with_fractional_offset(canvas, true);
}
#endif

View File

@ -15,11 +15,9 @@
#include "SkUtils.h"
#include "sk_tool_utils.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextOptions.h"
#include "SkGr.h"
#endif
/** Holds either a bitmap or image to be rendered and a rect that indicates what part of the bitmap
or image should be tested by the GM. The area outside of the rect is present to check
@ -402,11 +400,9 @@ protected:
}
}
#if SK_SUPPORT_GPU
void modifyGrContextOptions(GrContextOptions* options) override {
options->fMaxTileSizeOverride = kMaxTileSize;
}
#endif
private:
static constexpr int kBlockSize = 70;

View File

@ -10,8 +10,6 @@
#include "gm.h"
#include "sk_tool_utils.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrRenderTargetContextPriv.h"
#include "SkGr.h"
@ -184,5 +182,3 @@ private:
DEF_GM(return new ConstColorProcessor;)
}
#endif

View File

@ -9,8 +9,6 @@
#include "gm.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrDefaultGeoProcFactory.h"
#include "GrOpFlushState.h"
@ -278,5 +276,3 @@ private:
DEF_GM(return new ConvexPolyEffect;)
}
#endif

View File

@ -8,7 +8,6 @@
#include "gm.h"
#include "Resources.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "SkImage.h"
@ -46,5 +45,3 @@ DEF_SIMPLE_GM(cross_context_image, canvas, 512 * 3 + 60, 512 + 128 + 30) {
canvas->drawImage(crossContextSubset, 512 + 30, 512 + 30);
canvas->drawImage(crossContextRasterSubset, 512 + 512 + 60, 512 + 30);
}
#endif

View File

@ -39,7 +39,6 @@ protected:
SkScalar scales[] = { 2.0f*5.0f, 5.0f, 2.0f, 1.0f };
// set up offscreen rendering with distance field text
#if SK_SUPPORT_GPU
GrContext* ctx = inputCanvas->getGrContext();
SkISize size = onISize();
SkImageInfo info = SkImageInfo::MakeN32(size.width(), size.height(), kPremul_SkAlphaType,
@ -50,9 +49,6 @@ protected:
SkCanvas* canvas = surface ? surface->getCanvas() : inputCanvas;
// init our new canvas with the old canvas's matrix
canvas->setMatrix(inputCanvas->getTotalMatrix());
#else
SkCanvas* canvas = inputCanvas;
#endif
// apply global scale to test glyph positioning
canvas->scale(1.05f, 1.05f);
canvas->clear(0xffffffff);
@ -189,7 +185,6 @@ protected:
paint.setTextSize(SkIntToScalar(19));
canvas->drawString(fEmojiText, 670, 90, paint);
}
#if SK_SUPPORT_GPU
// render offscreen buffer
if (surface) {
SkAutoCanvasRestore acr(inputCanvas, true);
@ -197,7 +192,6 @@ protected:
inputCanvas->resetMatrix();
inputCanvas->drawImage(surface->makeImageSnapshot().get(), 0, 0, nullptr);
}
#endif
}
private:

View File

@ -46,7 +46,6 @@ protected:
virtual void onDraw(SkCanvas* inputCanvas) override {
// set up offscreen rendering with distance field text
#if SK_SUPPORT_GPU
GrContext* ctx = inputCanvas->getGrContext();
SkISize size = this->onISize();
if (!inputCanvas->getBaseLayerSize().isEmpty()) {
@ -60,9 +59,6 @@ protected:
SkCanvas* canvas = surface ? surface->getCanvas() : inputCanvas;
// init our new canvas with the old canvas's matrix
canvas->setMatrix(inputCanvas->getTotalMatrix());
#else
SkCanvas* canvas = inputCanvas;
#endif
SkScalar x = 0, y = 0;
SkScalar maxH = 0;
for (auto twm : {TranslateWithMatrix::kNo, TranslateWithMatrix::kYes}) {
@ -88,7 +84,6 @@ protected:
maxH = 0;
}
}
#if SK_SUPPORT_GPU
// render offscreen buffer
if (surface) {
SkAutoCanvasRestore acr(inputCanvas, true);
@ -96,7 +91,6 @@ protected:
inputCanvas->resetMatrix();
inputCanvas->drawImage(surface->makeImageSnapshot().get(), 0, 0, nullptr);
}
#endif
}
private:

View File

@ -12,8 +12,6 @@
#include "SkRandom.h"
#include "SkSurface.h"
#if SK_SUPPORT_GPU
namespace skiagm {
/*
@ -87,5 +85,3 @@ private:
DEF_GM(return new DiscardGM;)
} // end namespace
#endif

View File

@ -10,8 +10,6 @@
#include "SkSurface.h"
#if SK_SUPPORT_GPU
#include "GrContextPriv.h"
#include "ProxyUtils.h"
#include "SkImage_Gpu.h"
@ -271,5 +269,3 @@ private:
};
DEF_GM(return new FlippityGM;)
#endif

View File

@ -10,8 +10,6 @@
#include "gm.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrContextOptions.h"
@ -142,5 +140,3 @@ constexpr SkScalar FontCacheGM::kSize;
DEF_GM(return new FontCacheGM(GrContextOptions::Enable::kNo))
DEF_GM(return new FontCacheGM(GrContextOptions::Enable::kYes))
#endif

View File

@ -16,9 +16,7 @@
#include "SkStream.h"
#include "SkSurface.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#endif
static void drawContents(SkSurface* surface, SkColor fillC) {
SkSize size = SkSize::Make(SkIntToScalar(surface->width()),
@ -152,11 +150,8 @@ protected:
SkImageInfo info = SkImageInfo::MakeN32Premul(W, H);
sk_sp<SkSurface> surf0(SkSurface::MakeRasterDirect(info, fBuffer, RB));
sk_sp<SkSurface> surf1(SkSurface::MakeRaster(info));
sk_sp<SkSurface> surf2; // gpu
#if SK_SUPPORT_GPU
surf2 = SkSurface::MakeRenderTarget(canvas->getGrContext(), SkBudgeted::kNo, info);
#endif
sk_sp<SkSurface> surf2(SkSurface::MakeRenderTarget(canvas->getGrContext(),
SkBudgeted::kNo, info));
test_surface(canvas, surf0.get(), true);
canvas->translate(80, 0);

View File

@ -14,13 +14,11 @@
#include "SkPictureRecorder.h"
#include "SkSurface.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrSurfaceContext.h"
#include "GrTextureProxy.h"
#include "../src/image/SkImage_Gpu.h"
#endif
static void draw_something(SkCanvas* canvas, const SkRect& bounds) {
SkPaint paint;
@ -145,7 +143,6 @@ public:
EmptyGenerator(const SkImageInfo& info) : SkImageGenerator(info) {}
};
#if SK_SUPPORT_GPU
class TextureGenerator : public SkImageGenerator {
public:
TextureGenerator(GrContext* ctx, const SkImageInfo& info, sk_sp<SkPicture> pic)
@ -216,7 +213,6 @@ static std::unique_ptr<SkImageGenerator> make_tex_generator(GrContext* ctx, sk_s
}
return skstd::make_unique<TextureGenerator>(ctx, info, pic);
}
#endif
class ImageCacheratorGM : public skiagm::GM {
SkString fName;
@ -269,7 +265,6 @@ protected:
}
static void draw_as_tex(SkCanvas* canvas, SkImage* image, SkScalar x, SkScalar y) {
#if SK_SUPPORT_GPU
sk_sp<SkColorSpace> texColorSpace;
sk_sp<GrTextureProxy> proxy(as_IB(image)->asTextureProxyRef(
canvas->getGrContext(), GrSamplerState::ClampBilerp(),
@ -291,7 +286,6 @@ protected:
sk_ref_sp(canvas->getGrContext()), image->uniqueID(), kPremul_SkAlphaType,
std::move(proxy), std::move(texColorSpace), SkBudgeted::kNo));
canvas->drawImage(texImage.get(), x, y);
#endif
}
void drawSet(SkCanvas* canvas) const {
@ -333,6 +327,4 @@ private:
};
DEF_GM( return new ImageCacheratorGM("picture", make_pic_generator); )
DEF_GM( return new ImageCacheratorGM("raster", make_ras_generator); )
#if SK_SUPPORT_GPU
DEF_GM( return new ImageCacheratorGM("texture", make_tex_generator); )
#endif
DEF_GM( return new ImageCacheratorGM("texture", make_tex_generator); )

View File

@ -9,8 +9,6 @@
#include "gm.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrGpu.h"
@ -169,5 +167,3 @@ private:
DEF_GM(return new ImageFromYUVTextures;)
}
#endif

View File

@ -53,9 +53,7 @@ const MakerT makers[] = {
// SkImage_Gpu
[](SkCanvas* c, const SkImageInfo& info) -> sk_sp<SkImage> {
sk_sp<SkSurface> surface;
#if SK_SUPPORT_GPU
surface = SkSurface::MakeRenderTarget(c->getGrContext(), SkBudgeted::kNo, info);
#endif
return make_mask(surface ? surface : SkSurface::MakeRaster(info));
},

View File

@ -7,8 +7,6 @@
#include "gm.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextOptions.h"
#include "SkPath.h"
@ -113,5 +111,3 @@ private:
};
DEF_GM( return new PathMaskCache(); )
#endif

View File

@ -9,8 +9,6 @@
#include "gm.h"
#if SK_SUPPORT_GPU
#include "GrBackendSurface.h"
#include "GrContext.h"
#include "GrContextPriv.h"
@ -188,5 +186,3 @@ private:
DEF_GM(return new RectangleTexture;)
}
#endif

View File

@ -7,14 +7,12 @@
#include "gm.h"
#include "sk_tool_utils.h"
#if SK_SUPPORT_GPU
#include "GrCaps.h"
#include "GrContext.h"
#include "GrRenderTargetContextPriv.h"
#include "effects/GrRRectEffect.h"
#include "ops/GrDrawOp.h"
#include "ops/GrRectOpFactory.h"
#endif
#include "SkRRect.h"
namespace skiagm {
@ -83,11 +81,7 @@ protected:
SkIntToScalar(kImageHeight));
#endif
#if SK_SUPPORT_GPU
int lastEdgeType = (kEffect_Type == fType) ? (int) GrClipEdgeType::kLast: 0;
#else
int lastEdgeType = 0;
#endif
int y = 1;
for (int et = 0; et <= lastEdgeType; ++et) {
@ -103,7 +97,6 @@ protected:
canvas->save();
canvas->translate(SkIntToScalar(x), SkIntToScalar(y));
if (kEffect_Type == fType) {
#if SK_SUPPORT_GPU
SkRRect rrect = fRRects[curRRect];
rrect.offset(SkIntToScalar(x), SkIntToScalar(y));
GrClipEdgeType edgeType = (GrClipEdgeType) et;
@ -125,7 +118,6 @@ protected:
} else {
drew = false;
}
#endif
} else if (kBW_Clip_Type == fType || kAA_Clip_Type == fType) {
bool aaClip = (kAA_Clip_Type == fType);
canvas->clipRRect(fRRects[curRRect], aaClip);
@ -257,8 +249,6 @@ DEF_GM( return new RRectGM(RRectGM::kAA_Draw_Type); )
DEF_GM( return new RRectGM(RRectGM::kBW_Draw_Type); )
DEF_GM( return new RRectGM(RRectGM::kAA_Clip_Type); )
DEF_GM( return new RRectGM(RRectGM::kBW_Clip_Type); )
#if SK_SUPPORT_GPU
DEF_GM( return new RRectGM(RRectGM::kEffect_Type); )
#endif
}

View File

@ -116,11 +116,9 @@ protected:
SkImageInfo info = SkImageInfo::MakeN32Premul(size);
bool callNewSurface = true;
#if SK_SUPPORT_GPU
if (canvas->getGrContext() && skipGPU) {
callNewSurface = false;
}
#endif
sk_sp<SkSurface> surface = callNewSurface ? canvas->makeSurface(info) : nullptr;
if (nullptr == surface) {
// picture canvas will return null, so fall-back to raster

View File

@ -98,7 +98,6 @@ protected:
SkCanvas* canvas = inputCanvas;
sk_sp<SkSurface> surface;
if (fUseDFT) {
#if SK_SUPPORT_GPU
// Create a new Canvas to enable DFT
GrContext* ctx = inputCanvas->getGrContext();
SkISize size = onISize();
@ -111,7 +110,6 @@ protected:
canvas = surface.get() ? surface->getCanvas() : inputCanvas;
// init our new canvas with the old canvas's matrix
canvas->setMatrix(inputCanvas->getTotalMatrix());
#endif
}
canvas->drawColor(sk_tool_utils::color_to_565(SK_ColorWHITE));
@ -164,7 +162,6 @@ protected:
}
canvas->restore();
#if SK_SUPPORT_GPU
// render offscreen buffer
if (surface) {
SkAutoCanvasRestore acr(inputCanvas, true);
@ -172,7 +169,6 @@ protected:
inputCanvas->resetMatrix();
inputCanvas->drawImage(surface->makeImageSnapshot().get(), 0, 0, nullptr);
}
#endif
}
private:
@ -189,7 +185,5 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return new TextBlobMixedSizes(false); )
#if SK_SUPPORT_GPU
DEF_GM( return new TextBlobMixedSizes(true); )
#endif
}

View File

@ -17,8 +17,6 @@
#include "SkTextBlob.h"
#include "SkTypeface.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
namespace skiagm {
@ -168,4 +166,3 @@ private:
DEF_GM(return new TextBlobRandomFont;)
}
#endif

View File

@ -8,8 +8,6 @@
#include "gm.h"
#include "sk_tool_utils.h"
#if SK_SUPPORT_GPU
#include "SkCanvas.h"
#include "SkSurface.h"
#include "SkTextBlob.h"
@ -73,4 +71,3 @@ private:
DEF_GM(return new TextBlobUseAfterGpuFree;)
}
#endif

View File

@ -9,8 +9,6 @@
#include "gm.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrProxyProvider.h"
@ -155,5 +153,3 @@ private:
DEF_GM(return new TextureDomainEffect;)
}
#endif

View File

@ -10,7 +10,6 @@
#include "SkClipStack.h"
#include "SkRRect.h"
#if SK_SUPPORT_GPU
#include "GrAppliedClip.h"
#include "GrCaps.h"
#include "GrContextPriv.h"
@ -20,7 +19,6 @@
#include "GrResourceProvider.h"
#include "GrStencilClip.h"
#include "effects/GrTextureDomain.h"
#endif
constexpr static SkIRect kDeviceRect = {0, 0, 600, 600};
constexpr static SkIRect kCoverRect = {50, 50, 550, 550};
@ -104,8 +102,6 @@ DEF_GM( return new WindowRectanglesGM(); )
////////////////////////////////////////////////////////////////////////////////////////////////////
#if SK_SUPPORT_GPU
constexpr static int kNumWindows = 8;
/**
@ -286,6 +282,4 @@ void WindowRectanglesMaskGM::fail(SkCanvas* canvas) {
DEF_GM( return new WindowRectanglesMaskGM(); )
#endif
}

View File

@ -13,9 +13,7 @@
#include "SkBlendModePriv.h"
#include "SkColorPriv.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#endif
namespace skiagm {

View File

@ -9,8 +9,6 @@
#include "gm.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrProxyProvider.h"
@ -264,5 +262,3 @@ private:
DEF_GM(return new YUVNV12toRGBEffect;)
}
#endif

View File

@ -7,8 +7,6 @@
#include "SkTypes.h"
#if SK_SUPPORT_GPU
#include "GrCaps.h"
#include "GrContext.h"
#include "GrContextFactory.h"
@ -168,4 +166,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ApplyGamma, reporter, ctxInfo) {
}
}
}
#endif

View File

@ -19,7 +19,6 @@
#include "SkTypes.h"
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrBackendSurface.h"
#include "GrContext.h"
#include "GrContextFactory.h"
@ -27,7 +26,6 @@
#include "GrResourceProvider.h"
#include "GrTexture.h"
#include "GrTypes.h"
#endif
#include <vector>
@ -87,7 +85,6 @@ DEF_TEST(Blend_byte_multiply, r) {
for (auto multiply : perfect) { REPORTER_ASSERT(r, test(multiply).diffs == 0); }
}
#if SK_SUPPORT_GPU
namespace {
static sk_sp<SkSurface> create_gpu_surface_backend_texture_as_render_target(
GrContext* context, int sampleCnt, int width, int height, SkColorType colorType,
@ -206,4 +203,3 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ES2BlendWithNoTexture, reporter, ctxInfo)
backingSurface.reset();
}
}
#endif

View File

@ -39,9 +39,7 @@
#include "Test.h"
#include "sk_pixel_iter.h"
#if SK_SUPPORT_GPU
#include "GrContextFactory.h"
#endif
#include <math.h>
#include <string.h>
@ -349,9 +347,7 @@ DEF_TEST(BlurSigmaRange, reporter) {
#if WRITE_CSV
write_as_csv("RectSpecialCase", sigma, rectSpecialCaseResult, kSize);
write_as_csv("GeneralCase", sigma, generalCaseResult, kSize);
#if SK_SUPPORT_GPU
write_as_csv("GPU", sigma, gpuResult, kSize);
#endif
write_as_csv("GroundTruth2D", sigma, groundTruthResult, kSize);
write_as_csv("BruteForce1D", sigma, bruteForce1DResult, kSize);
#endif
@ -500,8 +496,6 @@ DEF_TEST(BlurAsABlur, reporter) {
}
}
#if SK_SUPPORT_GPU
// This exercises the problem discovered in crbug.com/570232. The return value from
// SkBlurMask::BoxBlur wasn't being checked in SkBlurMaskFilter.cpp::GrRRectBlurEffect::Create
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SmallBoxBlurBug, reporter, ctxInfo) {
@ -519,9 +513,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SmallBoxBlurBug, reporter, ctxInfo) {
canvas->drawRRect(rr, p);
}
#endif
DEF_TEST(BlurredRRectNinePatchComputation, reporter) {
const SkRect r = SkRect::MakeXYWH(10, 10, 100, 100);
static const SkScalar kBlurRad = 3.0f;
@ -710,7 +701,6 @@ DEF_TEST(BlurZeroSigma, reporter) {
///////////////////////////////////////////////////////////////////////////////////////////
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(BlurMaskBiggerThanDest, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
@ -741,6 +731,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(BlurMaskBiggerThanDest, reporter, ctxInfo) {
REPORTER_ASSERT(reporter, SkColorGetB(readback.getColor(15, 15)) == 0);
REPORTER_ASSERT(reporter, readback.getColor(31, 31) == SK_ColorBLACK);
}
#endif

View File

@ -7,7 +7,6 @@
#include "SkTypes.h"
#if SK_SUPPORT_GPU
#include "GrColor.h"
#include "GrContext.h"
#include "GrContextFactory.h"
@ -295,5 +294,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(FullScreenClearWithLayers, reporter, ctxInfo)
fullscreen_clear_with_layer_test(reporter, workaroundFactory.get(ctxInfo.type()));
}
}
#endif

View File

@ -7,8 +7,6 @@
#include "SkTypes.h"
// This is a GR test
#if SK_SUPPORT_GPU
#include "GrClipStackClip.h"
#include "SkClipOpPriv.h"
#include "SkClipStack.h"
@ -56,5 +54,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrClipBounds, reporter, ctxInfo) {
REPORTER_ASSERT(reporter, intScreen == devGrClipBound);
REPORTER_ASSERT(reporter, isIntersectionOfRects);
}
#endif

View File

@ -27,7 +27,6 @@
#include "SkTypes.h"
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrCaps.h"
#include "GrClip.h"
#include "GrClipStackClip.h"
@ -43,7 +42,6 @@
#include "GrTextureProxy.h"
typedef GrReducedClip::ElementList ElementList;
typedef GrReducedClip::InitialState InitialState;
#endif
#include <cstring>
#include <new>
@ -878,7 +876,6 @@ static void test_invfill_diff_bug(skiatest::Reporter* reporter) {
///////////////////////////////////////////////////////////////////////////////////////////////////
#if SK_SUPPORT_GPU
// Functions that add a shape to the clip stack. The shape is computed from a rectangle.
// AA is always disabled since the clip stack reducer can cause changes in aa rasterization of the
// stack. A fractional edge repeated in different elements may be rasterized fewer times using the
@ -1430,8 +1427,6 @@ static void test_tiny_query_bounds_assertion_bug(skiatest::Reporter* reporter) {
}
}
#endif
DEF_TEST(ClipStack, reporter) {
SkClipStack stack;
@ -1478,18 +1473,16 @@ DEF_TEST(ClipStack, reporter) {
test_path_replace(reporter);
test_quickContains(reporter);
test_invfill_diff_bug(reporter);
#if SK_SUPPORT_GPU
test_reduced_clip_stack(reporter);
test_reduced_clip_stack_genid(reporter);
test_reduced_clip_stack_no_aa_crash(reporter);
test_reduced_clip_stack_aa(reporter);
test_tiny_query_bounds_assertion_bug(reporter);
#endif
}
//////////////////////////////////////////////////////////////////////////////
#if SK_SUPPORT_GPU
sk_sp<GrTextureProxy> GrClipStackClip::testingOnly_createClipMask(GrContext* context) const {
const GrReducedClip reducedClip(*fStack, SkRect::MakeWH(512, 512), 0);
return this->createSoftwareClipMask(context, reducedClip, nullptr);
@ -1563,4 +1556,3 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(canvas_private_clipRgn, reporter, ctxInfo) {
REPORTER_ASSERT(reporter, rgn.getBounds() == SkIRect::MakeLTRB(3, 3, 7, 7));
canvas->restore();
}
#endif

View File

@ -7,7 +7,6 @@
#include "SkTypes.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextFactory.h"
#include "GrContextPriv.h"
@ -162,4 +161,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CopySurface, reporter, ctxInfo) {
}
}
}
#endif

View File

@ -7,7 +7,6 @@
#include "SkTypes.h"
#if SK_SUPPORT_GPU
#include "GrClip.h"
#include "GrColor.h"
#include "GrContext.h"
@ -138,5 +137,3 @@ DEF_GPUTEST_FOR_CONTEXTS(GrDefaultPathRendererTest,
run_test(ctx, reporter);
}
#endif

View File

@ -7,7 +7,6 @@
#include "SkTypes.h"
#if SK_SUPPORT_GPU
#include "GrBackendSurface.h"
#include "GrCaps.h"
#include "GrContext.h"
@ -939,5 +938,3 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(DDLCompatibilityTest, reporter, ctxInfo) {
}
}
#endif

View File

@ -7,7 +7,6 @@
#include "SkTypes.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextFactory.h"
#include "GrContextPriv.h"
@ -389,5 +388,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DetermineDomainModeTest, reporter, ctxInfo) {
proxy_test(reporter, context->contextPriv().proxyProvider());
}
#endif

View File

@ -16,12 +16,10 @@
#include "Test.h"
class SkColorSpace;
#if SK_SUPPORT_GPU
#include "GrContextFactory.h"
#include "GrTypes.h"
#include "SkGpuDevice.h"
class GrContext;
#endif
class DeviceTestingAccess {
public:
@ -78,8 +76,6 @@ DEF_TEST(SpecialImage_BitmapDevice, reporter) {
#endif
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_GPUDevice, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
@ -131,5 +127,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_GPUDevice, reporter, ctxInfo) {
SkASSERT(2*kHeight == special->height());
SkASSERT(SkIRect::MakeWH(2*kWidth, 2*kHeight) == special->subset());
}
#endif

View File

@ -7,7 +7,6 @@
#include "SkTypes.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextFactory.h"
#include "GrContextPriv.h"
@ -224,6 +223,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrAtlasTextOpPreparation, reporter, ctxInfo)
op->prepare(&flushState);
flushState.setOpArgs(nullptr);
}
#endif

View File

@ -7,7 +7,6 @@
#include "Test.h"
#include "TestUtils.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextFactory.h"
#include "GrContextPriv.h"
@ -198,5 +197,3 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) {
cleanup(glCtx0, externalTexture.fID, glCtx1.get(), context1, &backendTexture1, image);
}
#endif

View File

@ -15,7 +15,6 @@
#include <float.h>
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrProxyProvider.h"
@ -98,5 +97,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HalfFloatRGBATextureTest, reporter, ctxInfo)
kMaxIntegerRepresentableInHalfFloatingPoint, HALF_RGBA_CONTROL_ARRAY_SIZE,
GrColorType::kRGBA_F16);
}
#endif

View File

@ -9,7 +9,7 @@
#include "SkTypes.h"
#if SK_SUPPORT_GPU && SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
#if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
#include "GrAutoLocaleSetter.h"
#include "GrContextFactory.h"

View File

@ -7,8 +7,6 @@
#include "SkTypes.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrPath.h"
#include "GrShape.h"
@ -163,5 +161,3 @@ DEF_GPUTEST(GrPathKeys, reporter, /* options */) {
}
}
}
#endif

View File

@ -9,8 +9,6 @@
// The test fails when we add a discard to a newly created render target.
#if 0
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrLayerCache.h"
#include "GrResourceCache.h"
@ -371,4 +369,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GpuLayerCache, reporter, ctxInfo) {
}
#endif
#endif

View File

@ -5,8 +5,6 @@
* found in the LICENSE file.
*/
#if SK_SUPPORT_GPU
#include "GrRectanizer_pow2.h"
#include "GrRectanizer_skyline.h"
#include "SkRandom.h"
@ -70,5 +68,3 @@ DEF_GPUTEST(GpuRectanizer, reporter, factory) {
test_skyline(reporter, rects);
test_pow2(reporter, rects);
}
#endif

View File

@ -6,8 +6,6 @@
*/
#include "Test.h"
// This is a GPU-backend specific test
#if SK_SUPPORT_GPU
#include "GrAllocator.h"
namespace {
@ -99,5 +97,3 @@ DEF_TEST(GrAllocator, reporter) {
check_allocator(allocators[i], 100, 10, reporter);
}
}
#endif

View File

@ -8,8 +8,6 @@
#include "SkTypes.h"
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrClip.h"
@ -310,5 +308,3 @@ class GrCCPRTest_busyPath : public CCPRRenderingTest {
}
};
DEF_CCPR_RENDERING_TEST(GrCCPRTest_busyPath)
#endif

View File

@ -7,8 +7,6 @@
#include "SkTypes.h"
#if SK_SUPPORT_GPU
#include "GrContextFactory.h"
#include "Test.h"
@ -49,5 +47,3 @@ DEF_GPUTEST(GrContext_abandonContext, reporter, options) {
}
}
}
#endif

View File

@ -7,8 +7,6 @@
#include "SkTypes.h"
#if SK_SUPPORT_GPU
#include "GrContextFactory.h"
#include "GrContextPriv.h"
#include "GrCaps.h"
@ -167,5 +165,3 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrContextDump, reporter, ctxInfo) {
SkString result = ctxInfo.grContext()->contextPriv().dump();
REPORTER_ASSERT(reporter, !result.isEmpty());
}
#endif

View File

@ -7,9 +7,6 @@
#include "SkTypes.h"
// This test is a GPU-backend specific test.
#if SK_SUPPORT_GPU
#include "gl/GrGLDefines.h"
#include "gl/GrGLExtensions.h"
#include "Test.h"
@ -49,5 +46,3 @@ DEF_TEST(GrGLExtensionsTest_remove, reporter) {
REPORTER_ASSERT(reporter, ext.remove("test_extension_1"));
REPORTER_ASSERT(reporter, !ext.has("test_extension_1"));
}
#endif

View File

@ -6,8 +6,6 @@
*/
#include "Test.h"
// This is a GPU-backend specific test
#if SK_SUPPORT_GPU
#include "GrMemoryPool.h"
#include "SkRandom.h"
#include "SkTArray.h"
@ -397,5 +395,3 @@ DEF_TEST(GrObjectMemoryPoolAPI, reporter) {
REPORTER_ASSERT(reporter, secondBlockCount == kMinAllocCount);
}
}
#endif

View File

@ -8,8 +8,6 @@
#include "SkTypes.h"
#include "Test.h"
#if SK_SUPPORT_GPU
#include <array>
#include <vector>
#include "GrCaps.h"
@ -406,5 +404,3 @@ static void run_test(const char* testName, skiatest::Reporter* reporter,
}
}
}
#endif

View File

@ -7,8 +7,6 @@
#include "SkTypes.h"
#if SK_SUPPORT_GPU
#include "GrBackendSurface.h"
#include "GrBackendTextureImageGenerator.h"
#include "GrContext.h"
@ -289,5 +287,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn
}
}
}
#endif

View File

@ -8,8 +8,6 @@
#include "SkTypes.h"
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrColor.h"
#include "GrGeometryProcessor.h"
@ -218,5 +216,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrPipelineDynamicStateTest, reporter, ctxInfo
}
}
}
#endif

View File

@ -7,8 +7,6 @@
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrContextFactory.h"
#include "GrContextOptions.h"
#include "GrContextPriv.h"
@ -1104,5 +1102,3 @@ DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, options) {
}
gpu->deleteTestingOnlyBackendTexture(backendTex);
}
#endif

View File

@ -7,7 +7,6 @@
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrSKSLPrettyPrint.h"
#define ASSERT(x) REPORTER_ASSERT(r, x)
@ -120,5 +119,3 @@ DEF_TEST(GrSKSLPrettyPrint, r) {
ASSERT(GrSKSLPrettyPrint::PrettyPrint(testStr.begin(), lengths.begin(), 1,
true).c_str() != nullptr);
}
#endif

View File

@ -8,7 +8,6 @@
#include <initializer_list>
#include <functional>
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrShape.h"
#include "SkCanvas.h"
#include "SkDashPathEffect.h"
@ -2328,5 +2327,3 @@ DEF_TEST(GrShape_arcs, reporter) {
ovalArcWithCenter.compare(reporter, oval, ovalExpectations);
}
}
#endif

View File

@ -7,8 +7,6 @@
#include "SkTypes.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrGpu.h"
@ -231,4 +229,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(InitialTextureClear, reporter, context_info)
}
}
}
#endif

View File

@ -10,8 +10,6 @@
#include "SkString.h"
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrTRecorder.h"
////////////////////////////////////////////////////////////////////////////////
@ -292,5 +290,3 @@ DEF_GPUTEST(GrTRecorder, reporter, /* options */) {
test_subclasses(reporter);
REPORTER_ASSERT(reporter, 0 == activeRecorderItems); // Ensure ~GrTRecorder invokes dtors.
}
#endif

View File

@ -7,8 +7,6 @@
#include "SkTypes.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrTexturePriv.h"
#include "SkCanvas.h"
@ -53,5 +51,3 @@ DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrTextureMipMapInvalidationTest, reporter, ctxInf
REPORTER_ASSERT(reporter, isMipped(surf1.get()));
REPORTER_ASSERT(reporter, mipsAreDirty(surf1.get()));
}
#endif

View File

@ -191,7 +191,6 @@ DEF_TEST(ImageFilterCache_ImageBackedRaster, reporter) {
test_image_backed(reporter, srcImage);
}
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrProxyProvider.h"
@ -282,4 +281,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_GPUBacked, reporter, ctxInfo
test_internal_purge(reporter, fullImg);
test_explicit_purging(reporter, fullImg, subsetImg);
}
#endif

View File

@ -42,11 +42,9 @@
#include "Test.h"
#include "sk_tool_utils.h"
#if SK_SUPPORT_GPU
#include "GrCaps.h"
#include "GrContext.h"
#include "GrContextPriv.h"
#endif
static const int kBitmapSize = 4;
@ -390,14 +388,11 @@ static sk_sp<SkImageFilter> make_blue(sk_sp<SkImageFilter> input,
}
static sk_sp<SkSpecialSurface> create_empty_special_surface(GrContext* context, int widthHeight) {
#if SK_SUPPORT_GPU
if (context) {
return SkSpecialSurface::MakeRenderTarget(context,
widthHeight, widthHeight,
kRGBA_8888_GrPixelConfig, nullptr);
} else
#endif
{
} else {
const SkImageInfo info = SkImageInfo::MakeN32(widthHeight, widthHeight,
kOpaque_SkAlphaType);
return SkSpecialSurface::MakeRaster(info);
@ -406,12 +401,9 @@ static sk_sp<SkSpecialSurface> create_empty_special_surface(GrContext* context,
static sk_sp<SkSurface> create_surface(GrContext* context, int width, int height) {
const SkImageInfo info = SkImageInfo::MakeN32(width, height, kOpaque_SkAlphaType);
#if SK_SUPPORT_GPU
if (context) {
return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info);
} else
#endif
{
} else {
return SkSurface::MakeRaster(info);
}
}
@ -650,11 +642,9 @@ DEF_TEST(ImageFilterNegativeBlurSigma, reporter) {
test_negative_blur_sigma(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterNegativeBlurSigma_Gpu, reporter, ctxInfo) {
test_negative_blur_sigma(reporter, ctxInfo.grContext());
}
#endif
static void test_zero_blur_sigma(skiatest::Reporter* reporter, GrContext* context) {
// Check that SkBlurImageFilter with a zero sigma and a non-zero srcOffset works correctly.
@ -694,11 +684,9 @@ DEF_TEST(ImageFilterZeroBlurSigma, reporter) {
test_zero_blur_sigma(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterZeroBlurSigma_Gpu, reporter, ctxInfo) {
test_zero_blur_sigma(reporter, ctxInfo.grContext());
}
#endif
// Tests that, even when an upstream filter has returned null (due to failure or clipping), a
@ -726,11 +714,9 @@ DEF_TEST(ImageFilterFailAffectsTransparentBlack, reporter) {
test_fail_affects_transparent_black(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterFailAffectsTransparentBlack_Gpu, reporter, ctxInfo) {
test_fail_affects_transparent_black(reporter, ctxInfo.grContext());
}
#endif
DEF_TEST(ImageFilterDrawTiled, reporter) {
// Check that all filters when drawn tiled (with subsequent clip rects) exactly
@ -1017,11 +1003,9 @@ DEF_TEST(ImageFilterMergeResultSize, reporter) {
test_imagefilter_merge_result_size(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterMergeResultSize_Gpu, reporter, ctxInfo) {
test_imagefilter_merge_result_size(reporter, ctxInfo.grContext());
}
#endif
static void draw_blurred_rect(SkCanvas* canvas) {
SkPaint filterPaint;
@ -1186,22 +1170,18 @@ DEF_TEST(ImageFilterMatrixConvolutionBigKernel, reporter) {
test_big_kernel(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterMatrixConvolutionBigKernel_Gpu,
reporter, ctxInfo) {
test_big_kernel(reporter, ctxInfo.grContext());
}
#endif
DEF_TEST(ImageFilterCropRect, reporter) {
test_crop_rects(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCropRect_Gpu, reporter, ctxInfo) {
test_crop_rects(reporter, ctxInfo.grContext());
}
#endif
DEF_TEST(ImageFilterMatrix, reporter) {
SkBitmap temp;
@ -1260,11 +1240,9 @@ DEF_TEST(ImageFilterClippedPictureImageFilter, reporter) {
test_clipped_picture_imagefilter(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterClippedPictureImageFilter_Gpu, reporter, ctxInfo) {
test_clipped_picture_imagefilter(reporter, ctxInfo.grContext());
}
#endif
DEF_TEST(ImageFilterEmptySaveLayer, reporter) {
// Even when there's an empty saveLayer()/restore(), ensure that an image
@ -1516,11 +1494,9 @@ DEF_TEST(ComposedImageFilterOffset, reporter) {
test_composed_imagefilter_offset(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ComposedImageFilterOffset_Gpu, reporter, ctxInfo) {
test_composed_imagefilter_offset(reporter, ctxInfo.grContext());
}
#endif
static void test_composed_imagefilter_bounds(skiatest::Reporter* reporter, GrContext* context) {
// The bounds passed to the inner filter must be filtered by the outer
@ -1558,11 +1534,9 @@ DEF_TEST(ComposedImageFilterBounds, reporter) {
test_composed_imagefilter_bounds(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ComposedImageFilterBounds_Gpu, reporter, ctxInfo) {
test_composed_imagefilter_bounds(reporter, ctxInfo.grContext());
}
#endif
static void test_partial_crop_rect(skiatest::Reporter* reporter, GrContext* context) {
sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 100));
@ -1587,11 +1561,9 @@ DEF_TEST(ImageFilterPartialCropRect, reporter) {
test_partial_crop_rect(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterPartialCropRect_Gpu, reporter, ctxInfo) {
test_partial_crop_rect(reporter, ctxInfo.grContext());
}
#endif
DEF_TEST(ImageFilterCanComputeFastBounds, reporter) {
@ -1692,12 +1664,10 @@ static void test_large_blur_input(skiatest::Reporter* reporter, SkCanvas* canvas
SkBitmap largeBmp;
int largeW = 5000;
int largeH = 5000;
#if SK_SUPPORT_GPU
// If we're GPU-backed make the bitmap too large to be converted into a texture.
if (GrContext* ctx = canvas->getGrContext()) {
largeW = ctx->contextPriv().caps()->maxTextureSize() + 1;
}
#endif
largeBmp.allocN32Pixels(largeW, largeH);
largeBmp.eraseColor(0);
@ -1799,13 +1769,9 @@ DEF_TEST(ImageFilterMakeWithFilter, reporter) {
test_make_with_filter(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterMakeWithFilter_Gpu, reporter, ctxInfo) {
test_make_with_filter(reporter, ctxInfo.grContext());
}
#endif
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterHugeBlur_Gpu, reporter, ctxInfo) {
@ -1834,7 +1800,6 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ImageFilterBlurLargeImage_Gpu, reporter, ctxInfo) {
SkImageInfo::Make(100, 100, kRGBA_8888_SkColorType, kPremul_SkAlphaType)));
test_large_blur_input(reporter, surface->getCanvas());
}
#endif
/*
* Test that colorfilterimagefilter does not require its CTM to be decomposed when it has more

View File

@ -9,9 +9,7 @@
#include "Resources.h"
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#endif
#include "SkCanvas.h"
#include "SkImage.h"
#include "SkSurface.h"
@ -34,8 +32,6 @@ DEF_TEST(ImageIsOpaqueTest, reporter) {
check_isopaque(reporter, surfaceOpaque, true);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageIsOpaqueTest_Gpu, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
SkImageInfo infoTransparent = SkImageInfo::MakeN32Premul(5, 5);
@ -48,8 +44,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageIsOpaqueTest_Gpu, reporter, ctxInfo) {
check_isopaque(reporter, surfaceOpaque, true);
}
#endif
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "SkPictureRecorder.h"

View File

@ -12,9 +12,7 @@
#include "SkTypes.h"
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#endif
static void test_bitmap_equality(skiatest::Reporter* reporter, SkBitmap& bm1, SkBitmap& bm2) {
REPORTER_ASSERT(reporter, bm1.computeByteSize() == bm2.computeByteSize());
@ -106,8 +104,6 @@ DEF_TEST(ImageNewShader, reporter) {
run_shader_test(reporter, sourceSurface.get(), destinationSurface.get(), info);
}
#if SK_SUPPORT_GPU
static void gpu_to_gpu(skiatest::Reporter* reporter, GrContext* context) {
SkImageInfo info = SkImageInfo::MakeN32Premul(5, 5);
@ -145,5 +141,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageNewShader_GPU, reporter, ctxInfo) {
// RASTER -> GPU
raster_to_gpu(reporter, ctxInfo.grContext());
}
#endif

View File

@ -32,14 +32,12 @@
#include "sk_pixel_iter.h"
#include "sk_tool_utils.h"
#if SK_SUPPORT_GPU
#include "GrContextPriv.h"
#include "GrGpu.h"
#include "GrResourceCache.h"
#include "GrTest.h"
#include "GrTexture.h"
#include "SkGr.h"
#endif
using namespace sk_gpu_test;
@ -106,7 +104,6 @@ static sk_sp<SkImage> create_data_image() {
sk_sp<SkData> data(create_image_data(&info));
return SkImage::MakeRasterData(info, std::move(data), info.minRowBytes());
}
#if SK_SUPPORT_GPU // not gpu-specific but currently only used in GPU tests
static sk_sp<SkImage> create_image_large(int maxTextureSize) {
const SkImageInfo info = SkImageInfo::MakeN32(maxTextureSize + 1, 32, kOpaque_SkAlphaType);
auto surface(SkSurface::MakeRaster(info));
@ -124,7 +121,6 @@ static sk_sp<SkImage> create_picture_image() {
nullptr, nullptr, SkImage::BitDepth::kU8,
SkColorSpace::MakeSRGB());
};
#endif
// Want to ensure that our Release is called when the owning image is destroyed
struct RasterDataHolder {
RasterDataHolder() : fReleaseCount(0) {}
@ -151,14 +147,12 @@ static sk_sp<SkImage> create_codec_image() {
sk_sp<SkData> src(sk_tool_utils::EncodeImageToData(bitmap, SkEncodedImageFormat::kPNG, 100));
return SkImage::MakeFromEncoded(std::move(src));
}
#if SK_SUPPORT_GPU
static sk_sp<SkImage> create_gpu_image(GrContext* context) {
const SkImageInfo info = SkImageInfo::MakeN32(20, 20, kOpaque_SkAlphaType);
auto surface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info));
draw_image_test_pattern(surface->getCanvas());
return surface->makeImageSnapshot();
}
#endif
static void test_encode(skiatest::Reporter* reporter, SkImage* image) {
const SkIRect ir = SkIRect::MakeXYWH(5, 5, 10, 10);
@ -185,11 +179,9 @@ DEF_TEST(ImageEncode, reporter) {
test_encode(reporter, create_image().get());
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageEncode_Gpu, reporter, ctxInfo) {
test_encode(reporter, create_gpu_image(ctxInfo.grContext()).get());
}
#endif
DEF_TEST(Image_MakeFromRasterBitmap, reporter) {
const struct {
@ -331,7 +323,6 @@ DEF_TEST(image_newfrombitmap, reporter) {
}
///////////////////////////////////////////////////////////////////////////////////////////////////
#if SK_SUPPORT_GPU
#include "SkBitmapCache.h"
@ -619,8 +610,6 @@ DEF_GPUTEST(AbandonedContextImage, reporter, options) {
}
}
#endif
class EmptyGenerator : public SkImageGenerator {
public:
EmptyGenerator() : SkImageGenerator(SkImageInfo::MakeN32Premul(0, 0)) {}
@ -721,11 +710,9 @@ DEF_TEST(ImageReadPixels, reporter) {
image = create_codec_image();
image_test_read_pixels(reporter, image.get());
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageReadPixels_Gpu, reporter, ctxInfo) {
image_test_read_pixels(reporter, create_gpu_image(ctxInfo.grContext()).get());
}
#endif
static void check_legacy_bitmap(skiatest::Reporter* reporter, const SkImage* image,
const SkBitmap& bitmap) {
@ -779,12 +766,10 @@ DEF_TEST(ImageLegacyBitmap, reporter) {
image = create_codec_image();
test_legacy_bitmap(reporter, image.get());
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageLegacyBitmap_Gpu, reporter, ctxInfo) {
sk_sp<SkImage> image(create_gpu_image(ctxInfo.grContext()));
test_legacy_bitmap(reporter, image.get());
}
#endif
static void test_peek(skiatest::Reporter* reporter, SkImage* image, bool expectPeekSuccess) {
if (!image) {
@ -821,14 +806,11 @@ DEF_TEST(ImagePeek, reporter) {
image = create_codec_image();
test_peek(reporter, image.get(), false);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImagePeek_Gpu, reporter, ctxInfo) {
sk_sp<SkImage> image(create_gpu_image(ctxInfo.grContext()));
test_peek(reporter, image.get(), false);
}
#endif
#if SK_SUPPORT_GPU
struct TextureReleaseChecker {
TextureReleaseChecker() : fReleaseCount(0) {}
int fReleaseCount;
@ -1153,7 +1135,6 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(makeBackendTexture, reporter, ctxInfo) {
context->flush();
}
}
#endif
///////////////////////////////////////////////////////////////////////////////////////////////////
@ -1346,7 +1327,6 @@ DEF_TEST(ImageScalePixels, reporter) {
test_scale_pixels(reporter, codecImage.get(), pmRed);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageScalePixels_Gpu, reporter, ctxInfo) {
const SkPMColor pmRed = SkPackARGB32(0xFF, 0xFF, 0, 0);
const SkColor red = SK_ColorRED;
@ -1358,7 +1338,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageScalePixels_Gpu, reporter, ctxInfo) {
sk_sp<SkImage> gpuImage = surface->makeImageSnapshot();
test_scale_pixels(reporter, gpuImage.get(), pmRed);
}
#endif
static sk_sp<SkImage> any_image_will_do() {
return GetResourceAsImage("images/mandrill_32.png");

View File

@ -7,8 +7,6 @@
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrClip.h"
#include "GrContextPriv.h"
#include "GrProxyProvider.h"
@ -469,5 +467,3 @@ DEF_GPUTEST(LazyProxyUninstantiateTest, reporter, /* options */) {
gpu->deleteTestingOnlyBackendTexture(backendTex);
}
}
#endif

View File

@ -7,8 +7,6 @@
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrBackendSemaphore.h"
#include "GrClip.h"
#include "GrContextPriv.h"
@ -584,5 +582,3 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(OnFlushCallbackTest, reporter, ctxInfo) {
x += kDrawnTileSize;
test_color(reporter, readBack, x, SK_ColorYELLOW);
}
#endif

View File

@ -13,7 +13,6 @@
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrProxyProvider.h"
@ -145,5 +144,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RGBA4444TextureTest, reporter, ctxInfo) {
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RGB565TextureTest, reporter, ctxInfo) {
run_test(reporter, ctxInfo.grContext(), CONTROL_ARRAY_SIZE, kRGB_565_SkColorType);
}
#endif

View File

@ -9,7 +9,6 @@
#include "SkPath.h"
#if SK_SUPPORT_GPU
#include "GrClip.h"
#include "GrContext.h"
#include "GrContextPriv.h"
@ -150,5 +149,3 @@ DEF_GPUTEST(SoftwarePathRendererCacheTest, reporter, /* options */) {
test_path(reporter, create_concave_path, createPR, kExpectedResources, GrAAType::kCoverage,
style);
}
#endif

View File

@ -9,8 +9,6 @@
#include "Test.h"
#if SK_SUPPORT_GPU
using namespace sk_gpu_test;
#include "GrContextFactory.h"
@ -128,5 +126,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PinnedImageTest, reporter, ctxInfo) {
basic_test(reporter, ctxInfo.grContext());
cleanup_test(reporter);
}
#endif

View File

@ -10,9 +10,7 @@
#include "Test.h"
#include "sk_tool_utils.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#endif
static uint32_t pack_unpremul_rgba(SkColor c) {
uint32_t packed;
@ -102,7 +100,6 @@ DEF_TEST(PremulAlphaRoundTrip, reporter) {
test_premul_alpha_roundtrip(reporter, surf.get());
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PremulAlphaRoundTrip_Gpu, reporter, ctxInfo) {
const SkImageInfo info = SkImageInfo::MakeN32Premul(256, 256);
@ -111,4 +108,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PremulAlphaRoundTrip_Gpu, reporter, ctxInfo)
info));
test_premul_alpha_roundtrip(reporter, surf.get());
}
#endif

View File

@ -10,7 +10,6 @@
#include "SkTypes.h"
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrGeometryProcessor.h"
@ -155,4 +154,3 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) {
REPORTER_ASSERT(reporter, gpu->stats()->numFailedDraws() == 1);
#endif
}
#endif

View File

@ -8,7 +8,6 @@
#include "SkTypes.h"
#include "Test.h"
#if SK_SUPPORT_GPU
#include <random>
#include "GrClip.h"
#include "GrContext.h"
@ -567,4 +566,3 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorCloneTest, reporter, ctxInfo) {
#endif // GR_TEST_UTILS
#endif // SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
#endif // SK_SUPPORT_GPU

View File

@ -7,8 +7,6 @@
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrBackendSurface.h"
#include "GrContextPriv.h"
#include "GrGpu.h"
@ -240,5 +238,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PromiseImageTest, reporter, ctxInfo) {
gpu->deleteTestingOnlyBackendTexture(backendTex);
}
}
#endif

View File

@ -9,7 +9,6 @@
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrBackendSurface.h"
#include "GrContextPriv.h"
#include "GrGpu.h"
@ -175,4 +174,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn
REPORTER_ASSERT(reporter, !tProxy->asRenderTargetProxy());
}
}
#endif

View File

@ -9,7 +9,6 @@
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrContextPriv.h"
#include "GrGpuResourceRef.h"
#include "GrProxyProvider.h"
@ -195,5 +194,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
}
}
}
#endif

View File

@ -9,8 +9,6 @@
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrBackendSurface.h"
#include "GrContextPriv.h"
#include "GrProxyProvider.h"
@ -354,5 +352,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ZeroSizedProxyTest, reporter, ctxInfo) {
}
}
}
#endif

View File

@ -14,14 +14,12 @@
#include "SkSurface.h"
#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextFactory.h"
#include "GrContextPriv.h"
#include "GrProxyProvider.h"
#include "ProxyUtils.h"
#include "SkGr.h"
#endif
static const int DEV_W = 100, DEV_H = 100;
@ -453,7 +451,6 @@ DEF_TEST(ReadPixels, reporter) {
// SW readback fails a premul check when reading back to an unaligned rowbytes.
test_readpixels(reporter, surface, info, kLastAligned_BitmapInit);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadPixels_Gpu, reporter, ctxInfo) {
if (ctxInfo.type() == sk_gpu_test::GrContextFactory::kANGLE_D3D9_ES2_ContextType ||
ctxInfo.type() == sk_gpu_test::GrContextFactory::kANGLE_GL_ES2_ContextType ||
@ -479,9 +476,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadPixels_Gpu, reporter, ctxInfo) {
}
}
}
#endif
#if SK_SUPPORT_GPU
static void test_readpixels_texture(skiatest::Reporter* reporter,
sk_sp<GrSurfaceContext> sContext,
const SkImageInfo& surfaceInfo) {
@ -556,7 +551,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadPixels_Texture, reporter, ctxInfo) {
}
}
}
#endif
///////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -8,7 +8,6 @@
#include "Test.h"
// This test is specific to the GPU backend.
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrProxyProvider.h"
@ -218,5 +217,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) {
}
}
}
#endif

View File

@ -8,7 +8,6 @@
#include "Test.h"
#include "TestUtils.h"
#if SK_SUPPORT_GPU
#include "GrClip.h"
#include "GrContext.h"
#include "GrContextPriv.h"
@ -167,5 +166,3 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(RectangleTexture, reporter, ctxInfo) {
GR_GL_CALL(glContext->gl(), DeleteTextures(1, &rectTexID));
}
}
#endif

View File

@ -13,7 +13,6 @@
// mixes this test up. Re-enable once backing GPU resources are distributed by MDB at flush time.
#if 0
#if SK_SUPPORT_GPU
#include "GrTextureProxy.h"
#include "GrRenderTargetContext.h"
@ -75,4 +74,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RenderTargetContextTest, reporter, ctxInfo) {
// GrRenderTargetContext
}
#endif
#endif

View File

@ -5,10 +5,8 @@
* found in the LICENSE file.
*/
// Include here to ensure SK_SUPPORT_GPU is set correctly before it is examined.
#include "SkTypes.h"
#if SK_SUPPORT_GPU
#include "Test.h"
#include "GrContextPriv.h"
@ -215,5 +213,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceAllocatorTest, reporter, ctxInfo) {
resourceProvider->testingOnly_setExplicitlyAllocateGPUResources(orig);
}
#endif

View File

@ -5,10 +5,8 @@
* found in the LICENSE file.
*/
// Include here to ensure SK_SUPPORT_GPU is set correctly before it is examined.
#include "SkTypes.h"
#if SK_SUPPORT_GPU
#include <thread>
#include "GrContext.h"
#include "GrContextPriv.h"
@ -1810,5 +1808,3 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GPUMemorySize, reporter, ctxInfo) {
REPORTER_ASSERT(reporter, kSize*kSize*4+(kSize*kSize*4)/3 == size);
}
}
#endif

Some files were not shown because too many files have changed in this diff Show More