summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2018-12-11 17:47:21 -0500
committerDavid Thompson <dthompson2@worcester.edu>2018-12-11 17:47:21 -0500
commite777b012cb1fe58b55779af6464cac860d78ae96 (patch)
treef13dfe755a5300ba24438c233f5a98cb42bf4b05
parent0e3cddca04cc0ec9d3ea73debb1fa358e44aa538 (diff)
render: shader: Improve docstrings.
-rw-r--r--chickadee/render/shader.scm9
1 files changed, 9 insertions, 0 deletions
diff --git a/chickadee/render/shader.scm b/chickadee/render/shader.scm
index fdb683a..52dfc30 100644
--- a/chickadee/render/shader.scm
+++ b/chickadee/render/shader.scm
@@ -297,6 +297,8 @@
table))
(define (make-shader vertex-port fragment-port)
+ "Read GLSL source from VERTEX-PORT and FRAGMENT-PORT and compile
+them into a GPU shader program."
(define (make-shader-stage type port)
(let ((id (gl-create-shader type))
(source (get-bytevector-all port)))
@@ -330,6 +332,8 @@
(gpu-guard (%make-shader id (extract-attributes id) (extract-uniforms id)))))
(define (load-shader vertex-source-file fragment-source-file)
+ "Compile the GLSL source code within VERTEX-SOURCE-FILE and
+FRAGMENT-SOURCE-FILE into a GPU shader program."
(call-with-input-file vertex-source-file
(lambda (vertex-port)
(call-with-input-file fragment-source-file
@@ -337,6 +341,9 @@
(make-shader vertex-port fragment-port))))))
(define (strings->shader vertex-source fragment-source)
+ "Compile VERTEX-SOURCE, the GLSL code for the vertex shader,
+and FRAGMENT-SOURCE, the GLSL code for the fragment shader, into a GPU
+shader program."
(call-with-input-string vertex-source
(lambda (vertex-port)
(call-with-input-string fragment-source
@@ -344,6 +351,7 @@
(make-shader vertex-port fragment-port))))))
(define (shader-uniform shader name)
+ "Return the metadata for the uniform NAME in SHADER."
(let ((uniform (hash-ref (shader-uniforms shader) name)))
(or uniform (error "no such uniform" name))))
@@ -356,4 +364,5 @@ is undefined."
(%set-uniform-value! uniform x))
(define (uniform-default-value uniform)
+ "Return the default value of UNIFORM."
(default-uniform-value (uniform-type uniform)))