M12.2: viewer on gpu

The desktop viewer builds the GPU compositor on egui-wgpu's device and,
with Mercury GPU Acceleration, renders frames into RGBA8 textures that are
registered with egui-wgpu and drawn directly (no readback); the RAM preview
cache holds them under a video-memory budget. Pixels are read back only on
demand (Info panel, eyedroppers, histograms). Project Settings gets the
Video Rendering and Effects renderer choice. ui_gpu test: GPU viewer frame
matches the CPU one (skips without an adapter).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-02 11:06:05 -04:00
co-authored by Claude Opus 5.5
parent 485f562e19
commit af651a6f56
11 changed files with 269 additions and 37 deletions
+6 -2
View File
@@ -528,8 +528,8 @@ fn curves_size(width: f32) -> f32 {
}
/// Cached histogram of the displayed frame (recomputed when the frame changes).
fn frame_histogram(app: &EffectcraftApp, ctx: &egui::Context) -> Option<std::sync::Arc<[[u32; 256]; 5]>> {
let img = app.viewer_image.clone()?;
fn frame_histogram(app: &mut EffectcraftApp, ctx: &egui::Context) -> Option<std::sync::Arc<[[u32; 256]; 5]>> {
let img = app.viewer_pixels()?;
let key = std::sync::Arc::as_ptr(&img) as usize;
let id = egui::Id::new("ec-histogram");
if let Some((k, h)) = ctx.data(|d| d.get_temp::<(usize, std::sync::Arc<[[u32; 256]; 5]>)>(id))
@@ -969,6 +969,10 @@ pub fn viewer_hook(
app.ui.fx_pick = None;
return;
};
if pick.kind == "color" {
// GPU frames: read the shown frame back for sampling.
app.viewer_pixels();
}
let resp = ui.interact(map.area, egui::Id::new("viewer-fx-pick"), Sense::click());
app.auto.add("viewer.fxPick", map.area, &pick.name);
let hint = if pick.kind == "point" { format!("Click to set {}", pick.name) } else { format!("Click to sample {}", pick.name) };