diff options
-rw-r--r-- | chickadee/graphics/seagull.scm | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/chickadee/graphics/seagull.scm b/chickadee/graphics/seagull.scm index cc51b37..af15f97 100644 --- a/chickadee/graphics/seagull.scm +++ b/chickadee/graphics/seagull.scm @@ -53,9 +53,12 @@ #:use-module (ice-9 exceptions) #:use-module (ice-9 format) #:use-module (ice-9 match) + #:use-module (ice-9 pretty-print) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) #:use-module (srfi srfi-11) + #:use-module (system repl command) + #:use-module (system repl common) #:export (seagull-module? seagull-module-vertex? seagull-module-fragment? @@ -3174,10 +3177,6 @@ vec4 texture(samplerCube tex, vec3 coord) { (link-vertex-outputs-with-fragment-inputs vertex fragment)) (define vertex-glsl (emit-stage vertex* 'vertex version)) (define fragment-glsl (emit-stage fragment* 'fragment version)) - (display vertex-glsl) - (newline) - (display fragment-glsl) - (newline) (values vertex-glsl fragment-glsl uniform-map))) (define* (compile-shader vertex fragment #:key @@ -3191,3 +3190,24 @@ vec4 texture(samplerCube tex, vec3 coord) { (make-shader vertex-port fragment-port #:uniform-map uniform-map #:pre-process? #f))))))) + + +;;; +;;; REPL integration +;;; + +(define-meta-command ((seagull-inspect chickadee) repl module) + "seagull-inspect MODULE +Show the intermediate compiled form of MODULE." + (pretty-print (seagull-module-compiled (repl-eval repl module)))) + +(define-meta-command ((seagull-compile chickadee) repl vertex fragment + #:optional (version (graphics-engine-glsl-version))) + "seagull-compile VERTEX-MODULE FRAGMENT-MODULE +Show the compiled GLSL form of VERTEX-MODULE and FRAGMENT-MODULE." + (define-values (vertex-glsl fragment-glsl uniform-map) + (link-seagull-modules (repl-eval repl vertex) + (repl-eval repl fragment) + version)) + (format #t "Vertex GLSL:\n\n~a\n" vertex-glsl) + (format #t "Fragment GLSL:\n\n~a" fragment-glsl)) |