iris is the framework alone; the app is one crate in app-rust/
Iris: "the organization of the rust rewrite is a mess right now... there shouldn't be anything related to the app inside of iris. Iris is supposed to be the UI framework alone." And, on the crate count: "I'm confused why the app only code needs more than one crate though." Nine cargo workspaces become three, and the port's project code -- which sat in five places, four of them inside the framework -- becomes one crate, `ai-app`, in `app-rust/`: client-core -> app-rust/src/client iris/transcript-ui -> app-rust/src/ui iris/transcript-fixture -> app-rust/src/ui/fixture.rs + tests/ + touch/ iris/desktop-app -> app-rust/src/desktop + src/bin_desktop.rs iris/android-app -> app-rust/src/android + android-project/ android-shell -> app-rust/src/shell iris/ keeps core, macro, the iris crate, tabs-ui and rig-input, and now mentions no session, transcript, setup or server anywhere. Only two of the old splits had a reason that survived reading. event-model stays a crate at the repo root because server/ depends on it too, so a crate is what makes the backend and the app agree by construction. The two Android .so names looked like a hard constraint -- a package produces one library artifact -- until P2 turned out to already plan merging those two Android apps into one; both faces now come out of libai_app.so, picked apart by features so `--no-default-features --features shell` keeps wgpu, parley and iris out of the Compose app's APK. docs/RUST.md's "One app crate" has the rest, including what each remaining feature is for. DECISIONS.md and SUBAGENTS.md move into docs/ with everything else. Verified: ./run-tests.sh and `cd iris && cargo test` green, clippy and fmt clean in all five workspaces, `cargo ndk -t x86_64` links libai_app.so, build-apk.sh produces an APK that installs and launches on this checkout's emulator (Gl ... virgl, as expected), and the phone-sized headless screenshot renders the transcript unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7b54aaf3c4
commit
a9312e9431
113 files changed
+23221
-2992
No files matched your search
@@ -0,0 +1,104 @@
|
||||
//! (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;
|
||||
const SETTLE_FRAMES: usize = 4;
|
||||
const FRAMES: usize = 6;
|
||||
|
||||
#[derive(DefaultUiState)]
|
||||
struct State {
|
||||
ui_state: DefaultUiState,
|
||||
span: WeakWidget<Span>,
|
||||
frame: usize,
|
||||
appended: bool,
|
||||
}
|
||||
|
||||
impl DefaultAppState for State {
|
||||
fn new(
|
||||
mut ui_state: DefaultUiState,
|
||||
rsc: &mut DefaultRsc<Self>,
|
||||
_: Proxy<Self::Event>,
|
||||
) -> Self {
|
||||
let mut span = Span::empty(Dir::DOWN);
|
||||
for _ in 0..ROWS {
|
||||
let img = image::DynamicImage::new_rgba8(32, 32);
|
||||
let widget = image::<DefaultRsc<Self>>(img)(rsc);
|
||||
let widget = rsc.ui.widgets.add_strong(widget);
|
||||
span.push(widget.any());
|
||||
}
|
||||
let span = rsc.ui.widgets.add_strong(span);
|
||||
let span_weak = span.weak();
|
||||
let root = rsc
|
||||
.ui
|
||||
.widgets
|
||||
.add_strong(ScrollArea::new(span.any(), Axis::Y, Pin::End));
|
||||
ui_state.set_root(root.any());
|
||||
Self {
|
||||
ui_state,
|
||||
span: span_weak,
|
||||
frame: 0,
|
||||
appended: false,
|
||||
}
|
||||
}
|
||||
|
||||
fn window_event(
|
||||
&mut self,
|
||||
event: winit::event::WindowEvent,
|
||||
rsc: &mut DefaultRsc<Self>,
|
||||
_render: &mut UiRenderState,
|
||||
) {
|
||||
if !matches!(event, winit::event::WindowEvent::RedrawRequested) {
|
||||
return;
|
||||
}
|
||||
self.frame += 1;
|
||||
let creates = self.ui_state.renderer.ui.take_image_bind_group_creates();
|
||||
println!(
|
||||
"BENCH_IMAGES frame={} bind_group_creates={creates}",
|
||||
self.frame
|
||||
);
|
||||
if self.frame == SETTLE_FRAMES && !self.appended {
|
||||
self.appended = true;
|
||||
let img = image::DynamicImage::new_rgba8(32, 32);
|
||||
let widget = image::<DefaultRsc<Self>>(img)(rsc);
|
||||
let widget = rsc.ui.widgets.add_strong(widget);
|
||||
rsc.ui
|
||||
.widgets
|
||||
.get_mut(&self.span)
|
||||
.unwrap()
|
||||
.push(widget.any());
|
||||
println!("BENCH_IMAGES appended one image after settling");
|
||||
}
|
||||
if self.frame < FRAMES {
|
||||
self.ui_state.window.request_redraw();
|
||||
} else {
|
||||
std::process::exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
DefaultApp::<State>::run();
|
||||
}
|
||||
Reference in new issue
Block a user