Handle the shader lambda-list (preamble)

This commit is contained in:
Renaud Casenave-Péré 2015-04-04 23:42:56 +02:00
parent c66e3c62e8
commit a7fd8e4842

View file

@ -104,9 +104,15 @@ the forms comprised of these keywords will be printed in comments."
first
(walk-1 first)) (walk-list rest)))
(defun glsl-compile (lambda-list body)
(declare (ignore lambda-list))
(format nil "~%~a~%void main ()~%{~%~a}~%"
(defun handle-preamble (form)
"Handle a preamble declaration."
(format nil "~@[layout (location = ~a) ~]~@[~(~a~) ~]~(~a~) ~(~a~) ~(~a~);~%"
(awhen (member :location form) (cadr it))
(awhen (member :interp form) (cadr it))
(third form) (second form) (glsl-name (first form))))
(defun glsl-compile (lambda-list body)
(format nil "~a~%~%~{~a~}~%void main ()~%{~%~a}~%"
(mapcar #'handle-preamble lambda-list)
(let ((*current-indent* 2))
(walk `(progn ,body) *form-handlers* #'default-handler *env*))))