aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-05-11 05:21:56 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-11 05:21:56 -0700
commite19aecdd13d83b2235faf3e2601100a2fd980b7b (patch)
tree75f24881e08d8c287b53bc3d055c68b3406ae8bf /src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
parent3e11da7fa9b7ab26df6d6197c3f6a71d0826c97e (diff)
Revert of Separate user and raw stencil settings (patchset #8 id:140001 of https://codereview.chromium.org/1962243002/ )
Reason for revert: This seems to be breaking nanobench on the Windows bots with: Caught exception 3221225477 EXCEPTION_ACCESS_VIOLATION GrDrawTarget::stencilPath +c7 GrStencilAndCoverPathRenderer::onDrawPath +fd GrDrawContext::internalDrawPath +509 GrDrawContext::drawPath +223 GrBlurUtils::drawPathWithMaskFilter +250 SkGpuDevice::drawPath +2ea SkCanvas::onDrawPath +2e3 SkRecordDraw +2e6 SkBigPicture::playback +e5 SkCanvas::onDrawPicture +12c SkCanvas::drawPicture +145 SkRecordDraw +2e6 SkBigPicture::playback +e5 SkCanvas::onDrawPicture +12c SkCanvas::drawPicture +145 SkRecordDraw +261 SkBigPicture::playback +e5 SkCanvas::onDrawPicture +12c SkCanvas::drawPicture +145 SkMultiPictureDraw::draw +bf SKPBench::drawMPDPicture +1e0 SKPBench::onDraw +34 Benchmark::draw +32 time +92 setup_gpu_bench +6e nanobench_main +77b Original issue's description: > Separate user and raw stencil settings > > Adds a new GrUserStencilSettings class that describes in abstract terms > how a draw will use the stencil (e.g. kAlwaysIfInClip, kSetClipBit, > etc.). GrPipelineBuilder now only defines the GrUserStencilSettings. > When the GrPipeline is finalized, the user stencil settings are then > translated into concrete GrStencilSettings. > > At this point, GrClipMaskManager only needs to tell the GrAppliedClip > whether or not there is a stencil clip. It does not need to modify > stencil settings and GrPipelineBuilder does not need > AutoRestoreStencil. > > This is one step of the stencil overhaul. In the future it will also > allow us to clean up the special case handling for nvpr and the > stateful fClipMode member of GrClipMaskManager. > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1962243002 > > Committed: https://skia.googlesource.com/skia/+/12dbb3947e1aaf205b4fcf13b40e54e50650eb37 TBR=bsalomon@google.com,cdalton@nvidia.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review-Url: https://codereview.chromium.org/1969693003
Diffstat (limited to 'src/gpu/batches/GrStencilAndCoverPathRenderer.cpp')
-rw-r--r--src/gpu/batches/GrStencilAndCoverPathRenderer.cpp53
1 files changed, 24 insertions, 29 deletions
diff --git a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
index 1309dedd4c..ddba1c871e 100644
--- a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
@@ -36,7 +36,7 @@ bool GrStencilAndCoverPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c
if (args.fStyle->hasNonDashPathEffect() || args.fStyle->strokeRec().isHairlineStyle()) {
return false;
}
- if (args.fHasUserStencilSettings) {
+ if (!args.fIsStencilDisabled) {
return false;
}
if (args.fAntiAlias) {
@@ -80,7 +80,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
GrPipelineBuilder* pipelineBuilder = args.fPipelineBuilder;
const SkMatrix& viewMatrix = *args.fViewMatrix;
- SkASSERT(!pipelineBuilder->hasUserStencilSettings());
+ SkASSERT(pipelineBuilder->getStencil().isDisabled());
if (args.fAntiAlias) {
SkASSERT(pipelineBuilder->getRenderTarget()->isStencilBufferMultisampled());
@@ -90,21 +90,18 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, *args.fStyle));
if (path.isInverseFillType()) {
- static constexpr GrUserStencilSettings kInvertedCoverPass(
- GrUserStencilSettings::StaticInit<
- 0x0000,
- // We know our rect will hit pixels outside the clip and the user bits will be 0
- // outside the clip. So we can't just fill where the user bits are 0. We also need
- // to check that the clip bit is set.
- GrUserStencilTest::kEqualIfInClip,
- 0xffff,
- GrUserStencilOp::kKeep,
- GrUserStencilOp::kZero,
- 0xffff>()
- );
-
-
- pipelineBuilder->setUserStencil(&kInvertedCoverPass);
+ static constexpr GrStencilSettings kInvertedStencilPass(
+ kKeep_StencilOp,
+ kZero_StencilOp,
+ // We know our rect will hit pixels outside the clip and the user bits will be 0
+ // outside the clip. So we can't just fill where the user bits are 0. We also need to
+ // check that the clip bit is set.
+ kEqualIfInClip_StencilFunc,
+ 0xffff,
+ 0x0000,
+ 0xffff);
+
+ pipelineBuilder->setStencil(kInvertedStencilPass);
// fake inverse with a stencil and cover
args.fTarget->stencilPath(*pipelineBuilder, viewMatrix, p, p->getFillType());
@@ -136,22 +133,20 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
&invert));
args.fTarget->drawBatch(*pipelineBuilder, batch);
} else {
- static constexpr GrUserStencilSettings kCoverPass(
- GrUserStencilSettings::StaticInit<
- 0x0000,
- GrUserStencilTest::kNotEqual,
- 0xffff,
- GrUserStencilOp::kZero,
- GrUserStencilOp::kKeep,
- 0xffff>()
- );
-
- pipelineBuilder->setUserStencil(&kCoverPass);
+ static constexpr GrStencilSettings kStencilPass(
+ kZero_StencilOp,
+ kKeep_StencilOp,
+ kNotEqual_StencilFunc,
+ 0xffff,
+ 0x0000,
+ 0xffff);
+
+ pipelineBuilder->setStencil(kStencilPass);
SkAutoTUnref<GrDrawPathBatchBase> batch(
GrDrawPathBatch::Create(viewMatrix, args.fColor, p->getFillType(), p));
args.fTarget->drawPathBatch(*pipelineBuilder, batch);
}
- pipelineBuilder->disableUserStencil();
+ pipelineBuilder->stencil()->setDisabled();
return true;
}