bite-gp-scheduler 1.25.202

scheduler — part of the bite-gpui rearchitecture of zed's gpui
Documentation

bite-gp-scheduler

Part of bite-gpui — Zed's GPUI re-cut into a modular, acyclic stack of crates: install a tier on its own, or the whole stack behind one facade.

This package is the published build of scheduler, staged from the bite_v1.25.x line of this project's repository at 1.25.202.

Install

# this crate
cargo add bite-gp-scheduler

# the whole stack, behind one facade
cargo add bite-gpui

Hello, window

use gpui::*;

fn main() {
    gpui::application().run(|cx: &mut App| {
        cx.open_window(WindowOptions::default(), |_, cx| {
            cx.new(|_| MyView)
        })
        .unwrap();
    });
}

Swap a seam

Every seam in the stack is a trait an implementation can replace without forking the engine. bite-gp-parley is the published second implementation of TextSystem, and swapping it in is one builder call:

cargo add bite-gp-parley
use std::cell::RefCell;
use std::rc::Rc;
use gpui::*;
use gpui_parley::ParleyTextSystem;

fn main() {
    let metrics = Rc::new(RefCell::new(PhaseMetrics::default()));

    application()
        .with_text_system(ParleyTextSystem::new())
        .with_frame_pipeline({
            let metrics = metrics.clone();
            move |_window_id| {
                Box::new(
                    StandardImmediatePipeline
                        .max_fps(60)
                        .instrumented(metrics.clone())
                )
            }
        })
        .run(|cx: &mut App| { /* … */ });
}

Headless test — no display server, no GPU

With the test-support feature, a window is drawn in-process:

#[gpui::test]
fn renders_without_a_display(cx: &mut TestAppContext) {
    let window = cx.update(|cx| {
        cx.open_window(Default::default(), |_, cx| cx.new(|_| MyView))
            .unwrap()
    });
    let mut cx = VisualTestContext::from_window(window.into(), cx);

    // The window is drawn in-process: no display server, no GPU.
    let bounds = cx.debug_bounds("submit").unwrap();
    assert_eq!(bounds.size.height, px(32.));
}

Guides

  • Wraps & swaps — the two extension tiers, and the published crates behind them
  • Parley — how to swap the text engine, and the measured trade that comes with it
  • Morphorm — how to swap the layout solver, and its conformance numbers
  • Pass — how to wrap the frame pipeline, and the rate and ledger that come with it
  • Demos — projects built on the published crates
  • Compare — the comparisons that can actually be run

Provenance and licence

Derived from Zed's gpui: restructured, renamed and published as bite-gp-scheduler under Apache-2.0. NOTICE records the modifications the licence asks to be made prominent, and LICENSE-* carries the licence text.

source:   https://github.com/bite-gpui/bite-gpui
branch:   bite_v1.25.x  (upstream 1.25.2)
version:  1.25.202
commit:   19271206c7e12504f1a0b3879a85c90df5d9b4c4