M12.7: GPU distort/stylize effects (Turbulent Displace, Displacement Map, Wave Warp, Ripple, Twirl, Bulge, CC Lens, Mesh Warp, Mosaic, Find Edges, Emboss)

Compute kernels in shaders/fx_distort.wgsl mirroring the CPU effects; per-row/column
structure (map coordinates, wave phase, tile bounds, mesh triangle buckets) is computed
in f64 on the CPU and uploaded. Displacement Map fetches its map layer through the
effect host as the CPU does and samples it on the GPU. CPU oracle tests in
tests_fx_distort.rs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-03 02:42:43 -04:00
co-authored by Claude Opus 5.5
parent 9a6389db86
commit fcc09cf095
6 changed files with 1087 additions and 6 deletions
+2 -1
View File
@@ -414,7 +414,8 @@ fn grid_warp(src: &Image, w: u32, h: u32, nx: usize, ny: usize, dest: &[Pt], src
out
}
fn parse_mesh(s: &str) -> Vec<Pt> {
/// Mesh Warp's `mesh` parameter: the vertex offsets (layer pixels), row-major.
pub fn parse_mesh(s: &str) -> Vec<(f64, f64)> {
s.split(|c: char| c.is_whitespace() || c == ';')
.filter(|t| !t.is_empty())
.filter_map(|t| {
+12
View File
@@ -62,6 +62,7 @@ use std::sync::OnceLock;
pub use color_fx::{exposure_settings, levels_clip};
pub use color2::Curve;
pub use distort2::parse_mesh;
use effectcraft_keyframe::Value;
use effectcraft_project::build::Ids;
use effectcraft_project::{GroupKind, ParamUi, PropGroup, Property};
@@ -641,6 +642,17 @@ pub const GPU_EFFECTS: &[&str] = &[
"ec.color.exposure",
"ec.channel.invert",
"ec.distort.transform",
"ec.distort.turbulentdisplace",
"ec.distort.displacementmap",
"ec.distort.wavewarp",
"ec.distort.ripple",
"ec.distort.twirl",
"ec.distort.bulge",
"ec.distort.cclens",
"ec.distort.meshwarp",
"ec.stylize.mosaic",
"ec.stylize.findedges",
"ec.stylize.emboss",
];
/// Effects whose output depends on [`EffectCtx::time`] directly (not only through animated