Use base primitive names, let interpreter auto-select GPU

Recipe should work on both CPU and GPU. The interpreter
auto-selects *_gpu versions when available.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-04 12:21:32 +00:00
parent 514ee89cca
commit cd95e62899

View File

@@ -15,14 +15,9 @@
:seed 42 :seed 42
;; Load standard primitives (includes proper asset resolution) ;; Load standard primitives (includes proper asset resolution)
;; Auto-selects GPU versions when available, falls back to CPU
(include :name "tpl-standard-primitives") (include :name "tpl-standard-primitives")
;; Load optimized GPU primitives (falls back to CPU automatically)
(require-primitives "streaming_gpu") ;; Includes fused-pipeline
(require-primitives "geometry_gpu") ;; Fast CUDA rotate/ripple
(require-primitives "color_ops_gpu") ;; Fast CUDA hue-shift/invert
(require-primitives "blending_gpu") ;; Fast CUDA blend
;; === SOURCES (using streaming: which has proper asset resolution) === ;; === SOURCES (using streaming: which has proper asset resolution) ===
(def sources [ (def sources [
(streaming:make-video-source "woods-1" 30) (streaming:make-video-source "woods-1" 30)
@@ -156,8 +151,8 @@
{:op "invert" :amount (if inv-b-on 1 0)}] {:op "invert" :amount (if inv-b-on 1 0)}]
;; Apply fused pipelines (single kernel per source!) ;; Apply fused pipelines (single kernel per source!)
processed-a (streaming_gpu:fused-pipeline frame-a effects-a) processed-a (streaming:fused-pipeline frame-a effects-a)
processed-b (streaming_gpu:fused-pipeline frame-b effects-b)] processed-b (streaming:fused-pipeline frame-b effects-b)]
;; Blend the two processed frames ;; Blend the two processed frames
(blending:blend-images processed-a processed-b mix-ratio))) (blending:blend-images processed-a processed-b mix-ratio)))
@@ -188,11 +183,11 @@
(let [next-frame (process-pair-fast next-idx) (let [next-frame (process-pair-fast next-idx)
;; Active zooms out as it fades ;; Active zooms out as it fades
active-zoom (+ 1.0 fade-amt) active-zoom (+ 1.0 fade-amt)
active-zoomed (streaming_gpu:fused-pipeline active-frame active-zoomed (streaming:fused-pipeline active-frame
[{:op "zoom" :amount active-zoom}]) [{:op "zoom" :amount active-zoom}])
;; Next starts small and zooms in ;; Next starts small and zooms in
next-zoom (+ 0.1 (* fade-amt 0.9)) next-zoom (+ 0.1 (* fade-amt 0.9))
next-zoomed (streaming_gpu:fused-pipeline next-frame next-zoomed (streaming:fused-pipeline next-frame
[{:op "zoom" :amount next-zoom}])] [{:op "zoom" :amount next-zoom}])]
(blending:blend-images active-zoomed next-zoomed fade-amt)) (blending:blend-images active-zoomed next-zoomed fade-amt))
active-frame) active-frame)
@@ -210,7 +205,7 @@
:phase (* now 5) :center_x rip-cx :center_y rip-cy}]] :phase (* now 5) :center_x rip-cx :center_y rip-cy}]]
;; Apply final fused pipeline ;; Apply final fused pipeline
(streaming_gpu:fused-pipeline result final-effects (streaming:fused-pipeline result final-effects
:rotate_angle spin-angle :rotate_angle spin-angle
:ripple_phase (* now 5) :ripple_phase (* now 5)
:ripple_amplitude rip-amp)))) :ripple_amplitude rip-amp))))