Add glsl version directive to the shader according to the supported version
This commit is contained in:
parent
a7fd8e4842
commit
8b96f8166f
1 changed files with 6 additions and 1 deletions
|
|
@ -28,6 +28,10 @@
|
||||||
"Configure the verbosity of the compiler.
|
"Configure the verbosity of the compiler.
|
||||||
if non-nil, the dsl will be printed in comments together with the glsl code.")
|
if non-nil, the dsl will be printed in comments together with the glsl code.")
|
||||||
|
|
||||||
|
(defvar *version-profiles* '(("1.30" . "#version 130
|
||||||
|
#extension ARB_explicit_attrib_location : require")
|
||||||
|
("3.30" . "#version 330 core")))
|
||||||
|
|
||||||
(defvar *glsl-symbols* '(gl-position "gl_Position")
|
(defvar *glsl-symbols* '(gl-position "gl_Position")
|
||||||
"Keep a table of reserved glsl symbols.")
|
"Keep a table of reserved glsl symbols.")
|
||||||
|
|
||||||
|
|
@ -113,6 +117,7 @@ the forms comprised of these keywords will be printed in comments."
|
||||||
|
|
||||||
(defun glsl-compile (lambda-list body)
|
(defun glsl-compile (lambda-list body)
|
||||||
(format nil "~a~%~%~{~a~}~%void main ()~%{~%~a}~%"
|
(format nil "~a~%~%~{~a~}~%void main ()~%{~%~a}~%"
|
||||||
|
(cdr (assoc gl-utils:*glsl-version* *version-profiles* :test #'equal))
|
||||||
(mapcar #'handle-preamble lambda-list)
|
(mapcar #'handle-preamble lambda-list)
|
||||||
(let ((*current-indent* 2))
|
(let ((*current-indent* 2))
|
||||||
(walk `(progn ,body) *form-handlers* #'default-handler *env*))))
|
(walk (cons 'progn body) *form-handlers* #'default-handler *env*))))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue