StencilState class final

How the stencil test treats the draws that follow, for one face.

A value type with ==, like BlendState and for the same two reasons: a backend can cache one native object per distinct state, and a test can assert on the state a pass was left in.

The field set is flutter_gpu's StencilConfig. The defaults are the test switched off — always passes, nothing written — which is what every pass that never mentions the stencil gets, and what disabled names so a pass that did mention it can say it is done.

The masks default to eight bits, not thirty-two. flutter_gpu's own default is 0xFFFFFFFF, and the difference is invisible on it: every stencil format TextureFormat names holds eight bits, so the high bits of a mask meet nothing. The narrower default is stated because a backend exists — WebGL2 — whose stencilMask is specified against the attachment's bit depth, and a value the specification calls out of range is a value somebody will eventually have to explain.

Constructors

StencilState({CompareFunction compare = CompareFunction.always, StencilOperation failOp = StencilOperation.keep, StencilOperation depthFailOp = StencilOperation.keep, StencilOperation passOp = StencilOperation.keep, int readMask = 0xFF, int writeMask = 0xFF})
Creates a stencil state; the defaults are disabled: compare always, keep on every outcome, both masks 0xFF.
const

Properties

compare → CompareFunction
How the reference value is compared against what is stored. The reference is the new value in CompareFunction's wording: less passes when the reference is below the stored value.
final
depthFailOp → StencilOperation
What happens when the stencil test passes and the depth test fails.
final
failOp → StencilOperation
What happens to the stored value when the stencil test fails.
final
hashCode → int
The hash code for this object.
no setteroverride
passOp → StencilOperation
What happens when both tests pass.
final
readMask → int
Which bits of the stored value and the reference take part in the comparison.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
writeMask → int
Which bits of the stored value an operation may change.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override

Static Methods

checkFaces(StencilState front, StencilState? back, DeviceFeatures features, {required String backend}) → void
Throws UnsupportedCapabilityException when back reads or writes other bits than front and features lacks DeviceFeature.separateStencilMasks — since 1.0.0-rc.1. A null back is the front on both faces and needs nothing; only the eight bits narrowReference keeps are compared, since no attachment has more.
narrowReference(int value) → int
The eight bits a stencil reference has, out of whatever it was handed.

Constants

disabled → const StencilState
The test off: every fragment passes it and none changes the buffer.