Open floybix opened 7 years ago
Hi, I found this failure case. If a term appears multiple times within one branch of an if, the shared term gets emitted without an assignment to a variable.
if
(require '[gamma.api :as g]) (require '[gamma.program :as p]) (def ans2 (let [g-elem (g/* 5 5) sh {(g/gl-position) (g/vec4 (g/if (g/== 0 0) (g/+ g-elem g-elem) 0.0))}] (:glsl (p/shader sh {:float :highp})))) (println ans2)
precision highp float; void main(void){ float v387; float v394; if((0.0 == 0.0)){ (5.0 * 5.0); <----- note missing assignment (v387 = (v394 + v394));} else { (v387 = 0.0);} (gl_Position = vec4(v387)); }
I tried to track it down in the code but got lost in the compiler.
Hi, I found this failure case. If a term appears multiple times within one branch of an
if
, the shared term gets emitted without an assignment to a variable.I tried to track it down in the code but got lost in the compiler.