M12.2: gpu compositor and gpu effects
New L3 crate effectcraft-gpu: a wgpu compute backend for the per-frame compositing walk (layer transforms with the CPU's nearest/bilinear/bicubic sampling and minification pre-filter, motion-blur accumulation, track mattes, Preserve Transparency, layer style passes and knockout, all 38 blend modes as a WGSL port of color::blend, 8/16 bpc clamp+quantise, colour-space conversions). 3D runs, adjustment and wireframe layers run on the CPU between GPU steps. GPU effects with the CPU semantics: Gaussian, Fast Box and Directional Blur, Glow, Levels, Curves, Hue/Saturation, Tint, Fill, Gradient Ramp, Fractal Noise, Drop Shadow, Brightness & Contrast, Exposure, Invert, Transform (registry gpu badge from effects::GPU_EFFECTS). render: Backend (Cpu/Gpu/Auto) in RenderOpts, the Accelerator trait and Renderer::accel, GPU effect chains in the effect stack, hooks for the GPU walk. Project setting gpu_acceleration (Mercury GPU Acceleration / Software Only), render.backend command, file.projectSettings renderer. Session and Render Queue exports carry the accelerator. CLI --gpu and bench --gpu. Tests compare GPU vs CPU renders (blend modes x bit depths, transforms, masks, mattes, motion blur, colour management, styles, collapse, adjustment fallback, every GPU effect) and skip without an adapter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ab3b4cfb70
commit
485f562e19
@@ -119,6 +119,12 @@ impl Curve {
|
||||
h00 * self.ys[k] + h10 * h * self.ms[k] + h01 * self.ys[k + 1] + h11 * h * self.ms[k + 1]
|
||||
}
|
||||
|
||||
/// Control points (x, y), Hermite tangents and the 1025-entry table over 0..1 that
|
||||
/// [`Curve::eval`] interpolates (the GPU path uploads them).
|
||||
pub fn tables(&self) -> (&[f32], &[f32], &[f32], &[f32]) {
|
||||
(&self.xs, &self.ys, &self.ms, &self.lut)
|
||||
}
|
||||
|
||||
pub fn eval(&self, x: f32) -> f32 {
|
||||
if !(0.0..=1.0).contains(&x) {
|
||||
return self.eval_exact(x);
|
||||
|
||||
@@ -353,6 +353,11 @@ pub fn registry() -> &'static [EffectSpec] {
|
||||
v.extend(paint::specs());
|
||||
v.extend(puppet::specs());
|
||||
v.sort_by(|a, b| a.category.cmp(b.category).then(a.name.cmp(b.name)));
|
||||
for s in v.iter_mut() {
|
||||
if GPU_EFFECTS.contains(&s.id) {
|
||||
s.gpu = true;
|
||||
}
|
||||
}
|
||||
v
|
||||
})
|
||||
}
|
||||
@@ -411,6 +416,28 @@ pub fn instantiate(spec: &EffectSpec, ids: &mut Ids, instance_name: &str, layer_
|
||||
g
|
||||
}
|
||||
|
||||
/// Effects the GPU compositor (`effectcraft-gpu`) implements with the CPU effect's semantics
|
||||
/// (Mercury GPU Acceleration; the Effects & Presets GPU badge). Expression controls are
|
||||
/// pass-throughs and count as GPU effects too.
|
||||
pub const GPU_EFFECTS: &[&str] = &[
|
||||
"ec.blur.gaussian",
|
||||
"ec.blur.fastbox",
|
||||
"ec.blur.directional",
|
||||
"ec.stylize.glow",
|
||||
"ec.color.levels",
|
||||
"ec.color.curves",
|
||||
"ec.color.huesaturation",
|
||||
"ec.color.tint",
|
||||
"ec.generate.fill",
|
||||
"ec.generate.gradientramp",
|
||||
"ec.noise.fractal",
|
||||
"ec.perspective.dropshadow",
|
||||
"ec.color.brightnesscontrast",
|
||||
"ec.color.exposure",
|
||||
"ec.channel.invert",
|
||||
"ec.distort.transform",
|
||||
];
|
||||
|
||||
/// Effects whose output depends on [`EffectCtx::time`] directly (not only through animated
|
||||
/// parameters). The renderer's layer cache folds the layer time into the key for these.
|
||||
/// The `time_dependence_is_declared` test checks the list against every registered effect.
|
||||
|
||||
Reference in New Issue
Block a user