;; Heavy Fused Pipeline Test
;;
;; Tests with many effects to show the full benefit of kernel fusion

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

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

  ;; Define heavy effects pipeline (4 effects fused into one kernel)
  (def heavy-pipeline
    [{: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}])

  ;; Frame pipeline
  (frame
    (let [;; Create base image
          r (+ 0.5 (* 0.5 (math:sin (* t 1))))
          g (+ 0.5 (* 0.5 (math:sin (* t 1.3))))
          b (+ 0.5 (* 0.5 (math:sin (* t 1.7))))
          color [(* r 255) (* g 255) (* b 255)]
          base (image:make-image 1920 1080 color)

          ;; Dynamic parameters
          angle (* t 30)
          phase (* t 2)]

      ;; 4 effects in ONE kernel call!
      (streaming_gpu:fused-pipeline base heavy-pipeline
        :rotate_angle angle
        :ripple_phase phase))))
