Delete TessTypes.h
The flags here are specific to v1 behavior. Move them into v1 only.
Bug: skia:12524
Change-Id: I27f06d0c153f95e1510bb11c8486d59e5242056a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458997
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/gn/gpu.gni b/gn/gpu.gni
index 7a46b8e..6505926 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -339,7 +339,6 @@
"$_src/gpu/tessellate/StrokeHardwareTessellator.h",
"$_src/gpu/tessellate/StrokeIterator.h",
"$_src/gpu/tessellate/StrokeTessellator.h",
- "$_src/gpu/tessellate/TessTypes.h",
"$_src/gpu/tessellate/VectorXform.h",
# tessellate/shaders
@@ -529,6 +528,7 @@
"$_src/gpu/ops/DrawVerticesOp.h",
"$_src/gpu/ops/DrawableOp.cpp",
"$_src/gpu/ops/DrawableOp.h",
+ "$_src/gpu/ops/FillPathFlags.h",
"$_src/gpu/ops/FillRRectOp.cpp",
"$_src/gpu/ops/FillRRectOp.h",
"$_src/gpu/ops/FillRectOp.cpp",
diff --git a/src/gpu/ops/AtlasRenderTask.cpp b/src/gpu/ops/AtlasRenderTask.cpp
index 4e82d40..fb26955 100644
--- a/src/gpu/ops/AtlasRenderTask.cpp
+++ b/src/gpu/ops/AtlasRenderTask.cpp
@@ -101,7 +101,7 @@
pathList->pathCount(),
GrPaint(),
GrAAType::kMSAA,
- skgpu::tess::TessellationPathFlags::kStencilOnly,
+ FillPathFlags::kStencilOnly,
drawRect);
this->addAtlasDrawOp(std::move(op), caps);
}
diff --git a/src/gpu/ops/FillPathFlags.h b/src/gpu/ops/FillPathFlags.h
new file mode 100644
index 0000000..66dc0fc
--- /dev/null
+++ b/src/gpu/ops/FillPathFlags.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2021 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef FillPathFlags_DEFINED
+#define FillPathFlags_DEFINED
+
+#include "include/gpu/GrTypes.h"
+
+namespace skgpu::v1 {
+
+// We send these flags to the internal path filling Ops to control how a path gets rendered.
+enum class FillPathFlags {
+ kNone = 0,
+ kStencilOnly = (1 << 0),
+ kWireframe = (1 << 1)
+};
+
+GR_MAKE_BITFIELD_CLASS_OPS(FillPathFlags)
+
+} // namespace skgpu::v1
+
+#endif // FillPathFlags_DEFINED
diff --git a/src/gpu/ops/PathInnerTriangulateOp.cpp b/src/gpu/ops/PathInnerTriangulateOp.cpp
index 759a882..77a5321 100644
--- a/src/gpu/ops/PathInnerTriangulateOp.cpp
+++ b/src/gpu/ops/PathInnerTriangulateOp.cpp
@@ -16,8 +16,6 @@
#include "src/gpu/tessellate/PathCurveTessellator.h"
#include "src/gpu/tessellate/shaders/GrPathTessellationShader.h"
-using PathFlags = skgpu::tess::TessellationPathFlags;
-
namespace {
// Fills an array of convex hulls surrounding 4-point cubic or conic instances. This shader is used
@@ -219,8 +217,9 @@
// If using wireframe, we have to fall back on a standard Redbook "stencil then cover" algorithm
// instead of bypassing the stencil buffer to fill the fan directly.
- bool forceRedbookStencilPass = (fPathFlags & (PathFlags::kStencilOnly | PathFlags::kWireframe));
- bool doFill = !(fPathFlags & PathFlags::kStencilOnly);
+ bool forceRedbookStencilPass =
+ (fPathFlags & (FillPathFlags::kStencilOnly | FillPathFlags::kWireframe));
+ bool doFill = !(fPathFlags & FillPathFlags::kStencilOnly);
bool isLinear;
fFanTriangulator = args.fArena->make<GrInnerFanTriangulator>(fPath, args.fArena);
@@ -229,8 +228,11 @@
// Create a pipeline for stencil passes if needed.
const GrPipeline* pipelineForStencils = nullptr;
if (forceRedbookStencilPass || !isLinear) { // Curves always get stencilled.
+ auto pipelineFlags = (fPathFlags & FillPathFlags::kWireframe)
+ ? GrPipeline::InputFlags::kWireframe
+ : GrPipeline::InputFlags::kNone;
pipelineForStencils = GrPathTessellationShader::MakeStencilOnlyPipeline(
- args, fAAType, fPathFlags, appliedClip.hardClip());
+ args, fAAType, appliedClip.hardClip(), pipelineFlags);
}
// Create a pipeline for fill passes if needed.
diff --git a/src/gpu/ops/PathInnerTriangulateOp.h b/src/gpu/ops/PathInnerTriangulateOp.h
index 5380ae0..fe618ff 100644
--- a/src/gpu/ops/PathInnerTriangulateOp.h
+++ b/src/gpu/ops/PathInnerTriangulateOp.h
@@ -9,8 +9,8 @@
#define PathInnerTriangulateOp_DEFINED
#include "src/gpu/geometry/GrInnerFanTriangulator.h"
+#include "src/gpu/ops/FillPathFlags.h"
#include "src/gpu/ops/GrDrawOp.h"
-#include "src/gpu/tessellate/TessTypes.h"
#include "src/gpu/tessellate/shaders/GrTessellationShader.h"
namespace skgpu::tess {
@@ -37,7 +37,7 @@
const SkPath& path,
GrPaint&& paint,
GrAAType aaType,
- skgpu::tess::TessellationPathFlags pathFlags,
+ FillPathFlags pathFlags,
const SkRect& drawBounds)
: GrDrawOp(ClassID())
, fPathFlags(pathFlags)
@@ -66,7 +66,7 @@
void onPrepare(GrOpFlushState*) override;
void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
- const skgpu::tess::TessellationPathFlags fPathFlags;
+ const FillPathFlags fPathFlags;
const SkMatrix fViewMatrix;
const SkPath fPath;
const GrAAType fAAType;
diff --git a/src/gpu/ops/PathStencilCoverOp.cpp b/src/gpu/ops/PathStencilCoverOp.cpp
index e279e07..a47f9b8 100644
--- a/src/gpu/ops/PathStencilCoverOp.cpp
+++ b/src/gpu/ops/PathStencilCoverOp.cpp
@@ -21,8 +21,6 @@
#include "src/gpu/tessellate/PathWedgeTessellator.h"
#include "src/gpu/tessellate/shaders/GrPathTessellationShader.h"
-using PathFlags = skgpu::tess::TessellationPathFlags;
-
namespace {
// Fills a path's bounding box, with subpixel outset to avoid possible T-junctions with extreme
@@ -137,8 +135,11 @@
// We transform paths on the CPU. This allows for better batching.
const SkMatrix& shaderMatrix = SkMatrix::I();
+ auto pipelineFlags = (fPathFlags & FillPathFlags::kWireframe)
+ ? GrPipeline::InputFlags::kWireframe
+ : GrPipeline::InputFlags::kNone;
const GrPipeline* stencilPipeline = GrPathTessellationShader::MakeStencilOnlyPipeline(
- args, fAAType, fPathFlags, appliedClip.hardClip());
+ args, fAAType, appliedClip.hardClip(), pipelineFlags);
const GrUserStencilSettings* stencilSettings = GrPathTessellationShader::StencilPathSettings(
GrFillRuleForPathFillType(this->pathFillType()));
@@ -175,7 +176,7 @@
stencilPipeline,
stencilSettings);
- if (!(fPathFlags & PathFlags::kStencilOnly)) {
+ if (!(fPathFlags & FillPathFlags::kStencilOnly)) {
// Create a program that draws a bounding box over the path and fills its stencil coverage
// into the color buffer.
auto* bboxShader = args.fArena->make<BoundingBoxShader>(fColor, *args.fCaps->shaderCaps());
diff --git a/src/gpu/ops/PathStencilCoverOp.h b/src/gpu/ops/PathStencilCoverOp.h
index 45a82be..12bbf17 100644
--- a/src/gpu/ops/PathStencilCoverOp.h
+++ b/src/gpu/ops/PathStencilCoverOp.h
@@ -8,9 +8,9 @@
#ifndef PathStencilCoverOp_DEFINED
#define PathStencilCoverOp_DEFINED
+#include "src/gpu/ops/FillPathFlags.h"
#include "src/gpu/ops/GrDrawOp.h"
#include "src/gpu/tessellate/PathTessellator.h"
-#include "src/gpu/tessellate/TessTypes.h"
#include "src/gpu/tessellate/shaders/GrTessellationShader.h"
namespace skgpu::v1 {
@@ -31,7 +31,7 @@
const SkPath& path,
GrPaint&& paint,
GrAAType aaType,
- skgpu::tess::TessellationPathFlags pathFlags,
+ FillPathFlags pathFlags,
const SkRect& drawBounds)
: GrDrawOp(ClassID())
, fPathDrawList(arena->make<PathDrawList>(viewMatrix, path))
@@ -53,7 +53,7 @@
int pathCount,
GrPaint&& paint,
GrAAType aaType,
- skgpu::tess::TessellationPathFlags pathFlags,
+ FillPathFlags pathFlags,
const SkRect& drawBounds)
: GrDrawOp(ClassID())
, fPathDrawList(pathDrawList)
@@ -89,7 +89,7 @@
const PathDrawList* fPathDrawList;
const int fTotalCombinedPathVerbCnt;
const int fPathCount;
- const skgpu::tess::TessellationPathFlags fPathFlags;
+ const FillPathFlags fPathFlags;
const GrAAType fAAType;
SkPMColor4f fColor;
GrProcessorSet fProcessors;
diff --git a/src/gpu/ops/TessellationPathRenderer.cpp b/src/gpu/ops/TessellationPathRenderer.cpp
index 90ff692..ce4ed0e 100644
--- a/src/gpu/ops/TessellationPathRenderer.cpp
+++ b/src/gpu/ops/TessellationPathRenderer.cpp
@@ -25,7 +25,7 @@
GrOp::Owner make_non_convex_fill_op(GrRecordingContext* rContext,
SkArenaAlloc* arena,
- skgpu::tess::TessellationPathFlags pathFlags,
+ skgpu::v1::FillPathFlags fillPathFlags,
GrAAType aaType,
const SkRect& drawBounds,
const SkMatrix& viewMatrix,
@@ -48,7 +48,7 @@
path,
std::move(paint),
aaType,
- pathFlags,
+ fillPathFlags,
drawBounds);
}
}
@@ -58,7 +58,7 @@
path,
std::move(paint),
aaType,
- pathFlags,
+ fillPathFlags,
drawBounds);
}
@@ -150,7 +150,7 @@
: pathDevBounds;
auto op = make_non_convex_fill_op(args.fContext,
args.fSurfaceDrawContext->arenaAlloc(),
- skgpu::tess::TessellationPathFlags::kNone,
+ FillPathFlags::kNone,
args.fAAType,
drawBounds,
*args.fViewMatrix,
@@ -194,7 +194,7 @@
auto op = make_non_convex_fill_op(args.fContext,
args.fSurfaceDrawContext->arenaAlloc(),
- skgpu::tess::TessellationPathFlags::kStencilOnly,
+ FillPathFlags::kStencilOnly,
aaType,
pathDevBounds,
*args.fViewMatrix,
diff --git a/src/gpu/tessellate/TessTypes.h b/src/gpu/tessellate/TessTypes.h
deleted file mode 100644
index 56c1734..0000000
--- a/src/gpu/tessellate/TessTypes.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2021 Google LLC
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef tessellate_TessTypes_DEFINED
-#define tessellate_TessTypes_DEFINED
-
-#include "include/gpu/GrTypes.h"
-
-namespace skgpu::tess {
-
-// We send these flags to the internal path filling Ops to control how a path gets rendered.
-enum class TessellationPathFlags {
- kNone = 0,
- kStencilOnly = (1 << 0),
- kWireframe = (1 << 1)
-};
-
-GR_MAKE_BITFIELD_CLASS_OPS(TessellationPathFlags)
-
-} // namespace skgpu::tess
-
-#endif // tessellate_TessTypes_DEFINED
diff --git a/src/gpu/tessellate/shaders/GrPathTessellationShader.cpp b/src/gpu/tessellate/shaders/GrPathTessellationShader.cpp
index 12c86b6..52e92ba 100644
--- a/src/gpu/tessellate/shaders/GrPathTessellationShader.cpp
+++ b/src/gpu/tessellate/shaders/GrPathTessellationShader.cpp
@@ -56,17 +56,14 @@
const GrPipeline* GrPathTessellationShader::MakeStencilOnlyPipeline(
const ProgramArgs& args,
GrAAType aaType,
- skgpu::tess::TessellationPathFlags pathFlags,
- const GrAppliedHardClip& hardClip) {
- using PathFlags = skgpu::tess::TessellationPathFlags;
+ const GrAppliedHardClip& hardClip,
+ GrPipeline::InputFlags pipelineFlags) {
GrPipeline::InitArgs pipelineArgs;
- if (args.fCaps->wireframeSupport() && (pathFlags & PathFlags::kWireframe)) {
- pipelineArgs.fInputFlags |= GrPipeline::InputFlags::kWireframe;
- }
+ pipelineArgs.fInputFlags = pipelineFlags;
pipelineArgs.fCaps = args.fCaps;
return args.fArena->make<GrPipeline>(pipelineArgs,
- GrDisableColorXPFactory::MakeXferProcessor(),
- hardClip);
+ GrDisableColorXPFactory::MakeXferProcessor(),
+ hardClip);
}
// Evaluate our point of interest using numerically stable linear interpolations. We add our own
diff --git a/src/gpu/tessellate/shaders/GrPathTessellationShader.h b/src/gpu/tessellate/shaders/GrPathTessellationShader.h
index f08368b..7be2b7e 100644
--- a/src/gpu/tessellate/shaders/GrPathTessellationShader.h
+++ b/src/gpu/tessellate/shaders/GrPathTessellationShader.h
@@ -8,7 +8,6 @@
#ifndef GrPathTessellationShader_DEFINED
#define GrPathTessellationShader_DEFINED
-#include "src/gpu/tessellate/TessTypes.h"
#include "src/gpu/tessellate/shaders/GrTessellationShader.h"
// This is the base class for shaders in the GPU tessellator that fill paths.
@@ -152,10 +151,11 @@
}
// Creates a pipeline that does not write to the color buffer.
- static const GrPipeline* MakeStencilOnlyPipeline(const ProgramArgs&,
- GrAAType,
- skgpu::tess::TessellationPathFlags,
- const GrAppliedHardClip&);
+ static const GrPipeline* MakeStencilOnlyPipeline(
+ const ProgramArgs&,
+ GrAAType,
+ const GrAppliedHardClip&,
+ GrPipeline::InputFlags = GrPipeline::InputFlags::kNone);
protected:
constexpr static size_t kMiddleOutVertexStride = 2 * sizeof(float);