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

Side by Side Diff: src/gpu/batches/GrPathStencilSettings.h

Issue 1969693003: Revert of 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrPathStencilSettings_DEFINED 8 #ifndef GrPathStencilSettings_DEFINED
9 #define GrPathStencilSettings_DEFINED 9 #define GrPathStencilSettings_DEFINED
10 10
11 #include "GrUserStencilSettings.h"
12
13 //////////////////////////////////////////////////////////////////////////////// 11 ////////////////////////////////////////////////////////////////////////////////
14 // Stencil rules for paths 12 // Stencil rules for paths
15 13
16 ////// Even/Odd 14 ////// Even/Odd
17 15
18 static constexpr GrUserStencilSettings gEOStencilPass( 16 static constexpr GrStencilSettings gEOStencilPass(
19 GrUserStencilSettings::StaticInit< 17 kInvert_StencilOp,
20 0xffff, 18 kKeep_StencilOp,
21 GrUserStencilTest::kAlwaysIfInClip, 19 kAlwaysIfInClip_StencilFunc,
22 0xffff, 20 0xffff,
23 GrUserStencilOp::kInvert, 21 0xffff,
24 GrUserStencilOp::kKeep, 22 0xffff);
25 0xffff>()
26 );
27 23
28 // ok not to check clip b/c stencil pass only wrote inside clip 24 // ok not to check clip b/c stencil pass only wrote inside clip
29 static constexpr GrUserStencilSettings gEOColorPass( 25 static constexpr GrStencilSettings gEOColorPass(
30 GrUserStencilSettings::StaticInit< 26 kZero_StencilOp,
31 0x0000, 27 kZero_StencilOp,
32 GrUserStencilTest::kNotEqual, 28 kNotEqual_StencilFunc,
33 0xffff, 29 0xffff,
34 GrUserStencilOp::kZero, 30 0x0000,
35 GrUserStencilOp::kZero, 31 0xffff);
36 0xffff>()
37 );
38 32
39 // have to check clip b/c outside clip will always be zero. 33 // have to check clip b/c outside clip will always be zero.
40 static constexpr GrUserStencilSettings gInvEOColorPass( 34 static constexpr GrStencilSettings gInvEOColorPass(
41 GrUserStencilSettings::StaticInit< 35 kZero_StencilOp,
42 0x0000, 36 kZero_StencilOp,
43 GrUserStencilTest::kEqualIfInClip, 37 kEqualIfInClip_StencilFunc,
44 0xffff, 38 0xffff,
45 GrUserStencilOp::kZero, 39 0x0000,
46 GrUserStencilOp::kZero, 40 0xffff);
47 0xffff>()
48 );
49 41
50 ////// Winding 42 ////// Winding
51 43
52 // when we have separate stencil we increment front faces / decrement back faces 44 // when we have separate stencil we increment front faces / decrement back faces
53 // when we don't have wrap incr and decr we use the stencil test to simulate 45 // when we don't have wrap incr and decr we use the stencil test to simulate
54 // them. 46 // them.
55 47
56 static constexpr GrUserStencilSettings gWindStencilSeparateWithWrap( 48 static constexpr GrStencilSettings gWindStencilSeparateWithWrap(
57 GrUserStencilSettings::StaticInitSeparate< 49 kIncWrap_StencilOp, kDecWrap_StencilOp,
58 0xffff, 0xffff, 50 kKeep_StencilOp, kKeep_StencilOp,
59 GrUserStencilTest::kAlwaysIfInClip, GrUserStencilTest::kAlwaysIfInCli p, 51 kAlwaysIfInClip_StencilFunc, kAlwaysIfInClip_StencilFunc,
60 0xffff, 0xffff, 52 0xffff, 0xffff,
61 GrUserStencilOp::kIncWrap, GrUserStencilOp::kDecWrap, 53 0xffff, 0xffff,
62 GrUserStencilOp::kKeep, GrUserStencilOp::kKeep, 54 0xffff, 0xffff);
63 0xffff, 0xffff>()
64 );
65 55
66 // if inc'ing the max value, invert to make 0 56 // if inc'ing the max value, invert to make 0
67 // if dec'ing zero invert to make all ones. 57 // if dec'ing zero invert to make all ones.
68 // we can't avoid touching the stencil on both passing and 58 // we can't avoid touching the stencil on both passing and
69 // failing, so we can't resctrict ourselves to the clip. 59 // failing, so we can't resctrict ourselves to the clip.
70 static constexpr GrUserStencilSettings gWindStencilSeparateNoWrap( 60 static constexpr GrStencilSettings gWindStencilSeparateNoWrap(
71 GrUserStencilSettings::StaticInitSeparate< 61 kInvert_StencilOp, kInvert_StencilOp,
72 0xffff, 0x0000, 62 kIncClamp_StencilOp, kDecClamp_StencilOp,
73 GrUserStencilTest::kEqual, GrUserStencilTest::kEqual, 63 kEqual_StencilFunc, kEqual_StencilFunc,
74 0xffff, 0xffff, 64 0xffff, 0xffff,
75 GrUserStencilOp::kInvert, GrUserStencilOp::kInvert, 65 0xffff, 0x0000,
76 GrUserStencilOp::kIncMaybeClamp, GrUserStencilOp::kDecMaybeClamp, 66 0xffff, 0xffff);
77 0xffff, 0xffff>()
78 );
79 67
80 // When there are no separate faces we do two passes to setup the winding rule 68 // When there are no separate faces we do two passes to setup the winding rule
81 // stencil. First we draw the front faces and inc, then we draw the back faces 69 // stencil. First we draw the front faces and inc, then we draw the back faces
82 // and dec. These are same as the above two split into the incrementing and 70 // and dec. These are same as the above two split into the incrementing and
83 // decrementing passes. 71 // decrementing passes.
84 static constexpr GrUserStencilSettings gWindSingleStencilWithWrapInc( 72 static constexpr GrStencilSettings gWindSingleStencilWithWrapInc(
85 GrUserStencilSettings::StaticInit< 73 kIncWrap_StencilOp,
86 0xffff, 74 kKeep_StencilOp,
87 GrUserStencilTest::kAlwaysIfInClip, 75 kAlwaysIfInClip_StencilFunc,
88 0xffff, 76 0xffff,
89 GrUserStencilOp::kIncWrap, 77 0xffff,
90 GrUserStencilOp::kKeep, 78 0xffff);
91 0xffff>()
92 );
93 79
94 static constexpr GrUserStencilSettings gWindSingleStencilWithWrapDec( 80 static constexpr GrStencilSettings gWindSingleStencilWithWrapDec(
95 GrUserStencilSettings::StaticInit< 81 kDecWrap_StencilOp,
96 0xffff, 82 kKeep_StencilOp,
97 GrUserStencilTest::kAlwaysIfInClip, 83 kAlwaysIfInClip_StencilFunc,
98 0xffff, 84 0xffff,
99 GrUserStencilOp::kDecWrap, 85 0xffff,
100 GrUserStencilOp::kKeep, 86 0xffff);
101 0xffff>()
102 );
103 87
104 static constexpr GrUserStencilSettings gWindSingleStencilNoWrapInc( 88 static constexpr GrStencilSettings gWindSingleStencilNoWrapInc(
105 GrUserStencilSettings::StaticInit< 89 kInvert_StencilOp,
106 0xffff, 90 kIncClamp_StencilOp,
107 GrUserStencilTest::kEqual, 91 kEqual_StencilFunc,
108 0xffff, 92 0xffff,
109 GrUserStencilOp::kInvert, 93 0xffff,
110 GrUserStencilOp::kIncMaybeClamp, 94 0xffff);
111 0xffff>()
112 );
113 95
114 static constexpr GrUserStencilSettings gWindSingleStencilNoWrapDec( 96 static constexpr GrStencilSettings gWindSingleStencilNoWrapDec(
115 GrUserStencilSettings::StaticInit< 97 kInvert_StencilOp,
116 0x0000, 98 kDecClamp_StencilOp,
117 GrUserStencilTest::kEqual, 99 kEqual_StencilFunc,
118 0xffff, 100 0xffff,
119 GrUserStencilOp::kInvert, 101 0x0000,
120 GrUserStencilOp::kDecMaybeClamp, 102 0xffff);
121 0xffff>()
122 );
123 103
124 // Color passes are the same whether we use the two-sided stencil or two passes 104 // Color passes are the same whether we use the two-sided stencil or two passes
125 105
126 static constexpr GrUserStencilSettings gWindColorPass( 106 static constexpr GrStencilSettings gWindColorPass(
127 GrUserStencilSettings::StaticInit< 107 kZero_StencilOp,
128 0x0000, 108 kZero_StencilOp,
129 GrUserStencilTest::kLessIfInClip, // "0 < stencil" is equivalent to "0 ! = stencil". 109 kNonZeroIfInClip_StencilFunc,
130 0xffff, 110 0xffff,
131 GrUserStencilOp::kZero, 111 0x0000,
132 GrUserStencilOp::kZero, 112 0xffff);
133 0xffff>()
134 );
135 113
136 static constexpr GrUserStencilSettings gInvWindColorPass( 114 static constexpr GrStencilSettings gInvWindColorPass(
137 GrUserStencilSettings::StaticInit< 115 kZero_StencilOp,
138 0x0000, 116 kZero_StencilOp,
139 GrUserStencilTest::kEqualIfInClip, 117 kEqualIfInClip_StencilFunc,
140 0xffff, 118 0xffff,
141 GrUserStencilOp::kZero, 119 0x0000,
142 GrUserStencilOp::kZero, 120 0xffff);
143 0xffff>()
144 );
145 121
146 ////// Normal render to stencil 122 ////// Normal render to stencil
147 123
148 // Sometimes the default path renderer can draw a path directly to the stencil 124 // Sometimes the default path renderer can draw a path directly to the stencil
149 // buffer without having to first resolve the interior / exterior. 125 // buffer without having to first resolve the interior / exterior.
150 static constexpr GrUserStencilSettings gDirectToStencil( 126 static constexpr GrStencilSettings gDirectToStencil(
151 GrUserStencilSettings::StaticInit< 127 kZero_StencilOp,
152 0x0000, 128 kIncClamp_StencilOp,
153 GrUserStencilTest::kAlwaysIfInClip, 129 kAlwaysIfInClip_StencilFunc,
154 0xffff, 130 0xffff,
155 GrUserStencilOp::kZero, 131 0x0000,
156 GrUserStencilOp::kIncMaybeClamp, 132 0xffff);
157 0xffff>()
158 );
159 133
160 #endif 134 #endif
OLDNEW
« 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