Enhance the gl-assert macro to include an implicit progn

This commit is contained in:
Renaud Casenave-Péré 2015-04-21 17:14:50 +02:00
parent 8b96f8166f
commit a26b19be1b

View file

@ -37,12 +37,15 @@ Store values like the drivers version."
(and (<= maj *major-version*)
(<= min *minor-version*))))
(defmacro gl-assert (form)
`(prog1
(defmacro gl-assert (&body body)
`(progn
,@(loop for form in body
collect `(prog1
,form
(let ((err-sym (%gl:get-error)))
(unless (eq err-sym :zero)
(error "The OpenGL command `~a'~%~2iresulted in an error: ~s~%" ',form err-sym)))))
(error "The OpenGL command `~a'~%~2iresulted in an error: ~s~%"
',form err-sym)))))))
(defmacro gl-restart (form)
`(restart-case