Flutter Engine
The Flutter Engine
Classes | Enumerations | Variables
GrUserStencilSettings.h File Reference
#include "include/gpu/GrTypes.h"

Go to the source code of this file.

Classes

struct  GrTStencilFaceSettings< TTest, TOp >
 
struct  GrUserStencilSettings
 
struct  GrUserStencilSettings::Init< Ref, Test, TestMask, PassOp, FailOp, WriteMask >
 
struct  GrUserStencilSettings::InitSeparate< CWRef, CCWRef, CWTest, CCWTest, CWTestMask, CCWTestMask, CWPassOp, CCWPassOp, CWFailOp, CCWFailOp, CWWriteMask, CCWWriteMask >
 
struct  GrUserStencilSettings::Attrs< Test, PassOp, FailOp >
 

Enumerations

enum  GrStencilFlags : int {
  kDisabled_StencilFlag = (1 << 0) , kTestAlwaysPasses_StencilFlag = (1 << 1) , kNoModifyStencil_StencilFlag = (1 << 2) , kNoWrapOps_StencilFlag = (1 << 3) ,
  kSingleSided_StencilFlag = (1 << 4) , kLast_StencilFlag = kSingleSided_StencilFlag , kAll_StencilFlags = kLast_StencilFlag | (kLast_StencilFlag - 1)
}
 
enum class  GrUserStencilTest : uint16_t {
  kAlwaysIfInClip , kEqualIfInClip , kLessIfInClip , kLEqualIfInClip ,
  kAlways , kNever , kGreater , kGEqual ,
  kLess , kLEqual , kEqual , kNotEqual
}
 
enum class  GrUserStencilOp : uint8_t {
  kKeep , kZero , kReplace , kInvert ,
  kIncWrap , kDecWrap , kIncMaybeClamp , kDecMaybeClamp ,
  kZeroClipBit , kSetClipBit , kInvertClipBit , kSetClipAndReplaceUserBits ,
  kZeroClipAndUserBits
}
 

Variables

static constexpr GrUserStencilTest kLastClippedStencilTest = GrUserStencilTest::kLEqualIfInClip
 
static constexpr int kGrUserStencilTestCount = 1 + (int)GrUserStencilTest::kNotEqual
 
static constexpr GrUserStencilOp kLastUserOnlyStencilOp = GrUserStencilOp::kDecMaybeClamp
 
static constexpr GrUserStencilOp kLastClipOnlyStencilOp = GrUserStencilOp::kInvertClipBit
 
static constexpr int kGrUserStencilOpCount = 1 + (int)GrUserStencilOp::kZeroClipAndUserBits
 

Enumeration Type Documentation

◆ GrStencilFlags

Gr uses the stencil buffer to implement complex clipping inside the OpsTask class. The OpsTask makes a subset of the stencil buffer bits available for other uses by external code (user bits). Client code can modify these bits. OpsTask will ignore ref, mask, and writemask bits provided by clients that fall outside the user range.

When code outside the OpsTask class uses the stencil buffer the contract is as follows:

‍Normal stencil funcs allow the client to pass / fail regardless of the reserved clip bits. Additional functions allow a test against the clip along with a limited set of tests against the user bits. Client can assume all user bits are zero initially. Client must ensure that after all its passes are finished it has only written to the color buffer in the region inside the clip. Furthermore, it must zero all user bits that were modifed (both inside and outside the clip).

Enumerator
kDisabled_StencilFlag 
kTestAlwaysPasses_StencilFlag 
kNoModifyStencil_StencilFlag 
kNoWrapOps_StencilFlag 
kSingleSided_StencilFlag 
kLast_StencilFlag 
kAll_StencilFlags 

Definition at line 35 of file GrUserStencilSettings.h.

35 : int {
36 kDisabled_StencilFlag = (1 << 0),
39 kNoWrapOps_StencilFlag = (1 << 3),
40 kSingleSided_StencilFlag = (1 << 4),
41
44};
@ kAll_StencilFlags
@ kTestAlwaysPasses_StencilFlag
@ kSingleSided_StencilFlag
@ kDisabled_StencilFlag
@ kNoWrapOps_StencilFlag
@ kNoModifyStencil_StencilFlag
@ kLast_StencilFlag

◆ GrUserStencilOp

enum class GrUserStencilOp : uint8_t
strong
Enumerator
kKeep 
kZero 
kReplace 
kInvert 
kIncWrap 
kDecWrap 
kIncMaybeClamp 
kDecMaybeClamp 
kZeroClipBit 
kSetClipBit 
kInvertClipBit 
kSetClipAndReplaceUserBits 
kZeroClipAndUserBits 

Definition at line 79 of file GrUserStencilSettings.h.

79 : uint8_t {
80 kKeep,
81
82 // Ops that only modify user bits. These must not be paired with ops that modify the clip bit.
83 kZero,
84 kReplace, // Replace stencil value with fRef (only the bits enabled in fWriteMask).
85 kInvert,
88 // These two should only be used if wrap ops are not supported, or if the math is guaranteed
89 // to not overflow. The user bits may or may not clamp, depending on the state of non-user bits.
92
93 // Ops that only modify the clip bit. These must not be paired with ops that modify user bits.
97
98 // Ops that modify both clip and user bits. These can only be paired with kKeep or each other.
101};
@ kInvert
Perform a logical bitwise invert on the current stencil value.
@ kKeep
Don't modify the current stencil value.

◆ GrUserStencilTest

enum class GrUserStencilTest : uint16_t
strong
Enumerator
kAlwaysIfInClip 
kEqualIfInClip 
kLessIfInClip 
kLEqualIfInClip 
kAlways 
kNever 
kGreater 
kGEqual 
kLess 
kLEqual 
kEqual 
kNotEqual 

Definition at line 57 of file GrUserStencilSettings.h.

57 : uint16_t {
58 // Tests that respect the clip bit. If a stencil clip is not in effect, the "IfInClip" is
59 // ignored and these only act on user bits.
64
65 // Tests that ignore the clip bit. The client is responsible to ensure no color write occurs
66 // outside the clip if it is in use.
67 kAlways,
68 kNever,
70 kGEqual,
71 kLess,
72 kLEqual,
73 kEqual,
75};
constexpr auto kNever
Definition: SkSLTest.cpp:963
@ kAlways
Comparison test passes always passes.
@ kLess
Comparison test passes if new_value < current_value.
@ kGreater
Comparison test passes if new_value > current_value.

Variable Documentation

◆ kGrUserStencilOpCount

constexpr int kGrUserStencilOpCount = 1 + (int)GrUserStencilOp::kZeroClipAndUserBits
staticconstexpr

Definition at line 104 of file GrUserStencilSettings.h.

◆ kGrUserStencilTestCount

constexpr int kGrUserStencilTestCount = 1 + (int)GrUserStencilTest::kNotEqual
staticconstexpr

Definition at line 77 of file GrUserStencilSettings.h.

◆ kLastClipOnlyStencilOp

constexpr GrUserStencilOp kLastClipOnlyStencilOp = GrUserStencilOp::kInvertClipBit
staticconstexpr

Definition at line 103 of file GrUserStencilSettings.h.

◆ kLastClippedStencilTest

constexpr GrUserStencilTest kLastClippedStencilTest = GrUserStencilTest::kLEqualIfInClip
staticconstexpr

Definition at line 76 of file GrUserStencilSettings.h.

◆ kLastUserOnlyStencilOp

constexpr GrUserStencilOp kLastUserOnlyStencilOp = GrUserStencilOp::kDecMaybeClamp
staticconstexpr

Definition at line 102 of file GrUserStencilSettings.h.