M13.9: gpu effect family scaffolding (fx_key, fx_stylize, fx_noise)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas 2026-10-03 07:51:33 -04:00
parent 175375cbe8
commit 47f61debcb
13 changed files with 96 additions and 0 deletions

View File

@ -806,6 +806,12 @@ pub const GPU_EFFECTS: &[&str] = &[
"ec.color.selectivecolor",
"ec.key.linearcolor",
"ec.keying.keylight",
// effectcraft-gpu fx_key (keying, matte, channel)
//
// effectcraft-gpu fx_stylize (stylize, distort)
//
// effectcraft-gpu fx_noise (noise, blur, time)
//
];
/// Effects whose output depends on [`EffectCtx::time`] directly (not only through animated

View File

@ -151,6 +151,9 @@ impl GpuContext {
include_str!("shaders/fx_color.wgsl"),
include_str!("shaders/fx_distort.wgsl"),
include_str!("shaders/fx_generate.wgsl"),
include_str!("shaders/fx_key.wgsl"),
include_str!("shaders/fx_stylize.wgsl"),
include_str!("shaders/fx_noise.wgsl"),
]
.concat();
let module =
@ -204,6 +207,9 @@ impl GpuContext {
.chain(crate::fx_color::KERNELS)
.chain(crate::fx_distort::KERNELS)
.chain(crate::fx_generate::KERNELS)
.chain(crate::fx_key::KERNELS)
.chain(crate::fx_stylize::KERNELS)
.chain(crate::fx_noise::KERNELS)
.map(|e| (e, &layout))
.chain(EXT_ENTRIES.iter().map(|e| (e, &layout_ext)))
.map(|(e, layout)| {

View File

@ -121,6 +121,9 @@ fn apply(e: &mut Enc, id: &str, ctx: &EffectCtx, b: GBuf) -> Option<GBuf> {
_ if crate::fx_color::IDS.contains(&id) => crate::fx_color::apply(e, id, ctx, b),
_ if crate::fx_distort::IDS.contains(&id) => crate::fx_distort::apply(e, id, ctx, b),
_ if crate::fx_generate::IDS.contains(&id) => crate::fx_generate::apply(e, id, ctx, b),
_ if crate::fx_key::IDS.contains(&id) => crate::fx_key::apply(e, id, ctx, b),
_ if crate::fx_stylize::IDS.contains(&id) => crate::fx_stylize::apply(e, id, ctx, b),
_ if crate::fx_noise::IDS.contains(&id) => crate::fx_noise::apply(e, id, ctx, b),
_ => pointwise(e, id, ctx, b),
}
}

19
crates/gpu/src/fx_key.rs Normal file
View File

@ -0,0 +1,19 @@
//! GPU effects, keying, matte and channel family (kernels in `shaders/fx_key.wgsl`, every entry point prefixed
//! `fxk_`): the CPU effects' exact steps with the pixel loops as compute kernels.
use effectcraft_effects::EffectCtx;
use crate::context::Enc;
use crate::effects::GBuf;
/// Compute entry points in `fx_key.wgsl`.
pub(crate) const KERNELS: &[&str] = &[];
/// Effect ids implemented here.
pub(crate) const IDS: &[&str] = &[];
/// Run effect `id` (one of [`IDS`]); `None` = this parameter combination runs on the CPU.
pub(crate) fn apply(e: &mut Enc, id: &str, ctx: &EffectCtx, b: GBuf) -> Option<GBuf> {
let _ = (e, id, ctx, b);
None
}

View File

@ -0,0 +1,19 @@
//! GPU effects, noise, blur and time family (kernels in `shaders/fx_noise.wgsl`, every entry point prefixed
//! `fxn_`): the CPU effects' exact steps with the pixel loops as compute kernels.
use effectcraft_effects::EffectCtx;
use crate::context::Enc;
use crate::effects::GBuf;
/// Compute entry points in `fx_noise.wgsl`.
pub(crate) const KERNELS: &[&str] = &[];
/// Effect ids implemented here.
pub(crate) const IDS: &[&str] = &[];
/// Run effect `id` (one of [`IDS`]); `None` = this parameter combination runs on the CPU.
pub(crate) fn apply(e: &mut Enc, id: &str, ctx: &EffectCtx, b: GBuf) -> Option<GBuf> {
let _ = (e, id, ctx, b);
None
}

View File

@ -0,0 +1,19 @@
//! GPU effects, stylize and distort family (kernels in `shaders/fx_stylize.wgsl`, every entry point prefixed
//! `fxs_`): the CPU effects' exact steps with the pixel loops as compute kernels.
use effectcraft_effects::EffectCtx;
use crate::context::Enc;
use crate::effects::GBuf;
/// Compute entry points in `fx_stylize.wgsl`.
pub(crate) const KERNELS: &[&str] = &[];
/// Effect ids implemented here.
pub(crate) const IDS: &[&str] = &[];
/// Run effect `id` (one of [`IDS`]); `None` = this parameter combination runs on the CPU.
pub(crate) fn apply(e: &mut Enc, id: &str, ctx: &EffectCtx, b: GBuf) -> Option<GBuf> {
let _ = (e, id, ctx, b);
None
}

View File

@ -34,6 +34,9 @@ mod effects;
mod fx_color;
mod fx_distort;
mod fx_generate;
mod fx_key;
mod fx_noise;
mod fx_stylize;
mod ops;
mod particles;
mod walk;
@ -173,4 +176,10 @@ mod tests_fx_distort;
#[cfg(test)]
mod tests_fx_generate;
#[cfg(test)]
mod tests_fx_key;
#[cfg(test)]
mod tests_fx_noise;
#[cfg(test)]
mod tests_fx_stylize;
#[cfg(test)]
mod tests_particles;

View File

@ -0,0 +1,3 @@
// GPU effects (keying, matte and channel family): see src/fx_key.rs. Each entry point mirrors the CPU effect in
// effectcraft-effects operation for operation. Every name here is prefixed `fxk_` (the
// family files share one module).

View File

@ -0,0 +1,3 @@
// GPU effects (noise, blur and time family): see src/fx_noise.rs. Each entry point mirrors the CPU effect in
// effectcraft-effects operation for operation. Every name here is prefixed `fxn_` (the
// family files share one module).

View File

@ -0,0 +1,3 @@
// GPU effects (stylize and distort family): see src/fx_stylize.rs. Each entry point mirrors the CPU effect in
// effectcraft-effects operation for operation. Every name here is prefixed `fxs_` (the
// family files share one module).

View File

@ -0,0 +1,2 @@
//! GPU keying, matte and channel family effects vs the CPU effects (the oracle): direct on a buffer at full and half
//! resolution, as adjustment, and composited at 8 and 32 bpc.

View File

@ -0,0 +1,2 @@
//! GPU noise, blur and time family effects vs the CPU effects (the oracle): direct on a buffer at full and half
//! resolution, as adjustment, and composited at 8 and 32 bpc.

View File

@ -0,0 +1,2 @@
//! GPU stylize and distort family effects vs the CPU effects (the oracle): direct on a buffer at full and half
//! resolution, as adjustment, and composited at 8 and 32 bpc.