Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: src/gpu/batches/GrPathStencilSettings.h

Issue 1962243002: Separate user and raw stencil settings (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/batches/GrMSAAPathRenderer.cpp ('k') | src/gpu/batches/GrStencilAndCoverPathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrPathStencilSettings.h
diff --git a/src/gpu/batches/GrPathStencilSettings.h b/src/gpu/batches/GrPathStencilSettings.h
index dd930a0da7c47e67dd135036b63e8fa62264c0fb..f37d1b2f18074a3909155fc748363937d0c4a59c 100644
--- a/src/gpu/batches/GrPathStencilSettings.h
+++ b/src/gpu/batches/GrPathStencilSettings.h
@@ -8,36 +8,44 @@
#ifndef GrPathStencilSettings_DEFINED
#define GrPathStencilSettings_DEFINED
+#include "GrUserStencilSettings.h"
+
////////////////////////////////////////////////////////////////////////////////
// Stencil rules for paths
////// Even/Odd
-static constexpr GrStencilSettings gEOStencilPass(
- kInvert_StencilOp,
- kKeep_StencilOp,
- kAlwaysIfInClip_StencilFunc,
- 0xffff,
- 0xffff,
- 0xffff);
+static constexpr GrUserStencilSettings gEOStencilPass(
+ GrUserStencilSettings::StaticInit<
+ 0xffff,
+ GrUserStencilTest::kAlwaysIfInClip,
+ 0xffff,
+ GrUserStencilOp::kInvert,
+ GrUserStencilOp::kKeep,
+ 0xffff>()
+);
// ok not to check clip b/c stencil pass only wrote inside clip
-static constexpr GrStencilSettings gEOColorPass(
- kZero_StencilOp,
- kZero_StencilOp,
- kNotEqual_StencilFunc,
- 0xffff,
- 0x0000,
- 0xffff);
+static constexpr GrUserStencilSettings gEOColorPass(
+ GrUserStencilSettings::StaticInit<
+ 0x0000,
+ GrUserStencilTest::kNotEqual,
+ 0xffff,
+ GrUserStencilOp::kZero,
+ GrUserStencilOp::kZero,
+ 0xffff>()
+);
// have to check clip b/c outside clip will always be zero.
-static constexpr GrStencilSettings gInvEOColorPass(
- kZero_StencilOp,
- kZero_StencilOp,
- kEqualIfInClip_StencilFunc,
- 0xffff,
- 0x0000,
- 0xffff);
+static constexpr GrUserStencilSettings gInvEOColorPass(
+ GrUserStencilSettings::StaticInit<
+ 0x0000,
+ GrUserStencilTest::kEqualIfInClip,
+ 0xffff,
+ GrUserStencilOp::kZero,
+ GrUserStencilOp::kZero,
+ 0xffff>()
+);
////// Winding
@@ -45,90 +53,108 @@ static constexpr GrStencilSettings gInvEOColorPass(
// when we don't have wrap incr and decr we use the stencil test to simulate
// them.
-static constexpr GrStencilSettings gWindStencilSeparateWithWrap(
- kIncWrap_StencilOp, kDecWrap_StencilOp,
- kKeep_StencilOp, kKeep_StencilOp,
- kAlwaysIfInClip_StencilFunc, kAlwaysIfInClip_StencilFunc,
- 0xffff, 0xffff,
- 0xffff, 0xffff,
- 0xffff, 0xffff);
+static constexpr GrUserStencilSettings gWindStencilSeparateWithWrap(
+ GrUserStencilSettings::StaticInitSeparate<
+ 0xffff, 0xffff,
+ GrUserStencilTest::kAlwaysIfInClip, GrUserStencilTest::kAlwaysIfInClip,
+ 0xffff, 0xffff,
+ GrUserStencilOp::kIncWrap, GrUserStencilOp::kDecWrap,
+ GrUserStencilOp::kKeep, GrUserStencilOp::kKeep,
+ 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 GrStencilSettings gWindStencilSeparateNoWrap(
- kInvert_StencilOp, kInvert_StencilOp,
- kIncClamp_StencilOp, kDecClamp_StencilOp,
- kEqual_StencilFunc, kEqual_StencilFunc,
- 0xffff, 0xffff,
- 0xffff, 0x0000,
- 0xffff, 0xffff);
+static constexpr GrUserStencilSettings gWindStencilSeparateNoWrap(
+ GrUserStencilSettings::StaticInitSeparate<
+ 0xffff, 0x0000,
+ GrUserStencilTest::kEqual, GrUserStencilTest::kEqual,
+ 0xffff, 0xffff,
+ GrUserStencilOp::kInvert, GrUserStencilOp::kInvert,
+ GrUserStencilOp::kIncMaybeClamp, GrUserStencilOp::kDecMaybeClamp,
+ 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 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);
+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>()
+);
// Color passes are the same whether we use the two-sided stencil or two passes
-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);
+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>()
+);
////// 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 GrStencilSettings gDirectToStencil(
- kZero_StencilOp,
- kIncClamp_StencilOp,
- kAlwaysIfInClip_StencilFunc,
- 0xffff,
- 0x0000,
- 0xffff);
+static constexpr GrUserStencilSettings gDirectToStencil(
+ GrUserStencilSettings::StaticInit<
+ 0x0000,
+ GrUserStencilTest::kAlwaysIfInClip,
+ 0xffff,
+ GrUserStencilOp::kZero,
+ GrUserStencilOp::kIncMaybeClamp,
+ 0xffff>()
+);
#endif
« no previous file with comments | « src/gpu/batches/GrMSAAPathRenderer.cpp ('k') | src/gpu/batches/GrStencilAndCoverPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698