9 Commits
Author SHA1 Message Date
aiongg c55c0b7ce8 gpu: build each compositor pipeline on first use (#15439)
Every compositor built all ~30 pipelines when created. On the Windows CI
runners (WARP, FXC) that took 3 to 7.5 s in every GPU test process, and a
test that draws one layer needs two or three of them.

The pipelines now sit in one table per compositor (shared with its
siblings), one entry per kernel, each built the first time a draw needs
it. try_new_with_format_threads(_classified), which the app uses for its
background build, still builds every pipeline up front in parallel
through the same table, so the app keeps its start-up error and its
cached deterministic-failure path. A pipeline that fails on first use
makes that render Unsupported (CPU fallback); a failed effect-map
pipeline turns layer effects to the CPU as before.

The #9173 rules hold: each kernel has its own vertex entry point, a
kernel's formats are built on one thread, and every build in the process
takes the same lock.

every_compositor_pipeline_builds builds all pipelines through the
threaded build, so FXC still compiles every shader on Windows CI. New
count test: one layer builds a small share of the pipelines, and a second
render or a sibling builds none.
2026-11-18 18:51:38 +00:00
Dylan M. Taylor 2b75a0092d Use craft-cms from craft-libs; remove crates/cms
craft-cms was extracted from crates/cms (storytold/craft-libs#779), and both
copies changed afterwards. storytold/craft-libs#PRNUM ports the 41 commits made
here since the extraction, so the shared crate now has everything this copy
had, and PhotoCraft depends on it.

craft-cms returns errors where the local crate panicked on caller input:
transforms, tables and LUT constructors return Result. Call sites propagate
the error where the function already returns one, and fall back where the
arguments are fixed by construction (each with a comment saying why).
Lut3d's fields are private there; the proof and HDR display table is built
with Lut3d::from_fn.

The pin is the head of the craft-libs branch and moves to main when that
pull request merges.
2026-11-11 19:41:51 +00:00
5c157e8400 Build the GPU compositor off the UI thread (#9969)
* Prepare GPU compositor in background

* Add compositor startup performance scenarios

* Generate scorecard in scratch CI

* Fix pipeline build type inference

* Address compositor startup review and document measurements

* Run startup performance checks on scratch CI

* Remove scratch performance job

* Count failed GPU attempts in frame timing

* Make shader fingerprint test portable

* Address review: run first-document scenario as a guarded group; share COMPOSITOR_BUILDING constant

* Handle compositor startup benchmark failures

* Fix frame timing after upstream merge

* Keep GPU startup failures on CPU fallback

* Record the failed GPU attempt of a deferred redraw, and bound --reps

A redraw deferred after a failed GPU composite carries that attempt's time to its end, where it is
recorded once beside the CPU time. Perf::record clears the attempt so a direct CPU refresh doesn't
inherit the last one's. perf_scenarios caps --reps.

* Refresh cached canvases after compositor build

* Expose canvas cache key to GPU completion handler

* ci: drop the GPU compositor probe job

AGENTS.md: feature and fix PRs don't add or change CI, and app workflows
only call the shared craft-common-actions workflows. The probe example
stays as a manual tool (cargo run -p photocraft-gpu --example
compositor_build_probe).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: FredApps <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-05 22:49:12 +01:00
8701903f9b Fix-up for #9182: build jobs carry their vertex entry point, and the test rules out a shared vs
The build now takes each job's vertex entry name from build_jobs, the vertex
module is generated from the same jobs, and build_jobs_share_no_shader also
checks that compose.wgsl has no vertex entry point. Before, the test checked
the job plan on its own and still passed if the build went back to one shared
vs (verified: re-adding vs to compose.wgsl now fails the test).

Co-Authored-By: FinnNk <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 02:38:48 +01:00
David Mann f805540d0a Merge PR #9182: fix(gpu): build compositor pipelines without sharing FXC shader blobs across threads (#9173) 2026-11-04 02:35:01 +01:00
FredApps b0f3c7516b Merge current main into codex/scratch-storage
Resolve conflicts with main's prefs UI split, session/execute.rs move, GPU memory
budget (gpuMemoryMb, 0 = auto, kept from main) and effective_memory_usage_mb history
budget. Port the Memory Usage % and Scratch Disks preferences into prefs_ui, the edit
integrity guard into session/execute.rs, and adapt main's new pixel readers to the
guarded TileBytes API. Cargo.lock regenerated; scorecard regenerated.
2026-11-02 22:16:22 +01:00
Finn NewickandClaude Opus 5.5 6a39ccd52e fix(gpu): build compositor pipelines without sharing FXC shader blobs across threads (#9173)
wgpu-hal's D3D12 backend caches each compiled shader and hands every pipeline a clone of the
cached ID3DBlob, calling AddRef under the cache lock and Release outside it
(gfx-rs/wgpu#10547). Compositor::build creates its pipelines in parallel, all from one vertex
entry point and each effect-map kernel twice from one fragment shader, so on D3D12 + FXC the
builds raced on shared blobs and dropping the device could abort (0xc0000409 on CI's WARP runs).

The build stays parallel, but no shader is shared between threads: the vertex stage moves to a
generated module with one entry point per build job; an effect-map kernel builds both formats
in one job; and concurrent Compositor::build calls take turns behind a process-wide lock.

Fixes #9173.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 08:51:02 +00:00
aiongg 81c83b124f refactor(gpu): split lib.rs into batch, cells, consts, convert, encode, fx_passes, kit, paging, readback, setup, textures 2026-10-26 22:54:56 +00:00
aiongg 78d947d51a refactor(gpu): move lib.rs tests to tests.rs 2026-10-26 22:30:14 +00:00