aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/batches/GrPathStencilSettings.h
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/GrPathStencilSettings.h
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/GrPathStencilSettings.h')
-rw-r--r--src/gpu/batches/GrPathStencilSettings.h202
1 files changed, 88 insertions, 114 deletions
diff --git a/src/gpu/batches/GrPathStencilSettings.h b/src/gpu/batches/GrPathStencilSettings.h
index f37d1b2f18..dd930a0da7 100644
--- a/src/gpu/batches/GrPathStencilSettings.h
+++ b/src/gpu/batches/GrPathStencilSettings.h
@@ -8,44 +8,36 @@
#ifndef GrPathStencilSettings_DEFINED
#define GrPathStencilSettings_DEFINED
-#include "GrUserStencilSettings.h"
-
////////////////////////////////////////////////////////////////////////////////
// Stencil rules for paths
////// Even/Odd
-static constexpr GrUserStencilSettings gEOStencilPass(
- GrUserStencilSettings::StaticInit<
- 0xffff,
- GrUserStencilTest::kAlwaysIfInClip,
- 0xffff,
- GrUserStencilOp::kInvert,
- GrUserStencilOp::kKeep,
- 0xffff>()
-);
+static constexpr GrStencilSettings gEOStencilPass(
+ kInvert_StencilOp,
+ kKeep_StencilOp,
+ kAlwaysIfInClip_StencilFunc,
+ 0xffff,
+ 0xffff,
+ 0xffff);
// ok not to check clip b/c stencil pass only wrote inside clip
-static constexpr GrUserStencilSettings gEOColorPass(
- GrUserStencilSettings::StaticInit<
- 0x0000,
- GrUserStencilTest::kNotEqual,
- 0xffff,
- GrUserStencilOp::kZero,
- GrUserStencilOp::kZero,
- 0xffff>()
-);
+static constexpr GrStencilSettings gEOColorPass(
+ kZero_StencilOp,
+ kZero_StencilOp,
+ kNotEqual_StencilFunc,
+ 0xffff,
+ 0x0000,
+ 0xffff);
// have to check clip b/c outside clip will always be zero.
-static constexpr GrUserStencilSettings gInvEOColorPass(
- GrUserStencilSettings::StaticInit<
- 0x0000,
- GrUserStencilTest::kEqualIfInClip,
- 0xffff,
- GrUserStencilOp::kZero,
- GrUserStencilOp::kZero,
- 0xffff>()
-);
+static constexpr GrStencilSettings gInvEOColorPass(
+ kZero_StencilOp,
+ kZero_StencilOp,
+ kEqualIfInClip_StencilFunc,
+ 0xffff,
+ 0x0000,
+ 0xffff);
////// Winding
@@ -53,108 +45,90 @@ static constexpr GrUserStencilSettings gInvEOColorPass(
// when we don't have wrap incr and decr we use the stencil test to simulate
// them.
-static constexpr GrUserStencilSettings gWindStencilSeparateWithWrap(
- GrUserStencilSettings::StaticInitSeparate<
- 0xffff, 0xffff,
- GrUserStencilTest::kAlwaysIfInClip, GrUserStencilTest::kAlwaysIfInClip,
- 0xffff, 0xffff,
- GrUserStencilOp::kIncWrap, GrUserStencilOp::kDecWrap,
- GrUserStencilOp::kKeep, GrUserStencilOp::kKeep,
- 0xffff, 0xffff>()
-);
+static constexpr GrStencilSettings gWindStencilSeparateWithWrap(
+ kIncWrap_StencilOp, kDecWrap_StencilOp,
+ kKeep_StencilOp, kKeep_StencilOp,
+ kAlwaysIfInClip_StencilFunc, kAlwaysIfInClip_StencilFunc,
+ 0xffff, 0xffff,
+ 0xffff, 0xffff,
+ 0xffff, 0xffff);
// if inc'ing the max value, invert to make 0
// if dec'ing zero invert to make all ones.
// we can't avoid touching the stencil on both passing and
// failing, so we can't resctrict ourselves to the clip.
-static constexpr GrUserStencilSettings gWindStencilSeparateNoWrap(
- GrUserStencilSettings::StaticInitSeparate<
- 0xffff, 0x0000,
- GrUserStencilTest::kEqual, GrUserStencilTest::kEqual,
- 0xffff, 0xffff,
- GrUserStencilOp::kInvert, GrUserStencilOp::kInvert,
- GrUserStencilOp::kIncMaybeClamp, GrUserStencilOp::kDecMaybeClamp,
- 0xffff, 0xffff>()
-);
+static constexpr GrStencilSettings gWindStencilSeparateNoWrap(
+ kInvert_StencilOp, kInvert_StencilOp,
+ kIncClamp_StencilOp, kDecClamp_StencilOp,
+ kEqual_StencilFunc, kEqual_StencilFunc,
+ 0xffff, 0xffff,
+ 0xffff, 0x0000,
+ 0xffff, 0xffff);
// When there are no separate faces we do two passes to setup the winding rule
// stencil. First we draw the front faces and inc, then we draw the back faces
// and dec. These are same as the above two split into the incrementing and
// decrementing passes.
-static constexpr GrUserStencilSettings gWindSingleStencilWithWrapInc(
- GrUserStencilSettings::StaticInit<
- 0xffff,
- GrUserStencilTest::kAlwaysIfInClip,
- 0xffff,
- GrUserStencilOp::kIncWrap,
- GrUserStencilOp::kKeep,
- 0xffff>()
-);
-
-static constexpr GrUserStencilSettings gWindSingleStencilWithWrapDec(
- GrUserStencilSettings::StaticInit<
- 0xffff,
- GrUserStencilTest::kAlwaysIfInClip,
- 0xffff,
- GrUserStencilOp::kDecWrap,
- GrUserStencilOp::kKeep,
- 0xffff>()
-);
-
-static constexpr GrUserStencilSettings gWindSingleStencilNoWrapInc(
- GrUserStencilSettings::StaticInit<
- 0xffff,
- GrUserStencilTest::kEqual,
- 0xffff,
- GrUserStencilOp::kInvert,
- GrUserStencilOp::kIncMaybeClamp,
- 0xffff>()
-);
-
-static constexpr GrUserStencilSettings gWindSingleStencilNoWrapDec(
- GrUserStencilSettings::StaticInit<
- 0x0000,
- GrUserStencilTest::kEqual,
- 0xffff,
- GrUserStencilOp::kInvert,
- GrUserStencilOp::kDecMaybeClamp,
- 0xffff>()
-);
+static constexpr GrStencilSettings gWindSingleStencilWithWrapInc(
+ kIncWrap_StencilOp,
+ kKeep_StencilOp,
+ kAlwaysIfInClip_StencilFunc,
+ 0xffff,
+ 0xffff,
+ 0xffff);
+
+static constexpr GrStencilSettings gWindSingleStencilWithWrapDec(
+ kDecWrap_StencilOp,
+ kKeep_StencilOp,
+ kAlwaysIfInClip_StencilFunc,
+ 0xffff,
+ 0xffff,
+ 0xffff);
+
+static constexpr GrStencilSettings gWindSingleStencilNoWrapInc(
+ kInvert_StencilOp,
+ kIncClamp_StencilOp,
+ kEqual_StencilFunc,
+ 0xffff,
+ 0xffff,
+ 0xffff);
+
+static constexpr GrStencilSettings gWindSingleStencilNoWrapDec(
+ kInvert_StencilOp,
+ kDecClamp_StencilOp,
+ kEqual_StencilFunc,
+ 0xffff,
+ 0x0000,
+ 0xffff);
// Color passes are the same whether we use the two-sided stencil or two passes
-static constexpr GrUserStencilSettings gWindColorPass(
- GrUserStencilSettings::StaticInit<
- 0x0000,
- GrUserStencilTest::kLessIfInClip, // "0 < stencil" is equivalent to "0 != stencil".
- 0xffff,
- GrUserStencilOp::kZero,
- GrUserStencilOp::kZero,
- 0xffff>()
-);
-
-static constexpr GrUserStencilSettings gInvWindColorPass(
- GrUserStencilSettings::StaticInit<
- 0x0000,
- GrUserStencilTest::kEqualIfInClip,
- 0xffff,
- GrUserStencilOp::kZero,
- GrUserStencilOp::kZero,
- 0xffff>()
-);
+static constexpr GrStencilSettings gWindColorPass(
+ kZero_StencilOp,
+ kZero_StencilOp,
+ kNonZeroIfInClip_StencilFunc,
+ 0xffff,
+ 0x0000,
+ 0xffff);
+
+static constexpr GrStencilSettings gInvWindColorPass(
+ kZero_StencilOp,
+ kZero_StencilOp,
+ kEqualIfInClip_StencilFunc,
+ 0xffff,
+ 0x0000,
+ 0xffff);
////// Normal render to stencil
// Sometimes the default path renderer can draw a path directly to the stencil
// buffer without having to first resolve the interior / exterior.
-static constexpr GrUserStencilSettings gDirectToStencil(
- GrUserStencilSettings::StaticInit<
- 0x0000,
- GrUserStencilTest::kAlwaysIfInClip,
- 0xffff,
- GrUserStencilOp::kZero,
- GrUserStencilOp::kIncMaybeClamp,
- 0xffff>()
-);
+static constexpr GrStencilSettings gDirectToStencil(
+ kZero_StencilOp,
+ kIncClamp_StencilOp,
+ kAlwaysIfInClip_StencilFunc,
+ 0xffff,
+ 0x0000,
+ 0xffff);
#endif