Fix source indexing with modulo
This commit is contained in:
@@ -110,9 +110,10 @@
|
|||||||
;; === OPTIMIZED PROCESS-PAIR MACRO ===
|
;; === OPTIMIZED PROCESS-PAIR MACRO ===
|
||||||
;; Uses fused-pipeline to batch rotate+hue+invert into single kernel
|
;; Uses fused-pipeline to batch rotate+hue+invert into single kernel
|
||||||
(defmacro process-pair-fast (idx)
|
(defmacro process-pair-fast (idx)
|
||||||
(let [;; Get sources for this pair
|
(let [;; Get sources for this pair (with safe modulo indexing)
|
||||||
src-a (nth sources (* idx 2))
|
num-sources (len sources)
|
||||||
src-b (nth sources (+ (* idx 2) 1))
|
src-a (nth sources (mod (* idx 2) num-sources))
|
||||||
|
src-b (nth sources (mod (+ (* idx 2) 1) num-sources))
|
||||||
cfg (nth pair-configs idx)
|
cfg (nth pair-configs idx)
|
||||||
pstate (nth (bind pairs :states) idx)
|
pstate (nth (bind pairs :states) idx)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user