aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
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/GrStencilAndCoverPathRenderer.cpp
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/GrStencilAndCoverPathRenderer.cpp')
-rw-r--r--src/gpu/batches/GrStencilAndCoverPathRenderer.cpp35
1 files changed, 22 insertions, 13 deletions
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());
}