From 8b96f8166f1837d1e696bd820b22d39b71b2e3ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Renaud=20Casenave-P=C3=A9r=C3=A9?= Date: Sat, 4 Apr 2015 23:45:23 +0200 Subject: [PATCH] Add glsl version directive to the shader according to the supported version --- src/render/shader/glsl.lisp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/render/shader/glsl.lisp b/src/render/shader/glsl.lisp index 2975aeb..a688d24 100644 --- a/src/render/shader/glsl.lisp +++ b/src/render/shader/glsl.lisp @@ -28,6 +28,10 @@ "Configure the verbosity of the compiler. 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") "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) (format nil "~a~%~%~{~a~}~%void main ()~%{~%~a}~%" + (cdr (assoc gl-utils:*glsl-version* *version-profiles* :test #'equal)) (mapcar #'handle-preamble lambda-list) (let ((*current-indent* 2)) - (walk `(progn ,body) *form-handlers* #'default-handler *env*)))) + (walk (cons 'progn body) *form-handlers* #'default-handler *env*))))