Rename GrPathStencilFillOp -> GrPathStencilCoverOp
"Fill" is an overloaded term. Switch to saying "cover", which I
believe is more true to the Redbook terminology anyway.
Bug: skia:10419
Change-Id: I906122c58462ac374b29dcb96e35bb3f86e55b0d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/416079
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/tessellate/GrPathInnerTriangulateOp.cpp b/src/gpu/tessellate/GrPathInnerTriangulateOp.cpp
index 37b4c75..715b119 100644
--- a/src/gpu/tessellate/GrPathInnerTriangulateOp.cpp
+++ b/src/gpu/tessellate/GrPathInnerTriangulateOp.cpp
@@ -22,7 +22,7 @@
namespace {
// Fills an array of convex hulls surrounding 4-point cubic or conic instances. This shader is used
-// for the "fill" pass after the curves have been fully stencilled.
+// for the "cover" pass after the curves have been fully stencilled.
class HullShader : public GrPathTessellationShader {
public:
HullShader(const SkMatrix& viewMatrix, SkPMColor4f color)
@@ -157,13 +157,13 @@
SkASSERT(!fTessellator);
SkASSERT(!fStencilCurvesProgram);
SkASSERT(fFanPrograms.empty());
- SkASSERT(!fFillHullsProgram);
+ SkASSERT(!fCoverHullsProgram);
if (fPath.countVerbs() <= 0) {
return;
}
- // If using wireframe, we have to fall back on a standard Redbook "stencil then fill" algorithm
+ // 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);
@@ -202,8 +202,8 @@
// Pass 2: Fill the path's inner fan with a stencil test against the curves.
if (fFanPolys) {
if (forceRedbookStencilPass) {
- // Use a standard Redbook "stencil then fill" algorithm instead of bypassing the stencil
- // buffer to fill the fan directly.
+ // Use a standard Redbook "stencil then cover" algorithm instead of bypassing the
+ // stencil buffer to fill the fan directly.
const GrUserStencilSettings* stencilPathSettings =
GrPathTessellationShader::StencilPathSettings(fPath.getFillType());
this->pushFanStencilProgram(args, pipelineForStencils, stencilPathSettings);
@@ -299,7 +299,7 @@
// This will fill in any remaining samples and reset the stencil values back to zero.
SkASSERT(fTessellator);
auto* hullShader = args.fArena->make<HullShader>(fViewMatrix, fColor);
- fFillHullsProgram = GrTessellationShader::MakeProgram(
+ fCoverHullsProgram = GrTessellationShader::MakeProgram(
args, hullShader, fPipelineForFills,
GrPathTessellationShader::TestAndResetStencilSettings());
}
@@ -320,8 +320,8 @@
for (const GrProgramInfo* fanProgram : fFanPrograms) {
context->priv().recordProgramInfo(fanProgram);
}
- if (fFillHullsProgram) {
- context->priv().recordProgramInfo(fFillHullsProgram);
+ if (fCoverHullsProgram) {
+ context->priv().recordProgramInfo(fCoverHullsProgram);
}
}
@@ -365,10 +365,10 @@
flushState->draw(fFanVertexCount, fBaseFanVertex);
}
- if (fFillHullsProgram) {
+ if (fCoverHullsProgram) {
SkASSERT(fTessellator);
- flushState->bindPipelineAndScissorClip(*fFillHullsProgram, this->bounds());
- flushState->bindTextures(fFillHullsProgram->geomProc(), nullptr, *fPipelineForFills);
+ flushState->bindPipelineAndScissorClip(*fCoverHullsProgram, this->bounds());
+ flushState->bindTextures(fCoverHullsProgram->geomProc(), nullptr, *fPipelineForFills);
fTessellator->drawHullInstances(flushState);
}
}
diff --git a/src/gpu/tessellate/GrPathInnerTriangulateOp.h b/src/gpu/tessellate/GrPathInnerTriangulateOp.h
index da8ea5b..30b296e 100644
--- a/src/gpu/tessellate/GrPathInnerTriangulateOp.h
+++ b/src/gpu/tessellate/GrPathInnerTriangulateOp.h
@@ -15,7 +15,7 @@
class GrPathTessellator;
-// This op is a 3-pass twist on the standard Redbook "stencil then fill" algorithm:
+// This op is a 3-pass twist on the standard Redbook "stencil then cover" algorithm:
//
// 1) Tessellate the path's outer curves into the stencil buffer.
// 2) Triangulate the path's inner fan and fill it with a stencil test against the curves.
@@ -82,7 +82,7 @@
SkSTArray<2, const GrProgramInfo*> fFanPrograms;
// Pass 3: Draw convex hulls around each curve.
- const GrProgramInfo* fFillHullsProgram = nullptr;
+ const GrProgramInfo* fCoverHullsProgram = nullptr;
// This buffer gets created by fFanTriangulator during onPrepare.
sk_sp<const GrBuffer> fFanBuffer;
diff --git a/src/gpu/tessellate/GrPathStencilFillOp.cpp b/src/gpu/tessellate/GrPathStencilCoverOp.cpp
similarity index 82%
rename from src/gpu/tessellate/GrPathStencilFillOp.cpp
rename to src/gpu/tessellate/GrPathStencilCoverOp.cpp
index 06b1c05..13a0df5 100644
--- a/src/gpu/tessellate/GrPathStencilFillOp.cpp
+++ b/src/gpu/tessellate/GrPathStencilCoverOp.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "src/gpu/tessellate/GrPathStencilFillOp.h"
+#include "src/gpu/tessellate/GrPathStencilCoverOp.h"
#include "src/gpu/GrEagerVertexAllocator.h"
#include "src/gpu/GrGpu.h"
@@ -62,15 +62,15 @@
} // namespace
-void GrPathStencilFillOp::visitProxies(const VisitProxyFunc& fn) const {
- if (fFillBBoxProgram) {
- fFillBBoxProgram->pipeline().visitProxies(fn);
+void GrPathStencilCoverOp::visitProxies(const VisitProxyFunc& fn) const {
+ if (fCoverBBoxProgram) {
+ fCoverBBoxProgram->pipeline().visitProxies(fn);
} else {
fProcessors.visitProxies(fn);
}
}
-GrDrawOp::FixedFunctionFlags GrPathStencilFillOp::fixedFunctionFlags() const {
+GrDrawOp::FixedFunctionFlags GrPathStencilCoverOp::fixedFunctionFlags() const {
auto flags = FixedFunctionFlags::kUsesStencil;
if (fAAType != GrAAType::kNone) {
flags |= FixedFunctionFlags::kUsesHWAA;
@@ -78,19 +78,19 @@
return flags;
}
-GrProcessorSet::Analysis GrPathStencilFillOp::finalize(const GrCaps& caps,
- const GrAppliedClip* clip,
- GrClampType clampType) {
+GrProcessorSet::Analysis GrPathStencilCoverOp::finalize(const GrCaps& caps,
+ const GrAppliedClip* clip,
+ GrClampType clampType) {
return fProcessors.finalize(fColor, GrProcessorAnalysisCoverage::kNone, clip, nullptr, caps,
clampType, &fColor);
}
-void GrPathStencilFillOp::prePreparePrograms(const GrTessellationShader::ProgramArgs& args,
- GrAppliedClip&& appliedClip) {
+void GrPathStencilCoverOp::prePreparePrograms(const GrTessellationShader::ProgramArgs& args,
+ GrAppliedClip&& appliedClip) {
SkASSERT(!fTessellator);
SkASSERT(!fStencilFanProgram);
SkASSERT(!fStencilPathProgram);
- SkASSERT(!fFillBBoxProgram);
+ SkASSERT(!fCoverBBoxProgram);
if (fPath.countVerbs() <= 0) {
return;
@@ -136,16 +136,16 @@
std::move(appliedClip),
std::move(fProcessors));
auto* bboxStencil = GrPathTessellationShader::TestAndResetStencilSettings();
- fFillBBoxProgram = GrTessellationShader::MakeProgram(args, bboxShader, bboxPipeline,
- bboxStencil);
+ fCoverBBoxProgram = GrTessellationShader::MakeProgram(args, bboxShader, bboxPipeline,
+ bboxStencil);
}
}
-void GrPathStencilFillOp::onPrePrepare(GrRecordingContext* context,
- const GrSurfaceProxyView& writeView, GrAppliedClip* clip,
- const GrDstProxyView& dstProxyView,
- GrXferBarrierFlags renderPassXferBarriers,
- GrLoadOp colorLoadOp) {
+void GrPathStencilCoverOp::onPrePrepare(GrRecordingContext* context,
+ const GrSurfaceProxyView& writeView, GrAppliedClip* clip,
+ const GrDstProxyView& dstProxyView,
+ GrXferBarrierFlags renderPassXferBarriers,
+ GrLoadOp colorLoadOp) {
this->prePreparePrograms({context->priv().recordTimeAllocator(), writeView, &dstProxyView,
renderPassXferBarriers, colorLoadOp, context->priv().caps()},
(clip) ? std::move(*clip) : GrAppliedClip::Disabled());
@@ -155,12 +155,12 @@
if (fStencilPathProgram) {
context->priv().recordProgramInfo(fStencilPathProgram);
}
- if (fFillBBoxProgram) {
- context->priv().recordProgramInfo(fFillBBoxProgram);
+ if (fCoverBBoxProgram) {
+ context->priv().recordProgramInfo(fCoverBBoxProgram);
}
}
-void GrPathStencilFillOp::onPrepare(GrOpFlushState* flushState) {
+void GrPathStencilCoverOp::onPrepare(GrOpFlushState* flushState) {
if (!fTessellator) {
this->prePreparePrograms({flushState->allocator(), flushState->writeView(),
&flushState->dstProxyView(), flushState->renderPassBarriers(),
@@ -186,14 +186,14 @@
fTessellator->prepare(flushState, this->bounds(), fPath);
- if (fFillBBoxProgram) {
+ if (fCoverBBoxProgram) {
GrVertexWriter vertexWriter = flushState->makeVertexSpace(sizeof(SkRect), 1, &fBBoxBuffer,
&fBBoxBaseInstance);
vertexWriter.write(fPath.getBounds());
}
}
-void GrPathStencilFillOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
+void GrPathStencilCoverOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
if (!fTessellator) {
return;
}
@@ -216,10 +216,10 @@
}
// Fill in the bounding box (if not in stencil-only mode).
- if (fFillBBoxProgram) {
- flushState->bindPipelineAndScissorClip(*fFillBBoxProgram, this->bounds());
- flushState->bindTextures(fFillBBoxProgram->geomProc(), nullptr,
- fFillBBoxProgram->pipeline());
+ if (fCoverBBoxProgram) {
+ flushState->bindPipelineAndScissorClip(*fCoverBBoxProgram, this->bounds());
+ flushState->bindTextures(fCoverBBoxProgram->geomProc(), nullptr,
+ fCoverBBoxProgram->pipeline());
flushState->bindBuffers(nullptr, fBBoxBuffer, nullptr);
flushState->drawInstanced(1, fBBoxBaseInstance, 4, 0);
}
diff --git a/src/gpu/tessellate/GrPathStencilFillOp.h b/src/gpu/tessellate/GrPathStencilCoverOp.h
similarity index 77%
rename from src/gpu/tessellate/GrPathStencilFillOp.h
rename to src/gpu/tessellate/GrPathStencilCoverOp.h
index fcb48c5..968884b 100644
--- a/src/gpu/tessellate/GrPathStencilFillOp.h
+++ b/src/gpu/tessellate/GrPathStencilCoverOp.h
@@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
-#ifndef GrPathStencilFillOp_DEFINED
-#define GrPathStencilFillOp_DEFINED
+#ifndef GrPathStencilCoverOp_DEFINED
+#define GrPathStencilCoverOp_DEFINED
#include "src/gpu/ops/GrDrawOp.h"
#include "src/gpu/tessellate/GrTessellationPathRenderer.h"
@@ -14,16 +14,16 @@
class GrPathTessellator;
-// Draws paths using a standard Redbook "stencil then fill" method. Curves get linearized by either
+// Draws paths using a standard Redbook "stencil then cover" method. Curves get linearized by either
// GPU tessellation shaders or indirect draws. This Op doesn't apply analytic AA, so it requires
// MSAA if AA is desired.
-class GrPathStencilFillOp : public GrDrawOp {
+class GrPathStencilCoverOp : public GrDrawOp {
private:
DEFINE_OP_CLASS_ID
- GrPathStencilFillOp(const SkMatrix& viewMatrix, const SkPath& path, GrPaint&& paint,
- GrAAType aaType, GrTessellationPathRenderer::PathFlags pathFlags,
- const SkRect& devBounds)
+ GrPathStencilCoverOp(const SkMatrix& viewMatrix, const SkPath& path, GrPaint&& paint,
+ GrAAType aaType, GrTessellationPathRenderer::PathFlags pathFlags,
+ const SkRect& devBounds)
: GrDrawOp(ClassID())
, fPathFlags(pathFlags)
, fViewMatrix(viewMatrix)
@@ -34,13 +34,13 @@
this->setBounds(devBounds, HasAABloat::kNo, IsHairline::kNo);
}
- const char* name() const override { return "GrPathStencilFillOp"; }
+ const char* name() const override { return "GrPathStencilCoverOp"; }
void visitProxies(const VisitProxyFunc& fn) const override;
FixedFunctionFlags fixedFunctionFlags() const override;
GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*, GrClampType) override;
// Chooses the rendering method we will use and creates the corresponding tessellator and
- // stencil/fill programs.
+ // stencil/cover programs.
void prePreparePrograms(const GrTessellationShader::ProgramArgs&, GrAppliedClip&& clip);
void onPrePrepare(GrRecordingContext*, const GrSurfaceProxyView&, GrAppliedClip*,
@@ -59,7 +59,7 @@
GrPathTessellator* fTessellator = nullptr;
const GrProgramInfo* fStencilFanProgram = nullptr;
const GrProgramInfo* fStencilPathProgram = nullptr;
- const GrProgramInfo* fFillBBoxProgram = nullptr;
+ const GrProgramInfo* fCoverBBoxProgram = nullptr;
// Filled during onPrepare.
sk_sp<const GrBuffer> fFanBuffer;
diff --git a/src/gpu/tessellate/GrTessellationPathRenderer.cpp b/src/gpu/tessellate/GrTessellationPathRenderer.cpp
index bbab663..09f2769 100644
--- a/src/gpu/tessellate/GrTessellationPathRenderer.cpp
+++ b/src/gpu/tessellate/GrTessellationPathRenderer.cpp
@@ -19,7 +19,7 @@
#include "src/gpu/ops/GrFillRectOp.h"
#include "src/gpu/tessellate/GrDrawAtlasPathOp.h"
#include "src/gpu/tessellate/GrPathInnerTriangulateOp.h"
-#include "src/gpu/tessellate/GrPathStencilFillOp.h"
+#include "src/gpu/tessellate/GrPathStencilCoverOp.h"
#include "src/gpu/tessellate/GrStrokeTessellateOp.h"
constexpr static SkISize kAtlasInitialSize{512, 512};
@@ -161,8 +161,8 @@
devBounds);
}
}
- return GrOp::Make<GrPathStencilFillOp>(rContext, viewMatrix, path, std::move(paint), aaType,
- pathFlags, devBounds);
+ return GrOp::Make<GrPathStencilCoverOp>(rContext, viewMatrix, path, std::move(paint),
+ aaType, pathFlags, devBounds);
}
}
@@ -317,9 +317,9 @@
}
uberPath->setFillType(fillType);
GrAAType aaType = (antialias) ? GrAAType::kMSAA : GrAAType::kNone;
- auto op = GrOp::Make<GrPathStencilFillOp>(onFlushRP->recordingContext(), SkMatrix::I(),
- *uberPath, GrPaint(), aaType,
- PathFlags::kStencilOnly, atlasRect);
+ auto op = GrOp::Make<GrPathStencilCoverOp>(onFlushRP->recordingContext(), SkMatrix::I(),
+ *uberPath, GrPaint(), aaType,
+ PathFlags::kStencilOnly, atlasRect);
rtc->addDrawOp(nullptr, std::move(op));
}
}