Make GrPathRenderer and all derived class be OGA-only
Bug: skia:11837
Change-Id: I92aacf8b412d0158036a5f27aa767590e426bd5c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/417657
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 77b8786..f14126b 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1982,6 +1982,9 @@
if (skia_use_gl) {
sources += gl_gm_sources
}
+ if (!skia_enable_oga) {
+ sources -= oga_gm_sources
+ }
deps = [
":etc1",
":flags",
@@ -2100,6 +2103,9 @@
import("gn/samples.gni")
test_lib("samples") {
sources = samples_sources
+ if (!skia_enable_oga) {
+ sources -= oga_samples_sources
+ }
public_deps = [ ":tool_utils" ]
deps = [
":flags",
diff --git a/gm/trickycubicstrokes.cpp b/gm/trickycubicstrokes.cpp
index 778f61e..400de8b 100644
--- a/gm/trickycubicstrokes.cpp
+++ b/gm/trickycubicstrokes.cpp
@@ -18,10 +18,11 @@
#include "include/core/SkTypes.h"
#include "include/gpu/GrContextOptions.h"
#include "include/gpu/GrDirectContext.h"
+#include "include/utils/SkRandom.h"
#include "src/core/SkGeometry.h"
#include "src/gpu/GrDirectContextPriv.h"
#include "src/gpu/GrDrawingManager.h"
-#include "src/gpu/tessellate/GrTessellationPathRenderer.h"
+#include "src/gpu/GrRecordingContextPriv.h"
static constexpr float kStrokeWidth = 30;
static constexpr int kCellSize = 200;
@@ -179,6 +180,9 @@
draw_test(canvas, SkPaint::kRound_Cap, SkPaint::kRound_Join);
}
+#if GR_OGA
+#include "src/gpu/tessellate/GrTessellationPathRenderer.h"
+
class TrickyCubicStrokes_tess_segs_5 : public skiagm::GM {
SkString onShortName() override {
return SkString("trickycubicstrokes_tess_segs_5");
@@ -236,3 +240,4 @@
};
DEF_GM( return new TrickyCubicStrokes_tess_segs_5; )
+#endif // GR_OGA
diff --git a/gn/gm.gni b/gn/gm.gni
index 5f41519..dad3380 100644
--- a/gn/gm.gni
+++ b/gn/gm.gni
@@ -309,7 +309,6 @@
"$_gm/polygonoffset.cpp",
"$_gm/polygons.cpp",
"$_gm/postercircle.cpp",
- "$_gm/preservefillrule.cpp",
"$_gm/quadpaths.cpp",
"$_gm/radial_gradient_precision.cpp",
"$_gm/rasterhandleallocator.cpp",
@@ -404,7 +403,6 @@
"$_gm/vertices.cpp",
"$_gm/verylargebitmap.cpp",
"$_gm/wacky_yuv_formats.cpp",
- "$_gm/widebuttcaps.cpp",
"$_gm/windowrectangles.cpp",
"$_gm/xfermodeimagefilter.cpp",
"$_gm/xfermodes.cpp",
@@ -416,3 +414,10 @@
]
gl_gm_sources = [ "$_gm/rectangletexture.cpp" ]
+
+oga_gm_sources = [
+ "$_gm/preservefillrule.cpp",
+ "$_gm/widebuttcaps.cpp",
+]
+
+gm_sources += oga_gm_sources
diff --git a/gn/gpu.gni b/gn/gpu.gni
index e12b086..c6a2a66 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -139,10 +139,6 @@
"$_src/gpu/GrOpsTask.h",
"$_src/gpu/GrPaint.cpp",
"$_src/gpu/GrPaint.h",
- "$_src/gpu/GrPathRenderer.cpp",
- "$_src/gpu/GrPathRenderer.h",
- "$_src/gpu/GrPathRendererChain.cpp",
- "$_src/gpu/GrPathRendererChain.h",
"$_src/gpu/GrPersistentCacheUtils.cpp",
"$_src/gpu/GrPersistentCacheUtils.h",
"$_src/gpu/GrPipeline.cpp",
@@ -205,8 +201,6 @@
"$_src/gpu/GrShaderVar.cpp",
"$_src/gpu/GrShaderVar.h",
"$_src/gpu/GrSimpleMesh.h",
- "$_src/gpu/GrSoftwarePathRenderer.cpp",
- "$_src/gpu/GrSoftwarePathRenderer.h",
"$_src/gpu/GrStagingBufferManager.cpp",
"$_src/gpu/GrStagingBufferManager.h",
"$_src/gpu/GrStencilSettings.cpp",
@@ -355,24 +349,14 @@
"$_src/gpu/geometry/GrStyledShape.cpp",
"$_src/gpu/geometry/GrStyledShape.h",
"$_src/gpu/geometry/GrWangsFormula.h",
- "$_src/gpu/ops/GrAAConvexPathRenderer.cpp",
- "$_src/gpu/ops/GrAAConvexPathRenderer.h",
"$_src/gpu/ops/GrAAConvexTessellator.cpp",
"$_src/gpu/ops/GrAAConvexTessellator.h",
- "$_src/gpu/ops/GrAAHairLinePathRenderer.cpp",
- "$_src/gpu/ops/GrAAHairLinePathRenderer.h",
- "$_src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp",
- "$_src/gpu/ops/GrAALinearizingConvexPathRenderer.h",
"$_src/gpu/ops/GrAtlasTextOp.cpp",
"$_src/gpu/ops/GrAtlasTextOp.h",
"$_src/gpu/ops/GrClearOp.cpp",
"$_src/gpu/ops/GrClearOp.h",
- "$_src/gpu/ops/GrDashLinePathRenderer.cpp",
- "$_src/gpu/ops/GrDashLinePathRenderer.h",
"$_src/gpu/ops/GrDashOp.cpp",
"$_src/gpu/ops/GrDashOp.h",
- "$_src/gpu/ops/GrDefaultPathRenderer.cpp",
- "$_src/gpu/ops/GrDefaultPathRenderer.h",
"$_src/gpu/ops/GrDrawAtlasOp.cpp",
"$_src/gpu/ops/GrDrawAtlasOp.h",
"$_src/gpu/ops/GrDrawOp.h",
@@ -404,16 +388,12 @@
"$_src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h",
"$_src/gpu/ops/GrSmallPathAtlasMgr.cpp",
"$_src/gpu/ops/GrSmallPathAtlasMgr.h",
- "$_src/gpu/ops/GrSmallPathRenderer.cpp",
- "$_src/gpu/ops/GrSmallPathRenderer.h",
"$_src/gpu/ops/GrSmallPathShapeData.cpp",
"$_src/gpu/ops/GrSmallPathShapeData.h",
"$_src/gpu/ops/GrStrokeRectOp.cpp",
"$_src/gpu/ops/GrStrokeRectOp.h",
"$_src/gpu/ops/GrTextureOp.cpp",
"$_src/gpu/ops/GrTextureOp.h",
- "$_src/gpu/ops/GrTriangulatingPathRenderer.cpp",
- "$_src/gpu/ops/GrTriangulatingPathRenderer.h",
# gradients
"$_src/gpu/gradients/GrGradientBitmapCache.cpp",
@@ -463,7 +443,6 @@
"$_src/gpu/tessellate/GrStrokeTessellateOp.cpp",
"$_src/gpu/tessellate/GrStrokeTessellateOp.h",
"$_src/gpu/tessellate/GrStrokeTessellator.h",
- "$_src/gpu/tessellate/GrTessellationPathRenderer.cpp",
"$_src/gpu/tessellate/GrTessellationPathRenderer.h",
"$_src/gpu/tessellate/GrVectorXform.h",
@@ -637,12 +616,37 @@
"$_src/gpu/GrClipStack.h",
"$_src/gpu/GrClipStackClip.cpp",
"$_src/gpu/GrClipStackClip.h",
+ "$_src/gpu/GrPathRenderer.cpp",
+ "$_src/gpu/GrPathRenderer.h",
+ "$_src/gpu/GrPathRendererChain.cpp",
+ "$_src/gpu/GrPathRendererChain.h",
"$_src/gpu/GrReducedClip.cpp",
"$_src/gpu/GrReducedClip.h",
+ "$_src/gpu/GrSoftwarePathRenderer.cpp",
+ "$_src/gpu/GrSoftwarePathRenderer.h",
"$_src/gpu/GrStencilClip.h",
"$_src/gpu/GrStencilMaskHelper.cpp",
"$_src/gpu/GrStencilMaskHelper.h",
+ # Ops
+ "$_src/gpu/ops/GrAAConvexPathRenderer.cpp",
+ "$_src/gpu/ops/GrAAConvexPathRenderer.h",
+ "$_src/gpu/ops/GrAAHairLinePathRenderer.cpp",
+ "$_src/gpu/ops/GrAAHairLinePathRenderer.h",
+ "$_src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp",
+ "$_src/gpu/ops/GrAALinearizingConvexPathRenderer.h",
+ "$_src/gpu/ops/GrDashLinePathRenderer.cpp",
+ "$_src/gpu/ops/GrDashLinePathRenderer.h",
+ "$_src/gpu/ops/GrDefaultPathRenderer.cpp",
+ "$_src/gpu/ops/GrDefaultPathRenderer.h",
+ "$_src/gpu/ops/GrSmallPathRenderer.cpp",
+ "$_src/gpu/ops/GrSmallPathRenderer.h",
+ "$_src/gpu/ops/GrTriangulatingPathRenderer.cpp",
+ "$_src/gpu/ops/GrTriangulatingPathRenderer.h",
+
+ # tessellate
+ "$_src/gpu/tessellate/GrTessellationPathRenderer.cpp",
+
# Sk files
"$_src/gpu/SkGpuDevice.cpp",
"$_src/gpu/SkGpuDevice.h",
diff --git a/gn/samples.gni b/gn/samples.gni
index 693283d..61ab5c4 100644
--- a/gn/samples.gni
+++ b/gn/samples.gni
@@ -54,7 +54,6 @@
"$_samplecode/SamplePathClip.cpp",
"$_samplecode/SamplePathEffects.cpp",
"$_samplecode/SamplePathOverstroke.cpp",
- "$_samplecode/SamplePathTessellators.cpp",
"$_samplecode/SamplePathText.cpp",
"$_samplecode/SamplePolyToPoly.cpp",
"$_samplecode/SampleQuadStroker.cpp",
@@ -83,3 +82,7 @@
"$_samplecode/SampleXfermodesBlur.cpp",
"$_samplecode/vertexdump.cpp",
]
+
+oga_samples_sources = [ "$_samplecode/SamplePathTessellators.cpp" ]
+
+samples_sources += oga_samples_sources
diff --git a/gn/tests.gni b/gn/tests.gni
index b339806..257a3cd 100644
--- a/gn/tests.gni
+++ b/gn/tests.gni
@@ -99,7 +99,6 @@
"$_tests/GpuRectanizerTest.cpp",
"$_tests/GrAHardwareBufferTest.cpp",
"$_tests/GrBlockAllocatorTest.cpp",
- "$_tests/GrCCPRTest.cpp",
"$_tests/GrContextAbandonTest.cpp",
"$_tests/GrContextFactoryTest.cpp",
"$_tests/GrContextOOM.cpp",
@@ -189,7 +188,6 @@
"$_tests/PathBuilderTest.cpp",
"$_tests/PathCoverageTest.cpp",
"$_tests/PathMeasureTest.cpp",
- "$_tests/PathRendererCacheTests.cpp",
"$_tests/PathTest.cpp",
"$_tests/PictureBBHTest.cpp",
"$_tests/PictureShaderTest.cpp",
@@ -427,6 +425,10 @@
"$_tests/WangsFormulaTest.cpp",
]
-oga_tests_sources = [ "$_tests/GrClipStackTest.cpp" ]
+oga_tests_sources = [
+ "$_tests/GrCCPRTest.cpp",
+ "$_tests/GrClipStackTest.cpp",
+ "$_tests/PathRendererCacheTests.cpp",
+]
tests_sources += oga_tests_sources
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index 7cb5db9..3cf2493 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -14,7 +14,6 @@
#include "src/gpu/GrFixedClip.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
-#include "src/gpu/GrSoftwarePathRenderer.h"
#include "src/gpu/GrStyle.h"
#include "src/gpu/GrSurfaceDrawContext.h"
#include "src/gpu/GrTextureProxy.h"
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 2c2d3e3..d5b73c9 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -30,7 +30,6 @@
#include "src/gpu/GrRenderTaskCluster.h"
#include "src/gpu/GrResourceAllocator.h"
#include "src/gpu/GrResourceProvider.h"
-#include "src/gpu/GrSoftwarePathRenderer.h"
#include "src/gpu/GrSurfaceContext.h"
#include "src/gpu/GrSurfaceDrawContext.h"
#include "src/gpu/GrSurfaceProxyPriv.h"
@@ -47,16 +46,30 @@
#include "src/gpu/text/GrSDFTControl.h"
#include "src/image/SkSurface_Gpu.h"
+#if GR_OGA
+#include "src/gpu/GrSoftwarePathRenderer.h"
+#endif
+
///////////////////////////////////////////////////////////////////////////////////////////////////
-GrDrawingManager::GrDrawingManager(GrRecordingContext* context,
+#if GR_OGA
+GrDrawingManager::GrDrawingManager(GrRecordingContext* rContext,
const GrPathRendererChain::Options& optionsForPathRendererChain,
bool reduceOpsTaskSplitting)
- : fContext(context)
+ : fContext(rContext)
, fOptionsForPathRendererChain(optionsForPathRendererChain)
, fPathRendererChain(nullptr)
, fSoftwarePathRenderer(nullptr)
- , fFlushing(false)
- , fReduceOpsTaskSplitting(reduceOpsTaskSplitting) { }
+ , fReduceOpsTaskSplitting(reduceOpsTaskSplitting) {
+}
+
+#else
+
+GrDrawingManager::GrDrawingManager(GrRecordingContext* rContext, bool reduceOpsTaskSplitting)
+ : fContext(rContext)
+ , fReduceOpsTaskSplitting(reduceOpsTaskSplitting) {
+}
+
+#endif
GrDrawingManager::~GrDrawingManager() {
this->closeAllTasks();
@@ -75,9 +88,11 @@
}
}
+#if GR_OGA
// a path renderer may be holding onto resources
fPathRendererChain = nullptr;
fSoftwarePathRenderer = nullptr;
+#endif
}
// MDB TODO: make use of the 'proxies' parameter.
@@ -586,11 +601,13 @@
fContext->priv().detachProgramData(&ddl->fProgramData);
+#if GR_OGA
if (fPathRendererChain) {
if (auto ccpr = fPathRendererChain->getCoverageCountingPathRenderer()) {
ddl->fPendingPaths = ccpr->detachPendingPaths();
}
}
+#endif
SkDEBUGCODE(this->validate());
}
@@ -626,11 +643,13 @@
// The lazy proxy that references it (in the DDL opsTasks) will then steal its GrTexture.
ddl->fLazyProxyData->fReplayDest = newDest.get();
+#if GR_OGA
if (ddl->fPendingPaths.size()) {
GrCoverageCountingPathRenderer* ccpr = this->getCoverageCountingPathRenderer();
ccpr->mergePendingPaths(ddl->fPendingPaths);
}
+#endif
// Add a task to handle drawing and lifetime management of the DDL.
SkDEBUGCODE(auto ddlTask =) this->appendTask(sk_make_sp<GrDDLTask>(this,
@@ -878,6 +897,7 @@
return true;
}
+#if GR_OGA
/*
* This method finds a path renderer that can draw the specified path on
* the provided target.
@@ -936,6 +956,8 @@
return fPathRendererChain->getTessellationPathRenderer();
}
+#endif // GR_OGA
+
void GrDrawingManager::flushIfNecessary() {
auto direct = fContext->asDirectContext();
if (!direct) {
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
index 6e5e077..e18a812 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -15,11 +15,14 @@
#include "src/gpu/GrBufferAllocPool.h"
#include "src/gpu/GrDeferredUpload.h"
#include "src/gpu/GrHashMapWithCache.h"
-#include "src/gpu/GrPathRenderer.h"
-#include "src/gpu/GrPathRendererChain.h"
#include "src/gpu/GrResourceCache.h"
#include "src/gpu/GrSurfaceProxy.h"
+#if GR_OGA
+#include "src/gpu/GrPathRenderer.h"
+#include "src/gpu/GrPathRendererChain.h"
+#endif
+
// Enabling this will print out which path renderers are being chosen
#define GR_PATH_RENDERER_SPEW 0
@@ -103,6 +106,7 @@
GrRecordingContext* getContext() { return fContext; }
+#if GR_OGA
GrPathRenderer* getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args,
bool allowSW,
GrPathRendererChain::DrawType drawType,
@@ -117,6 +121,7 @@
// Returns a direct pointer to the tessellation path renderer, or null if it is not supported
// and turned on.
GrTessellationPathRenderer* getTessellationPathRenderer();
+#endif
void flushIfNecessary();
@@ -131,10 +136,12 @@
#if GR_TEST_UTILS
void testingOnly_removeOnFlushCallbackObject(GrOnFlushCallbackObject*);
+#if GR_OGA
GrPathRendererChain::Options testingOnly_getOptionsForPathRendererChain() {
return fOptionsForPathRendererChain;
}
#endif
+#endif
GrRenderTask* getLastRenderTask(const GrSurfaceProxy*) const;
GrOpsTask* getLastOpsTask(const GrSurfaceProxy*) const;
@@ -146,9 +153,13 @@
SkIPoint offset);
private:
+#if GR_OGA
GrDrawingManager(GrRecordingContext*,
const GrPathRendererChain::Options&,
bool reduceOpsTaskSplitting);
+#else
+ GrDrawingManager(GrRecordingContext*, bool reduceOpsTaskSplitting);
+#endif
bool wasAbandoned() const;
@@ -190,7 +201,6 @@
static const int kNumDFTOptions = 2; // DFT or no DFT
GrRecordingContext* fContext;
- GrPathRendererChain::Options fOptionsForPathRendererChain;
// This cache is used by both the vertex and index pools. It reuses memory across multiple
// flushes.
@@ -204,11 +214,14 @@
// These are the new renderTasks generated by the onFlush CBs
SkSTArray<4, sk_sp<GrRenderTask>> fOnFlushRenderTasks;
+#if GR_OGA
+ GrPathRendererChain::Options fOptionsForPathRendererChain;
std::unique_ptr<GrPathRendererChain> fPathRendererChain;
- sk_sp<GrSoftwarePathRenderer> fSoftwarePathRenderer;
+ sk_sp<GrSoftwarePathRenderer> fSoftwarePathRenderer;
+#endif
GrTokenTracker fTokenTracker;
- bool fFlushing;
+ bool fFlushing = false;
const bool fReduceOpsTaskSplitting;
SkTArray<GrOnFlushCallbackObject*> fOnFlushCBObjects;
diff --git a/src/gpu/GrRecordingContext.cpp b/src/gpu/GrRecordingContext.cpp
index 501f01e..e078ae3 100644
--- a/src/gpu/GrRecordingContext.cpp
+++ b/src/gpu/GrRecordingContext.cpp
@@ -61,6 +61,7 @@
return false;
}
+#if GR_OGA
GrPathRendererChain::Options prcOptions;
prcOptions.fAllowPathMaskCaching = this->options().fAllowPathMaskCaching;
#if GR_TEST_UTILS
@@ -70,6 +71,7 @@
if (this->options().fDisableDistanceFieldPaths) {
prcOptions.fGpuPathRenderers &= ~GpuPathRenderers::kSmall;
}
+#endif
bool reduceOpsTaskSplitting = false;
if (this->caps()->avoidReorderingRenderTasks()) {
@@ -80,7 +82,9 @@
reduceOpsTaskSplitting = false;
}
fDrawingManager.reset(new GrDrawingManager(this,
+#if GR_OGA
prcOptions,
+#endif
reduceOpsTaskSplitting));
return true;
}
diff --git a/src/gpu/GrSurfaceDrawContext.cpp b/src/gpu/GrSurfaceDrawContext.cpp
index 5a58dac..de18ac6 100644
--- a/src/gpu/GrSurfaceDrawContext.cpp
+++ b/src/gpu/GrSurfaceDrawContext.cpp
@@ -40,7 +40,6 @@
#include "src/gpu/GrImageContextPriv.h"
#include "src/gpu/GrImageInfo.h"
#include "src/gpu/GrMemoryPool.h"
-#include "src/gpu/GrPathRenderer.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRenderTarget.h"
#include "src/gpu/GrResourceProvider.h"
@@ -73,6 +72,10 @@
#include "src/gpu/text/GrSDFTControl.h"
#include "src/gpu/text/GrTextBlobCache.h"
+#if GR_OGA
+#include "src/gpu/GrPathRenderer.h"
+#endif
+
#define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this->drawingManager()->getContext())
#define ASSERT_SINGLE_OWNER GR_ASSERT_SINGLE_OWNER(this->singleOwner())
#define RETURN_IF_ABANDONED if (fContext->abandoned()) { return; }
@@ -874,6 +877,7 @@
GrAA doStencilMSAA,
const SkMatrix& viewMatrix,
const SkPath& path) {
+#if GR_OGA
SkIRect clipBounds = clip ? clip->getConservativeBounds()
: SkIRect::MakeSize(this->dimensions());
GrStyledShape shape(path, GrStyledShape::DoSimplify::kNo);
@@ -905,6 +909,9 @@
args.fDoStencilMSAA = doStencilMSAA;
pr->stencilPath(args);
return true;
+#else
+ return false;
+#endif // GR_OGA
}
void GrSurfaceDrawContext::drawTextureSet(const GrClip* clip,
@@ -1532,9 +1539,11 @@
/* attemptDrawSimple */ true);
}
+#if GR_OGA
static SkIRect get_clip_bounds(const GrSurfaceDrawContext* rtc, const GrClip* clip) {
return clip ? clip->getConservativeBounds() : SkIRect::MakeWH(rtc->width(), rtc->height());
}
+#endif // GR_OGA
bool GrSurfaceDrawContext::drawAndStencilPath(const GrHardClip* clip,
const GrUserStencilSettings* ss,
@@ -1543,6 +1552,7 @@
GrAA aa,
const SkMatrix& viewMatrix,
const SkPath& path) {
+#if GR_OGA
ASSERT_SINGLE_OWNER
RETURN_FALSE_IF_ABANDONED
SkDEBUGCODE(this->validate();)
@@ -1601,6 +1611,9 @@
this->colorInfo().isLinearlyBlended()};
pr->drawPath(args);
return true;
+#else
+ return false;
+#endif
}
SkBudgeted GrSurfaceDrawContext::isBudgeted() const {
@@ -1722,6 +1735,7 @@
const SkMatrix& viewMatrix,
GrStyledShape&& shape,
bool attemptDrawSimple) {
+#if GR_OGA
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
GR_CREATE_TRACE_MARKER_CONTEXT("GrSurfaceDrawContext", "internalDrawPath", fContext);
@@ -1830,6 +1844,7 @@
aaType,
this->colorInfo().isLinearlyBlended()};
pr->drawPath(args);
+#endif
}
static void op_bounds(SkRect* bounds, const GrOp* op) {
diff --git a/src/gpu/GrSurfaceDrawContext.h b/src/gpu/GrSurfaceDrawContext.h
index 85ca777..f03f291 100644
--- a/src/gpu/GrSurfaceDrawContext.h
+++ b/src/gpu/GrSurfaceDrawContext.h
@@ -29,6 +29,7 @@
class GrCoverageCountingPathRenderer;
class GrDrawOp;
class GrDstProxyView;
+class GrHardClip;
class GrOp;
class GrRenderTarget;
class GrStyledShape;
diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.h b/src/gpu/ccpr/GrCoverageCountingPathRenderer.h
index b39f3d9..f32b544 100644
--- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.h
+++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.h
@@ -11,7 +11,6 @@
#include <map>
#include "src/gpu/GrOnFlushResourceProvider.h"
#include "src/gpu/GrOpsTask.h"
-#include "src/gpu/GrPathRenderer.h"
#include "src/gpu/ccpr/GrCCPerFlushResources.h"
#include "src/gpu/ccpr/GrCCPerOpsTaskPaths.h"
diff --git a/src/gpu/tessellate/GrTessellationPathRenderer.h b/src/gpu/tessellate/GrTessellationPathRenderer.h
index c8d5ed8..5850f6a 100644
--- a/src/gpu/tessellate/GrTessellationPathRenderer.h
+++ b/src/gpu/tessellate/GrTessellationPathRenderer.h
@@ -8,6 +8,10 @@
#ifndef GrTessellationPathRenderer_DEFINED
#define GrTessellationPathRenderer_DEFINED
+#include "include/gpu/GrTypes.h"
+
+#if GR_OGA
+
#include "src/core/SkIPoint16.h"
#include "src/gpu/GrDynamicAtlas.h"
#include "src/gpu/GrOnFlushResourceProvider.h"
@@ -88,4 +92,23 @@
GR_MAKE_BITFIELD_CLASS_OPS(GrTessellationPathRenderer::PathFlags);
+#else // GR_OGA
+
+class GrTessellationPathRenderer {
+public:
+ // We send these flags to the internal path filling Ops to control how a path gets rendered.
+ enum class PathFlags {
+ kNone = 0,
+ kStencilOnly = (1 << 0),
+ kWireframe = (1 << 1)
+ };
+
+ static bool IsSupported(const GrCaps&) { return false; }
+
+};
+
+GR_MAKE_BITFIELD_CLASS_OPS(GrTessellationPathRenderer::PathFlags);
+
+#endif // GR_OGA
+
#endif
diff --git a/tests/PathRendererCacheTests.cpp b/tests/PathRendererCacheTests.cpp
index fbd6750..2d50353 100644
--- a/tests/PathRendererCacheTests.cpp
+++ b/tests/PathRendererCacheTests.cpp
@@ -83,10 +83,10 @@
dContext->setResourceCacheLimit(8000000);
GrResourceCache* cache = dContext->priv().getResourceCache();
- auto rtc = GrSurfaceDrawContext::Make(
+ auto sdc = GrSurfaceDrawContext::Make(
dContext.get(), GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox, {800, 800},
SkSurfaceProps(), 1, GrMipmapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
- if (!rtc) {
+ if (!sdc) {
return;
}
@@ -97,7 +97,7 @@
REPORTER_ASSERT(reporter, cache_non_scratch_resources_equals(cache, 0));
// Draw the path, check that new resource count matches expectations
- draw_path(dContext.get(), rtc.get(), path, pathRenderer.get(), aaType, style);
+ draw_path(dContext.get(), sdc.get(), path, pathRenderer.get(), aaType, style);
dContext->flushAndSubmit();
REPORTER_ASSERT(reporter, cache_non_scratch_resources_equals(cache, expected));
@@ -120,13 +120,13 @@
REPORTER_ASSERT(reporter, SkPathPriv::GenIDChangeListenersCount(path) == 0);
for (int i = 0; i < 20; ++i) {
float scaleX = 1 + ((float)i + 1)/20.f;
- draw_path(dContext.get(), rtc.get(), path, pathRenderer.get(), aaType, style, scaleX);
+ draw_path(dContext.get(), sdc.get(), path, pathRenderer.get(), aaType, style, scaleX);
}
dContext->flushAndSubmit();
REPORTER_ASSERT(reporter, SkPathPriv::GenIDChangeListenersCount(path) == 20);
cache->purgeUnlockedResources();
// The listeners don't actually purge until we try to add another one.
- draw_path(dContext.get(), rtc.get(), path, pathRenderer.get(), aaType, style);
+ draw_path(dContext.get(), sdc.get(), path, pathRenderer.get(), aaType, style);
REPORTER_ASSERT(reporter, SkPathPriv::GenIDChangeListenersCount(path) == 1);
}
diff --git a/tests/TriangulatingPathRendererTests.cpp b/tests/TriangulatingPathRendererTests.cpp
index 1d2da56..91efe89 100644
--- a/tests/TriangulatingPathRendererTests.cpp
+++ b/tests/TriangulatingPathRendererTests.cpp
@@ -17,7 +17,6 @@
#include "src/gpu/GrSurfaceDrawContext.h"
#include "src/gpu/effects/GrPorterDuffXferProcessor.h"
#include "src/gpu/geometry/GrStyledShape.h"
-#include "src/gpu/ops/GrTriangulatingPathRenderer.h"
#include "src/shaders/SkShaderBase.h"
#include "tools/ToolUtils.h"
#include <map>
@@ -485,6 +484,9 @@
},
};
+#if GR_OGA
+#include "src/gpu/ops/GrTriangulatingPathRenderer.h"
+
// A simple concave path. Test this with a non-invertible matrix.
static SkPath create_path_17() {
SkPath path;
@@ -774,6 +776,8 @@
test_path(ctx, rtc.get(), create_path_46(), SkMatrix(), GrAAType::kCoverage);
}
+#endif // GR_OGA
+
namespace {
class SimpleVertexAllocator : public GrEagerVertexAllocator {
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp
index ac03100..b76ce0e 100644
--- a/tools/gpu/GrTest.cpp
+++ b/tools/gpu/GrTest.cpp
@@ -56,26 +56,29 @@
GrRecordingContext*, GrSurfaceDrawContext*, int)
#define DRAW_OP_TEST_ENTRY(Op) Op##__Test
+#if GR_OGA
DRAW_OP_TEST_EXTERN(AAConvexPathOp);
DRAW_OP_TEST_EXTERN(AAFlatteningConvexPathOp);
DRAW_OP_TEST_EXTERN(AAHairlineOp);
+DRAW_OP_TEST_EXTERN(DefaultPathOp);
+DRAW_OP_TEST_EXTERN(SmallPathOp);
+DRAW_OP_TEST_EXTERN(TriangulatingPathOp);
+#endif // GR_OGA
+
DRAW_OP_TEST_EXTERN(AAStrokeRectOp);
DRAW_OP_TEST_EXTERN(CircleOp);
DRAW_OP_TEST_EXTERN(DashOp);
-DRAW_OP_TEST_EXTERN(DefaultPathOp);
+DRAW_OP_TEST_EXTERN(DrawAtlasOp);
+DRAW_OP_TEST_EXTERN(DrawVerticesOp);
DRAW_OP_TEST_EXTERN(DIEllipseOp);
DRAW_OP_TEST_EXTERN(EllipseOp);
DRAW_OP_TEST_EXTERN(FillRectOp);
DRAW_OP_TEST_EXTERN(GrAtlasTextOp);
-DRAW_OP_TEST_EXTERN(DrawAtlasOp);
-DRAW_OP_TEST_EXTERN(DrawVerticesOp);
DRAW_OP_TEST_EXTERN(NonAALatticeOp);
DRAW_OP_TEST_EXTERN(NonAAStrokeRectOp);
-DRAW_OP_TEST_EXTERN(ShadowRRectOp);
-DRAW_OP_TEST_EXTERN(SmallPathOp);
DRAW_OP_TEST_EXTERN(RegionOp);
DRAW_OP_TEST_EXTERN(RRectOp);
-DRAW_OP_TEST_EXTERN(TriangulatingPathOp);
+DRAW_OP_TEST_EXTERN(ShadowRRectOp);
DRAW_OP_TEST_EXTERN(TextureOp);
void GrDrawRandomOp(SkRandom* random, GrSurfaceDrawContext* surfaceDrawContext, GrPaint&& paint) {
@@ -83,26 +86,29 @@
using MakeDrawOpFn = GrOp::Owner (GrPaint&&, SkRandom*,
GrRecordingContext*, GrSurfaceDrawContext*, int numSamples);
static constexpr MakeDrawOpFn* gFactories[] = {
+#if GR_OGA
DRAW_OP_TEST_ENTRY(AAConvexPathOp),
DRAW_OP_TEST_ENTRY(AAFlatteningConvexPathOp),
DRAW_OP_TEST_ENTRY(AAHairlineOp),
+ DRAW_OP_TEST_ENTRY(DefaultPathOp),
+ DRAW_OP_TEST_ENTRY(SmallPathOp),
+ DRAW_OP_TEST_ENTRY(TriangulatingPathOp),
+#endif // GR_OGA
+
DRAW_OP_TEST_ENTRY(AAStrokeRectOp),
DRAW_OP_TEST_ENTRY(CircleOp),
DRAW_OP_TEST_ENTRY(DashOp),
- DRAW_OP_TEST_ENTRY(DefaultPathOp),
+ DRAW_OP_TEST_ENTRY(DrawAtlasOp),
+ DRAW_OP_TEST_ENTRY(DrawVerticesOp),
DRAW_OP_TEST_ENTRY(DIEllipseOp),
DRAW_OP_TEST_ENTRY(EllipseOp),
DRAW_OP_TEST_ENTRY(FillRectOp),
DRAW_OP_TEST_ENTRY(GrAtlasTextOp),
- DRAW_OP_TEST_ENTRY(DrawAtlasOp),
- DRAW_OP_TEST_ENTRY(DrawVerticesOp),
DRAW_OP_TEST_ENTRY(NonAALatticeOp),
DRAW_OP_TEST_ENTRY(NonAAStrokeRectOp),
- DRAW_OP_TEST_ENTRY(ShadowRRectOp),
- DRAW_OP_TEST_ENTRY(SmallPathOp),
DRAW_OP_TEST_ENTRY(RegionOp),
DRAW_OP_TEST_ENTRY(RRectOp),
- DRAW_OP_TEST_ENTRY(TriangulatingPathOp),
+ DRAW_OP_TEST_ENTRY(ShadowRRectOp),
DRAW_OP_TEST_ENTRY(TextureOp),
};