Skip to content

Commit

Permalink
Use SK_GANESH and SK_GRAPHITE everywhere
Browse files Browse the repository at this point in the history
Did mechanical find and replaces for:
 - #ifdef SK_GRAPHITE_ENABLED -> #if defined(SK_GRAPHITE)
 - SK_GRAPHITE_ENABLED -> SK_GRAPHITE
 - SK_GANESH_ENABLED -> SK_GANESH

Change-Id: I675eccf178182bd1f016aa2cb105ff867e2f3be0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/650116
Commit-Queue: Kevin Lubick <[email protected]>
Reviewed-by: Greg Daniel <[email protected]>
  • Loading branch information
kjlubick authored and SkCQ committed Feb 28, 2023
1 parent b4fb6db commit 0f7b44e
Show file tree
Hide file tree
Showing 219 changed files with 750 additions and 751 deletions.
4 changes: 2 additions & 2 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ config("skia_public") {
]
}
if (skia_enable_gpu || skia_enable_ganesh) {
defines += [ "SK_GANESH_ENABLED" ]
defines += [ "SK_GANESH" ]
}
if (skia_enable_graphite) {
defines += [ "SK_GRAPHITE_ENABLED" ]
defines += [ "SK_GRAPHITE" ]
}
if (skia_use_perfetto) {
defines += [ "SK_USE_PERFETTO" ]
Expand Down
2 changes: 1 addition & 1 deletion RELEASE_NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This file includes a list of high level updates for each milestone release.

Milestone 113
-------------
* The define SK_SUPPORT_GPU is now SK_GANESH_ENABLED. It is no longer detected as a 0 or 1, but
* The define SK_SUPPORT_GPU is now SK_GANESH. It is no longer detected as a 0 or 1, but
as the absence or presence of that define. As a result, it defaults to off (not defined) if
not defined (SK_SUPPORT_GPU would default to SK_SUPPORT_GPU=1 if not defined).
* SkStrSplit is no longer part of the public API.
Expand Down
2 changes: 1 addition & 1 deletion bench/ColorFilterBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ DEF_BENCH( return new ColorFilterBench("gaussian", []() {
return SkColorFilterPriv::MakeGaussian();
}); )

#if defined(SK_GANESH_ENABLED)
#if defined(SK_GANESH)
DEF_BENCH( return new ColorFilterBench("src_runtime", []() {
static sk_sp<SkRuntimeEffect> gEffect =
SkRuntimeEffect::MakeForColorFilter(SkString(RuntimeNone_GPU_SRC)).effect;
Expand Down
2 changes: 1 addition & 1 deletion bench/SKPBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void SKPBench::onPerCanvasPreDraw(SkCanvas* canvas) {
bounds.intersect(fPic->cullRect().roundOut());
SkAssertResult(!bounds.isEmpty());

#if defined(SK_GRAPHITE_ENABLED)
#if defined(SK_GRAPHITE)
const bool gpu = canvas->recordingContext() != nullptr || canvas->recorder() != nullptr;
#else
const bool gpu = canvas->recordingContext() != nullptr;
Expand Down
6 changes: 3 additions & 3 deletions bench/SkSLBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "src/sksl/generated/sksl_public.minified.sksl"
#include "src/sksl/generated/sksl_rt_shader.minified.sksl"
#include "src/sksl/generated/sksl_vert.minified.sksl"
#if defined(SK_GRAPHITE_ENABLED)
#if defined(SK_GRAPHITE)
#include "src/sksl/generated/sksl_graphite_frag.minified.sksl"
#include "src/sksl/generated/sksl_graphite_vert.minified.sksl"
#endif
Expand Down Expand Up @@ -529,7 +529,7 @@ void RunSkSLModuleBenchmarks(NanoJSONResultsWriter* log) {
bench(log, "sksl_compiler_gpu", gpuBytes);
}

#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
// Heap used by a compiler with the Graphite modules loaded.
before = heap_bytes_used();
compiler.moduleForProgramKind(SkSL::ProgramKind::kGraphiteVertex);
Expand Down Expand Up @@ -559,7 +559,7 @@ void RunSkSLModuleBenchmarks(NanoJSONResultsWriter* log) {
std::size(SKSL_MINIFIED_sksl_rt_shader);
bench(log, "sksl_binary_size_gpu", compilerGPUBinarySize);

#if defined(SK_GRAPHITE_ENABLED)
#if defined(SK_GRAPHITE)
int compilerGraphiteBinarySize = std::size(SKSL_MINIFIED_sksl_graphite_frag) +
std::size(SKSL_MINIFIED_sksl_graphite_vert);
bench(log, "sksl_binary_size_graphite", compilerGraphiteBinarySize);
Expand Down
10 changes: 5 additions & 5 deletions bench/nanobench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
#include "client_utils/android/BitmapRegionDecoder.h"
#endif

#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
#include "include/gpu/graphite/Context.h"
#include "include/gpu/graphite/Recorder.h"
#include "include/gpu/graphite/Recording.h"
Expand Down Expand Up @@ -302,7 +302,7 @@ struct GPUTarget : public Target {
}
};

#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
struct GraphiteTarget : public Target {
explicit GraphiteTarget(const Config& c) : Target(c) {}
using TestContext = skiatest::graphite::GraphiteTestContext;
Expand Down Expand Up @@ -381,7 +381,7 @@ struct GraphiteTarget : public Target {
void dumpStats() override {
}
};
#endif // SK_GRAPHITE_ENABLED
#endif // SK_GRAPHITE

static double time(int loops, Benchmark* bench, Target* target) {
SkCanvas* canvas = target->getCanvas();
Expand Down Expand Up @@ -593,7 +593,7 @@ static std::optional<Config> create_config(const SkCommandLineConfig* config) {
ctxOverrides,
gpuConfig->getSurfaceFlags()};
}
#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
if (const auto* gpuConfig = config->asConfigGraphite()) {
if (!FLAGS_gpu) {
SkDebugf("Skipping config '%s' as requested.\n", config->getTag().c_str());
Expand Down Expand Up @@ -718,7 +718,7 @@ static Target* is_enabled(Benchmark* bench, const Config& config) {
case Benchmark::kGPU_Backend:
target = new GPUTarget(config);
break;
#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
case Benchmark::kGraphite_Backend:
target = new GraphiteTarget(config);
break;
Expand Down
6 changes: 3 additions & 3 deletions defines.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ GENERAL_DEFINES = [
GPU_DEFINES = select_multi({
"//src/gpu:gl_backend": [
"SK_GL",
"SK_GANESH_ENABLED",
"SK_GANESH",
],
"//src/gpu:vulkan_backend": [
"SK_VULKAN",
"SK_GANESH_ENABLED",
"SK_GANESH",
],
"//src/gpu:dawn_backend": [
"SK_DAWN",
"SK_GANESH_ENABLED",
"SK_GANESH",
"VK_USE_PLATFORM_XCB_KHR", # TODO(kjlubick) support dawn's dawn_enable_vulkan etc
],
}) + select({
Expand Down
2 changes: 1 addition & 1 deletion dm/DM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ static Sink* create_sink(const GrContextOptions& grCtxOptions, const SkCommandLi
}
}
}
#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
if (FLAGS_graphite) {
if (const SkCommandLineConfigGraphite *graphiteConfig = config->asConfigGraphite()) {
return new GraphiteSink(graphiteConfig);
Expand Down
6 changes: 3 additions & 3 deletions dm/DMGpuTestProcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include "include/gpu/GrDirectContext.h"

#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
#include "include/gpu/graphite/Context.h"
#include "tools/graphite/ContextFactory.h"
#endif
Expand Down Expand Up @@ -88,7 +88,7 @@ void RunWithGaneshTestContexts(GrContextTestFn* testFn, GrContextTypeFilterFn* f
}
}

#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)

namespace graphite {

Expand All @@ -113,6 +113,6 @@ void RunWithGraphiteTestContexts(GraphiteTestFn* test, GrContextTypeFilterFn* fi

} // namespace graphite

#endif // SK_GRAPHITE_ENABLED
#endif // SK_GRAPHITE

} // namespace skiatest
8 changes: 4 additions & 4 deletions dm/DMSrcSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
#include "src/xml/SkXMLWriter.h"
#endif

#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
#include "include/gpu/graphite/Context.h"
#include "include/gpu/graphite/Recorder.h"
#include "include/gpu/graphite/Recording.h"
Expand Down Expand Up @@ -1098,12 +1098,12 @@ Result SKPSrc::draw(SkCanvas* canvas) const {

struct DeserializationContext {
GrDirectContext* fDirectContext = nullptr;
#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
skgpu::graphite::Recorder* fRecorder = nullptr;
#endif
} ctx {
GrAsDirectContext(canvas->recordingContext()),
#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
canvas->recorder()
#endif
};
Expand Down Expand Up @@ -2096,7 +2096,7 @@ Result RasterSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString*) co

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)

GraphiteSink::GraphiteSink(const SkCommandLineConfigGraphite* config)
: fContextType(config->getContextType())
Expand Down
2 changes: 1 addition & 1 deletion dm/DMSrcSink.h
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ class SVGSink : public Sink {
int fPageIndex;
};

#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)

class GraphiteSink : public Sink {
public:
Expand Down
4 changes: 2 additions & 2 deletions fuzz/FuzzCanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#include "tools/debugger/DebugCanvas.h"
#include "tools/flags/CommandLineFlags.h"

#if defined(SK_GANESH_ENABLED)
#if defined(SK_GANESH)
#include "include/gpu/GrDirectContext.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
#include "tools/gpu/GrContextFactory.h"
Expand Down Expand Up @@ -1608,7 +1608,7 @@ DEF_FUZZ(SerializedImageFilter, fuzz) {
canvas.restore();
}

#if defined(SK_GANESH_ENABLED)
#if defined(SK_GANESH)
static void fuzz_ganesh(Fuzz* fuzz, GrDirectContext* context) {
SkASSERT(context);
auto surface = SkSurface::MakeRenderTarget(
Expand Down
2 changes: 1 addition & 1 deletion gm/discard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class DiscardGM : public GM {
surface = SkSurface::MakeRenderTarget(dContext, skgpu::Budgeted::kNo, info);
}

#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
auto recorder = canvas->recorder();
if (recorder) {
surface = SkSurface::MakeGraphite(recorder, info);
Expand Down
2 changes: 1 addition & 1 deletion gm/drawbitmaprect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static void imagesubsetproc(SkCanvas* canvas, sk_sp<SkImage> image, const SkBitm
if (sk_sp<SkImage> subset = image->makeSubset(srcR, direct)) {
canvas->drawImageRect(subset, dstR, sampling, paint);
}
#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
if (sk_sp<SkImage> subset = image->makeSubset(srcR, canvas->recorder())) {
canvas->drawImageRect(subset, dstR, sampling, paint);
}
Expand Down
6 changes: 3 additions & 3 deletions gm/graphite_replay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "tools/Resources.h"
#include "tools/ToolUtils.h"

#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
#include "include/gpu/graphite/Context.h"
#include "include/gpu/graphite/Recorder.h"
#include "include/gpu/graphite/Recording.h"
Expand Down Expand Up @@ -42,7 +42,7 @@ class GraphiteReplayGM : public GM {
}

DrawResult onDraw(SkCanvas* canvas, SkString* errorMsg) override {
#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
skgpu::graphite::Recorder* recorder = canvas->recorder();
if (recorder) {
this->drawGraphite(canvas, recorder);
Expand Down Expand Up @@ -96,7 +96,7 @@ class GraphiteReplayGM : public GM {
canvas->restore();
}

#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
void drawGraphite(SkCanvas* canvas, skgpu::graphite::Recorder* canvasRecorder) {
SkImageInfo tileImageInfo =
canvas->imageInfo().makeDimensions(SkISize::Make(kTileWidth, kTileHeight));
Expand Down
2 changes: 1 addition & 1 deletion gm/graphitestart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ class GraphiteStartGM : public GM {
canvas->restore();

// Bottom-left corner
#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
// TODO: failing serialize test on Linux, not sure what's going on
canvas->writePixels(fBitmap, 0, 2*kTileHeight);
#endif
Expand Down
10 changes: 5 additions & 5 deletions gm/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ DEF_SIMPLE_GM_CAN_FAIL(new_texture_image, canvas, errorMsg, 280, 115) {
GrDirectContext* dContext = GrAsDirectContext(canvas->recordingContext());
bool isGPU = SkToBool(dContext);

#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
skgpu::graphite::Recorder* recorder = canvas->recorder();
isGPU = isGPU || SkToBool(recorder);
#endif
Expand Down Expand Up @@ -376,7 +376,7 @@ DEF_SIMPLE_GM_CAN_FAIL(new_texture_image, canvas, errorMsg, 280, 115) {
if (dContext) {
surface = SkSurface::MakeRenderTarget(dContext, skgpu::Budgeted::kYes, ii);
} else {
#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
surface = SkSurface::MakeGraphite(recorder, ii);
#endif
}
Expand All @@ -399,7 +399,7 @@ DEF_SIMPLE_GM_CAN_FAIL(new_texture_image, canvas, errorMsg, 280, 115) {
texImage = image->makeTextureImage(dContext,
mm ? GrMipmapped::kYes : GrMipmapped::kNo);
} else {
#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
texImage = image->makeTextureImage(recorder,
{ mm ? skgpu::Mipmapped::kYes
: skgpu::Mipmapped::kNo });
Expand Down Expand Up @@ -486,15 +486,15 @@ DEF_SIMPLE_GM_CAN_FAIL(image_subset, canvas, errorMsg, 440, 220) {
}

GrDirectContext* dContext = GrAsDirectContext(canvas->recordingContext());
#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
auto recorder = canvas->recorder();
#endif

canvas->drawImage(img, 10, 10);

sk_sp<SkImage> subset;

#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
if (recorder) {
subset = img->makeSubset({100, 100, 200, 200}, recorder);
} else
Expand Down
6 changes: 3 additions & 3 deletions gm/image_pict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class TextureGenerator : public SkImageGenerator {
surface = SkSurface::MakeRenderTarget(fRContext.get(), skgpu::Budgeted::kYes, info,
0, kTopLeft_GrSurfaceOrigin, nullptr);
}
#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
if (skgpu::graphite::Recorder* recorder = canvas->recorder()) {
surface = SkSurface::MakeGraphite(recorder, info);
}
Expand Down Expand Up @@ -220,7 +220,7 @@ class TextureGenerator : public SkImageGenerator {
/*label=*/"SurfaceProxyView_GenerateTexture");
}

#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
sk_sp<SkImage> onMakeTextureImage(skgpu::graphite::Recorder*,
const SkImageInfo&,
skgpu::Mipmapped) override {
Expand Down Expand Up @@ -304,7 +304,7 @@ class ImageCacheratorGM : public skiagm::GM {
fImageSubset = SkImage::MakeFromGenerator(std::move(gen))->makeSubset(subset,
dContext);
} else {
#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
auto recorder = canvas->recorder();
fImageSubset = SkImage::MakeFromGenerator(std::move(gen))->makeSubset(subset,
recorder);
Expand Down
4 changes: 2 additions & 2 deletions gm/imagemasksubset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const MakerT makers[] = {
surface = SkSurface::MakeRenderTarget(c->recordingContext(),
skgpu::Budgeted::kNo, info);
} else {
#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
surface = SkSurface::MakeGraphite(c->recorder(), info);
#endif
}
Expand Down Expand Up @@ -96,7 +96,7 @@ DEF_SIMPLE_GM(imagemasksubset, canvas, 480, 480) {
if (auto direct = GrAsDirectContext(canvas->recordingContext())) {
subset = image->makeSubset(kSubset, direct);
} else {
#ifdef SK_GRAPHITE_ENABLED
#if defined(SK_GRAPHITE)
subset = image->makeSubset(kSubset, canvas->recorder());
#endif
}
Expand Down
Loading

0 comments on commit 0f7b44e

Please sign in to comment.