Prune commentary and stale Rust port notes
This commit is contained in:
1 parent
3ae034a47b
commit
1e6d3b1edd
84 files changed
+334
-5648
No files matched your search
@@ -1,27 +1,3 @@
|
||||
//! (d) of IRIS_TODO.md's "Benchmarks" item: 1,000 image rows, checking that
|
||||
//! standalone-image bind-group *creation* -- a real `wgpu` resource, unlike
|
||||
//! the counters in `benches/message_lazy_span.rs` -- goes to zero once every
|
||||
//! image has loaded. This needs an actual `wgpu` device (`GpuTextures`,
|
||||
//! `UiRenderNode`), so unlike the rest of the suite it cannot run as a
|
||||
//! plain binary; run it through `iris/run-headless.sh bench_images`, which
|
||||
//! gives it a real (headless, GPU-accelerated) compositor and surface. See
|
||||
//! `run-bench.sh` for the wrapper that greps its output into one line.
|
||||
//!
|
||||
//! Each `RedrawRequested` prints the frame number and
|
||||
//! `UiRenderNode::take_image_bind_group_creates()` for that frame, then
|
||||
//! requests another redraw (nothing else marks the scene dirty, so without
|
||||
//! this the app would only ever draw once). The first frame is expected to
|
||||
//! report 1,000 (one create per image, on first load); the steady state
|
||||
//! IRIS_TODO.md asks this scenario to prove is every frame after settling
|
||||
//! down to 0.
|
||||
//!
|
||||
//! After `SETTLE_FRAMES` it appends one *new* image row (a transcript
|
||||
//! receiving one more message) and keeps counting -- a chat transcript's
|
||||
//! real access pattern is "one more image arrives," not "reload the whole
|
||||
//! list," so the steady-state question that actually matters is the
|
||||
//! *incremental* cost of that one append, not just whether an untouched
|
||||
//! scene costs zero. It exits after `FRAMES`.
|
||||
|
||||
use iris::prelude::*;
|
||||
|
||||
const ROWS: usize = 1000;
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
//! RUST.md's I3: `iris::widget::LazySpan` with 800 rows of varied-length
|
||||
//! wrapped text, one in twelve carrying a small image, scrollable with the
|
||||
//! mouse wheel. Run headless with `iris/run-headless.sh message_list --shot
|
||||
//! /tmp/message_list.png` -- there is no display on this machine, so that
|
||||
//! is the only way to see it rendered; `scripts/run-tests.sh`/`cargo test` never
|
||||
//! touch this file.
|
||||
//!
|
||||
//! Rows alternate two background tints so a screenshot can show the
|
||||
//! boundary between adjacent rows even where the text itself wraps to a
|
||||
//! different number of lines -- exactly the "variable-height rows" I3
|
||||
//! asks for, and the thing a virtualised list gets wrong first if it is
|
||||
//! wrong at all (a gap, an overlap, a row the wrong colour). This example
|
||||
//! is also what found `LazySpan::place`'s oversized-background bug (see
|
||||
//! lazy_span.rs's module doc and its `a_fill_shaped_background_is_not_left_
|
||||
//! oversized` test) -- a plain unit test could have (and now does) catch
|
||||
//! it directly, but it was this screenshot rendering as a single blank
|
||||
//! tinted rectangle that pointed at it first.
|
||||
|
||||
use iris::prelude::*;
|
||||
use winit::{dpi::LogicalSize, window::WindowAttributes};
|
||||
|
||||
@@ -31,10 +13,6 @@ struct State {
|
||||
const ROWS: usize = 800;
|
||||
const IMAGE_EVERY: usize = 12;
|
||||
|
||||
/// Repeats a short sentence a varying number of times per row so real
|
||||
/// wrapping happens at every row height from one line to several, rather
|
||||
/// than every row being identically tall (which would render correctly
|
||||
/// even with a broken height measurement).
|
||||
fn row_text(i: usize) -> String {
|
||||
const SENTENCE: &str =
|
||||
"Iris lays out this row once and moves it on scroll, never re-laying it out. ";
|
||||
@@ -42,9 +20,6 @@ fn row_text(i: usize) -> String {
|
||||
format!("Message {i}: {}", SENTENCE.repeat(repeats))
|
||||
}
|
||||
|
||||
/// A small solid-colour square standing in for a real decoded image --
|
||||
/// what matters for I3 is that a row can carry an `Image` widget at all,
|
||||
/// not what the picture shows.
|
||||
fn row_image(i: usize) -> image::DynamicImage {
|
||||
let hue = ((i * 47) % 255) as u8;
|
||||
image::RgbaImage::from_pixel(48, 48, image::Rgba([hue, 128, 255 - hue, 255])).into()
|
||||
@@ -84,11 +59,6 @@ fn build_row<Rsc: UiRsc + 'static>(rsc: &mut Rsc, i: usize) -> StrongWidget {
|
||||
}
|
||||
|
||||
impl DefaultAppState for State {
|
||||
// A phone-plausible portrait shape (the transcript screen this is
|
||||
// standing in for). The tiling headless compositor `run-headless.sh`
|
||||
// uses ignores this and fills its own 1920x1200 output regardless, but
|
||||
// it's a correct hint for any other backend (a real window manager, or
|
||||
// android-view) and costs nothing to state.
|
||||
fn window_attributes() -> WindowAttributes {
|
||||
WindowAttributes::default().with_inner_size(LogicalSize::new(420.0, 900.0))
|
||||
}
|
||||
@@ -104,12 +74,6 @@ impl DefaultAppState for State {
|
||||
list.push_back(LazyItem::new(i as u64, row));
|
||||
}
|
||||
|
||||
// `.scrollable()`, like anything else that scrolls -- here the
|
||||
// span's own inherent one, which registers the wheel and the drag
|
||||
// against the controller it already owns rather than wrapping it
|
||||
// in a `ScrollArea`. Masked outside it, since a `LazySpan` draws
|
||||
// the row straddling each edge in full and asserts something clips
|
||||
// it.
|
||||
let root = list
|
||||
.scrollable()
|
||||
.masked()
|
||||
|
||||
@@ -5,10 +5,6 @@ fn main() {
|
||||
DefaultApp::<Client>::run();
|
||||
}
|
||||
|
||||
/// The tabs example: five demo panes plus a message composer, built by
|
||||
/// `tabs_ui::build` and driven here through the winit backend. The same
|
||||
/// widget tree also runs on the android-view backend, through
|
||||
/// `iris-android-app` -- see RUST.md's I2.
|
||||
#[derive(DefaultUiState)]
|
||||
pub struct Client {
|
||||
ui_state: DefaultUiState,
|
||||
|
||||
Reference in new issue
Block a user