[graphite] Allow graphite to compile without ganesh and add shared gn files.

With this you should be able to set skia_enable_gpu=false in your gn
args and still be able to compile and run graphite.

Bug: skia:12466
Change-Id: Ibffc8774a8c46afad3f717dabc54fa831338a807
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463317
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Greg Daniel 2021-10-25 16:47:46 -04:00 committed by SkCQ
parent 1f27d9ad54
commit a21aacf7c7
5 changed files with 11 additions and 4 deletions

View File

@ -843,7 +843,7 @@ optional("gpu") {
public_configs = []
public_deps = []
sources = skia_gpu_sources + skia_sksl_gpu_sources
sources = skia_gpu_sources + skia_shared_gpu_sources + skia_sksl_gpu_sources
if (skia_enable_skgpu_v2) {
sources += skia_skgpu_v2_sources
}
@ -1045,7 +1045,7 @@ optional("graphite") {
enabled = skia_enable_graphite
public_defines = [ "SK_GRAPHITE_ENABLED" ]
public = skia_graphite_public
sources = skia_graphite_sources
sources = skia_graphite_sources + skia_shared_gpu_sources
if (skia_use_metal) {
public_defines += [ "SK_METAL" ]
sources += skia_graphite_mtl_sources

View File

@ -7,8 +7,10 @@
#include "experimental/graphite/src/Image_Graphite.h"
#if SK_SUPPORT_GPU
// TODO: move onAsFragmentProcessor off of SkImage_Base and remove this include
#include "src/gpu/GrFragmentProcessor.h"
#endif
namespace skgpu {
@ -18,6 +20,7 @@ Image_Graphite::Image_Graphite(const SkImageInfo& ii)
Image_Graphite::~Image_Graphite() {}
#if SK_SUPPORT_GPU
std::unique_ptr<GrFragmentProcessor> Image_Graphite::onAsFragmentProcessor(
GrRecordingContext*,
SkSamplingOptions,
@ -27,5 +30,6 @@ std::unique_ptr<GrFragmentProcessor> Image_Graphite::onAsFragmentProcessor(
const SkRect* domain) const {
return nullptr;
}
#endif
} // namespace skgpu

View File

@ -50,6 +50,7 @@ public:
protected:
private:
#if SK_SUPPORT_GPU
std::tuple<GrSurfaceProxyView, GrColorType> onAsView(
GrRecordingContext*,
GrMipmapped,
@ -64,6 +65,7 @@ private:
const SkMatrix&,
const SkRect* subset,
const SkRect* domain) const override;
#endif
};

View File

@ -254,7 +254,6 @@ skia_gpu_sources = [
"$_src/gpu/SurfaceContext.h",
"$_src/gpu/SurfaceFillContext.cpp",
"$_src/gpu/SurfaceFillContext.h",
"$_src/gpu/VertexWriter.h",
# Ops
"$_src/gpu/effects/GrBezierEffect.cpp",
@ -826,3 +825,5 @@ skia_native_gpu_sources = [
"$_src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp",
"$_src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp",
]
skia_shared_gpu_sources = [ "$_src/gpu/VertexWriter.h" ]

View File

@ -236,7 +236,7 @@
# define SK_SUPPORT_GPU 1
#endif
#if SK_SUPPORT_GPU
#if SK_SUPPORT_GPU || SK_GRAPHITE_ENABLED
# if !defined(SK_ENABLE_SKSL)
# define SK_ENABLE_SKSL
# endif