aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/batches
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2016-12-09 20:02:08 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-09 20:02:22 +0000
commit073285c0595d46205d1482cc19af2d7d891bfeae (patch)
treef127dd2c03ef707cd47396be0bf1cbf911403849 /src/gpu/batches
parent3944484020d98ff8f386378296106c321279482b (diff)
Revert "Reland "Remove antialiasing control from GrPaint.""
This reverts commit 3944484020d98ff8f386378296106c321279482b. Reason for revert: Merges badly with a recent change. Will rebase and reland. Original change's description: > Reland "Remove antialiasing control from GrPaint." > > This contains fixes for GLPrograms test and mixed samples rendering. > > This reverts commit 419d81eed4a010e6080db199795117cbedf9e6e4. > > BUG=skia: > > Change-Id: If8f002fbfaaaab6d1607403f2b15ccc7f1e17e87 > Reviewed-on: https://skia-review.googlesource.com/5763 > Commit-Queue: Brian Salomon <bsalomon@google.com> > Reviewed-by: Robert Phillips <robertphillips@google.com> > TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org BUG=skia: NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: Iff9657041e28604a845bc5a9acec7c9b248c53bd Reviewed-on: https://skia-review.googlesource.com/5772 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/batches')
-rw-r--r--src/gpu/batches/GrAAConvexPathRenderer.cpp4
-rw-r--r--src/gpu/batches/GrAADistanceFieldPathRenderer.cpp26
-rw-r--r--src/gpu/batches/GrAAHairLinePathRenderer.cpp4
-rw-r--r--src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp4
-rw-r--r--src/gpu/batches/GrDashLinePathRenderer.cpp28
-rw-r--r--src/gpu/batches/GrDefaultPathRenderer.cpp20
-rw-r--r--src/gpu/batches/GrDefaultPathRenderer.h1
-rw-r--r--src/gpu/batches/GrMSAAPathRenderer.cpp15
-rw-r--r--src/gpu/batches/GrMSAAPathRenderer.h1
-rw-r--r--src/gpu/batches/GrPLSPathRenderer.cpp7
-rw-r--r--src/gpu/batches/GrStencilAndCoverPathRenderer.cpp35
-rw-r--r--src/gpu/batches/GrTessellatingPathRenderer.cpp10
12 files changed, 85 insertions, 70 deletions
diff --git a/src/gpu/batches/GrAAConvexPathRenderer.cpp b/src/gpu/batches/GrAAConvexPathRenderer.cpp
index cc31f4973a..56a5e7ae14 100644
--- a/src/gpu/batches/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/batches/GrAAConvexPathRenderer.cpp
@@ -672,7 +672,7 @@ sk_sp<GrGeometryProcessor> QuadEdgeEffect::TestCreate(GrProcessorTestData* d) {
///////////////////////////////////////////////////////////////////////////////
bool GrAAConvexPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
- return (args.fShaderCaps->shaderDerivativeSupport() && (GrAAType::kCoverage == args.fAAType) &&
+ return (args.fShaderCaps->shaderDerivativeSupport() && args.fAntiAlias &&
args.fShape->style().isSimpleFill() && !args.fShape->inverseFilled() &&
args.fShape->knownToBeConvex());
}
@@ -1002,7 +1002,7 @@ bool GrAAConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
sk_sp<GrDrawOp> batch(new AAConvexPathBatch(args.fPaint->getColor(), *args.fViewMatrix, path));
- GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fAAType);
+ GrPipelineBuilder pipelineBuilder(*args.fPaint);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
args.fRenderTargetContext->addDrawOp(pipelineBuilder, *args.fClip, batch.get());
diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
index 71b9000482..0aa451df86 100644
--- a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
@@ -90,8 +90,8 @@ bool GrAADistanceFieldPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c
if (!args.fShape->style().isSimpleFill()) {
return false;
}
- // This does non-inverse coverage-based antialiased fills.
- if (GrAAType::kCoverage != args.fAAType) {
+ // This does non-inverse antialiased fills.
+ if (!args.fAntiAlias) {
return false;
}
// TODO: Support inverse fill
@@ -128,6 +128,7 @@ public:
AADistanceFieldPathBatch(GrColor color,
const GrShape& shape,
+ bool antiAlias,
const SkMatrix& viewMatrix,
GrBatchAtlas* atlas,
ShapeCache* shapeCache, ShapeDataList* shapeList,
@@ -135,7 +136,7 @@ public:
: INHERITED(ClassID()) {
SkASSERT(shape.hasUnstyledKey());
fBatch.fViewMatrix = viewMatrix;
- fGeoData.emplace_back(Geometry{color, shape});
+ fGeoData.emplace_back(Geometry{color, shape, antiAlias});
fAtlas = atlas;
fShapeCache = shapeCache;
@@ -156,7 +157,7 @@ public:
SkString dumpInfo() const override {
SkString string;
for (const auto& geo : fGeoData) {
- string.appendf("Color: 0x%08x\n", geo.fColor);
+ string.appendf("Color: 0x%08x AA:%d\n", geo.fColor, geo.fAntiAlias);
}
string.append(DumpPipelineInfo(*this->pipeline()));
string.append(INHERITED::dumpInfo());
@@ -273,6 +274,7 @@ private:
atlas,
shapeData,
args.fShape,
+ args.fAntiAlias,
desiredDimension,
scale)) {
delete shapeData;
@@ -298,8 +300,8 @@ private:
}
bool addPathToAtlas(GrMeshDrawOp::Target* target, FlushInfo* flushInfo, GrBatchAtlas* atlas,
- ShapeData* shapeData, const GrShape& shape, uint32_t dimension,
- SkScalar scale) const {
+ ShapeData* shapeData, const GrShape& shape, bool antiAlias,
+ uint32_t dimension, SkScalar scale) const {
const SkRect& bounds = shape.bounds();
// generate bounding rect for bitmap draw
@@ -346,7 +348,7 @@ private:
// rasterize path
SkPaint paint;
paint.setStyle(SkPaint::kFill_Style);
- paint.setAntiAlias(true);
+ paint.setAntiAlias(antiAlias);
SkDraw draw;
sk_bzero(&draw, sizeof(draw));
@@ -500,6 +502,7 @@ private:
struct Geometry {
GrColor fColor;
GrShape fShape;
+ bool fAntiAlias;
};
BatchTracker fBatch;
@@ -515,6 +518,8 @@ private:
bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrAADistanceFieldPathRenderer::onDrawPath");
+ SkASSERT(!args.fRenderTargetContext->isUnifiedMultisampled());
+ SkASSERT(args.fShape->style().isSimpleFill());
// we've already bailed on inverse filled paths, so this is safe
SkASSERT(!args.fShape->isEmpty());
@@ -531,10 +536,11 @@ bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
}
sk_sp<GrDrawOp> batch(new AADistanceFieldPathBatch(args.fPaint->getColor(),
- *args.fShape, *args.fViewMatrix,
+ *args.fShape,
+ args.fAntiAlias, *args.fViewMatrix,
fAtlas.get(), &fShapeCache, &fShapeList,
args.fGammaCorrect));
- GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fAAType);
+ GrPipelineBuilder pipelineBuilder(*args.fPaint);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
args.fRenderTargetContext->addDrawOp(pipelineBuilder, *args.fClip, batch.get());
@@ -608,9 +614,11 @@ DRAW_BATCH_TEST_DEFINE(AADistanceFieldPathBatch) {
// This path renderer only allows fill styles.
GrShape shape(GrTest::TestPath(random), GrStyle::SimpleFill());
+ bool antiAlias = random->nextBool();
return new AADistanceFieldPathBatch(color,
shape,
+ antiAlias,
viewMatrix,
gTestStruct.fAtlas.get(),
&gTestStruct.fShapeCache,
diff --git a/src/gpu/batches/GrAAHairLinePathRenderer.cpp b/src/gpu/batches/GrAAHairLinePathRenderer.cpp
index 732d694b45..662010f7c9 100644
--- a/src/gpu/batches/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/batches/GrAAHairLinePathRenderer.cpp
@@ -617,7 +617,7 @@ static void add_line(const SkPoint p[2],
///////////////////////////////////////////////////////////////////////////////
bool GrAAHairLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
- if (GrAAType::kCoverage != args.fAAType) {
+ if (!args.fAntiAlias) {
return false;
}
@@ -981,7 +981,7 @@ bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
*args.fViewMatrix, path,
args.fShape->style(), devClipBounds));
- GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fAAType);
+ GrPipelineBuilder pipelineBuilder(*args.fPaint);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
args.fRenderTargetContext->addDrawOp(pipelineBuilder, *args.fClip, batch.get());
diff --git a/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp
index cbf526c807..f961c5eb74 100644
--- a/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp
@@ -37,7 +37,7 @@ GrAALinearizingConvexPathRenderer::GrAALinearizingConvexPathRenderer() {
///////////////////////////////////////////////////////////////////////////////
bool GrAALinearizingConvexPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
- if (GrAAType::kCoverage != args.fAAType) {
+ if (!args.fAntiAlias) {
return false;
}
if (!args.fShape->knownToBeConvex()) {
@@ -361,7 +361,7 @@ bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
stroke.getStyle(),
join, miterLimit));
- GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fAAType);
+ GrPipelineBuilder pipelineBuilder(*args.fPaint);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
args.fRenderTargetContext->addDrawOp(pipelineBuilder, *args.fClip, batch.get());
diff --git a/src/gpu/batches/GrDashLinePathRenderer.cpp b/src/gpu/batches/GrDashLinePathRenderer.cpp
index 9304885c9d..d2a420d4be 100644
--- a/src/gpu/batches/GrDashLinePathRenderer.cpp
+++ b/src/gpu/batches/GrDashLinePathRenderer.cpp
@@ -16,9 +16,6 @@ bool GrDashLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
SkPoint pts[2];
bool inverted;
if (args.fShape->style().isDashed() && args.fShape->asLine(pts, &inverted)) {
- if (args.fAAType == GrAAType::kMixedSamples) {
- return false;
- }
// We should never have an inverse dashed case.
SkASSERT(!inverted);
return GrDashingEffect::CanDrawDashLine(pts, args.fShape->style(), *args.fViewMatrix);
@@ -29,19 +26,16 @@ bool GrDashLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrDashLinePathRenderer::onDrawPath");
- GrDashingEffect::AAMode aaMode = GrDashingEffect::AAMode::kNone;
- switch (args.fAAType) {
- case GrAAType::kNone:
- break;
- case GrAAType::kCoverage:
- case GrAAType::kMixedSamples:
- aaMode = GrDashingEffect::AAMode::kCoverage;
- break;
- case GrAAType::kMSAA:
- // In this mode we will use aa between dashes but the outer border uses MSAA. Otherwise,
- // we can wind up with external edges antialiased and internal edges unantialiased.
- aaMode = GrDashingEffect::AAMode::kCoverageWithMSAA;
- break;
+ bool useHWAA = args.fRenderTargetContext->isUnifiedMultisampled();
+ GrDashingEffect::AAMode aaMode;
+ if (useHWAA) {
+ // We ignore args.fAntiAlias here and force anti aliasing when using MSAA. Otherwise,
+ // we can wind up with external edges antialiased and internal edges unantialiased.
+ aaMode = GrDashingEffect::AAMode::kCoverageWithMSAA;
+ } else if (args.fAntiAlias) {
+ aaMode = GrDashingEffect::AAMode::kCoverage;
+ } else {
+ aaMode = GrDashingEffect::AAMode::kNone;
}
SkPoint pts[2];
SkAssertResult(args.fShape->asLine(pts, nullptr));
@@ -54,7 +48,7 @@ bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
return false;
}
- GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fAAType);
+ GrPipelineBuilder pipelineBuilder(*args.fPaint, useHWAA);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
args.fRenderTargetContext->addDrawOp(pipelineBuilder, *args.fClip, batch.get());
diff --git a/src/gpu/batches/GrDefaultPathRenderer.cpp b/src/gpu/batches/GrDefaultPathRenderer.cpp
index 0b688c5305..f3f9e73155 100644
--- a/src/gpu/batches/GrDefaultPathRenderer.cpp
+++ b/src/gpu/batches/GrDefaultPathRenderer.cpp
@@ -424,13 +424,11 @@ private:
bool GrDefaultPathRenderer::internalDrawPath(GrRenderTargetContext* renderTargetContext,
const GrPaint& paint,
- GrAAType aaType,
const GrUserStencilSettings& userStencilSettings,
const GrClip& clip,
const SkMatrix& viewMatrix,
const GrShape& shape,
bool stencilOnly) {
- SkASSERT(GrAAType::kCoverage != aaType);
SkPath path;
shape.asPath(&path);
@@ -569,20 +567,23 @@ bool GrDefaultPathRenderer::internalDrawPath(GrRenderTargetContext* renderTarget
&localMatrix));
SkASSERT(GrDrawFace::kBoth == drawFace[p]);
- GrPipelineBuilder pipelineBuilder(paint, aaType);
+ GrPipelineBuilder pipelineBuilder(paint, renderTargetContext->mustUseHWAA(paint));
pipelineBuilder.setDrawFace(drawFace[p]);
pipelineBuilder.setUserStencil(passes[p]);
+
renderTargetContext->addDrawOp(pipelineBuilder, clip, batch.get());
} else {
sk_sp<GrDrawOp> batch(new DefaultPathBatch(paint.getColor(), path, srcSpaceTol,
newCoverage, viewMatrix, isHairline,
devBounds));
- GrPipelineBuilder pipelineBuilder(paint, aaType);
+
+ GrPipelineBuilder pipelineBuilder(paint, renderTargetContext->mustUseHWAA(paint));
pipelineBuilder.setDrawFace(drawFace[p]);
pipelineBuilder.setUserStencil(passes[p]);
if (passCount > 1) {
pipelineBuilder.setDisableColorXPFactory();
}
+
renderTargetContext->addDrawOp(pipelineBuilder, clip, batch.get());
}
}
@@ -590,8 +591,8 @@ bool GrDefaultPathRenderer::internalDrawPath(GrRenderTargetContext* renderTarget
}
bool GrDefaultPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
- // This can draw any path with any simple fill style but doesn't do coverage-based antialiasing.
- return GrAAType::kCoverage != args.fAAType &&
+ // this class can draw any path with any simple fill style but doesn't do any anti-aliasing.
+ return !args.fAntiAlias &&
(args.fShape->style().isSimpleFill() ||
IsStrokeHairlineOrEquivalent(args.fShape->style(), *args.fViewMatrix, nullptr));
}
@@ -601,7 +602,6 @@ bool GrDefaultPathRenderer::onDrawPath(const DrawPathArgs& args) {
"GrDefaultPathRenderer::onDrawPath");
return this->internalDrawPath(args.fRenderTargetContext,
*args.fPaint,
- args.fAAType,
*args.fUserStencilSettings,
*args.fClip,
*args.fViewMatrix,
@@ -616,10 +616,10 @@ void GrDefaultPathRenderer::onStencilPath(const StencilPathArgs& args) {
GrPaint paint;
paint.setXPFactory(GrDisableColorXPFactory::Make());
+ paint.setAntiAlias(args.fIsAA);
- this->internalDrawPath(args.fRenderTargetContext, paint, args.fAAType,
- GrUserStencilSettings::kUnused, *args.fClip, *args.fViewMatrix,
- *args.fShape, true);
+ this->internalDrawPath(args.fRenderTargetContext, paint, GrUserStencilSettings::kUnused,
+ *args.fClip, *args.fViewMatrix, *args.fShape, true);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/batches/GrDefaultPathRenderer.h b/src/gpu/batches/GrDefaultPathRenderer.h
index 8e192478b1..243d4e7d92 100644
--- a/src/gpu/batches/GrDefaultPathRenderer.h
+++ b/src/gpu/batches/GrDefaultPathRenderer.h
@@ -32,7 +32,6 @@ private:
bool internalDrawPath(GrRenderTargetContext*,
const GrPaint&,
- GrAAType,
const GrUserStencilSettings&,
const GrClip&,
const SkMatrix& viewMatrix,
diff --git a/src/gpu/batches/GrMSAAPathRenderer.cpp b/src/gpu/batches/GrMSAAPathRenderer.cpp
index 930f7f926a..f073db0a28 100644
--- a/src/gpu/batches/GrMSAAPathRenderer.cpp
+++ b/src/gpu/batches/GrMSAAPathRenderer.cpp
@@ -562,7 +562,6 @@ private:
bool GrMSAAPathRenderer::internalDrawPath(GrRenderTargetContext* renderTargetContext,
const GrPaint& paint,
- GrAAType aaType,
const GrUserStencilSettings& userStencilSettings,
const GrClip& clip,
const SkMatrix& viewMatrix,
@@ -663,7 +662,7 @@ bool GrMSAAPathRenderer::internalDrawPath(GrRenderTargetContext* renderTargetCon
GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM, bounds, nullptr,
&localMatrix));
- GrPipelineBuilder pipelineBuilder(paint, aaType);
+ GrPipelineBuilder pipelineBuilder(paint, renderTargetContext->mustUseHWAA(paint));
pipelineBuilder.setUserStencil(passes[p]);
renderTargetContext->addDrawOp(pipelineBuilder, clip, batch.get());
@@ -674,11 +673,12 @@ bool GrMSAAPathRenderer::internalDrawPath(GrRenderTargetContext* renderTargetCon
return false;
}
- GrPipelineBuilder pipelineBuilder(paint, aaType);
+ GrPipelineBuilder pipelineBuilder(paint, renderTargetContext->mustUseHWAA(paint));
pipelineBuilder.setUserStencil(passes[p]);
if (passCount > 1) {
pipelineBuilder.setDisableColorXPFactory();
}
+
renderTargetContext->addDrawOp(pipelineBuilder, clip, batch.get());
}
}
@@ -689,7 +689,7 @@ bool GrMSAAPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
// This path renderer only fills and relies on MSAA for antialiasing. Stroked shapes are
// handled by passing on the original shape and letting the caller compute the stroked shape
// which will have a fill style.
- return args.fShape->style().isSimpleFill() && (GrAAType::kCoverage != args.fAAType);
+ return args.fShape->style().isSimpleFill() && !args.fAntiAlias;
}
bool GrMSAAPathRenderer::onDrawPath(const DrawPathArgs& args) {
@@ -704,7 +704,6 @@ bool GrMSAAPathRenderer::onDrawPath(const DrawPathArgs& args) {
}
return this->internalDrawPath(args.fRenderTargetContext,
*args.fPaint,
- args.fAAType,
*args.fUserStencilSettings,
*args.fClip,
*args.fViewMatrix,
@@ -720,10 +719,10 @@ void GrMSAAPathRenderer::onStencilPath(const StencilPathArgs& args) {
GrPaint paint;
paint.setXPFactory(GrDisableColorXPFactory::Make());
+ paint.setAntiAlias(args.fIsAA);
- this->internalDrawPath(args.fRenderTargetContext, paint, args.fAAType,
- GrUserStencilSettings::kUnused, *args.fClip, *args.fViewMatrix,
- *args.fShape, true);
+ this->internalDrawPath(args.fRenderTargetContext, paint, GrUserStencilSettings::kUnused,
+ *args.fClip, *args.fViewMatrix, *args.fShape, true);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/batches/GrMSAAPathRenderer.h b/src/gpu/batches/GrMSAAPathRenderer.h
index a112c6253b..3a70bcb059 100644
--- a/src/gpu/batches/GrMSAAPathRenderer.h
+++ b/src/gpu/batches/GrMSAAPathRenderer.h
@@ -23,7 +23,6 @@ private:
bool internalDrawPath(GrRenderTargetContext*,
const GrPaint&,
- GrAAType,
const GrUserStencilSettings&,
const GrClip&,
const SkMatrix& viewMatrix,
diff --git a/src/gpu/batches/GrPLSPathRenderer.cpp b/src/gpu/batches/GrPLSPathRenderer.cpp
index 269fde166c..6dd2199671 100644
--- a/src/gpu/batches/GrPLSPathRenderer.cpp
+++ b/src/gpu/batches/GrPLSPathRenderer.cpp
@@ -758,7 +758,7 @@ bool GrPLSPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
// seams. Disable in the presence of even-odd for now.
SkPath path;
args.fShape->asPath(&path);
- return args.fShaderCaps->shaderDerivativeSupport() && GrAAType::kCoverage == args.fAAType &&
+ return args.fShaderCaps->shaderDerivativeSupport() && args.fAntiAlias &&
args.fShape->style().isSimpleFill() && !path.isInverseFillType() &&
path.getFillType() == SkPath::FillType::kWinding_FillType;
}
@@ -936,10 +936,13 @@ bool GrPLSPathRenderer::onDrawPath(const DrawPathArgs& args) {
args.fShape->asPath(&path);
sk_sp<GrDrawOp> batch(new PLSPathBatch(args.fPaint->getColor(), path, *args.fViewMatrix));
- GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fAAType);
+
+ GrPipelineBuilder pipelineBuilder(*args.fPaint,
+ args.fRenderTargetContext->mustUseHWAA(*args.fPaint));
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
args.fRenderTargetContext->addDrawOp(pipelineBuilder, *args.fClip, batch.get());
+
SkDEBUGCODE(inPLSDraw = false;)
return true;
diff --git a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
index ac9ed9035e..97287d2c86 100644
--- a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
@@ -44,8 +44,11 @@ bool GrStencilAndCoverPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c
if (args.fHasUserStencilSettings) {
return false;
}
- // doesn't do per-path AA, relies on the target having MSAA.
- return (GrAAType::kCoverage != args.fAAType);
+ if (args.fAntiAlias) {
+ return args.fIsStencilBufferMSAA;
+ } else {
+ return true; // doesn't do per-path AA, relies on the target having MSAA
+ }
}
static GrPath* get_gr_path(GrResourceProvider* resourceProvider, const GrShape& shape) {
@@ -77,14 +80,18 @@ static GrPath* get_gr_path(GrResourceProvider* resourceProvider, const GrShape&
void GrStencilAndCoverPathRenderer::onStencilPath(const StencilPathArgs& args) {
GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrStencilAndCoverPathRenderer::onStencilPath");
+ SkASSERT(!args.fIsAA || args.fRenderTargetContext->isStencilBufferMultisampled());
+
sk_sp<GrPath> p(get_gr_path(fResourceProvider, *args.fShape));
- args.fRenderTargetContext->priv().stencilPath(*args.fClip, args.fAAType,
+ args.fRenderTargetContext->priv().stencilPath(*args.fClip, args.fIsAA,
*args.fViewMatrix, p.get());
}
bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrStencilAndCoverPathRenderer::onDrawPath");
+ SkASSERT(!args.fPaint->isAntiAlias() ||
+ args.fRenderTargetContext->isStencilBufferMultisampled());
SkASSERT(!args.fShape->style().strokeRec().isHairlineStyle());
const SkMatrix& viewMatrix = *args.fViewMatrix;
@@ -118,8 +125,8 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
nullptr, &invert));
// fake inverse with a stencil and cover
- args.fRenderTargetContext->priv().stencilPath(*args.fClip, args.fAAType, viewMatrix,
- path.get());
+ args.fRenderTargetContext->priv().stencilPath(*args.fClip, args.fPaint->isAntiAlias(),
+ viewMatrix, path.get());
{
static constexpr GrUserStencilSettings kInvertedCoverPass(
@@ -134,13 +141,10 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
GrUserStencilOp::kZero,
0xffff>()
);
- // We have to suppress enabling MSAA for mixed samples or we will get seams due to
- // coverage modulation along the edge where two triangles making up the rect meet.
- GrAAType coverAAType = args.fAAType;
- if (GrAAType::kMixedSamples == coverAAType) {
- coverAAType = GrAAType::kNone;
- }
- GrPipelineBuilder pipelineBuilder(*args.fPaint, coverAAType);
+
+ GrPipelineBuilder pipelineBuilder(*args.fPaint,
+ args.fPaint->isAntiAlias() &&
+ !args.fRenderTargetContext->hasMixedSamples());
pipelineBuilder.setUserStencil(&kInvertedCoverPass);
args.fRenderTargetContext->addDrawOp(pipelineBuilder, *args.fClip, coverBatch.get());
@@ -159,8 +163,13 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
sk_sp<GrDrawOp> batch(GrDrawPathBatch::Create(viewMatrix, args.fPaint->getColor(),
path.get()));
- GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fAAType);
+ GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fPaint->isAntiAlias());
pipelineBuilder.setUserStencil(&kCoverPass);
+ if (args.fAntiAlias) {
+ SkASSERT(args.fRenderTargetContext->isStencilBufferMultisampled());
+ pipelineBuilder.enableState(GrPipelineBuilder::kHWAntialias_Flag);
+ }
+
args.fRenderTargetContext->addDrawOp(pipelineBuilder, *args.fClip, batch.get());
}
diff --git a/src/gpu/batches/GrTessellatingPathRenderer.cpp b/src/gpu/batches/GrTessellatingPathRenderer.cpp
index 4b3ef00193..afa9fe7148 100644
--- a/src/gpu/batches/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/batches/GrTessellatingPathRenderer.cpp
@@ -140,7 +140,7 @@ bool GrTessellatingPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) cons
if (!args.fShape->style().isSimpleFill() || args.fShape->knownToBeConvex()) {
return false;
}
- if (GrAAType::kCoverage == args.fAAType) {
+ if (args.fAntiAlias) {
#ifdef SK_DISABLE_SCREENSPACE_TESS_AA_PATH_RENDERER
return false;
#else
@@ -364,10 +364,14 @@ bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
*args.fShape,
*args.fViewMatrix,
clipBoundsI,
- GrAAType::kCoverage == args.fAAType));
- GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fAAType);
+ args.fAntiAlias));
+
+ GrPipelineBuilder pipelineBuilder(*args.fPaint,
+ args.fRenderTargetContext->mustUseHWAA(*args.fPaint));
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
+
args.fRenderTargetContext->addDrawOp(pipelineBuilder, *args.fClip, batch.get());
+
return true;
}