Compare commits

..
Author SHA1 Message Date
shinyobjectz b90ee0728c #82: the ARM64 build (it compiles: raea.exe is AA64 and runs) is packed and checked without drawing (release-check.sh RAEA_CHECK_NO_GPU=1 keeps plugins, guides, song map and bin\'s files; the windows-11-arm runner has only WARP, which segfaults in Bevy as on x64, and lavapipe has no ARM64 build), and it uses the release's compile cache 2026-11-26 13:59:45 -08:00
shinyobjectz 5eb8b1e40e windows-arm.yml runs on v* tags too, beside release.yml, and attaches raea-VERSION-windows-arm64.zip to that release (skills-passed from the tag, as release.yml reads it); an ARM64 failure never holds up the release 2026-11-26 13:43:27 -08:00
shinyobjectz bce27988ab windows-arm.yml: metis-sys alone on windows-latest's x64 MSVC too, which release.yml builds with 2026-11-26 11:42:54 -08:00
shinyobjectz c02a02d902 #82: metis-sys vendored with GKlib's stdint.h/inttypes.h stand-ins only before Visual Studio 2013 (Visual Studio 18's stdint.h types int_fast16_t differently, and the windows-11-arm build failed on every GKlib file); its graphs, manual and programs left out 2026-11-26 11:42:35 -08:00
shinyobjectz b26da1cc95 #82: a windows-arm64 zip: RAEA_WIN_ARCH=arm64 has onnxruntime.sh and win-bundle.sh take the ARM64 runtime, VC++ CRT, uv and DXC (FFmpeg stays x64, run emulated), release.sh names and packs raea-VERSION-windows-arm64.zip, and windows-arm.yml packs and checks it on WARP 2026-11-26 11:35:06 -08:00
shinyobjectz cf0282f550 #82: raea built natively for Windows on ARM in CI (windows-arm.yml on windows-11-arm: the release's four binaries, raea --version, a 2D still on WARP); rav1d's assembly off there, where MSVC skips its GNU .S files 2026-11-26 11:26:19 -08:00
25 changed files with 172 additions and 634 deletions

No files matched your search

Generated
-11
View File
@@ -16436,22 +16436,11 @@ dependencies = [
"raea-io-home",
"raea-io-media",
"raea-io-trace",
"raea-sys-mix-device",
"raea-sys-mix-level",
"raea-sys-tone",
"serde_json",
]
[[package]]
name = "raea-sys-mix-device"
version = "0.1.0"
dependencies = [
"audioadapter-buffers",
"cpal 0.15.3",
"firewheel",
"raea-io-trace",
]
[[package]]
name = "raea-sys-mix-level"
version = "0.1.0"
-1
View File
@@ -86,7 +86,6 @@ members = [
"systems/tone",
"systems/mix",
"systems/mix/level",
"systems/mix/device",
"systems/ml",
"systems/mlx",
"systems/kimodo",
+5 -5
View File
@@ -1,7 +1,8 @@
//! Whether a job is done (docs/make.feature MK1), from what's on disk and nothing the agent says: the deliverables, the
//! notes, the record of renders and checks, and the judge's rounds. Pure over a `Job` so it is tested on fixtures.
use std::{path::{Path, PathBuf}, time::SystemTime};
use std::path::{Path, PathBuf};
use std::time::SystemTime;
use raea_core_brief::make::{self, Make};
use raea_core_facts::{Level, record::Entry};
@@ -187,11 +188,10 @@ pub fn status(job: &Job) -> Value {
}
let mut gates = checks(job);
gates.extend(lods(job, &notes));
// a cut job: its brief's rules over every delivered file (MK25-MK27), and the person's review its critic; a goal's
let plan = |g: make::Gate| gate(g.name, g.of.as_deref(), g.clear, g.says);
match (&job.make.cut, job.make.kind) {
(Some(c), make::Kind::Cut) => gates.extend(raea_runtime_cut_plan::gates(c, job.dir).into_iter().map(plan)),
(_, make::Kind::Goal) => gates.extend(job.make.goal.iter().flat_map(|g| raea_runtime_goal_plan::gates(g, job.dir)).map(plan)),
// a cut job: its brief's rules over every delivered file (MK25-MK27), and the person's review its critic
(Some(c), make::Kind::Cut) => gates.extend(raea_runtime_cut_plan::gates(c, job.dir).into_iter().map(|g| gate(g.name, g.of.as_deref(), g.clear, g.says))),
(_, make::Kind::Goal) => gates.extend(job.make.goal.iter().flat_map(|g| raea_runtime_goal_plan::gates(g, job.dir)).map(|g| gate(g.name, g.of.as_deref(), g.clear, g.says))),
_ => gates.extend(critic(job, newest, &notes)),
}
let (asks, said) = crate::asked::gates(&sheets(job), job.ledger, &notes);
-10
View File
@@ -318,13 +318,3 @@ pub fn doctor(m: &Make) -> Vec<String> {
}
out
}
/// One gate as `raea make status` lists it: its name, the file, item or rule it's about, whether it's clear, and what
/// it says. A cut's gates come from raea-runtime-cut-plan, a goal's from raea-runtime-goal-plan.
#[derive(Debug, Clone, PartialEq)]
pub struct Gate {
pub name: &'static str,
pub of: Option<String>,
pub clear: bool,
pub says: String,
}
-81
View File
@@ -1,81 +0,0 @@
---
title: "raea 0.1.11"
version: "0.1.11"
date: "2026-11-26"
summary: "A goal is a make job, judged by its own commands and a fresh critic. Live sound follows your output device, a picture taller than the GPU's largest texture draws, and Windows on ARM gets raea's installer and its own build. In the app, typing to Ideate answers with your own agent, there is one Settings page, and voice comes with Studio."
sources: ["https://github.com/shinyobjectz/raea/releases/tag/v0.1.11"]
---
raea 0.1.11 makes a goal something `raea make` holds an agent to: the goal's own commands and a critic that only
reads decide when it's done, never the agent's word. Live sound now follows the output you're listening on, a very
tall picture draws instead of being refused, and Windows on ARM PCs get raea's installer and a build of their own. In
the app, typing to Ideate answers with the agent you connected, Settings are one page, and talking with Ideate comes
with Studio.
**Get the app at [raea.io](https://raea.io)** (a Mac with Apple silicon, Windows 10 or 11, or Linux on x86_64).
The engine alone:
```sh
curl -fsSL https://raea.io/install | sh
```
On Windows, in PowerShell: `irm https://raea.io/install.ps1 | iex`.
## What changed since 0.1.10
**A goal is a make job.** Besides scenes, kits, shots and cuts, `make: goal({...})` in `brief.ts` is a fifth kind of
job (MK28-MK29). Its rules are commands that must pass and things it must say, and `raea make judge` has a fresh
critic, which only reads, judge each `says` rule into `review/goal.judge.json`. `raea make status` is the one judge
of whether the goal is met.
**Cuts from a brief rotate their call to action.** A `cut` brief's `cta.also` lists the other lines a brief rotates,
and each cut ends on one of them within its last 8 seconds (MK25).
**Live sound follows your output.** When the system's output changes (headphones, AirPods, a display) or the stream
breaks, live sound reopens on the device in use instead of going quiet.
**A tall picture draws (#245).** A picture larger than the GPU's image atlas (a 1080 x 18000 site capture drawn 880
wide) was refused with a message about a filtered layer. It is now decoded at a size that fits the atlas, which is
16384 px a side even on a GPU that allows larger textures.
**Windows on ARM (#82).**
- `irm https://raea.io/install.ps1 | iex` installs on an ARM64 PC: raea's ARM64 build when the release has one, else
the x86_64 build, which Windows 11 on ARM runs emulated. Before, the installer refused ARM64 PCs.
- raea is built natively for Windows on ARM (`raea-0.1.11-windows-arm64.zip`) when its build passes, beside the
release's other archives.
- On a Snapdragon PC, raea picks DirectX 12 for its Adreno GPU, where Vulkan drew 2D pages striped and with grey boxes
behind fading text.
**In the app.**
- Typing to Ideate answers with your own agent (Claude, Codex, or whichever you connected), named on screen while it
thinks, and the conversation stays open instead of fading after a few seconds. raea's own voice model is only for
speaking.
- Talking with Ideate comes with Studio (300 minutes a month) and Enterprise (no limit). Free and Pro type.
- Settings are one page: your workspace's sections, then this computer's (account, plan, sharing, general, storage
and debugging), searched together.
- Signing out on the Mac's workspace signs raea's account out, and the menu names the account you're in.
- A review's player starts with sound, and remembers if you turn it off.
- Every project has a canvas: deliverables, previews and the brief's frames, marked with a region or a point and a
`#tag`, sent back as a note or as edits.
- On Windows, Codex's shell commands run (#244). Codex's elevated sandbox waited on a Windows prompt or failed every
call with "The tool call failed"; raea now starts it with Windows' unelevated sandbox, unless you set your own.
**raea cloud.**
- Boxes move onto each new release, and each box build is stamped with the commit and files it came from.
- An agent's errors go into its run's trace, a runaway render is stopped before it takes the box down, and an agent
waiting on a long render keeps its connection.
- A render sends a project's footage once, known by the file rather than its path.
- `raea words` on a box transcribes with Whisper large-v3, and `raea frames check` measures what a cut's pictures get
wrong (faces cut off, split frames that make no sense).
- Google's AI signs in on the box, in a browser you work from the dashboard.
**Known**
- The Windows on ARM build is checked in CI without drawing: GitHub's ARM64 runner has no GPU raea can draw on. A
Snapdragon PC is where its pictures are checked. If something looks wrong, the x86_64 build still runs there, and
`WGPU_BACKEND=vulkan` or `dx12` chooses the graphics API by hand.
- The Windows app is unsigned, as before: Windows asks once whether to run it (#221).
- On Linux, raea needs a processor with AVX (most from 2011 on) and glibc 2.39 or newer (Ubuntu 24.04, Debian 13,
Fedora 40 and later).
- A proxy set by an automatic configuration (PAC) file isn't read. If yours uses one, start raea with `HTTPS_PROXY`
set.
+9 -6
View File
@@ -10,8 +10,14 @@ use std::path::Path;
use raea_core_brief::cut::{self, Cut, norm};
use serde_json::Value;
/// One gate as `raea make status` lists it (a goal's are the same kind)
pub use raea_core_brief::make::Gate;
/// One gate as `raea make status` lists it: its name, the file or item it's about, whether it's clear, what it says.
#[derive(Debug, Clone, PartialEq)]
pub struct Gate {
pub name: &'static str,
pub of: Option<String>,
pub clear: bool,
pub says: String,
}
fn gate(name: &'static str, of: Option<&str>, clear: bool, says: String) -> Gate {
Gate { name, of: of.map(str::to_string), clear, says }
@@ -186,10 +192,7 @@ fn file_gates(c: &Cut, plan: &cut::CutPlan, format: &str, f: &Path, rel: &str, s
in_order(&want, &j.iter().map(|(w, _)| w.as_str()).collect::<Vec<_>>())
};
let lines: Vec<&str> = std::iter::once(cta.text.as_str()).chain(cta.also.iter().map(String::as_str)).collect();
// the line heard most, the first of equals (none when no line's words were heard)
let heard: Vec<_> = lines.iter().map(|l| share(l, &last)).collect();
let heard_share = heard.iter().copied().fold(0.0, f64::max);
let best = lines.iter().zip(&heard).find(|(_, h)| heard_share > 0.0 && **h == heard_share).map_or("", |(l, _)| *l);
let (best, heard_share) = lines.iter().map(|l| (*l, share(l, &last))).fold(("", 0.0), |a, b| if b.1 > a.1 { b } else { a });
let on_screen = screen.iter().any(|(s, at)| *at >= end - within && lines.iter().any(|l| share(l, &s.split(' ').collect::<Vec<_>>()) >= CTA_SHARE));
let ok = heard_share >= CTA_SHARE || on_screen;
let says = match (ok, on_screen) {
+8 -2
View File
@@ -12,8 +12,14 @@ use std::time::{Duration, Instant, SystemTime};
use raea_core_brief::goal::Goal;
use serde_json::{Value, json};
/// One gate as `raea make status` lists it (a cut's are the same kind): `of` is the rule it's about
pub use raea_core_brief::make::Gate;
/// One gate as `raea make status` lists it: its name, the rule it's about, whether it's clear, what it says.
#[derive(Debug, Clone, PartialEq)]
pub struct Gate {
pub name: &'static str,
pub of: Option<String>,
pub clear: bool,
pub says: String,
}
fn gate(name: &'static str, of: &str, clear: bool, says: String) -> Gate {
Gate { name, of: Some(of.to_string()), clear, says }
+1 -1
Submodule skills updated: 98de983bca...ae1c222713.
-2
View File
@@ -9,8 +9,6 @@ description = "raea's one mixer core: the same Firewheel graph plays live in the
[dependencies]
# the mix before the master: dialogue at one level, room tone at the joins
raea-sys-mix-level = { path = "level" }
# the system's output: the stream live play runs in, moved onto the device in use
raea-sys-mix-device = { path = "device" }
raea-io-trace = { path = "../../io/trace" }
# the bounce's scratch file, as the frames come (SG4a)
raea-io-home = { path = "../../io/home" }
-16
View File
@@ -1,16 +0,0 @@
[package]
name = "raea-sys-mix-device"
version = "0.1.0"
edition = "2024"
license = "FSL-1.1-ALv2"
publish = false
description = "raea's mixer on the system's output: Firewheel's processor driven from cpal's callback, and moved onto the device in use when the output changes or the stream breaks"
[dependencies]
raea-io-trace = { path = "../../../io/trace" }
# the mixer's graph, as raea-sys-mix pins it
firewheel = { version = "=0.12.1", default-features = false, features = ["std", "scheduled_events"] }
# the cpal react and the legacy app use (0.15): Firewheel's own CPAL backend needs 0.18, which can't link beside 0.15
cpal = "0.15"
# the processor's output, pulled into a stereo buffer
audioadapter-buffers = { version = "4.0.0", default-features = false, features = ["std"] }
-130
View File
@@ -1,130 +0,0 @@
//! The mixer's output: the system's default device, with Firewheel's processor pulled from cpal's callback, followed
//! when the system's output changes (headphones in, AirPods away, a display's speakers) or cpal says the stream broke
//! (11-26, Shane: "sometimes i dont hear any sound": the stream stayed on the device it opened on, gone or not the one
//! being listened to).
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::time::{Duration, Instant};
use audioadapter_buffers::direct::InterleavedSlice;
use cpal::traits::{DeviceTrait, HostTrait, StreamTrait};
pub use cpal::Stream;
use firewheel::backend::BackendProcessInfo;
use firewheel::node::StreamStatus;
use firewheel::{ActivateInfo, FirewheelContext};
/// The output a mixer plays on: the device's name (empty while there's none), the rate and block size it asks for,
/// and whether cpal said the stream broke.
pub struct Output {
pub name: String,
rate: u32,
block: u32,
lost: Arc<AtomicBool>,
looked: Instant,
}
impl Output {
/// The default device's stream, and the rate it runs at (`rate` when the device takes it).
pub fn open(cx: &mut FirewheelContext, rate: u32, block: u32) -> Result<(Output, Stream, u32), String> {
let lost = Arc::new(AtomicBool::new(false));
let (stream, got, name) = start(cx, rate, block, lost.clone())?;
Ok((Output { name, rate, block, lost, looked: Instant::now() }, stream, got))
}
/// Whether the stream should move: at once after cpal said it broke, else when the system's default output, looked
/// at once a second, is another device.
pub fn moved(&mut self) -> bool {
let lost = self.lost.load(Ordering::Relaxed);
if !lost && self.looked.elapsed() < Duration::from_secs(1) {
return false;
}
self.looked = Instant::now();
let now = cpal::default_host().default_output_device().and_then(|d| d.name().ok()).unwrap_or_default();
lost || (!now.is_empty() && now != self.name)
}
/// The stream started again on the default device: `old` is let go first, which hands the graph back (its
/// processor dropped). The new stream and its rate, or no device to play on (looked for again in a second).
pub fn reopen(&mut self, cx: &mut FirewheelContext, old: Option<Stream>) -> Result<(Stream, u32), String> {
drop(old);
let t0 = Instant::now();
while cx.is_active() && t0.elapsed() < Duration::from_millis(500) {
let _ = cx.update();
std::thread::sleep(Duration::from_millis(1));
}
self.lost.store(false, Ordering::Relaxed);
match start(cx, self.rate, self.block, self.lost.clone()) {
Ok((stream, rate, name)) => {
eprintln!("raea mixer: sound now on {name} (was {})", if self.name.is_empty() { "nothing" } else { &self.name });
self.name = name;
Ok((stream, rate))
}
Err(e) => {
if !self.name.is_empty() {
eprintln!("raea mixer: no sound: {e}");
}
self.name.clear();
Err(e)
}
}
}
}
/// The default output device, at `want` Hz when it takes it, `block` frames a callback when it takes that: Firewheel's
/// processor pulled from cpal's callback, as the bounce pulls it into a buffer (stereo, spread over the device's
/// channels).
fn start(cx: &mut FirewheelContext, want: u32, block: u32, lost: Arc<AtomicBool>) -> Result<(Stream, u32, String), String> {
let host = cpal::default_host();
let dev = host.default_output_device().ok_or("no audio output device")?;
let name = dev.name().unwrap_or_default();
let def = dev.default_output_config().map_err(|e| format!("audio output: {e}"))?;
let channels = def.channels();
let takes_48k = dev.supported_output_configs().map(|mut c| c.any(|r| r.channels() == channels && r.sample_format() == cpal::SampleFormat::F32 && r.min_sample_rate().0 <= want && r.max_sample_rate().0 >= want)).unwrap_or(false);
let rate = if takes_48k { want } else { def.sample_rate().0 };
let max_block = 8192usize;
let mut proc = cx
.activate(ActivateInfo { sample_rate: std::num::NonZeroU32::new(rate).unwrap(), max_block_frames: std::num::NonZeroU32::new(max_block as u32).unwrap(), num_stream_in_channels: 0, num_stream_out_channels: 2, input_to_output_latency_seconds: 0.0 })
.map_err(|e| format!("the mixer's graph: {e:?}"))?;
let ch = channels as usize;
let began = std::time::Instant::now();
let mut stereo = vec![0f32; max_block * 2];
let empty: [f32; 0] = [];
let mut callback = move |out: &mut [f32], info: &cpal::OutputCallbackInfo| {
let ts = info.timestamp();
let delay = ts.playback.duration_since(&ts.callback);
let frames = out.len() / ch.max(1);
let mut done = 0;
while done < frames {
let k = (frames - done).min(max_block);
let pi = BackendProcessInfo { frames: k, process_timestamp: Some(std::time::Instant::now()), duration_since_stream_start: began.elapsed(), input_stream_status: StreamStatus::empty(), output_stream_status: StreamStatus::empty(), dropped_frames: 0, process_to_playback_delay: delay };
if let (Ok(input), Ok(mut output)) = (InterleavedSlice::new(&empty[..], 0, 0), InterleavedSlice::new_mut(&mut stereo[..k * 2], 2, k)) {
proc.process(&input, &mut output, pi);
}
for i in 0..k {
let (l, r) = (stereo[2 * i], stereo[2 * i + 1]);
let o = &mut out[(done + i) * ch..(done + i + 1) * ch];
match ch {
1 => o[0] = 0.5 * (l + r),
_ => {
o[0] = l;
o[1] = r;
o[2..].fill(0.0);
}
}
}
done += k;
}
};
// the block size when the device's range takes it, else its own
let fits = dev.supported_output_configs().map(|mut c| c.any(|r| r.channels() == channels && matches!(r.buffer_size(), cpal::SupportedBufferSize::Range { min, max } if *min <= block && block <= *max))).unwrap_or(false);
let config = cpal::StreamConfig { channels, sample_rate: cpal::SampleRate(rate), buffer_size: if fits { cpal::BufferSize::Fixed(block) } else { cpal::BufferSize::Default } };
let mut said = raea_io_trace::once::said_once::<cpal::StreamError>("raea mixer");
let broke = move |e: cpal::StreamError| {
lost.store(true, Ordering::Relaxed);
said(e)
};
let stream = dev.build_output_stream(&config, move |o: &mut [f32], i: &cpal::OutputCallbackInfo| callback(o, i), broke, None).map_err(|e| format!("audio stream: {e}"))?;
stream.play().map_err(|e| format!("audio stream: {e}"))?;
Ok((stream, rate, name))
}
+113 -22
View File
@@ -7,15 +7,16 @@
use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::sync::atomic::Ordering;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::{Receiver, Sender, channel};
use std::sync::{Arc, Mutex};
use cpal::traits::StreamTrait;
use audioadapter_buffers::direct::InterleavedSlice;
use cpal::traits::{DeviceTrait, HostTrait, StreamTrait};
use firewheel::backend::BackendProcessInfo;
use firewheel::clock::{EventInstant, InstantSamples};
use firewheel::node::NodeID;
use firewheel::{FirewheelConfig, FirewheelContext};
use raea_sys_mix_device::Output;
use firewheel::node::{NodeID, StreamStatus};
use firewheel::{ActivateInfo, FirewheelConfig, FirewheelContext};
use crate::nodes::{Stats, event};
use raea_io_media::pcm::Pcm;
@@ -35,8 +36,13 @@ pub struct Live {
cx: FirewheelContext,
/// the device's stream: None for the moment it's reopened on another device (follow_device)
_stream: Option<cpal::Stream>,
/// the output it plays on, followed when the system's output changes (raea-sys-mix-device)
out: Output,
/// the output it plays on (its name), the block size it was asked for, and whether cpal said the stream broke
/// (the device unplugged, its AirPods put away): the stage follows the system's output (11-26, Shane: "sometimes i
/// dont hear any sound": the stream stayed on the device it opened on, gone or not the one being listened to)
device: String,
block: u32,
lost: Arc<AtomicBool>,
looked: std::time::Instant,
voices: NodeID,
master: NodeID,
score: Option<Score>,
@@ -87,7 +93,8 @@ impl Live {
let mut cx = FirewheelContext::new(FirewheelConfig::default());
let (voices, master) = crate::graph(&mut cx, stats.clone(), tap.as_ref().map(|t| t.1.clone()), mute)?;
let block = std::env::var("RAEA_AUDIO_BLOCK").ok().and_then(|v| v.parse().ok()).unwrap_or(256u32);
let (out, stream, rate) = Output::open(&mut cx, RATE, block)?;
let lost = Arc::new(AtomicBool::new(false));
let (stream, rate, device) = start(&mut cx, block, lost.clone())?;
if rate != RATE {
eprintln!("raea mixer: the device runs at {rate} Hz, not {RATE}: live play can't be the bounce sample for sample");
}
@@ -99,7 +106,7 @@ impl Live {
// a device opened beside the edit's open waits for nothing by then
Ok(Live {
opened: std::time::Instant::now(),
settled: false, cx, _stream: Some(stream), out, voices, master, score: None, pcm: HashMap::new(), opening: HashMap::new(), loader: raea_io_media::pcm::loader(), rate, head, head_base: head, origin: None, drift_ms: Vec::new(), anchors: Vec::new(), slews: 0, load_ms: Vec::new(), load_wait: std::time::Duration::from_millis(std::env::var("RAEA_AUDIO_LOAD_WAIT_MS").ok().and_then(|v| v.parse().ok()).unwrap_or(80)), used: HashMap::new(), items: Vec::new(), keep: HashMap::new(), blocks: Vec::new(), master_set: (0.0, 20.0 * (crate::nodes::CEILING as f64).log10()), bypass: false, resting: false, built: Default::default(), stats, tap })
settled: false, cx, _stream: Some(stream), device, block, lost, looked: std::time::Instant::now(), voices, master, score: None, pcm: HashMap::new(), opening: HashMap::new(), loader: raea_io_media::pcm::loader(), rate, head, head_base: head, origin: None, drift_ms: Vec::new(), anchors: Vec::new(), slews: 0, load_ms: Vec::new(), load_wait: std::time::Duration::from_millis(std::env::var("RAEA_AUDIO_LOAD_WAIT_MS").ok().and_then(|v| v.parse().ok()).unwrap_or(80)), used: HashMap::new(), items: Vec::new(), keep: HashMap::new(), blocks: Vec::new(), master_set: (0.0, 20.0 * (crate::nodes::CEILING as f64).log10()), bypass: false, resting: false, built: Default::default(), stats, tap })
}
/// The master: `gain_db` on the sum, then the limiter at `ceiling_db` (dBTP).
@@ -352,22 +359,48 @@ impl Live {
/// old one is let go, which hands the graph back (its processor dropped), and it starts again on the new device. The
/// timeline is placed again on the next frame, as after a rest.
fn follow_device(&mut self) {
if !self.out.moved() {
let lost = self.lost.load(Ordering::Relaxed);
if !lost && self.looked.elapsed() < std::time::Duration::from_secs(1) {
return;
}
let Ok((stream, rate)) = self.out.reopen(&mut self.cx, self._stream.take()) else { return };
if rate != self.rate {
// the head and the score count samples: both at the new device's rate
self.head_base = (self.head_base as f64 * rate as f64 / self.rate as f64).round() as i64;
self.rate = rate;
self.score = None;
self.looked = std::time::Instant::now();
let now = cpal::default_host().default_output_device().and_then(|d| d.name().ok()).unwrap_or_default();
if !lost && (now.is_empty() || now == self.device) {
return;
}
// the old stream and its callback go, and the processor in it: the context is free to start again
self._stream = None;
let t0 = std::time::Instant::now();
while self.cx.is_active() && t0.elapsed() < std::time::Duration::from_millis(500) {
let _ = self.cx.update();
std::thread::sleep(std::time::Duration::from_millis(1));
}
self.lost.store(false, Ordering::Relaxed);
match start(&mut self.cx, self.block, self.lost.clone()) {
Ok((stream, rate, device)) => {
eprintln!("raea mixer: sound now on {device} (was {})", if self.device.is_empty() { "nothing" } else { &self.device });
if rate != self.rate {
// the head and the score count samples: both at the new device's rate
self.head_base = (self.head_base as f64 * rate as f64 / self.rate as f64).round() as i64;
self.rate = rate;
self.score = None;
}
self._stream = Some(stream);
self.device = device;
self.resting = false;
self.origin = None;
self.settled = false;
self.opened = std::time::Instant::now();
let _ = self.cx.update();
}
// no device to play on (none plugged in): looked for again in a second
Err(e) => {
if !self.device.is_empty() {
eprintln!("raea mixer: no sound: {e}");
}
self.device.clear();
}
}
self._stream = Some(stream);
self.resting = false;
self.origin = None;
self.settled = false;
self.opened = std::time::Instant::now();
let _ = self.cx.update();
}
/// The device stream stopped (after stop_all and its fade-outs: nothing is heard): no callback runs, so neither the
@@ -432,6 +465,64 @@ impl Live {
}
}
/// The default output device, at 48 kHz when it takes it, `block` frames a callback when it takes that: Firewheel's
/// processor pulled from cpal's callback, as the bounce pulls it into a buffer (stereo, spread over the device's
/// channels).
fn start(cx: &mut FirewheelContext, block: u32, lost: Arc<AtomicBool>) -> Result<(cpal::Stream, u32, String), String> {
let host = cpal::default_host();
let dev = host.default_output_device().ok_or("no audio output device")?;
let name = dev.name().unwrap_or_default();
let def = dev.default_output_config().map_err(|e| format!("audio output: {e}"))?;
let channels = def.channels();
let takes_48k = dev.supported_output_configs().map(|mut c| c.any(|r| r.channels() == channels && r.sample_format() == cpal::SampleFormat::F32 && r.min_sample_rate().0 <= RATE && r.max_sample_rate().0 >= RATE)).unwrap_or(false);
let rate = if takes_48k { RATE } else { def.sample_rate().0 };
let max_block = 8192usize;
let mut proc = cx
.activate(ActivateInfo { sample_rate: std::num::NonZeroU32::new(rate).unwrap(), max_block_frames: std::num::NonZeroU32::new(max_block as u32).unwrap(), num_stream_in_channels: 0, num_stream_out_channels: 2, input_to_output_latency_seconds: 0.0 })
.map_err(|e| format!("the mixer's graph: {e:?}"))?;
let ch = channels as usize;
let began = std::time::Instant::now();
let mut stereo = vec![0f32; max_block * 2];
let empty: [f32; 0] = [];
let mut callback = move |out: &mut [f32], info: &cpal::OutputCallbackInfo| {
let ts = info.timestamp();
let delay = ts.playback.duration_since(&ts.callback);
let frames = out.len() / ch.max(1);
let mut done = 0;
while done < frames {
let k = (frames - done).min(max_block);
let pi = BackendProcessInfo { frames: k, process_timestamp: Some(std::time::Instant::now()), duration_since_stream_start: began.elapsed(), input_stream_status: StreamStatus::empty(), output_stream_status: StreamStatus::empty(), dropped_frames: 0, process_to_playback_delay: delay };
if let (Ok(input), Ok(mut output)) = (InterleavedSlice::new(&empty[..], 0, 0), InterleavedSlice::new_mut(&mut stereo[..k * 2], 2, k)) {
proc.process(&input, &mut output, pi);
}
for i in 0..k {
let (l, r) = (stereo[2 * i], stereo[2 * i + 1]);
let o = &mut out[(done + i) * ch..(done + i + 1) * ch];
match ch {
1 => o[0] = 0.5 * (l + r),
_ => {
o[0] = l;
o[1] = r;
o[2..].fill(0.0);
}
}
}
done += k;
}
};
// the block size when the device's range takes it, else its own
let fits = dev.supported_output_configs().map(|mut c| c.any(|r| r.channels() == channels && matches!(r.buffer_size(), cpal::SupportedBufferSize::Range { min, max } if *min <= block && block <= *max))).unwrap_or(false);
let config = cpal::StreamConfig { channels, sample_rate: cpal::SampleRate(rate), buffer_size: if fits { cpal::BufferSize::Fixed(block) } else { cpal::BufferSize::Default } };
let mut said = raea_io_trace::once::said_once::<cpal::StreamError>("raea mixer");
let broke = move |e: cpal::StreamError| {
lost.store(true, Ordering::Relaxed);
said(e)
};
let stream = dev.build_output_stream(&config, move |o: &mut [f32], i: &cpal::OutputCallbackInfo| callback(o, i), broke, None).map_err(|e| format!("audio stream: {e}"))?;
stream.play().map_err(|e| format!("audio stream: {e}"))?;
Ok((stream, rate, name))
}
impl Drop for Live {
fn drop(&mut self) {
let Some((path, buf)) = self.tap.take() else { return };
-3
View File
@@ -159,9 +159,6 @@ pub fn draw(mut scenes: ResMut<Scenes>, mut vello: ResMut<Vello>, device: Res<Re
}
// the image atlas (each filtered element is an image in it) as large as the device can make, not Vello's 8192
vello::low_level::vello_encoding::set_max_atlas_size(device.limits().max_texture_dimension_2d);
// and the blend spill, grown for a scene whose layers nest past four (raea #247), within what the device binds
let limits = device.limits();
vello::low_level::vello_encoding::set_max_buffer_size((limits.max_storage_buffer_binding_size as u64).min(limits.max_buffer_size));
// and an image larger than the atlas (16384 at most, whatever the device allows) decoded at a size that fits it
// (raea#245: an M5's GPU allows 32768, and a 1080x18000 picture was kept whole and refused)
blitz_dom::net::set_max_image_side(vello::low_level::vello_encoding::max_atlas_size());
-124
View File
@@ -1,124 +0,0 @@
//! 0.1.11's paint reports, each the issue's own repro as HTML, painted by blitz-paint into a recording scene and read
//! back: what is filled, in what colour or brush, and under which clips (no GPU, so every runner checks them).
use anyrender::recording::RenderCommand;
use anyrender::{Paint, Scene};
use bevy::math::UVec2;
use vello::kurbo::{Point, Rect, Shape};
use raea_sys_page::{Page, config};
fn painted(html: &str, w: u32, h: u32) -> Scene {
let mut doc = blitz_html::HtmlDocument::from_html(html, config(Page { size: UVec2::new(w, h), scale: 1.0 })).into_inner();
doc.resolve(0.0);
let mut scene = Scene::new();
blitz_paint::paint_scene(&mut scene, &mut doc, 1.0, w, h, 0, 0);
scene
}
/// Each fill: its brush, its box on the page, and the boxes of the layers it's clipped by.
fn fills(scene: &Scene) -> Vec<(Paint, Rect, Vec<Rect>)> {
let (mut clips, mut out) = (Vec::new(), Vec::new());
for c in &scene.commands {
match c {
RenderCommand::PushLayer(l) => clips.push(l.transform.transform_rect_bbox(l.clip.bounding_box())),
RenderCommand::PushClipLayer(l) => clips.push(l.transform.transform_rect_bbox(l.clip.bounding_box())),
RenderCommand::PopLayer => drop(clips.pop()),
RenderCommand::Fill(f) => out.push((f.brush.clone(), f.transform.transform_rect_bbox(f.shape.bounding_box()), clips.clone())),
_ => {}
}
}
out
}
fn rgb(p: &Paint) -> Option<[u8; 3]> {
match p {
Paint::Solid(c) => {
let c = c.to_rgba8();
(c.a > 0).then_some([c.r, c.g, c.b])
}
_ => None,
}
}
/// What of `color` is drawn: the fills in it, each cut by its clips (None when a clip leaves none of it).
fn drawn(scene: &Scene, color: [u8; 3]) -> Vec<Rect> {
fills(scene)
.into_iter()
.filter(|(p, ..)| rgb(p) == Some(color))
.filter_map(|(_, r, clips)| {
let cut = clips.iter().fold(r, |a, c| a.intersect(*c));
(cut.width() > 0.0 && cut.height() > 0.0).then_some(cut)
})
.collect()
}
/// raea #250: `clip-path: inset(0 0 0 100%)` clips the element away (it drew whole); 99% leaves a sliver
#[test]
fn a_clip_path_inset_that_clips_everything_draws_nothing() {
let page = |inset: &str| {
format!(
r#"<body style="margin:0;background:#fff"><div style="padding:40px"><div style="position:relative;width:400px;height:300px;background:#0f0">
<div style="position:absolute;inset:0;background:#f00;clip-path:inset({inset})"></div></div></div></body>"#
)
};
for inset in ["0 0 0 100%", "100% 0 0 0", "0 60% 0 50%", "0 0 0 120%"] {
let s = painted(&page(inset), 700, 400);
assert_eq!(drawn(&s, [255, 0, 0]), vec![], "inset({inset}) drew red");
assert_eq!(drawn(&s, [0, 255, 0]).len(), 1, "inset({inset}) lost the green box");
}
let sliver = drawn(&painted(&page("0 0 0 99%"), 700, 400), [255, 0, 0]);
assert_eq!(sliver.len(), 1);
assert!((sliver[0].width() - 4.0).abs() < 0.01 && (sliver[0].height() - 300.0).abs() < 0.01, "{sliver:?}");
}
/// raea #251: an <svg> with `overflow: visible` draws past its viewport (a 1x1 svg drew nothing); without it, the
/// UA sheet still clips it to its box, as Chrome does
#[test]
fn an_svg_with_overflow_visible_draws_past_its_viewport() {
let page = |overflow: &str| {
format!(
r##"<body style="margin:0;background:#fff"><svg xmlns="http://www.w3.org/2000/svg" style="position:absolute;left:0;top:0;{overflow}" width="1" height="1">
<circle cx="200" cy="200" r="80" fill="#ff6600"/><polygon points="0,-40 32,24 -28,20" transform="translate(400 200) rotate(30)" fill="#3366ff"/></svg></body>"##
)
};
let s = painted(&page("overflow:visible"), 700, 400);
let circle = drawn(&s, [255, 102, 0]);
assert_eq!(circle.len(), 1, "the circle: {circle:?}");
assert!(circle[0].contains(Point::new(200.0, 200.0)) && circle[0].width() > 150.0, "{circle:?}");
let triangle = drawn(&s, [51, 102, 255]);
assert!(triangle.len() == 1 && triangle[0].contains(Point::new(400.0, 200.0)), "the triangle: {triangle:?}");
// the UA's clip, and an author's overflow: hidden, keep it in its 1x1 box
for overflow in ["", "overflow:hidden"] {
let s = painted(&page(overflow), 700, 400);
assert_eq!(drawn(&s, [255, 102, 0]), vec![], "{overflow:?} drew the circle past the box");
}
}
/// raea #248: a background-image on an inline element is drawn on each of its line fragments (it drew nothing, its
/// background-color did), laid out across the fragments side by side, so `background-size: 10% 100%` covers part of the
/// first line's fragment and nothing of the others'
#[test]
fn an_inline_elements_background_image_fills_its_line_fragments() {
let page = |size: &str| {
format!(
r#"<body style="margin:0;background:#fff"><div style="padding:40px;font-size:40px;line-height:50px"><div style="width:300px">Before <span id="m" style="background-image:linear-gradient(#FFD43B, #FFD43B);background-repeat:no-repeat;background-size:{size}">this marked phrase wraps over lines</span> after.</div></div></body>"#
)
};
let gradients = |s: &Scene| -> Vec<Rect> {
fills(s)
.into_iter()
.filter(|(p, ..)| matches!(p, Paint::Gradient(_)))
.filter_map(|(_, r, clips)| {
let cut = clips.iter().fold(r, |a, c| a.intersect(*c));
(cut.width() > 1.0 && cut.height() > 1.0).then_some(cut)
})
.collect()
};
let full = gradients(&painted(&page("100% 100%"), 700, 400));
assert!(full.len() >= 2, "a fill on each line's fragment: {full:?}");
let mut tops: Vec<i64> = full.iter().map(|r| r.y0.round() as i64).collect();
tops.dedup();
assert!(tops.len() >= 2, "on more than one line: {full:?}");
// 10% of the fragments side by side: on the first line alone
let half = gradients(&painted(&page("10% 100%"), 700, 400));
assert!(!half.is_empty() && half.iter().all(|r| r.y0 < full.iter().map(|f| f.y0).fold(f64::MAX, f64::min) + 1.0), "{half:?} vs {full:?}");
}
-4
View File
@@ -55,7 +55,6 @@ raea-core-ask = "core"
raea-sys-k = "systems"
raea-sys-mix = "systems"
raea-sys-mix-level = "systems"
raea-sys-mix-device = "systems"
raea-sys-tone = "systems"
raea-seedling = "systems"
raea-sys-ml = "systems"
@@ -169,7 +168,6 @@ raea-runtime-twins = "runtime"
raea-runtime-dom = "runtime"
raea-runtime-dom-media = "runtime"
raea-runtime-edit = "runtime"
raea-runtime-goal-plan = "runtime"
raea-runtime-input = "runtime"
raea-runtime-bake = "runtime"
raea-runtime-bundle = "runtime"
@@ -296,8 +294,6 @@ raea-sys-rt = true
raea-sys-mix = true
# the mix before the master: dialogue at one level, room tone at the joins (the mix masters what it gives)
raea-sys-mix-level = true
# the mixer's output: the device stream live play runs in, followed when the system's output changes
raea-sys-mix-device = true
raea-sys-tone = true
raea-sys-ml = true
raea-sys-mlx = true
+2 -5
View File
@@ -18,12 +18,9 @@ die() { echo "promoted-from: $*" >&2; exit 1; }
# tests include tools/release.sh and an sdk/guides page, and tests aren't in a release build). The skills (skills/, the
# raea-skills pin) and docs/ are read by no build either (11-11, Shane: "promote skills to the latest possible"):
# release.sh packs the skills the release's commit pins, and the skills gate (its skills-passed line) and check-cli
# hold them to the candidate's binaries, so newer skills go out on a candidate's binaries. The layers gate's files
# (tools/layers.sh and its layers.toml) are read by CI's check of the crate graph only (11-26: 0.1.11-rc2's commit failed
# CI on a crate with no layer, and the one-line fix would have forced a rebuild)
# hold them to the candidate's binaries, so newer skills go out on a candidate's binaries
SAME=(':(exclude)README.md' ':(exclude).github' ':(exclude)tools/release.sh' ':(exclude)tools/release-check.sh' ':(exclude)tools/release-appimage.sh'
':(exclude)tools/release' ':(exclude)tools/agents' ':(exclude)tools/raea-app' ':(exclude)skills' ':(exclude)docs'
':(exclude)tools/layers.sh' ':(exclude)tools/layers.toml' ':(exclude)tools/layers.allow')
':(exclude)tools/release' ':(exclude)tools/agents' ':(exclude)tools/raea-app' ':(exclude)skills' ':(exclude)docs')
fetch_tag() { git cat-file -e "refs/tags/$1" 2>/dev/null || git fetch -q --depth=1 origin "refs/tags/$1:refs/tags/$1"; }
differ() { git diff --name-only "$1^{commit}" "$2^{commit}" -- . "${SAME[@]}"; }
-6
View File
@@ -11,12 +11,6 @@
svg|*:not(svg|svg), svg|*:not(svg|foreignObject) > svg|svg {
transform-origin: 0 0;
}
/* raea: Chrome's svg.css clips an inner <svg> to its viewport (`svg:not(:root) { overflow: hidden }`), which
* `overflow: visible` lifts (raea #251). `clip` rather than `hidden`, so an svg is no scroll container and lays out
* as it did (a flex item keeps its automatic minimum size); blitz-paint's draw_svg reads it */
svg|svg:not(:root) {
overflow: clip;
}
@font-face {
font-family: -moz-bullet-font;
+2 -36
View File
@@ -882,15 +882,13 @@ impl<'dom, 'a> BlitzDomPainter<'dom, 'a> {
// The root element's overflow is propagated to the viewport (which is clipped by the
// window/surface bounds), so the root element must not clip its own overflow.
let is_root_element = self.root_element_id == Some(node_id);
// raea: an inline <svg>'s overflow clip is drawn by draw_svg, and only when its drawing spills past its
// viewport: the UA sheet's `overflow: clip` on every svg would otherwise be a clip layer for every icon (#251)
let is_inline_svg = node.element_data().is_some_and(|e| &*e.name.local == "svg" && matches!(e.image_data(), Some(blitz_dom::node::ImageData::Svg(_))));
let should_clip = !is_root_element
&& (is_image
|| is_sub_doc
|| is_text_input
|| contain_paint
|| (!is_inline_svg && (!matches!(overflow_x, Overflow::Visible) || !matches!(overflow_y, Overflow::Visible))));
|| !matches!(overflow_x, Overflow::Visible)
|| !matches!(overflow_y, Overflow::Visible));
// Apply padding/border offset to inline root
let taffy::Layout {
@@ -1169,11 +1167,6 @@ impl<'dom, 'a> BlitzDomPainter<'dom, 'a> {
// Compute clip-path (if any) and wrap all rendering in a clip layer
let clip_path_shape = cx.clip_path_shape();
// raea: a clip-path with no area (an inset that clips everything, a circle(0)) hides the element and all it
// draws, its shadows and outline included, as `clip: rect()` of no area does below (raea #250)
if clip_path_shape.as_ref().is_some_and(|(p, _)| p.bounding_box().is_zero_area()) {
return;
}
let has_clip_path = clip_path_shape.is_some();
let clip_fill = clip_path_shape.as_ref().map_or(peniko::Fill::NonZero, |s| s.1);
let default_clip = cx.frame.border_box_path();
@@ -1872,30 +1865,12 @@ impl ElementCx<'_, '_> {
(pos.y - text_layout.block_offset as f64 - (layout.padding.top + layout.border.top) as f64) * self.scale,
))
* Affine::scale(self.scale);
// raea: an inline element's background images (#248), drawn by an ElementCx whose box is `at` (its
// fragments side by side, in CSS px from the root's border box), with its own borders and padding (an
// inline box has no Taffy layout of its own; a percentage padding is of the root's content width)
let content_width = CSSPixelLength::new(layout.content_box_width());
let images = |scene: &mut _, id: NodeId, at: Rect| {
let Some(node) = self.context.dom.get_node(id) else { return };
let Some(st) = node.primary_styles() else { return };
let (b, p) = (st.get_border(), st.get_padding());
let pad = |v: &style::values::computed::NonNegativeLengthPercentage| v.0.resolve(content_width).px();
let mut l = taffy::Layout::new();
l.size = taffy::Size { width: at.width() as f32, height: at.height() as f32 };
l.border = taffy::Rect { left: b.border_left_width.0.to_f32_px(), right: b.border_right_width.0.to_f32_px(), top: b.border_top_width.0.to_f32_px(), bottom: b.border_bottom_width.0.to_f32_px() };
l.padding = taffy::Rect { left: pad(&p.padding_left), right: pad(&p.padding_right), top: pad(&p.padding_top), bottom: pad(&p.padding_bottom) };
// the box's corner at device scale: border_box is in CSS px, an ElementCx's transform in device px
let t = border_box * Affine::translate((at.x0, at.y0)) * Affine::scale(1.0 / self.scale);
self.context.element_cx(node, l, t, None).draw_inline_background_images(scene);
};
crate::text::draw_inline_backgrounds(
scene,
text_layout.layout.lines(),
self.context.dom,
border_box,
self.node.id,
images,
);
// Render text selection highlight (if any) using cached selection ranges
@@ -2397,15 +2372,6 @@ impl ElementCx<'_, '_> {
let b = tree.root().abs_stroke_bounding_box();
let (sw, sh) = (svg_size.width(), svg_size.height());
let spills = b.left() < -0.01 || b.top() < -0.01 || b.right() > sw + 0.01 || b.bottom() > sh + 0.01;
// raea: an inline <svg>'s clip is its `overflow` (the UA sheet's `svg|svg:not(:root) { overflow: clip }`), so
// `overflow: visible` draws what reaches past its viewport, as Chrome does: a 1x1 svg drawing particles in page
// coordinates drew nothing (raea #251). An SVG image (<img>) is always clipped to its box.
let b = self.style.get_box();
let clips = !inline || !matches!(b.overflow_x, Overflow::Visible) || !matches!(b.overflow_y, Overflow::Visible);
if spills && !clips {
anyrender_svg::render_svg_tree_in(scene, &tree, transform, host, in_css);
return;
}
if spills {
self.context.layer_manager.maybe_with_layer(scene, true, 1.0, self.transform, &self.frame.content_box_path(), None, None, |scene| {
anyrender_svg::render_svg_tree_in(scene, &tree, transform, host, in_css);
+23 -41
View File
@@ -137,6 +137,7 @@ impl<'a> ImageLayerStyles<'a> {
impl ElementCx<'_, '_> {
pub(super) fn draw_background(&self, scene: &mut impl PaintScene) {
let bg_styles = &self.style.get_background();
let image_data = &self.element.background_images;
let layer_count = bg_styles.background_image.0.len();
// The background color is clipped by the clip of the last layer in the list
@@ -155,7 +156,28 @@ impl ElementCx<'_, '_> {
self.context.layer_manager.maybe_with_blend_layer(scene, isolated, 1.0, Some(peniko::Mix::Normal.into()), self.transform, &bounds, None, None, |scene| {
// Draw background color (if any)
self.draw_solid_bg(scene, &background_clip_path);
self.draw_background_layers(scene, &blends);
for idx in (0..layer_count).rev() {
let layer = ImageLayerStyles::from_background(bg_styles, image_data, idx);
if layer_paints_nothing(&layer) {
continue;
}
let background_clip_path = self.box_path(layer.clip);
self.context.layer_manager.maybe_with_blend_layer(
scene,
true,
1.0,
blends[idx],
self.transform,
&background_clip_path,
None,
None,
|scene| {
self.draw_image_layer(scene, &layer);
},
);
}
if text {
let dest_in = peniko::BlendMode::new(peniko::Mix::Normal, peniko::Compose::DestIn);
self.context.layer_manager.maybe_with_blend_layer(scene, true, 1.0, Some(dest_in), self.transform, &bounds, None, None, |scene| self.draw_text_mask(scene));
@@ -163,46 +185,6 @@ impl ElementCx<'_, '_> {
});
}
/// The background's image layers, bottom first, each in its clip and blended by `blends` (draw_background's)
fn draw_background_layers(&self, scene: &mut impl PaintScene, blends: &[Option<peniko::BlendMode>]) {
let bg_styles = &self.style.get_background();
let image_data = &self.element.background_images;
for idx in (0..bg_styles.background_image.0.len()).rev() {
let layer = ImageLayerStyles::from_background(bg_styles, image_data, idx);
if layer_paints_nothing(&layer) {
continue;
}
let background_clip_path = self.box_path(layer.clip);
self.context.layer_manager.maybe_with_blend_layer(
scene,
true,
1.0,
blends.get(idx).copied().flatten(),
self.transform,
&background_clip_path,
None,
None,
|scene| {
self.draw_image_layer(scene, &layer);
},
);
}
}
/// raea: an inline element's background images on one of its fragments (text.rs draw_inline_backgrounds, raea
/// #248), its frame the box its fragments make side by side: the layers alone, as the fragments' colour, borders
/// and clip are text.rs's; in a group of their own when a layer blends (blended with each other, not its colour)
pub(super) fn draw_inline_background_images(&self, scene: &mut impl PaintScene) {
let n = self.style.get_background().background_image.0.len();
let blends: Vec<_> = (0..n).map(|i| crate::blend::background_blend(&self.style, i)).collect();
let bounds = self.frame.border_box_path().bounding_box();
let isolated = blends.iter().any(Option::is_some);
self.context.layer_manager.maybe_with_blend_layer(scene, isolated, 1.0, Some(peniko::Mix::Normal.into()), self.transform, &bounds, None, None, |scene| {
self.draw_background_layers(scene, &blends);
});
}
/// The path of the given CSS box model box for this element
pub(super) fn box_path(&self, css_box: BoxModelBox) -> crate::kurbo_css::BoxShape {
match css_box {
+1 -3
View File
@@ -174,10 +174,8 @@ impl ElementCx<'_, '_> {
let x1 = ox + w - right;
let y1 = oy + h - bottom;
// raea: an inset that meets or crosses itself clips everything (an empty clip region), not nothing:
// None meant no clip-path, so `inset(0 0 0 100%)` drew the whole element (raea #250)
if x1 <= x0 || y1 <= y0 {
return Some(BezPath::new());
return None;
}
// TODO: Support border-radius on inset()
+3 -18
View File
@@ -115,18 +115,12 @@ fn snap_glyph(x: f32, y: f32, at: Affine) -> (f32, f32) {
///
/// The inline root's own background is painted separately (as a normal block box). `transform` is the root's
/// border box at device scale.
///
/// raea: its background images too (raea #248: a highlighter's `linear-gradient` on a phrase drew nothing, its colour
/// alone did), by `images` (the element, and the box they're laid out in, in the root's CSS px): each fragment clipped
/// to itself from one box as wide as all its fragments side by side, as Chrome's `box-decoration-break: slice` lays a
/// background out, so a `background-size` of 0% to 100% sweeps across the lines in turn.
pub(crate) fn draw_inline_backgrounds<'a, S: PaintScene>(
scene: &mut S,
pub(crate) fn draw_inline_backgrounds<'a>(
scene: &mut impl PaintScene,
lines: impl Iterator<Item = Line<'a, TextBrush>>,
doc: &BaseDocument,
transform: Affine,
inline_root_id: NodeId,
mut images: impl FnMut(&mut S, NodeId, Rect),
) {
let mut seen: Vec<(usize, NodeId)> = Vec::new();
let mut add = |mut id: NodeId| {
@@ -175,15 +169,12 @@ pub(crate) fn draw_inline_backgrounds<'a, S: PaintScene>(
side(&border.border_bottom_width, &border.border_bottom_color, border.border_bottom_style),
side(&border.border_left_width, &border.border_left_color, border.border_left_style),
];
let has_images = styles.get_background().background_image.0.iter().any(|i| !matches!(i, style::values::generics::image::GenericImage::None));
if bg == Color::TRANSPARENT && !has_images && [top, right, bottom, left].iter().all(Option::is_none) {
if bg == Color::TRANSPARENT && [top, right, bottom, left].iter().all(Option::is_none) {
continue;
}
let Some(frags) = node.inline_fragment_boxes() else { continue };
let frags: Vec<_> = frags.collect();
let n = frags.len();
let slices = frags.iter().map(|f| (f.right - f.left) as f64).sum::<f64>();
let mut before = 0.0;
for (i, f) in frags.into_iter().enumerate() {
let r = Rect::new(f.left as f64, f.top as f64, f.right as f64, f.bottom as f64);
let (first, last) = (i == 0, i + 1 == n);
@@ -205,12 +196,6 @@ pub(crate) fn draw_inline_backgrounds<'a, S: PaintScene>(
if bg != Color::TRANSPARENT {
scene.fill(Fill::NonZero, transform, bg, None, &shape);
}
if has_images {
scene.push_clip_layer(Fill::NonZero, transform, &shape);
images(scene, id, Rect::new(r.x0 - before, r.y0, r.x0 - before + slices, r.y1));
scene.pop_layer();
}
before += r.width();
if rounded {
scene.push_clip_layer(Fill::NonZero, transform, &shape);
}
+1 -58
View File
@@ -411,8 +411,7 @@ impl BufferSizes {
let seg_counts = BufferSize::new(bump.seg_counts.max(1));
let segments = BufferSize::new(bump.segments.max(1));
// 16 * 16 (1 << 8) is one blend spill, so the default allows for 4096 spills.
// raea: and room for every tile to spill as deep as the scene's layers nest (`blend_spill_for`)
let blend_spill = BufferSize::new(bump.blend_spill.max(blend_spill_for(n_tiles, LAYER_DEPTH.get())).max(1));
let blend_spill = BufferSize::new(bump.blend_spill.max(1));
let ptcl = BufferSize::new(bump.ptcl.max(1));
Self {
path_reduced,
@@ -510,41 +509,6 @@ fn grown(base: BumpAllocationSizes, n_tiles: u32) -> BumpAllocationSizes {
}
}
/// raea: the layers a tile's blend stack holds in the fine stage's registers (shader/shared/config.wgsl's
/// BLEND_STACK_SPLIT); each layer deeper is a spill of the tile's 16x16 pixels into the blend spill buffer
pub const BLEND_STACK_SPLIT: u32 = 4;
std::thread_local! {
/// raea: the nesting of the scene this thread resolved last (resolve.rs `layer_depth`), which the render's config,
/// made from that resolve's layout on the same thread (vello's render_encoding_coarse), sizes its blend spill by
static LAYER_DEPTH: std::cell::Cell<u32> = const { std::cell::Cell::new(0) };
}
pub(crate) fn set_layer_depth(depth: u32) {
LAYER_DEPTH.set(depth);
}
/// raea: the largest storage buffer the device binds, in bytes (`set_max_buffer_size`); wgpu's default limit until the
/// embedder gives its device's
static MAX_BUFFER_BYTES: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(128 << 20);
/// raea: the largest storage buffer the device binds (wgpu's `max_storage_buffer_binding_size`), which a blend spill
/// grown for a deep scene stays within
pub fn set_max_buffer_size(bytes: u64) {
MAX_BUFFER_BYTES.store(bytes.max(1 << 20), std::sync::atomic::Ordering::Relaxed);
}
/// raea: the blend spill (u32 pixels) a render of `n_tiles` needs when its layers nest `depth` deep: every tile spills
/// what's deeper than BLEND_STACK_SPLIT, 256 pixels a layer (coarse.wgsl's `scratch_size`), up to the largest buffer
/// the device binds. Vello's fixed size (1 << 20, raea-page's 1 << 18) holds 4096 spills, and a 1080x1920 page has 8160
/// tiles, so a single full-frame layer past the fourth (two nested masks in a faded group) overflowed it, and the
/// frame wasn't drawn even at Vello's own sizes (raea #247).
pub fn blend_spill_for(n_tiles: u32, depth: u32) -> u32 {
let need = n_tiles as u64 * depth.saturating_sub(BLEND_STACK_SPLIT) as u64 * (TILE_WIDTH * TILE_HEIGHT) as u64;
let most = MAX_BUFFER_BYTES.load(std::sync::atomic::Ordering::Relaxed) / 4;
need.min(most).min(u32::MAX as u64) as u32
}
static BUMP_FULL: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);
/// raea: these defaults for the renders from now on (true), the embedder's sizes again (false): a frame drawn again
@@ -568,27 +532,6 @@ mod tests {
w.div_ceil(TILE_WIDTH) * h.div_ceil(TILE_HEIGHT)
}
/// raea #247: two nested masks in a faded group on a 1080x1920 page are layers seven deep over every tile
#[test]
fn blend_spill_holds_every_tile_spilling_as_deep_as_the_scene_nests() {
let n = tiles(1080, 1920);
assert_eq!(n, 8160);
// four layers or fewer stay in the fine stage's registers: the set size alone
assert_eq!(blend_spill_for(n, 4), 0);
// one past four on every tile is 8160 spills of 256 pixels: past Vello's 4096 spills, which refused the frame
assert_eq!(blend_spill_for(n, 5), 8160 * 256);
assert!(blend_spill_for(n, 5) > BumpAllocationSizes::default().blend_spill);
// the config a render makes after resolving a scene of that depth has the room
set_layer_depth(7);
let layout = Layout::default();
let cfg = RenderConfig::new(&layout, 1080, 1920, &peniko::Color::TRANSPARENT);
assert_eq!(cfg.gpu.blend_size, 8160 * 3 * 256);
assert_eq!(cfg.buffer_sizes.blend_spill.len(), cfg.gpu.blend_size);
// and never past the largest buffer the device binds (128 MiB until it's given)
assert_eq!(blend_spill_for(tiles(15360, 8640), 40) as u64 * 4, 128 << 20);
set_layer_depth(0);
}
#[test]
fn bump_sizes_grow_past_1080p() {
// up to 1080p the set sizes, ptcl with every tile's initial allocation on top
+1 -2
View File
@@ -54,7 +54,6 @@ pub use clip::{Clip, ClipBbox, ClipBic, ClipElement};
pub use config::{
BufferSize, BufferSizes, BumpAllocationSizes, BumpAllocatorMemory, BumpAllocators, ConfigUniform, IndirectCount,
PTCL_INITIAL_ALLOC, RenderConfig, WorkgroupCounts, WorkgroupSize, bump_sizes_for, set_bump_allocation_sizes, set_bump_full, set_blend_linear,
BLEND_STACK_SPLIT, blend_spill_for, set_max_buffer_size,
};
pub use draw::{
DRAW_INFO_FLAGS_FILL_RULE_BIT, DrawBbox, DrawBeginClip, DrawBlurRoundedRect, DrawColor,
@@ -70,7 +69,7 @@ pub use path::{
PathTag, SegmentCount, Style, Tile,
};
pub use ramp_cache::Ramps;
pub use resolve::{Layout, Patch, Resolver, layer_depth, resolve_solid_paths_only, take_images_left_out};
pub use resolve::{Layout, Patch, Resolver, resolve_solid_paths_only, take_images_left_out};
#[cfg(feature = "bump_estimate")]
pub use estimate::BumpEstimator;
-44
View File
@@ -185,8 +185,6 @@ impl Resolver {
encoding: &Encoding,
packed: &mut Vec<u8>,
) -> (Layout, Ramps<'a>, Images<'a>) {
// raea: the scene's layer nesting, which sizes its blend spill (config.rs `blend_spill_for`)
crate::config::set_layer_depth(layer_depth(&encoding.draw_tags));
let resources = &encoding.resources;
if resources.patches.is_empty() {
let layout = resolve_solid_paths_only(encoding, packed);
@@ -565,21 +563,6 @@ impl Resolver {
}
}
/// raea: how deep the scene's layers (begin clips, a clip layer or a blended one alike) nest at most: a tile's blend
/// stack is never deeper, as coarse.wgsl counts a begin clip that touches the tile into its `max_blend_depth`.
pub fn layer_depth(tags: &[DrawTag]) -> u32 {
let (mut depth, mut deepest) = (0u32, 0u32);
for tag in tags {
if *tag == DrawTag::BEGIN_CLIP {
depth += 1;
deepest = deepest.max(depth);
} else if *tag == DrawTag::END_CLIP {
depth = depth.saturating_sub(1);
}
}
deepest
}
static IMAGES_LEFT_OUT: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(0);
/// raea: how many images the resolves since the last call left out, the atlas having no room for them at its largest
@@ -705,33 +688,6 @@ mod tests {
use super::*;
use peniko::{Blob, ImageAlphaType, ImageFormat};
/// raea #247: the resolve measures how deep the scene's layers nest, and the render's config made after it gives
/// the blend spill room for every tile to spill that deep: here layers six deep beside a lone one, two past the
/// fine stage's four on each of a 1080x1920 page's 8160 tiles
#[test]
fn a_resolve_sizes_the_blend_spill_by_how_deep_its_layers_nest() {
use crate::{DrawBeginClip, RenderConfig};
let mut encoding = Encoding::new();
let layer = DrawBeginClip::new(peniko::Mix::Normal.into(), 0.9);
for _ in 0..6 {
encoding.encode_begin_clip(layer);
}
for _ in 0..6 {
encoding.encode_end_clip();
}
encoding.encode_begin_clip(layer);
encoding.encode_end_clip();
assert_eq!(layer_depth(&encoding.draw_tags), 6);
let mut packed = Vec::new();
let (layout, _, _) = Resolver::new().resolve(&encoding, &mut packed);
let cfg = RenderConfig::new(&layout, 1080, 1920, &peniko::Color::TRANSPARENT);
assert_eq!(cfg.gpu.blend_size, 8160 * 2 * 256);
// a shallow scene after it is back at the set size
let (layout, _, _) = Resolver::new().resolve(&Encoding::new(), &mut packed);
let cfg = RenderConfig::new(&layout, 1080, 1920, &peniko::Color::TRANSPARENT);
assert_eq!(cfg.gpu.blend_size, crate::bump_sizes_for(8160).blend_spill);
}
/// raea: frame `f`'s `n` images, each new (a blob of its own) and near a 1080p frame's size, a few px apart and
/// differently in each frame: raea-page's layers under a moving camera, each a placeholder the size of its box
fn frame(n: u32, f: u32) -> Encoding {
+3 -3
View File
@@ -70,14 +70,14 @@ exit = "a bevy_ui_widgets release on parley 0.12"
path = "vendor/blitz-paint"
upstream = "crates.io:0.3.0-beta.4"
kind = "patch"
reason = "angled tile gradients, many-tile gradient layers as one brush, text-shadow, ellipsis, inline-box opacity, box-shadow blur as Chrome's; filters by GPU passes (B4a/B4b); z-index boxes clipped by the overflow between them and their stacking context; a range input's thumb; what an element paints at an offset of its own (background position and tiles, box and text shadows, scroll, inline SVG) placed in its own axes under a rotated ancestor (#18); background-clip: text, its background masked by the text of the element and everything in it (#37) as Chrome does, unscrolled; inline text in a scroller scrolled once, not twice (#46); a rounded corner where one side has no width (a left-only border on a rounded box), which drew nothing; a bevy_ui node's box shadow (data-raea-bevy-shadow, its BoxShadowSamples) drawn as bevy_ui draws it: spread by its width and its height and corners by the same ratio, then blurred as box_shadow.wesl blurs it, from a CPU bitmap (render/bevy_shadow.rs); a stacking context's out-of-flow boxes from containing blocks above it kept in its layer and not culled (raea #39); a filter's layer over the boxes the element and its descendants draw (up to the overflow clips in their way), not its border box alone; a filter of opacity() functions alone drawn as the layer's alpha, not as an atlas image (raea #96); an inline run whose element is visibility: hidden isn't drawn, though it keeps its place in the line (raea #13); a filter's layer the size of what the element and its descendants draw, a box that draws nothing (a full-frame wrapper) left out of it, as Chrome sizes a filter's input (raea #125); a clip-path of no area (an inset that clips everything) hides the element, not draws it unclipped (raea #250); an inline element's background images on its line fragments, laid out over them side by side as box-decoration-break: slice does (raea #248); an inline <svg> clipped to its viewport by its `overflow`, so `overflow: visible` draws past it (raea #251)"
reason = "angled tile gradients, many-tile gradient layers as one brush, text-shadow, ellipsis, inline-box opacity, box-shadow blur as Chrome's; filters by GPU passes (B4a/B4b); z-index boxes clipped by the overflow between them and their stacking context; a range input's thumb; what an element paints at an offset of its own (background position and tiles, box and text shadows, scroll, inline SVG) placed in its own axes under a rotated ancestor (#18); background-clip: text, its background masked by the text of the element and everything in it (#37) as Chrome does, unscrolled; inline text in a scroller scrolled once, not twice (#46); a rounded corner where one side has no width (a left-only border on a rounded box), which drew nothing; a bevy_ui node's box shadow (data-raea-bevy-shadow, its BoxShadowSamples) drawn as bevy_ui draws it: spread by its width and its height and corners by the same ratio, then blurred as box_shadow.wesl blurs it, from a CPU bitmap (render/bevy_shadow.rs); a stacking context's out-of-flow boxes from containing blocks above it kept in its layer and not culled (raea #39); a filter's layer over the boxes the element and its descendants draw (up to the overflow clips in their way), not its border box alone; a filter of opacity() functions alone drawn as the layer's alpha, not as an atlas image (raea #96); an inline run whose element is visibility: hidden isn't drawn, though it keeps its place in the line (raea #13); a filter's layer the size of what the element and its descendants draw, a box that draws nothing (a full-frame wrapper) left out of it, as Chrome sizes a filter's input (raea #125)"
exit = "a Blitz release that draws these"
[blitz-dom]
path = "vendor/blitz-dom"
upstream = "crates.io:0.3.0-beta.4"
kind = "patch"
reason = "inline flex/grid baselines, auto table columns, table row rects, inline image load events, SVG text fonts, SVG non-scaling strokes, url() filters; Blitz main's #1244 and #1246; a node removed in a mutation batch dropped from the style, form and title nodes the batch flushes (raea #24); a node in a 3D rendering context (or with a projection) placed again on every resolve, so it follows a preserve-3d parent whose transform a script set (raea #19); a ParseErrorReporter (not_applied.rs) on every author parse, keeping what stylo drops for the render to say once (raea #34); a bevy_text box whose lines are no finite size (an Apple bitmap-only face, which parley scales by a units-per-em of 0) measures 0 by 0, as bevy_text does; a family list ending in ; getBoundingClientRect and the geometry walks stop at a freed containing-block link instead of panicking on its key, and an element in a display: none subtree answers a zero rect (raea #108)"raea-bevy fallback" (bevy_text's FontSource::Family) falls to the collection's fallback families, not to serif nor to the CoreText pick (parley: NO_HOOK_FAMILY); an out-of-flow box painted by the stacking context between it and its containing block, inside its opacity group (raea #39); an SVG's paint properties from CSS written into its serialized source for usvg (raea #45); transform-box: stroke-box as fill-box under non-scaling-stroke, a stylesheet's stroke in the stroke box, and the non-scaling mark on an element with its own id (raea #50); an SVG element's rewritten style attribute without a leading `;` when its own declarations were transforms alone; transform-box: view-box's reference box at the origin of user space, not at the viewBox's x and y; every inline box laid out in full while its line is only measured, since Taffy's measure cache keeps a box's size without its baseline (raea #109); an inline element has a border edge only where its border has a style, so a plain span (border-style none, its width still `medium`) doesn't split the shaping at its edges and lose the kerning across them (docs/layout-reads.feature LR10); an app-bundled svg face of a family the page already gave is left out, as one given before the page's is removed (raea/text loadFont fetches Google's faces at import, LR10); getBoundingClientRect through a perspective's projection (the node's Projection), and transformed_rect for a rect inside a node's box (LR10); an element whose `:has()` was matched is matched again when a node under it is inserted or removed (raea layers LA2a: a caption a <Sequence> put on the page stayed hidden under `:not(:has(...))`); a picture fitted to the raea-w/raea-h its URL asks (net.rs fit); the UA sheet's `svg|svg:not(:root) { overflow: clip }` (Chrome's hidden, as clip so layout is unchanged), which blitz-paint's draw_svg reads (raea #251)"
reason = "inline flex/grid baselines, auto table columns, table row rects, inline image load events, SVG text fonts, SVG non-scaling strokes, url() filters; Blitz main's #1244 and #1246; a node removed in a mutation batch dropped from the style, form and title nodes the batch flushes (raea #24); a node in a 3D rendering context (or with a projection) placed again on every resolve, so it follows a preserve-3d parent whose transform a script set (raea #19); a ParseErrorReporter (not_applied.rs) on every author parse, keeping what stylo drops for the render to say once (raea #34); a bevy_text box whose lines are no finite size (an Apple bitmap-only face, which parley scales by a units-per-em of 0) measures 0 by 0, as bevy_text does; a family list ending in ; getBoundingClientRect and the geometry walks stop at a freed containing-block link instead of panicking on its key, and an element in a display: none subtree answers a zero rect (raea #108)"raea-bevy fallback" (bevy_text's FontSource::Family) falls to the collection's fallback families, not to serif nor to the CoreText pick (parley: NO_HOOK_FAMILY); an out-of-flow box painted by the stacking context between it and its containing block, inside its opacity group (raea #39); an SVG's paint properties from CSS written into its serialized source for usvg (raea #45); transform-box: stroke-box as fill-box under non-scaling-stroke, a stylesheet's stroke in the stroke box, and the non-scaling mark on an element with its own id (raea #50); an SVG element's rewritten style attribute without a leading `;` when its own declarations were transforms alone; transform-box: view-box's reference box at the origin of user space, not at the viewBox's x and y; every inline box laid out in full while its line is only measured, since Taffy's measure cache keeps a box's size without its baseline (raea #109); an inline element has a border edge only where its border has a style, so a plain span (border-style none, its width still `medium`) doesn't split the shaping at its edges and lose the kerning across them (docs/layout-reads.feature LR10); an app-bundled svg face of a family the page already gave is left out, as one given before the page's is removed (raea/text loadFont fetches Google's faces at import, LR10); getBoundingClientRect through a perspective's projection (the node's Projection), and transformed_rect for a rect inside a node's box (LR10); an element whose `:has()` was matched is matched again when a node under it is inserted or removed (raea layers LA2a: a caption a <Sequence> put on the page stayed hidden under `:not(:has(...))`); a picture fitted to the raea-w/raea-h its URL asks (net.rs fit)"
exit = "a Blitz release with #1244/#1246 and these"
[parley_engine]
@@ -119,7 +119,7 @@ exit = "anyrender_svg drawing these"
path = "vendor/vello_encoding"
upstream = "crates.io:0.11.0"
kind = "patch"
reason = "bump buffer sizes set by the embedder (vello#1861's BumpAllocationSizes), not 165 MiB of defaults, grown with the target past 1080p (bump_sizes_for: ptcl holds every tile's initial allocation, which alone filled 99% of a fixed 2M at 4K), and back at the defaults while set_bump_full is on (a frame that came out all black drawn again); glyph tops for the CoreGraphics y-map (RAEA_PAGE_CG_YMAP); a resolve with no images keeps the image atlas (resolve.rs: a solid-only scene reported 0x0, the renderer swapped in a 1x1 atlas and every cached image then drew blank); a full image atlas lets go of what the resolve hasn't used, the longest unused first, and is then packed again with the resolve's images alone, before an image is left out, and the images left out are counted (take_images_left_out: raea-page's layers are new images in every frame, the atlas kept the last two frames' and a page of ten frame-sized layers drew without its nearest); the atlas grows to the device's largest texture (set_max_atlas_size: 16384 on Apple silicon), not 8192 (raea #125); a blend spill with room for every tile to spill as deep as the scene's layers nest (resolve.rs layer_depth, config.rs blend_spill_for, up to set_max_buffer_size): the fixed 4096 spills couldn't hold one full-frame layer past the fourth on a 1080x1920 page (raea #247)"
reason = "bump buffer sizes set by the embedder (vello#1861's BumpAllocationSizes), not 165 MiB of defaults, grown with the target past 1080p (bump_sizes_for: ptcl holds every tile's initial allocation, which alone filled 99% of a fixed 2M at 4K), and back at the defaults while set_bump_full is on (a frame that came out all black drawn again); glyph tops for the CoreGraphics y-map (RAEA_PAGE_CG_YMAP); a resolve with no images keeps the image atlas (resolve.rs: a solid-only scene reported 0x0, the renderer swapped in a 1x1 atlas and every cached image then drew blank); a full image atlas lets go of what the resolve hasn't used, the longest unused first, and is then packed again with the resolve's images alone, before an image is left out, and the images left out are counted (take_images_left_out: raea-page's layers are new images in every frame, the atlas kept the last two frames' and a page of ten frame-sized layers drew without its nearest); the atlas grows to the device's largest texture (set_max_atlas_size: 16384 on Apple silicon), not 8192 (raea #125)"
exit = "vello#1861 in a release; the y-map hook stays ours"
# checked 2026-10-26 for firewheel and its graph, macros and nodes: crates.io 0.14.0 (latest) and Firewheel main 34b35cad stop at glam-32 and bevy_reflect 0.19; bevy_seedling 0.8.0 and its main ab4a88b4 need firewheel 0.12 and Bevy 0.19