summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2023-05-03 17:17:30 -0400
committerDavid Thompson <dthompson2@worcester.edu>2023-05-03 17:17:30 -0400
commit71934b1f3ebc852c9e573f2b455d8421f5ea0ac2 (patch)
tree548d1995102ff83ebb4d235b39357fd26f297638
parent1dd76823c98ce5ee42488fdda79859553252be35 (diff)
graphics: shader: Extract sampler? procedure.
-rw-r--r--chickadee/graphics/shader.scm7
1 files changed, 5 insertions, 2 deletions
diff --git a/chickadee/graphics/shader.scm b/chickadee/graphics/shader.scm
index d1ba7ce..5af2c7e 100644
--- a/chickadee/graphics/shader.scm
+++ b/chickadee/graphics/shader.scm
@@ -435,6 +435,10 @@
(size uniform-size)
(value uniform-value %set-uniform-value!))
+(define (sampler? uniform)
+ (or (eq? (uniform-type uniform) sampler-2d)
+ (eq? (uniform-type uniform) sampler-cube)))
+
;; variable name -> {uniform, namespace, uniform array} map
(define-record-type <uniform-namespace>
(make-uniform-namespace name members)
@@ -839,8 +843,7 @@ shader program."
;; most other values. In the case of samplers, they are
;; mapped to OpenGL's "texture units", so we need to
;; ignore them here.
- (unless (or (eq? (uniform-type uniform) sampler-2d)
- (eq? (uniform-type uniform) sampler-cube))
+ (unless (sampler? uniform)
(traverse uniform (shader-struct-ref value key))))
uniform)
(error "expected shader struct" x)))