summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2023-02-07 08:34:14 -0500
committerDavid Thompson <dthompson2@worcester.edu>2023-06-08 08:14:41 -0400
commitfbe819f0f34f0347e6def90ddc605efb877de519 (patch)
tree6c9eb06a71cf630af9d8c6f6d72d8792b7bf9f27
parenta08683819191f12fd7380373ab823ebc246825d7 (diff)
Fix array type emission.
-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)