;; Autonomous Pipeline Test
;;
;; Uses the autonomous-pipeline primitive which computes ALL parameters
;; on GPU - including sin/cos expressions. Zero Python in the hot path!

(stream "autonomous_test"
  :fps 30
  :width 1920
  :height 1080
  :seed 42

  ;; Load primitives
  (require-primitives "streaming_gpu")
  (require-primitives "image")

  ;; Effects pipeline (what effects to apply)
  (def effects
    [{:op "rotate" :angle 0}
     {:op "hue_shift" :degrees 30}
     {:op "ripple" :amplitude 15 :frequency 10 :decay 2 :phase 0 :center_x 960 :center_y 540}
     {:op "brightness" :factor 1.0}])

  ;; Dynamic expressions (computed on GPU!)
  ;; These use CUDA syntax: sinf(), cosf(), t (time), frame_num
  (def expressions
    {:rotate_angle "t * 30.0f"
     :ripple_phase "t * 2.0f"
     :brightness_factor "0.8f + 0.4f * sinf(t * 2.0f)"})

  ;; Frame pipeline - creates image ON GPU and applies autonomous pipeline
  (frame
    (let [;; Create base image ON GPU (no CPU involvement!)
          base (streaming_gpu:gpu-make-image 1920 1080 [128 100 200])]

      ;; Apply autonomous pipeline - ALL EFFECTS + ALL MATH ON GPU!
      (streaming_gpu:autonomous-pipeline base effects expressions frame-num 30.0))))
