summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/graphics/seagull.scm12
1 files changed, 11 insertions, 1 deletions
diff --git a/chickadee/graphics/seagull.scm b/chickadee/graphics/seagull.scm
index 6ff764e..567522f 100644
--- a/chickadee/graphics/seagull.scm
+++ b/chickadee/graphics/seagull.scm
@@ -3275,6 +3275,14 @@
(reverse uniforms)
`(begin ,@body))))))
+;; Allow importing Scheme values into Seagull expressions with special
+;; '$' syntax, such as numeric constants or user-defined shader types.
+(define-syntax seagull-quasiquote
+ (syntax-rules ($)
+ ((_ ($ x)) x)
+ ((_ (x ...)) (list (seagull-quasiquote x) ...))
+ ((_ x) (quote x))))
+
;; Using syntax-case allows us to compile shaders to their fully typed
;; intermediate form at compile time, leaving only GLSL emission for
;; runtime.
@@ -3284,7 +3292,9 @@
((_ name stage body ...)
(let*-values (((inputs outputs uniforms body)
(partition-globals
- (syntax->datum #'(body ...)))))
+ (syntax->datum
+ (eval #'(seagull-quasiquote (body ...))
+ (current-module))))))
(define-values (compiled global-map max-id)
(compile-seagull #:stage (syntax->datum #'stage)
#:inputs inputs