Skip to content

Instantly share code, notes, and snippets.

@cbaggers
Created June 26, 2015 21:04
Show Gist options
  • Save cbaggers/3a0f6313bc9b567b07a4 to your computer and use it in GitHub Desktop.
Save cbaggers/3a0f6313bc9b567b07a4 to your computer and use it in GitHub Desktop.
Varjo now turns variables referenced inside nested funcs into implicit arguments
VARJO> (glsl-code
(defshader test ()
(let ((a 4) (b 20) (c 5))
(labels ((test ((x :int))
(labels ((moo () (+ c b)))
(* x a (moo)))))
(+ 1 2 3 4)
(test 10)))
(v! 1 2 3 4)))
;; compiles to
#version 330
int TEST_55V(int X_53V, int C_52V, int B_51V, int A_50V);
int MOO_54V(int C_52V, int B_51V);
int MOO_54V(int C_52V, int B_51V) {
return (C_52V + B_51V);
}
int TEST_55V(int X_53V, int C_52V, int B_51V, int A_50V) {
return (X_53V * (A_50V * MOO_54V(C_52V,B_51V)));
}
void main() {
int A_50V = 4;
int B_51V = 20;
int C_52V = 5;
(1 + (2 + (3 + 4)));
TEST_55V(10,C_52V,B_51V,A_50V);
gl_Position = vec4(1,2,3,4);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment