EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust
Merge branch 'worktree-agent-a773c6d272696f48a' (M12.2 GPU compositor)
Brandon Thomasa751a1cda956
diff --cc crates/render/src/lib.rsindex 6aa7ebd05,f7b5721f4..aa9c763fd--- a/crates/render/src/lib.rs+++ b/crates/render/src/lib.rs@@@ -339,8 -391,30 +391,34 @@@ impl<'a> Renderer<'a>EvalCtx { project: self.project, comp_id, comp, time: t, expr: self.expr }}+ /// The accelerator to use for this render, if any (see [`Backend`]).+ pub fn active_accel(&self) -> Option<&'a dyn Accelerator> {+ let a = self.accel?;+ match self.opts.backend {+ Backend::Cpu => None,+ Backend::Gpu => Some(a),+ Backend::Auto => self.project.settings.gpu_acceleration.then_some(a),+ }+ }+/// Render a composition at comp time `t` (transparent background, comp size × scale).+ /// Top-level frames go to the GPU when [`Self::active_accel`] is set and handles them.pub fn comp_frame(&self, comp_id: ItemId, t: Tick) -> Image {++ // Auto keeps comps with 3D layers on the CPU compositor: 3D runs are still composited on++ // the CPU, and the GPU path's readback/upload around them makes such comps slower.++ let auto_3d = self.opts.backend == Backend::Auto && self.project.comp(comp_id).is_some_and(|c| c.has_3d());+ if self.depth == 0++ && !auto_3d+ && let Some(a) = self.active_accel()+ && let Some(img) = a.comp_frame(self, comp_id, t)+ {+ return img;+ }+ self.comp_frame_cpu(comp_id, t)+ }++ /// [`Self::comp_frame`] on the CPU compositor only.+ pub fn comp_frame_cpu(&self, comp_id: ItemId, t: Tick) -> Image {let Some(comp) = self.project.comp(comp_id) else { return Image::new(1, 1) };let s = self.opts.scale;let w = ((comp.width as f64 * s).round() as u32).max(1);