Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches: [main, 'compile_v*']
pull_request:
workflow_dispatch:

permissions:
contents: read
Expand Down
12 changes: 12 additions & 0 deletions native/HASHOUT_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -630,3 +630,15 @@ The megakernel entry above is superseded in three points. (1) Adaptive sampling
- kind: verification
- logged: v0.3.0 · 2026-12-02
On lavapipe at 320x240 with the shader cache off: before the change the first switch to adaptive took 1.01 s in `set_adaptive` and 5.34 s for the next pass (a new pipeline); after it every toggle took 0.000 s and the next 1-spp pass 0.13 to 0.24 s. Through the engine (release builds, shader cache off) the first switch reached 3 samples in 0.67 s instead of 7.18 s. Parity against the CPU is unchanged: sample 0.000010, spheres 0.000010, daylight 0.000001, a scene without lights and catcher 0.000011 mean absolute difference at 16 spp; adaptive retired flags 76,799 or 76,800 of 76,800 equal. Variants: `Some(Features::NONE)` built the scene's own kernel; an ALL renderer on a plain scene reported `needs_specialise`, `specialise_async` compiled in 0.99 s, a second call compiled nothing, and the two kernels drew 19,200 of 19,200 pixels bit-identical. Region (rect 80..240 x 60..120): 9,600 of 9,600 pixels inside reached 6 samples bit-identical to a full-film renderer, 67,200 of 67,200 outside kept 2; a region pass took 0.116 s against 1.137 s for the full film. naga: 24 reports OK, Frame 62 members and 288 bytes on both sides. Not run: a real GPU, the region on llvmpipe GL separately, a region over a film split into several bands; the wasm32 path (`specialise_async` awaited in the window) was compiled for wasm32 and run natively only, and the window does not call it yet.

### (workspace) · clippy clean under the pinned toolchain
- refers-to: crates/fsh-core/src/color.rs :: planckian_xy; crates/fsh-materials/src/bsdf.rs :: Bsdf::sample, Bsdf::prepare; crates/fsh-materials/src/tables.rs :: DielGroup, fill_diel; crates/fsh-scene/src/mesh.rs :: compute_normals; crates/fsh-io/src/clean.rs; crates/fsh-io/src/gltf.rs; crates/fsh-io/src/png.rs
- kind: decision
- logged: v0.4.0 · 2026-12-02
CI's engine job runs `./formshot engine check`, which is clippy over the whole workspace with `-D warnings` on the pinned 1.99.1. It failed on main from the 0.2.0 merge on: first on three fsh-core literals, and those errors hid the crates behind them. `planckian_xy` keeps the Kim et al. coefficients as published, with `clippy::excessive_precision` allowed on that one function (each literal rounds to the same f32 either way). `Bsdf::sample` and `Bsdf::prepare` keep their negated comparisons (`!(pdf > 0.0)`, `!(wl.z < 0.0)`, `!(side.abs() > 1e-9)`) because they are also true for NaN, which is how a broken sample is rejected; the rewrite clippy suggests would let NaN through, so `clippy::neg_cmp_op_on_partial_ord` is allowed on those two functions instead. `fill_diel` names its worker groups with a `DielGroup` alias (type_complexity). Fixed-size records are read with `as_chunks::<N>()` instead of `chunks_exact(N)` (the 1.99 lint chunks_exact_to_as_chunks): triangle indices in `compute_normals` and in the clean-up pass, glTF positions and UVs, the PNG palette and tRNS.

### (workspace) · clippy and identity after the lint fixes
- refers-to: crates/fsh-cli :: render, convert, info, bench
- kind: verification
- logged: v0.4.0 · 2026-12-02
Run: `./formshot engine check` passes (cargo check and clippy over the workspace, all targets, `-D warnings`); the same two commands with an empty target folder took 118 s on 2 cores. The fixed release engine against the one built before the fixes: `render sample` (320x240, 8 spp, CPU) byte-identical, 1 and 2 threads byte-identical, the sample written as GLB, imported and rendered byte-identical, `info` identical; `bench` on lavapipe Vulkan and llvmpipe GL still 0.00001 mean absolute difference from the CPU picture.
1 change: 1 addition & 0 deletions native/crates/fsh-core/src/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ pub fn srgb_decode(v: f32) -> f32 {
}

/// CIE 1931 xy chromaticity of a blackbody at `kelvin` (Kim et al. cubic spline, clamped to 1667..25000 K).
#[allow(clippy::excessive_precision)]
pub fn planckian_xy(kelvin: f32) -> (f32, f32) {
let t = 1000.0 / kelvin.clamp(1667.0, 25000.0);
let (t2, t3) = (t * t, t * t * t);
Expand Down
4 changes: 2 additions & 2 deletions native/crates/fsh-io/src/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ fn validate(scene: &mut RawScene, rep: &mut CleanReport, watch: &Watch) -> Resul
let before = m.indices.len() / 3;
let pos = &m.positions;
let mut kept = Vec::with_capacity(m.indices.len());
for t in m.indices.chunks_exact(3) {
for t in m.indices.as_chunks::<3>().0 {
let (a, b, c) = (t[0], t[1], t[2]);
if a == b || b == c || a == c {
continue;
Expand Down Expand Up @@ -320,7 +320,7 @@ fn smooth_normals(m: &mut RawMesh, cos_limit: f32) {
let tris = m.indices.len() / 3;
let mut face = Vec::with_capacity(tris);
let mut unit = Vec::with_capacity(tris);
for t in m.indices.chunks_exact(3) {
for t in m.indices.as_chunks::<3>().0 {
let (a, b, c) = (m.positions[t[0] as usize], m.positions[t[1] as usize], m.positions[t[2] as usize]);
let f = (b - a).cross(c - a);
face.push(f);
Expand Down
4 changes: 2 additions & 2 deletions native/crates/fsh-io/src/gltf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ fn vec3s(f: &[f32], comps: usize, what: &str) -> Result<Vec<Vec3>> {
if comps != 3 {
return malformed(format!("{what} must be VEC3"));
}
Ok(f.chunks_exact(3).map(|c| Vec3::new(c[0], c[1], c[2])).collect())
Ok(f.as_chunks::<3>().0.iter().map(|c| Vec3::new(c[0], c[1], c[2])).collect())
}

/// Reads glTF 2.0 (JSON or GLB) into a raw scene.
Expand Down Expand Up @@ -676,7 +676,7 @@ fn read_mesh(r: &Reader, mj: &Value, mi: usize, scene: &mut RawScene) -> Result<
if c != 2 || f.len() / 2 != n {
return malformed(format!("{mesh_name}: TEXCOORD_{set} must be VEC2 with one entry per vertex"));
}
m.uvs.push(f.chunks_exact(2).map(|c| Vec2::new(c[0], c[1])).collect());
m.uvs.push(f.as_chunks::<2>().0.iter().map(|c| Vec2::new(c[0], c[1])).collect());
set += 1;
}
if let Some(ci) = idx(attrs, "COLOR_0")? {
Expand Down
4 changes: 2 additions & 2 deletions native/crates/fsh-io/src/png.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ pub fn read_png(bytes: &[u8]) -> Result<Picture> {
}
hdr = Some(Header { w, h, depth, ctype, interlace: data[12] == 1 });
}
b"PLTE" => palette = data.chunks_exact(3).map(|c| [c[0], c[1], c[2]]).collect(),
b"PLTE" => palette = data.as_chunks::<3>().0.iter().map(|c| [c[0], c[1], c[2]]).collect(),
b"tRNS" => trns = data.to_vec(),
b"IDAT" => idat.extend_from_slice(data),
b"IEND" => {
Expand Down Expand Up @@ -319,7 +319,7 @@ fn write_pixel(h: &Header, row: &[u8], x: usize, palette: &[[u8; 3]], trns: &[u8
}
if out.len() == 4 {
let key: Vec<u16> =
trns.chunks_exact(2).take(3).map(|k| u16::from_be_bytes([k[0], k[1]])).collect();
trns.as_chunks::<2>().0.iter().take(3).map(|k| u16::from_be_bytes([k[0], k[1]])).collect();
let opaque = if h.depth == 16 { 65535 } else { 255 };
out[3] = if key.len() == 3 && key[..] == out[..3] { 0 } else { opaque };
}
Expand Down
2 changes: 2 additions & 0 deletions native/crates/fsh-materials/src/bsdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ impl Bsdf {
}

/// Samples an incident direction: `u_lobe` picks the lobe, `u` the direction.
#[allow(clippy::neg_cmp_op_on_partial_ord)]
pub fn sample(&self, wo: Vec3, u_lobe: f32, u: Vec2) -> Option<BsdfSample> {
let c = self.prepare(wo)?;
let (i, ur) = pick(&c.sel, u_lobe)?;
Expand Down Expand Up @@ -341,6 +342,7 @@ impl Bsdf {
tables().diel(mu, g.alpha_eff(), eta)
}

#[allow(clippy::neg_cmp_op_on_partial_ord)]
fn prepare(&self, wo_w: Vec3) -> Option<Ctx> {
let wo_w = wo_w.try_normalize()?;
let side = self.ng.dot(wo_w);
Expand Down
5 changes: 4 additions & 1 deletion native/crates/fsh-materials/src/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,13 @@ fn fill_diel(diel: &mut [[f32; 2]]) {
}
}

#[cfg(not(target_arch = "wasm32"))]
type DielGroup<'a> = Vec<(usize, &'a mut [[f32; 2]])>;

#[cfg(not(target_arch = "wasm32"))]
fn fill_diel(diel: &mut [[f32; 2]]) {
let workers = std::thread::available_parallelism().map(|n| n.get()).unwrap_or(1).clamp(1, 8);
let mut groups: Vec<Vec<(usize, &mut [[f32; 2]])>> = (0..workers).map(|_| Vec::new()).collect();
let mut groups: Vec<DielGroup<'_>> = (0..workers).map(|_| Vec::new()).collect();
for (ci, chunk) in diel.chunks_mut(NR * NM).enumerate() {
groups[ci % workers].push((ci, chunk));
}
Expand Down
2 changes: 1 addition & 1 deletion native/crates/fsh-scene/src/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl Mesh {
/// Fills `normals` with area-weighted smooth normals; only call when none were authored.
pub fn compute_normals(&mut self) {
let mut acc = vec![Vec3::ZERO; self.positions.len()];
for t in self.indices.chunks_exact(3) {
for t in self.indices.as_chunks::<3>().0 {
let (a, b, c) = (t[0] as usize, t[1] as usize, t[2] as usize);
if a >= acc.len() || b >= acc.len() || c >= acc.len() {
continue;
Expand Down
12 changes: 12 additions & 0 deletions setup/HASHOUT_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,15 @@ Jobs: frontend (npm ci, audit, `npm run typecheck`, build), engine (`./formshot
- kind: verification
- logged: v0.2.0 · 2026-12-02
Run: `bash -n` on every shell script, `py_compile`, `./formshot help`, `./formshot doctor`, `./formshot i18n check`, `./formshot mcp` against a live and a dead port, `./formshot notices --check`. Not run: install, engine build, check and wasm, render, freeze, desktop, build_app, any .bat (no Windows here), agents sync (it would build fsh-cli), CI. Later, with the hand-written THIRD-PARTY-NOTICES.txt of 0.2.0 (docs part), `notices --check` passed the Python, npm and runtime sections and reported the 17 native crates as "no longer ships", because fsh-cli did not yet depend on the other crates at that moment.

### .github/workflows/ci.yml · a run by hand, and why main was red
- refers-to: .github/workflows/ci.yml :: on
- kind: decision
- logged: v0.4.0 · 2026-12-02
The triggers stay the family's (pushes to main and compile_v*, every pull request), plus `workflow_dispatch` as FormSurface has it, so a run can be started by hand on any branch when GitHub shows a pull request with no checks: `gh workflow run ci.yml -R nodemode-dev/formshot --ref <branch>`. That happened once, to pull request #2, and it was a GitHub fault, not the workflow. Separately, main had been red (3 of 5) since the 0.2.0 merge for two real reasons, fixed in the same change: the engine job's clippy (`-D warnings`) and the desktop-shell job's `cargo check --locked` with no Cargo.lock committed (native and src-tauri logs).

### .github/workflows/ci.yml · the five jobs, run by hand
- refers-to: .github/workflows/ci.yml :: frontend, engine, backend, desktop-shell, scripts
- kind: verification
- logged: v0.4.0 · 2026-12-02
Each job's steps were run on Ubuntu 24.04 from a clean checkout, as the workflow writes them: frontend (npm ci, `npm audit --audit-level=low` with 0 vulnerabilities, typecheck, build), engine (`./formshot engine check`), backend (Python 3.12 venv, compileall, `import app.main`), desktop-shell (its apt packages, frontend build, sidecar placeholder, `cargo check --locked`, clippy `-D warnings`), scripts (`bash -n`, `py_compile`, the em dash and emoji scan over every tracked file): all pass. Not run: the workflow on GitHub itself.
Loading