| OLD | NEW |
| 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 | 8 |
| 9 #ifndef GrUserStencilSettings_DEFINED | 9 #ifndef GrUserStencilSettings_DEFINED |
| 10 #define GrUserStencilSettings_DEFINED | 10 #define GrUserStencilSettings_DEFINED |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // This struct can only be constructed with static initializers. | 181 // This struct can only be constructed with static initializers. |
| 182 GrUserStencilSettings() = delete; | 182 GrUserStencilSettings() = delete; |
| 183 GrUserStencilSettings(const GrUserStencilSettings&) = delete; | 183 GrUserStencilSettings(const GrUserStencilSettings&) = delete; |
| 184 | 184 |
| 185 const uint16_t fFrontFlags[2]; // frontFlagsForDraw = fFrontFlags[hasStenc
ilClip]. | 185 const uint16_t fFrontFlags[2]; // frontFlagsForDraw = fFrontFlags[hasStenc
ilClip]. |
| 186 const Face fFront; | 186 const Face fFront; |
| 187 const uint16_t fBackFlags[2]; // backFlagsForDraw = fBackFlags[hasStencilC
lip]. | 187 const uint16_t fBackFlags[2]; // backFlagsForDraw = fBackFlags[hasStencilC
lip]. |
| 188 const Face fBack; | 188 const Face fBack; |
| 189 | 189 |
| 190 static const GrUserStencilSettings& kUnused; | 190 static const GrUserStencilSettings& kUnused; |
| 191 |
| 192 bool isUnused() const { return this == &kUnused; } |
| 191 }; | 193 }; |
| 192 | 194 |
| 193 template<GrUserStencilTest Test, GrUserStencilOp PassOp, GrUserStencilOp FailOp> | 195 template<GrUserStencilTest Test, GrUserStencilOp PassOp, GrUserStencilOp FailOp> |
| 194 struct GrUserStencilSettings::Attrs { | 196 struct GrUserStencilSettings::Attrs { |
| 195 // Ensure an op that only modifies user bits isn't paired with one that modi
fies clip bits. | 197 // Ensure an op that only modifies user bits isn't paired with one that modi
fies clip bits. |
| 196 GR_STATIC_ASSERT(GrUserStencilOp::kKeep == PassOp || GrUserStencilOp::kKeep
== FailOp || | 198 GR_STATIC_ASSERT(GrUserStencilOp::kKeep == PassOp || GrUserStencilOp::kKeep
== FailOp || |
| 197 (PassOp <= kLastUserOnlyStencilOp) == (FailOp <= kLastUserO
nlyStencilOp)); | 199 (PassOp <= kLastUserOnlyStencilOp) == (FailOp <= kLastUserO
nlyStencilOp)); |
| 198 // Ensure an op that only modifies clip bits isn't paired with one that modi
fies clip and user. | 200 // Ensure an op that only modifies clip bits isn't paired with one that modi
fies clip and user. |
| 199 GR_STATIC_ASSERT(GrUserStencilOp::kKeep == PassOp || GrUserStencilOp::kKeep
== FailOp || | 201 GR_STATIC_ASSERT(GrUserStencilOp::kKeep == PassOp || GrUserStencilOp::kKeep
== FailOp || |
| 200 (PassOp <= kLastClipOnlyStencilOp) == (FailOp <= kLastClipO
nlyStencilOp)); | 202 (PassOp <= kLastClipOnlyStencilOp) == (FailOp <= kLastClipO
nlyStencilOp)); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 228 } | 230 } |
| 229 constexpr static uint16_t EffectiveWriteMask(uint16_t writeMask) { | 231 constexpr static uint16_t EffectiveWriteMask(uint16_t writeMask) { |
| 230 // We don't modify the mask differently when hasStencilClip=false becaus
e either the entire | 232 // We don't modify the mask differently when hasStencilClip=false becaus
e either the entire |
| 231 // face gets disabled in that case (e.g. Test=kAlwaysIfInClip, PassOp=kK
eep), or else the | 233 // face gets disabled in that case (e.g. Test=kAlwaysIfInClip, PassOp=kK
eep), or else the |
| 232 // effective mask stays the same either way. | 234 // effective mask stays the same either way. |
| 233 return DoesNotModifyStencil(true) ? 0 : writeMask; | 235 return DoesNotModifyStencil(true) ? 0 : writeMask; |
| 234 } | 236 } |
| 235 }; | 237 }; |
| 236 | 238 |
| 237 #endif | 239 #endif |
| OLD | NEW |