pub struct FrameChunk { /* private fields */ }Expand description
One frame of one render target: the arena, primitives, mesh stream and draw
calls every player sharing the target appends to, in its order.
Implementations§
Source§impl FrameChunk
impl FrameChunk
Sourcepub fn stencil_enabled(&self) -> bool
pub fn stencil_enabled(&self) -> bool
Whether the hardware stencil is in use for the target this is built for.
Sourcepub fn mask_backend(&self) -> MaskBackend
pub fn mask_backend(&self) -> MaskBackend
How the target this is built for draws masks.
crate::SSPlayer’s walk reads this rather than Self::stencil_enabled:
planning writers, skipping a pure mask’s colour and testing a masked
target are the same work for both backends, and only what the batch is
appended as differs.
Sourcepub fn set_node_coverage(
&mut self,
node: &mut NodeSlot,
uv: &[f32; 6],
extent: (f32, f32),
writers: &[ScopedWriter],
)
pub fn set_node_coverage( &mut self, node: &mut NodeSlot, uv: &[f32; 6], extent: (f32, f32), writers: &[ScopedWriter], )
Attach the player’s coverage block to its top node, once the whole tree’s writers are planned.
uv is the affine that takes a player-local point to coverage UV
[0,1] — the bbox normalisation, as
[a, b, c, d, tx, ty] for u = a*x + c*y + tx, v = b*x + d*y + ty.
Both the bake (which turns UV into clip space) and the replay (which
samples with it) read this one transform, so the two cannot disagree about
where the bitmap is.
Sourcepub fn inherit_node_coverage(
&mut self,
node: &mut NodeSlot,
uv: &[f32; 6],
layer: u32,
writers: &[ScopedWriter],
)
pub fn inherit_node_coverage( &mut self, node: &mut NodeSlot, uv: &[f32; 6], layer: u32, writers: &[ScopedWriter], )
Point a sub-animation at its player’s bitmap.
No new layer: the child reads the one bitmap the top node baked, and the same writer records — their scopes are on the tree sequence, which the whole tree shares. Only the affine differs, composed with the chain of instance placements so the child’s own local coordinates land in the top node’s coverage.
Sourcepub fn node_coverage_layer(&self, node: &NodeSlot) -> u32
pub fn node_coverage_layer(&self, node: &NodeSlot) -> u32
Which layer a node’s coverage went to, for pointing the rest of its tree at it.
Sourcepub fn push_transform(&mut self, transform: &[f32; 16]) -> NodeSlot
pub fn push_transform(&mut self, transform: &[f32; 16]) -> NodeSlot
Copy a placement matrix into the arena, for a top node that is no crowd: before any of its primitives, and the draws after it are issued once.
Sourcepub fn append_batch(
&mut self,
renderer: &SSRenderer,
frame: &FrameView<'_>,
node: &NodeSlot,
batch: &BatchInfo,
)
pub fn append_batch( &mut self, renderer: &SSRenderer, frame: &FrameView<'_>, node: &NodeSlot, batch: &BatchInfo, )
Append one Normal, Mesh or Shape DrawBatch’s geometry to the frame. The
vertices are copied as the runtime laid them out; node names the
placement the vertex stage applies to them (the root’s, or an instance
child’s composed with its parents’). frame is re-parsed for its
draw_order/parts/parts_color; the batch fields are passed in so the caller
(SSPlayer) drives batch iteration and can interleave instance recursion at
the right rank. batch.stencil selects the stencil-test content pipeline
for masked parts.
Sourcepub fn append_mask_writer(
&mut self,
frame: &FrameView<'_>,
node: &NodeSlot,
writer: &MaskWriter,
op: MaskOp,
)
pub fn append_mask_writer( &mut self, frame: &FrameView<'_>, node: &NodeSlot, writer: &MaskWriter, op: MaskOp, )
Append one mask writer’s geometry, routed to the mask-write pipeline for
op. The cutout threshold rides in the primitive’s rate slot, which
fs_mask reads as varg.x: it needs the full f32 range,
including the -1 that means “no cutout”. No-op if masking is disabled.
Sourcepub fn append_coverage_writer(
&mut self,
frame: &FrameView<'_>,
node: &NodeSlot,
writer: &MaskWriter,
bit: usize,
)
pub fn append_coverage_writer( &mut self, frame: &FrameView<'_>, node: &NodeSlot, writer: &MaskWriter, bit: usize, )
Rasterise one writer’s shape into the coverage bitmap, setting bit.
Called once per writer per frame — there is no add/remove interleave here, because the coverage backend does not carry a running state through the draw walk. What the stencil path spends passes replaying, the replay shader recomputes per fragment from the writer’s rank.
Sourcepub fn append_effect(
&mut self,
plan_buf: &[u8],
node: &NodeSlot,
stencil: StencilTest,
mask_seq: u32,
alpha: f32,
tint: u32,
keys: &AtlasKeys,
)
pub fn append_effect( &mut self, plan_buf: &[u8], node: &NodeSlot, stencil: StencilTest, mask_seq: u32, alpha: f32, tint: u32, keys: &AtlasKeys, )
Append an effect slot’s EffectDrawPlan (a raw FlatBuffer) to the frame.
node names the effect part’s composed placement (the vertices are
slot-relative), and keys translates the plan’s cellmap hashes into
renderer texture keys. Blend is per-command; color is taken
from the plan and modulates the cellmap texture via the sprite shader.
stencil selects the stencil test when the effect is a masked target
(inherited from a parent mask); None for ordinary effects. alpha and
tint are the player-level fade and colour (see BatchInfo::alpha and
BatchInfo::tint).
Under the coverage backend a masked effect tests like any other part:
node carries the coverage block, pulled back to the effect’s own local
space, and mask_seq is the emitter’s place on the tree sequence.