Commit Graph
316 Commits
Author SHA1 Message Date
Elvis33LE 40b3bf9b6b test(gpu): reword the tile-growth doc comment for what main does
The comment still described the reverted encoder-batching design; on main
keep_overlap submits its own copy, so the pinned property is that the
kept overlap never overwrites tiles rewritten in the same update,
whatever the submission shape.
2026-10-20 19:02:51 +02:00
David Mann 0b39361076 Merge main into feat/tool-214-12-shape-feather 2026-10-20 17:12:29 +02:00
Nigel Ihza Firdausy f0aae59938 Merge upstream main and retain CPU/GPU Dissolve parity coverage 2026-10-20 19:44:22 +07:00
mweinbach ee0fe906a2 gpu, docs: fix timing test skip guard and document Windows ARM64 build on RTX Spark
- Subtract submit_ms when checking the execution window in gpu_time_tracks_execution_not_submission (wall_ms - submit_ms < 3.0 * submit_ms).
- Document clang-cl requirement for Windows on ARM64 (aarch64-pc-windows-msvc) builds in docs/development.md.
- Add [people.mweinbach] to contributors/people.toml per AGENTS.md.
2026-10-19 21:04:51 -04:00
Hector VillarrealandClaude Opus 5.5 46d48523a7 GPU parity: a bevel gloss contour that starts at 100 % (#7360)
Rolling Slope - Descending, as on the type in the report. Main's shader fails
it (CPU and GPU differ by 131/255); this PR's matches the CPU render.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 16:26:17 -06:00
David Mann c2f3e23a40 Merge PR #5477: perf: chisel bevel size changes, CPU passes on threads and GPU fields share their sharp edges (results unchanged) 2026-10-19 16:51:22 +02:00
David MannandClaude Opus 5.5 0604f39d97 Performance: hand single-part tiles to put without a copy (#5108)
Only CMYK and Lab tiles are split into bands; every other format's one part
went through concat, an extra allocation and copy per tile on the UI thread
(8-bit RGBA, 64 tiles: 2.7 -> 3.3 ms). Now it passes straight through.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 09:43:36 +02:00
Hector VillarrealandClaude Opus 5.5 a42e831698 Map the bevel's shading through its gloss contour, not its light (#7360)
The gloss contour was applied to the highlight and shadow amounts after
the lighting split, so a contour that starts high (Rolling Slope -
Descending) turned every unlit pixel into a full highlight: a bevelled
glyph's flat face painted (255, 40, 42) over its (151, 22, 23) fill. It
now maps the shading before the split, with the flat face's mapped
shading as the neutral, on the CPU and the GPU. Linear is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 23:01:11 -06:00
Ni-zavandVikram Bhaskaran a221622ad4 fix(compose): cover clipped Dissolve adjustments
Port the clipped-adjustment coverage path from #4711 and verify depth, alpha, masks, and document-coordinate GPU parity.

Co-authored-by: Vikram Bhaskaran <vikram.bhaskaran@outlook.com>
2026-10-19 07:18:54 +07:00
Nigel Ihza Firdausy 2ef53bb673 test(gpu): cover clipped Dissolve opacity and fill parity 2026-10-19 07:18:54 +07:00
Nigel Ihza Firdausy d127cd6afb style(gpu): match rustfmt compact ColorOverlay initialization 2026-10-19 07:18:54 +07:00
Nigel Ihza Firdausy 7e1c21e9a8 test(gpu): split Dissolve parity cases and exercise adjustment masking 2026-10-19 07:18:54 +07:00
Nigel Ihza Firdausy 21871dd40e refactor(gpu): branch explicitly on Dissolve effect-stack coverage 2026-10-19 07:18:54 +07:00
Nigel Ihza Firdausy 28807ed7ab test(gpu): cover Dissolve adjustment, clipping and effect parity 2026-10-19 07:18:53 +07:00
Nigel Ihza Firdausy 61724b49f0 fix(gpu): match CPU Dissolve coverage for adjustment, clipping and effects 2026-10-19 07:18:53 +07:00
00xJ0 4615a8bc26 Survive a lost window GPU device: draw nothing, save unsaved work for recovery, close (#3438, #1215)
When the window's own wgpu device was lost (a driver reset, e.g. after sleep), egui-wgpu could
not draw another frame: a frame with shapes panicked inside it ("Failed to create staging buffer
for index data", #1215, exit 101, unsaved work lost), and a frozen window's close button opened
an unsaved-changes prompt nobody could see (#3438). The #243 fallback only covered the canvas.

- DeviceHealth::device_lost (wgpu reported the loss, not a recorded fault) and ::probe (a
  non-blocking poll that keeps running after a recorded fault).
- RecoveryStore::flush: finish queued autosaves and wait for them.
- gpu_status::check_window, at the end of every frame: once the window's device is lost the
  frame draws nothing; the first time every unsaved document is written to crash recovery
  (Services::flush_autosaves) and the app closes without asking. The next launch reopens them.
- The app watches the window device on the CPU canvas too; ui.gpu.simulateLoss {destroy: true}
  destroys the real device to drive the path.

Verified on an RX 6900 XT, Vulkan and DX12: destroying the device in the running app exited 101
with the egui-wgpu panic before, and now exits 0 with the document recovered on the next launch.
2026-10-18 12:53:48 -07:00
Akos Arinton 33dd5f0103 perf(gpu): blend plain layers several to a pass, P60/P61 111 -> 28 ms
- LayerBlend: a plain layer is blended straight from its texture in one pass
  instead of a Content pass to a scratch chunk and a Blend pass.
- fs_layerbatch: runs of up to four plain layers that only feed each other
  are drawn as one pass, reading and writing the chunk once (the uniform
  record grows to its 256-byte stride to hold the extra layers).
- Drop shadows and outer glows alone: the merge builds the layer from its
  shape (F_LAYER_SHAPE), and nothing is copied back when the effect region
  covers the canvas. Such a layer takes 3 passes instead of 6.
- fs_layerbatch_normal: runs of Normal layers use a shader with Normal's code
  alone. Per-pass timestamps showed the batch spent 80% of its time on the
  register cost of carrying every blend mode, not on the arithmetic; Normal
  goes through the same function in every shader, so a layer gives the same
  bits whichever pass draws it.

P60 / P61 with the GPU compositor (8 GB budget, M4 Pro): 111 / 113 ms ->
28.2 / 28.1 ms. With the app's default Memory Usage these documents still
fall back to the CPU compositor on unified memory, so the budgets stay
unenforced.

Output: over the GPU parity suite (1620 renders) 1038 are bit-identical to
before and the rest differ by at most 1e-4/255, except one pixel one 8-bit
step apart where an adjustment rounds at .5; the mean difference from the CPU
reference is unchanged. New parity tests cover runs of every mode, Normal
runs at 8/16/32-bit and Lab, and exterior effects at any fill.
2026-10-18 22:26:06 +03:00
skylar taylor-barrick 5c7c847923 perf(canvas): report how long the GPU spends on a composite (#7275)
`composite_ms` measures encoding and submitting a composite, not running it: on
a 24 MP refresh it read 7.7 ms for work the GPU spent ~171 ms on, so nothing in
the app could see a regression that moved work onto the GPU.

A timestamp is written on the GPU timeline at the start and end of every command
encoder a refresh submits, and the spans are summed and read back
asynchronously. Nothing waits, so a measurement arrives a frame or two later and
carries the pixel count of the refresh it belongs to. It is reported as a new
`Option<f64>` `perf.gpu_ms`; `composite_ms` keeps its meaning, so its consumers
are untouched. At 24 MP it reports 83.9 ms against a waited wall clock of
88.4 ms, where the app previously said 3.1 ms.

What it leaves out, documented in the module: queue-level uploads, which wgpu
runs in its own command buffer ahead of ours, and the end-of-batch writeback
after the last timestamp. That is ~5 % of the reported time here and
proportional to the composite, against the ~22x of the number it replaces.

Unavailable rather than wrong: without TIMESTAMP_QUERY and
TIMESTAMP_QUERY_INSIDE_ENCODERS the timer is never built and `gpu_ms` is None —
on older drivers, the CPU compositor, wasm, and Apple silicon, whose GPUs
support counter sampling only at stage boundaries. `PHOTOCRAFT_NO_GPU_TIMING`
suppresses both the timer and the feature request.

Pass-boundary timestamps would cover Apple silicon and need only
TIMESTAMP_QUERY, but they capture 70-78 % of the encoder-level span here and
the shortfall grows with document size, so they were measured and rejected.

D3D12 is exercised: device creation, a 100 ns/tick period and the full
write/resolve/map round-trip succeed with no validation errors, including
across a flushed three-buffer refresh. Numbers throughout are from an
integrated Intel GPU on Mesa/Vulkan and a software D3D12 adapter; no vendor
Windows driver and no Apple hardware was tested.
2026-10-18 10:41:35 -06:00
Michael Higgins 27260461e1 Merge branch 'main' into fix/iris-xe-texel-guard 2026-10-18 10:15:37 -04:00
Michael Higgins 7ce7a347f8 Merge branch 'main' into fix/6563-layer-texture-oom 2026-10-18 10:15:26 -04:00
oRE-o 8fb5d94d2b Gradient Overlay: expose interpolation methods and retain source stops 2026-10-18 18:36:30 +09:00
NetterSilverandClaude Haiku 5.5 866e7bfe4e Upload 16-bit layer masks as R16Float instead of R32Float (#6845)
Fixes #6534

Co-authored-by: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-18 03:34:37 -04:00
David MannandClaude Opus 5.5 175bdce659 GPU: a group's effect cache follows its vector mask and children's Blend If (#5706) (#5707)
* GPU: a group's effect cache follows its vector mask and children's Blend If (#5706)

group_key, which decides when a styled group's effect shape and distance
fields are rebuilt on the GPU, hashed the group's children and layer mask
but not the group's own vector mask, nor each child's Blend If and
Advanced Blending. A group's Stroke or Drop Shadow kept the old outline
after those changed. Hash them, as the CPU's layer_identity does.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* GPU: pass the pin callback in the group key test after main's signature change

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-18 03:32:53 -04:00
Elvis33LE 459a25bd95 Revert "perf(gpu): batch resident overlap copies"
This reverts commit f57bb1f3b1.
2026-10-18 09:17:34 +02:00
Vikram Bhaskaran db546ff482 Merge origin/main into fix/3050-dissolve 2026-10-18 11:56:48 +11:00
Korg1ch 00e4423fcc test(compose): Dissolve effects are speckled, tile-independent and match on the GPU (#6995) 2026-10-18 02:57:55 +03:00
Korg1ch e0d90b2896 fix(compose): layer effects in Dissolve mode speckle instead of painting as Normal (#6995) 2026-10-18 02:57:44 +03:00
David MannandClaude Opus 5.5 47063c29c5 Merge main into fix/6544-lut-format-roundtrip
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 18:39:12 +02:00
Elvis33LE 7414914290 test(gpu): tile growth rewrites must beat the kept overlap copy
Grows a raster layer one tile per render and rewrites everything with
per-step noise, on the whole-texture and the paged compositor, comparing
each render against the CPU oracle. Fails at 254/255 when keep_overlap
does not route the resident through encoder-ordered writes (verified by
temporarily dropping new.ordered = true).
2026-10-17 17:53:39 +02:00
Higgs32584andClaude Opus 5.5 3d53024a99 GPU canvas: test layer-page admission under a zero budget (#6563)
A paged render with a zero resident budget evicts the previous cell's pages as each
new page is created, stays on the GPU and matches the CPU compositor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 11:16:45 -04:00
Matthew SantiagoandClaude Opus 5.5 d213273c74 GPU composite: lower-stack cache chunks have no texture view (#5423)
The prefix cache's chunk textures are only copied to and from
(COPY_SRC | COPY_DST), but went through Tex::new, which always creates
a default view. Vulkan rejects a view on an image with no sampled,
storage or attachment usage (VUID-VkImageViewCreateInfo-image-04441);
wgpu doesn't check it, so it only shows with the validation layers on,
once per new chunk while painting. The view was never used. Chunks now
hold a bare wgpu::Texture. No rendering change.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:19:53 -06:00
Higgs32584andClaude Opus 5.5 3e373ddef8 GPU canvas: count pages evicted to admit a layer texture in render stats (#6563)
Admission now evicts before creating a page, so the post-cell evict found
nothing over budget and Stats::evicted stayed 0 (pages_are_evicted_under_the_budget).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:43:00 -04:00
wwew 93f6376c5e docs: write product name as PhotoCraft in package descriptions and comments (#5615) 2026-10-16 16:59:41 -06:00
Higgs32584andClaude Opus 5.5 257f0a0d31 GPU canvas: a layer that doesn't fit GPU memory evicts and retries instead of breaking the GPU (#6563)
Compositor::sync created each pc_compose_layer page texture with a bare
create_texture: nothing checked the new bytes against the resident budget
(eviction ran only after each cell) and an Out of Memory error went
uncaptured, invalidating every later texture in the pass.

Now least recently used pages are evicted to admit the new page's bytes
before creating it; creation runs in error scopes (first_error) on native,
and on Out of Memory every page the current cell doesn't use is dropped and
creation is retried once. If it still fails the refresh returns
Unsupported(OVER_BUDGET) so that refresh draws on the CPU and the next one
tries the GPU again; the captured error no longer reaches the health
callbacks. The LRU admission logic is a pure function with a unit test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 17:34:59 -04:00
Higgs32584andClaude Opus 5.5 7b32097e2a Intel Iris Xe on DX12: no more red blocks in brush previews and tool icons (#6790)
wgpu-hal 30 creates Iris Xe textures as committed resources (its
gfx-rs/wgpu#3552 workaround) with D3D12_HEAP_FLAG_CREATE_NOT_ZEROED, and
egui-wgpu fills each new texture with a single copy. On this driver the
copy leaves 4x4 blocks of all-zero texels showing stale memory, so the
empty corners of Brush Preset picker strokes and tool icons show freed
textures' pixels (often red).

ui-egui's new texel_guard plugin rewrites fully transparent texels in
each frame's texture uploads as premultiplied (0, 0, 0, 1) before eframe
renders them (under one 8-bit level of difference). The desktop app
installs it only for DX12 on "Iris(R) Xe", the same adapter test wgpu
uses; PHOTOCRAFT_TEXEL_GUARD=1/0 forces it on or off.

The gpu example zero_block_probe reproduces the driver bug without the
UI: 630/1500 egui-style uploads read back wrong, 0/1500 with the guard.
Driving the release app (tool cycling, picker rescaled): 6/40
screenshots with red blocks before, 0/120 after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 16:40:42 -04:00
David MannandClaude Opus 5.5 43ade8be26 Merge main into perf/p33-cmyk-dab
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-16 22:32:33 +02:00
David MannandClaude Opus 5.5 1b0e69d2f6 Merge main into feat/tool-214-12-shape-feather
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-16 22:07:55 +02:00
David MannandClaude Opus 5.5 87074f9499 Merge main into fix/5692-tsl-off-blend
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-16 22:03:44 +02:00
David MannandClaude Opus 5.5 5760a302c1 Merge main into fix/4381-psd-frame-stroke
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-16 22:00:44 +02:00
David MannandClaude Opus 5.5 750a91c8b2 Color Lookup: PSD save keeps a .3dl/.look LUT file as loaded (#6544)
A Color Lookup layer embeds its LUT file in the PSD (LUT3DFileData,
LUTFormat, LUT3DFileName). Photoshop stores the file as loaded and tags
its format; it never converts it. PhotoCraft kept only the parsed table,
so every save re-encoded it as .cube with LUTFormatCUBE while keeping the
original name: a layer loaded from "Film.3dl" was saved as .cube data
under a .3dl name.

The layer now keeps the file it was loaded from (its format and bytes,
`ColorLookup::source`), set when a PSD is read and when the colorLookup
command loads `data`/`file`, and cleared when a built-in look or "none"
replaces the table. A PSD save writes those bytes and format back
unchanged, but only while they still parse to the layer's table, so the
stored file can never go stale. Otherwise (a table made in PhotoCraft,
or one that no longer matches) it falls back to .cube as before and
swaps a .3dl/.look extension in the name for .cube.

The new field is `#[serde(default)]` and skipped when empty, so older
.pcraft files load unchanged. lutfile gains Format::detect/parse_as so
the recorded format is exactly the one the parser used.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-16 20:59:24 +02:00
Vikram Bhaskaran 67fca4775d Merge current main and retain both compositor parity regressions. 2026-10-17 03:10:28 +11:00
Vikram Bhaskaran e9a9d882fb Integrate clipped Dissolve coverage and verify adjustment and effect parity. 2026-10-17 03:08:02 +11:00
Tanish Manku 6d3443c098 GPU memory: discrete cards aren't charged for the document; GPU Memory preference; GPU Memory Full status (#5973)
* GPU memory: a graphics card's own memory isn't charged for the document; GPU Memory preference; GPU Memory Full in the status bar

Many layers hit a cliff: past what the GPU memory budget leaves for layer pages, every edit
that redraws the whole document (opacity, visibility, a nudge) goes to the CPU compositor.
Measured on 3000x2000 full-canvas layers (RTX 5090, 31 GB RAM, Memory Usage 8 GB): 150
layers took 2.6 s per such edit, 300 layers 6 s. The budget was Memory Usage minus the
document's pixels and History, which is right where the GPU shares system memory, but a
discrete card's memory doesn't hold the document, so 150 layers of 6 MP (3.6 GB) squeezed
the budget below what they needed.

- Automatic budget: discrete adapters are no longer charged for the document's pixels
  (integrated and software adapters still are). 150 layers: 2.6 s -> 25 ms.
- Preferences › Performance › GPU Memory (MB, 0 = Automatic; performance.gpuMemoryMb) sets
  the budget outright. 300 layers with 12 GB: 6 s -> 45-72 ms.
- The status bar shows "GPU Memory Full" while the active document's layers don't fit
  (both status bar styles); hovering gives the numbers, clicking opens Preferences ›
  Performance. Its Graphics rows show the budget and what the layers need. The slow CPU
  redraw notice gives the numbers and points at GPU Memory.
- Headless: the preference is a normal pref (prefs.set), and ui.state's perf.timings
  reports gpuLayerFit {doc, needed, budget} next to gpuBudgetMb.

Next (owner-approved plan): after #5370, read the card's real limit from the driver
(wgpu memory budget thresholds) and shrink on out-of-memory; then redraw the visible
area on the GPU first when layers still don't fit.

* GPU memory: typed discrete check; the status and budget follow a GPU Memory change at once (measure_fit); perf rows P60/P61 for whole-document edits among 150 full-canvas layers under the app's budget

* GPU memory on top of #5234: memory_budget takes the card's memory (vram) and the GPU Memory value; the document's pixels are charged unless the card's own memory is known; a set GPU Memory is capped at the card's share; benches use video_memory
2026-10-15 21:22:46 -07:00
geduful acb8dbdb47 fix(gpu): poll non-blockingly when recording a caught error
DeviceHealth::caught polled with PollType::Wait and no timeout, blocking
the UI thread until every in-flight submission drained, or forever on a
wedged device, immediately after a failed frame.

A non-blocking poll loses nothing here: wgpu-core only enters the fence
wait when a submission index is given, so PollType::Poll still reads the
fence and fires the device-lost callback for a lost device, it just never
blocks waiting for one.

Adds the regression test review asked for: a watched device forced into a
synchronous validation error must return Err and fault health, not panic.
Confirmed to fail without the caught() call.
2026-10-15 20:59:54 +00:00
Elvis33LE f57bb1f3b1 perf(gpu): batch resident overlap copies 2026-10-15 19:30:51 +02:00
David Mann ecaa81b42a Merge branch 'main' into perf/p33-cmyk-dab 2026-10-15 15:57:57 +02:00
David Mann d6b6b52c74 Merge remote-tracking branch 'origin/main' into fix/5692-tsl-off-blend 2026-10-15 12:12:39 +02:00
David Mann 43d8572c9f Merge remote-tracking branch 'origin/main' into feat/tool-214-12-shape-feather
# Conflicts:
#	docs/scorecard.md
#	docs/ui-parity.md
2026-10-15 12:12:20 +02:00
David Mann 0335545ebe Merge remote-tracking branch 'origin/main' into fix/4381-psd-frame-stroke 2026-10-15 11:42:42 +02:00
David MannandClaude Opus 5.5 f8e6d9666a PSD: Frame layers keep their stroke (#4381)
A Photoshop Frame is a group whose record carries the frame outline as a
vector mask and its Properties > Stroke as a shape-style `vstk`. We dropped
that `vstk`, so frames lost their stroke. `Group::frame_stroke` now holds it:
read from and written back to PSD (byte-identical while unchanged), saved in
.pcraft, and drawn along the vector mask above the frame's content by the CPU
compositor and the GPU planner.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-15 11:42:40 +02:00