A render encoder that opened from a carry holds kept draws of the states its command buffer's earlier encoders drew. At a split of its pass instance, rehome_aside re-homed the kept draws set aside in the encoder but let go of every carried one not drawn since, and select_kept's opened check dropped the rest once the instance changed. Each such state's first draw after the split then took every step. On the Iris walk of a guest animation page (ia-p150), a fit over its per-second counts puts 12 to 20 of the 46.6 full draws a present in encoders that opened from a carry at splits (~3.6 splits a present, 3 to 5 carried states undrawn at each), at an estimated 88-101 us a full draw against ~10 us a rebound one. - rehome_aside re-homes a carried kept draw like the others (readers and draws that read the pass's colors are still let go); it stays carried. - draw_rebound begins nothing for a re-homed draw (the split's draw began the instance it records into); select_kept lets a re-homed carried draw past the opened check. - Kept::carried_into clears the mark, so the next encoder's first draw of it still begins that encoder's first instance. Why the re-homed draw is right in the new instance: it stays carried, so its rebind brings every slot the encoder's calls bound since its opening, and carried_stale stops it where the bind state holds a slot no call of the encoder bound (a new encoder inherits no binding in Metal). Its state commands record against the instance it records into (settled none, a fresh record; inline_splits.rs: the record stays valid across instances in one primary command buffer). Its uses are made whole and gathered into the instance after the split, so the barrier and copies the pass end plans before that instance order it as an every-step draw there. WorkCounts: kept_draws_rehomed_carried (of kept_draws_rehomed) and kept_draws_carried_unopened (carried draws still let go at select because the instance is no longer the opened one). No new Degradation kind. draw_costs gains a "splits" shape. Tests: split_keeps::carried_draws_undrawn_at_a_split_are_rebound_past_it (commands, state commands and pixels equal the every-step run; debug builds compare the carried draws field by field). Verified (rebound lane): msi lavapipe m2v_cpu_icd 86/86 of the split, carry, rebound and recovery-carry suites (m3-max-39124); negative control with the carried reject back fails the new test (m3-max-39129); release build of the example (m3-max-39128). Clippy x3, rustdoc and the splits bench run on development after.
449 lines
20 KiB
Rust
449 lines
20 KiB
Rust
//! A render encoder's kept draws past a split (`render/draw_again.rs`, re-homed past a split): a
|
|
//! draw that keeps nothing only because it recorded into an instance after a split, here one that
|
|
//! reads its own attachment after a memory barrier over the render targets, re-homes the kept
|
|
//! draws set aside into the instance (`WorkCounts::kept_draws_rehomed`), and the draws after it of
|
|
//! their pipeline states are rebound (`WorkCounts::draws_rebound`) into the instance, which records
|
|
//! inline after the split (`render/inline_splits.rs`), and so are the draws again there with no
|
|
//! call between (never a Vulkan draw of their own ahead of the instance's room), with the same
|
|
//! commands of every kind, state commands and pixels as the same draws each taking every step. An
|
|
//! encoder that ends with kept draws in its instance after the split carries them into its
|
|
//! command buffer's next render encoder (`render/carried.rs`), whose first draw of each of their
|
|
//! states is rebound against them (`WorkCounts::draws_rebound_carried`). In builds with debug
|
|
//! assertions, every second draw again (and the first carried draw and every second one after it)
|
|
//! takes every step instead and checks what it worked out (`render/draw_again.rs`'s and
|
|
//! `render/carried.rs`'s checks), so the tests run those checks too. A kept draw carried into an
|
|
//! encoder and not drawn before its split is re-homed past it as the others are
|
|
//! (`WorkCounts::kept_draws_rehomed_carried`), its state's first draw after the split rebound as
|
|
//! a carried draw is.
|
|
//!
|
|
//! A device test: compiled only under the validation crate's GPU safety cfgs (`m2v_gpu`,
|
|
//! `m2v_cpu_icd`), on the kind of device the cfg selects. The functions are `tob_rect`,
|
|
//! `tob_sample`, `tob_solid` and `tob_read` of the owned fixture
|
|
//! `validation/fixtures/public/engine/tob_renders.ll` (`llvm-as`).
|
|
|
|
use super::blit_holds::{until, Scratch};
|
|
use super::draw_again::{checks_ended, device, drawn_alone, run_into, Heard, Ran};
|
|
use super::encoder_holds::library;
|
|
use crate::{
|
|
Device, PipelineOptions, Region, RenderCommandEncoder, RenderPipelineState, ResourceOptions,
|
|
SamplerState, ScissorRect, Texture, TextureDescriptor, WorkCounts,
|
|
};
|
|
use metal2vulkan::bind::SamplerDescriptor;
|
|
use metal2vulkan::metal::{
|
|
BarrierScope, BlendFactor, PixelFormat, PrimitiveType, RenderStages, TextureUsage,
|
|
};
|
|
use metal2vulkan::pipeline::{ColorAttachmentDescriptor, RenderPipelineDescriptor, StageSource};
|
|
|
|
/// The target's side, in pixels.
|
|
const SIDE: u64 = 16;
|
|
|
|
/// The texels of the two textures draw A samples, the first before the split, the second after.
|
|
const TEXELS: [[u8; 4]; 2] = [[200, 0, 0, 255], [0, 0, 200, 255]];
|
|
|
|
/// The colors draw B adds, the first before the split, the second after.
|
|
const ADDED: [[u8; 4]; 2] = [[0, 51, 0, 0], [51, 51, 0, 255]];
|
|
|
|
/// The boxes `[x0, y0, x1, y1)` of the encoder's draws, in its order: A, B, the reader, A, B (and
|
|
/// B's draws again, [`AGAIN`]).
|
|
const BOXES: [[u64; 4]; 5] = [
|
|
[0, 0, 8, 8],
|
|
[4, 4, 12, 12],
|
|
[2, 2, 10, 10],
|
|
[6, 6, 14, 14],
|
|
[8, 0, 16, 8],
|
|
];
|
|
|
|
/// The draws of the last B again after it, with no call between.
|
|
const AGAIN: u64 = 2;
|
|
|
|
/// An encoder's draws of [`BOXES`], by their index there: every one, in its order.
|
|
const ALL: &[usize] = &[0, 1, 2, 3, 4];
|
|
|
|
/// The states and resources of the encoder's draws.
|
|
struct Draws {
|
|
/// `tob_sample`, opaque.
|
|
sampling: RenderPipelineState,
|
|
/// `tob_solid`, adding its color to the target's.
|
|
adding: RenderPipelineState,
|
|
/// `tob_read`, opaque: the target's texel at the fragment's pixel.
|
|
reading: RenderPipelineState,
|
|
textures: [Texture; 2],
|
|
sampler: SamplerState,
|
|
}
|
|
|
|
impl Draws {
|
|
fn new(device: &Device) -> Draws {
|
|
let state = |fragment: &str, adding: bool| {
|
|
let library = library(device, "engine/tob_renders.ll");
|
|
let function = |name| {
|
|
let function = library.new_function_with_name(name).unwrap();
|
|
StageSource::Function(function.function_descriptor())
|
|
};
|
|
let mut descriptor = RenderPipelineDescriptor::new(function("tob_rect"));
|
|
descriptor.fragment = Some(function(fragment));
|
|
let mut color = ColorAttachmentDescriptor::new(PixelFormat::RGBA8Unorm);
|
|
if adding {
|
|
color.blending_enabled = true;
|
|
color.destination_rgb_blend_factor = BlendFactor::One;
|
|
color.destination_alpha_blend_factor = BlendFactor::One;
|
|
}
|
|
descriptor.color_attachments[0] = Some(color);
|
|
device
|
|
.new_render_pipeline_state(&descriptor, &PipelineOptions::default())
|
|
.unwrap()
|
|
};
|
|
let texture = |texel: [u8; 4]| {
|
|
let mut descriptor =
|
|
TextureDescriptor::texture_2d(PixelFormat::RGBA8Unorm, 1, 1, false);
|
|
descriptor.usage = TextureUsage::SHADER_READ;
|
|
descriptor.resource_options = ResourceOptions::shared();
|
|
let texture = device.new_texture(&descriptor).unwrap();
|
|
let whole = Region::new_2d(0, 0, 1, 1);
|
|
texture.replace_region(whole, 0, 0, &texel, 4, 0).unwrap();
|
|
texture
|
|
};
|
|
Draws {
|
|
sampling: state("tob_sample", false),
|
|
adding: state("tob_solid", true),
|
|
reading: state("tob_read", false),
|
|
textures: TEXELS.map(texture),
|
|
sampler: device.new_sampler_state(&SamplerDescriptor::new()).unwrap(),
|
|
}
|
|
}
|
|
|
|
/// The encoder's draws into `target` (the module docs), after the sampler and fragment buffer 0
|
|
/// bound before them (as the walk binds them, so that every state's bind state holds the slot
|
|
/// B binds), each setting its state, its scissor rectangle (its box) and its corners, with
|
|
/// `between` called after each, those of `order` of: A sampling the first texture, B adding
|
|
/// the first color, a memory barrier over the render targets from the fragment stage to the
|
|
/// fragment stage and the reader, A sampling the second texture, B adding the second color;
|
|
/// then B's draw again [`AGAIN`] times.
|
|
fn encode(
|
|
&self,
|
|
encoder: &mut RenderCommandEncoder,
|
|
(target, order): (&Texture, &[usize]),
|
|
between: &dyn Fn(&mut RenderCommandEncoder),
|
|
) {
|
|
encoder
|
|
.set_fragment_sampler_state(Some(&self.sampler), 0)
|
|
.unwrap();
|
|
let added = ADDED[0].map(|byte| f32::from(byte) / 255.0);
|
|
encoder.set_fragment_bytes(&floats(added), 0).unwrap();
|
|
for &at in order {
|
|
let area = BOXES[at];
|
|
match at {
|
|
0 | 3 => {
|
|
let texture = &self.textures[at / 3];
|
|
encoder.set_render_pipeline_state(&self.sampling).unwrap();
|
|
encoder.set_fragment_texture(Some(texture), 0).unwrap();
|
|
}
|
|
1 | 4 => {
|
|
encoder.set_render_pipeline_state(&self.adding).unwrap();
|
|
let added = ADDED[at / 4].map(|byte| f32::from(byte) / 255.0);
|
|
encoder.set_fragment_bytes(&floats(added), 0).unwrap();
|
|
}
|
|
_ => {
|
|
let fragment = RenderStages::FRAGMENT;
|
|
let scope = BarrierScope::RENDER_TARGETS;
|
|
encoder.memory_barrier_with_scope(scope, fragment, fragment);
|
|
encoder.set_render_pipeline_state(&self.reading).unwrap();
|
|
encoder.set_fragment_texture(Some(target), 0).unwrap();
|
|
}
|
|
}
|
|
let [x0, y0, x1, y1] = area;
|
|
let rect = ScissorRect {
|
|
x: x0,
|
|
y: y0,
|
|
width: x1 - x0,
|
|
height: y1 - y0,
|
|
};
|
|
encoder.set_scissor_rect(rect).unwrap();
|
|
encoder.set_vertex_bytes(&corners(area), 0).unwrap();
|
|
let drawn = encoder.draw_primitives(PrimitiveType::Triangle, 0, 6, 1, 0);
|
|
assert_eq!(drawn, Ok(()));
|
|
between(encoder);
|
|
}
|
|
for _ in 0..AGAIN {
|
|
let drawn = encoder.draw_primitives(PrimitiveType::Triangle, 0, 6, 1, 0);
|
|
assert_eq!(drawn, Ok(()));
|
|
between(encoder);
|
|
}
|
|
}
|
|
|
|
/// [`Draws::encode`] in render encoders of one command buffer, each of the next of `orders`,
|
|
/// into a new private target, which the first clears and each later one loads, with `between`
|
|
/// after each draw, on a queue of its own (no carry an earlier run's last encoder left its
|
|
/// queue, `render/carried.rs`, reaches it): what it recorded and drew.
|
|
fn run(
|
|
&self,
|
|
device: &Device,
|
|
orders: &[&[usize]],
|
|
between: &dyn Fn(&mut RenderCommandEncoder),
|
|
) -> Ran {
|
|
let queue = device.new_command_queue().unwrap();
|
|
let mut descriptor =
|
|
TextureDescriptor::texture_2d(PixelFormat::RGBA8Unorm, SIDE, SIDE, false);
|
|
descriptor.usage = TextureUsage::RENDER_TARGET | TextureUsage::SHADER_READ;
|
|
descriptor.resource_options = ResourceOptions::private();
|
|
let target = device.new_texture(&descriptor).unwrap();
|
|
let next = std::cell::Cell::new(0);
|
|
let encode = |encoder: &mut RenderCommandEncoder| {
|
|
let order = orders[next.get()];
|
|
next.set(next.get() + 1);
|
|
self.encode(encoder, (&target, order), between)
|
|
};
|
|
run_into(device, &queue, (&target, orders.len()), encode, true)
|
|
}
|
|
|
|
/// Run encoders of the draws of `orders` until a run draws no key's residual form and the
|
|
/// device's pool is idle (`draw_again::warm`), then wait until the device's own checks ended.
|
|
fn warm(&self, device: &Device, orders: &[&[usize]]) {
|
|
until("every key's own pipeline made", || {
|
|
let residual = device.work_counts().residual_form_draws;
|
|
self.run(device, orders, &|_| {});
|
|
device.work_counts().residual_form_draws == residual
|
|
});
|
|
until("the pipeline pool idle", || {
|
|
device.work_counts().pipeline_pool_busy == 0
|
|
});
|
|
checks_ended(device);
|
|
}
|
|
}
|
|
|
|
/// A call between draws that changes nothing for them (`set_tessellation_factor_scale`, which no
|
|
/// draw of their states reads), which forgets every kept draw: each draw takes every step.
|
|
fn forgets(encoder: &mut RenderCommandEncoder) {
|
|
encoder.set_tessellation_factor_scale(1.0);
|
|
}
|
|
|
|
fn floats(v: [f32; 4]) -> Vec<u8> {
|
|
v.iter().flat_map(|f| f.to_le_bytes()).collect()
|
|
}
|
|
|
|
/// The corners, in normalized device coordinates, of the target's pixels `[x0, x1) x [y0, y1)`.
|
|
fn corners([x0, y0, x1, y1]: [u64; 4]) -> Vec<u8> {
|
|
let x = |p: u64| p as f32 / SIDE as f32 * 2.0 - 1.0;
|
|
let y = |p: u64| 1.0 - p as f32 / SIDE as f32 * 2.0;
|
|
floats([x(x0), y(y1), x(x1), y(y0)])
|
|
}
|
|
|
|
/// The two kept draws set aside when the reader splits the pass are re-homed into the instance
|
|
/// after the split, and the draws of their states after it are rebound there, as are B's draws
|
|
/// again with no call between (a draw again's every other form records a Vulkan draw of its own,
|
|
/// which an instance after a split records only from its room), with the same
|
|
/// commands, state commands and pixels as every draw taking every step after a call between each
|
|
/// that changes nothing for them (`set_tessellation_factor_scale`, which no draw of their states
|
|
/// reads), which forgets the kept draws. The reader splits the pass once in both runs, and no
|
|
/// draw keeps nothing for another reason than its own (`WorkCounts::draws_unkept_other`): a draw
|
|
/// into the instance after the split keeps itself. The re-homed draws restate by their scissor
|
|
/// rectangles alone (`WorkCounts::draws_restated_scissors`): the encoder set nothing beyond them.
|
|
#[test]
|
|
fn kept_draws_set_aside_are_rebound_past_a_split() {
|
|
let scratch = Scratch::new("split-keeps");
|
|
let heard = Heard::default();
|
|
let device = device(&scratch.0, &[], &heard);
|
|
let draws = Draws::new(&device);
|
|
draws.warm(&device, &[ALL]);
|
|
let kept = draws.run(&device, &[ALL], &|_| {});
|
|
let every = draws.run(&device, &[ALL], &forgets);
|
|
eprintln!("kept: {}", kept.moved());
|
|
eprintln!("every step: {}", every.moved());
|
|
let counted = |of: fn(&WorkCounts) -> u64| (kept.counted(of), every.counted(of));
|
|
assert_eq!(
|
|
counted(|c| c.inline_split_instances),
|
|
(1, 1),
|
|
"the instances after the split"
|
|
);
|
|
assert_eq!(
|
|
counted(|c| c.instance_splits_attached_read),
|
|
(1, 1),
|
|
"the splits by the reader's read of its attachment"
|
|
);
|
|
assert_eq!(
|
|
counted(|c| c.kept_draws_rehomed),
|
|
(2, 0),
|
|
"the kept draws re-homed"
|
|
);
|
|
// Re-homed under the encoder's render state, which set its scissor rectangles alone since.
|
|
assert_eq!(
|
|
counted(|c| c.draws_restated_scissors),
|
|
(2, 0),
|
|
"the re-homed draws restated by their scissor rectangles alone"
|
|
);
|
|
assert_eq!(
|
|
counted(|c| c.draws_unlike_kept + c.draws_rebind_stopped),
|
|
(0, 0),
|
|
"the draws unlike their kept draws, or whose rebind stopped"
|
|
);
|
|
assert_eq!(
|
|
counted(|c| c.draws_rebound),
|
|
(drawn_alone(2 + AGAIN), 0),
|
|
"the draws rebound"
|
|
);
|
|
assert_eq!(
|
|
counted(|c| c.draws_unkept_other),
|
|
(0, 0),
|
|
"the draws that kept nothing for another reason"
|
|
);
|
|
assert_eq!(kept.commands, every.commands);
|
|
assert_eq!(kept.commands["cmd_draw"], BOXES.len() as u64 + AGAIN);
|
|
assert_eq!(
|
|
kept.counted(|c| c.draw_states_recorded),
|
|
every.counted(|c| c.draw_states_recorded)
|
|
);
|
|
assert_eq!(kept.words, every.words, "the pixels of the draws");
|
|
// The draws after the split drew what they bound: the second texture, the second color (added
|
|
// by B and its draws again).
|
|
let word = |x: u64, y: u64| kept.words[(y * SIDE + x) as usize];
|
|
assert_eq!(
|
|
word(13, 13),
|
|
u32::from_le_bytes(TEXELS[1]),
|
|
"A after the split"
|
|
);
|
|
assert_eq!(
|
|
word(15, 1),
|
|
u32::from_le_bytes(ADDED[1].map(|byte| byte.saturating_mul(1 + AGAIN as u8))),
|
|
"B after the split"
|
|
);
|
|
}
|
|
|
|
/// Two render encoders of the draws in one command buffer: the first ends with kept draws in its
|
|
/// pass's instance after the split, and carries them into the second (`render/carried.rs`: an
|
|
/// instance after a split carries as the first does), whose first draw of each state is rebound
|
|
/// against them (`WorkCounts::draws_rebound_carried`) and which re-homes them past its own split
|
|
/// in turn, with the same commands, state commands and pixels as every draw taking every step.
|
|
/// Only the readers and the first encoder's first draw of each state take every step; no encoder
|
|
/// ends uncarried for its split, and no draw is unlike its kept draw or stops its rebind or carry.
|
|
/// The carried and re-homed draws restate by their scissor rectangles alone
|
|
/// (`WorkCounts::draws_restated_scissors`): neither encoder set its render state beyond them.
|
|
#[test]
|
|
fn kept_draws_past_a_split_carry_into_the_next_encoder() {
|
|
let scratch = Scratch::new("split-carries");
|
|
let heard = Heard::default();
|
|
let device = device(&scratch.0, &[], &heard);
|
|
let draws = Draws::new(&device);
|
|
const ENCODERS: usize = 2;
|
|
draws.warm(&device, &[ALL; ENCODERS]);
|
|
let kept = draws.run(&device, &[ALL; ENCODERS], &|_| {});
|
|
let every = draws.run(&device, &[ALL; ENCODERS], &forgets);
|
|
eprintln!("kept: {}", kept.moved());
|
|
eprintln!("every step: {}", every.moved());
|
|
let counted = |of: fn(&WorkCounts) -> u64| (kept.counted(of), every.counted(of));
|
|
let encoders = ENCODERS as u64;
|
|
assert_eq!(
|
|
counted(|c| c.inline_split_instances),
|
|
(encoders, encoders),
|
|
"the instances after the splits"
|
|
);
|
|
assert_eq!(
|
|
counted(|c| c.kept_draws_rehomed),
|
|
(2 * encoders, 0),
|
|
"the kept draws re-homed"
|
|
);
|
|
assert_eq!(
|
|
counted(|c| c.draws_rebound_carried),
|
|
(drawn_alone(2), 0),
|
|
"the second encoder's first draws of A and B, rebound against the carried draws"
|
|
);
|
|
// Neither encoder set its render state beyond its scissor rectangles, over one target: the
|
|
// carried draws restate by them alone, as the re-homed ones do.
|
|
assert_eq!(
|
|
counted(|c| c.draws_restated_scissors),
|
|
(2 * encoders + 2, 0),
|
|
"the re-homed and carried draws restated by their scissor rectangles alone"
|
|
);
|
|
// Each encoder's draws: A, B, the reader, A, B and B's draws again.
|
|
let each = BOXES.len() as u64 + AGAIN;
|
|
assert_eq!(
|
|
counted(|c| c.draws_none_kept),
|
|
(3 + 1, encoders * each),
|
|
"the draws that took every step with nothing kept"
|
|
);
|
|
assert_eq!(
|
|
counted(|c| c.draws_unlike_kept + c.draws_rebind_stopped + c.draws_carry_stopped),
|
|
(0, 0),
|
|
"the draws unlike their kept draws, or whose rebind or carry stopped"
|
|
);
|
|
assert_eq!(
|
|
counted(|c| c.encoders_uncarried_split + c.encoders_none_kept_next_split),
|
|
(0, 0),
|
|
"the encoders that carried nothing for their split"
|
|
);
|
|
assert_eq!(kept.commands, every.commands);
|
|
assert_eq!(kept.commands["cmd_draw"], encoders * each);
|
|
assert_eq!(
|
|
kept.counted(|c| c.draw_states_recorded),
|
|
every.counted(|c| c.draw_states_recorded)
|
|
);
|
|
assert_eq!(kept.words, every.words, "the pixels of the draws");
|
|
}
|
|
|
|
/// Two render encoders of one command buffer, the second drawing B, then the reader, which splits
|
|
/// its pass, then A and B: the kept draw of A carried into it and not drawn before the split is
|
|
/// re-homed past it with B's (`WorkCounts::kept_draws_rehomed_carried`), so its first draw after
|
|
/// the split is rebound as a carried draw is (`WorkCounts::draws_rebound_carried`), into the
|
|
/// instance after the split, where it took every step with nothing kept before; with the same
|
|
/// commands, state commands and pixels as every draw taking every step. Only the readers and the
|
|
/// first encoder's first draw of each state take every step; no carried draw is let go for its
|
|
/// instance (`WorkCounts::kept_draws_carried_unopened`), and no draw is unlike its kept draw or
|
|
/// stops its rebind or carry.
|
|
#[test]
|
|
fn carried_draws_undrawn_at_a_split_are_rebound_past_it() {
|
|
let scratch = Scratch::new("split-carried");
|
|
let heard = Heard::default();
|
|
let device = device(&scratch.0, &[], &heard);
|
|
let draws = Draws::new(&device);
|
|
let orders: [&[usize]; 2] = [ALL, &[1, 2, 3, 4]];
|
|
draws.warm(&device, &orders);
|
|
let kept = draws.run(&device, &orders, &|_| {});
|
|
let every = draws.run(&device, &orders, &forgets);
|
|
eprintln!("kept: {}", kept.moved());
|
|
eprintln!("every step: {}", every.moved());
|
|
let counted = |of: fn(&WorkCounts) -> u64| (kept.counted(of), every.counted(of));
|
|
assert_eq!(
|
|
counted(|c| c.inline_split_instances),
|
|
(2, 2),
|
|
"the instances after the splits"
|
|
);
|
|
assert_eq!(
|
|
counted(|c| c.kept_draws_rehomed_carried),
|
|
(1, 0),
|
|
"the carried draw of A re-homed past the second encoder's split"
|
|
);
|
|
assert_eq!(
|
|
counted(|c| c.kept_draws_rehomed),
|
|
(2 + 2, 0),
|
|
"the kept draws re-homed, A's carried one among them"
|
|
);
|
|
assert_eq!(
|
|
counted(|c| c.kept_draws_carried_unopened),
|
|
(0, 0),
|
|
"the carried draws let go for their instance"
|
|
);
|
|
assert_eq!(
|
|
counted(|c| c.draws_rebound_carried),
|
|
(drawn_alone(2), 0),
|
|
"the second encoder's draws of B before the split and of A after it, rebound against the \
|
|
carried draws"
|
|
);
|
|
let drawn = (ALL.len() + orders[1].len()) as u64 + 2 * AGAIN;
|
|
assert_eq!(
|
|
counted(|c| c.draws_none_kept),
|
|
(3 + 1, drawn),
|
|
"the draws that took every step with nothing kept: the first encoder's A, B and reader, \
|
|
and the second's reader"
|
|
);
|
|
assert_eq!(
|
|
counted(|c| c.draws_unlike_kept + c.draws_rebind_stopped + c.draws_carry_stopped),
|
|
(0, 0),
|
|
"the draws unlike their kept draws, or whose rebind or carry stopped"
|
|
);
|
|
assert_eq!(kept.commands, every.commands);
|
|
assert_eq!(kept.commands["cmd_draw"], drawn);
|
|
assert_eq!(
|
|
kept.counted(|c| c.draw_states_recorded),
|
|
every.counted(|c| c.draw_states_recorded)
|
|
);
|
|
assert_eq!(kept.words, every.words, "the pixels of the draws");
|
|
}
|