summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/graphics/seagull.scm18
1 files changed, 14 insertions, 4 deletions
diff --git a/chickadee/graphics/seagull.scm b/chickadee/graphics/seagull.scm
index 0ddbbfb..f19dc90 100644
--- a/chickadee/graphics/seagull.scm
+++ b/chickadee/graphics/seagull.scm
@@ -2421,12 +2421,22 @@
(define %type-name-map
'((sampler-2d . sampler2D)))
+(define (type-descriptor->glsl desc)
+ (match desc
+ ((? symbol?)
+ (or (assq-ref %type-name-map desc) desc))
+ (('array desc* length)
+ (format #f "~a[~a]"
+ (type-descriptor->glsl desc*)
+ length))))
+
(define (emit:top-level bindings body version port level)
(for-each (match-lambda
- (((? top-level-qualifier? qualifier) type-name name)
- (define type-name*
- (or (assq-ref %type-name-map type-name) type-name))
- (format port "~a ~a ~a;\n" qualifier type-name* name))
+ (((? top-level-qualifier? qualifier) type-desc name)
+ (format port "~a ~a ~a;\n"
+ qualifier
+ (type-descriptor->glsl type-desc)
+ name))
(('function name ('t (type) ('lambda params body)))
(emit:function name type params body version port level)))
bindings)