summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-10-28 22:24:53 -0400
committerDavid Thompson <dthompson2@worcester.edu>2014-10-28 22:25:51 -0400
commit58c6c9c3c3ebf3870a5c0320d963f3a5f64ffcd7 (patch)
tree7e8f73ea8eab5d53330d5a994d154fecfc1edbb9
parent8ada9eac88d82a0034c56d3ea2281c4f5e5342aa (diff)
viewport: Memoize clear-buffer-mask.
* sly/render/camera.scm (clear-buffer-mask): Memoize.
-rw-r--r--sly/render/camera.scm21
1 files changed, 12 insertions, 9 deletions
diff --git a/sly/render/camera.scm b/sly/render/camera.scm
index 5afb6f7..f5921e3 100644
--- a/sly/render/camera.scm
+++ b/sly/render/camera.scm
@@ -28,6 +28,7 @@
#:use-module (gl low-level)
#:use-module (gl enums)
#:use-module (sly wrappers gl)
+ #:use-module (sly helpers)
#:use-module (sly color)
#:use-module (sly rect)
#:use-module (sly transform)
@@ -60,15 +61,17 @@ values for CLEAR-FLAGS are 'color-buffer', 'depth-buffer',
'accum-buffer', and 'stencil-buffer'."
(%make-viewport area clear-color clear-flags))
-(define (clear-buffer-mask flags)
- (apply logior
- ;; Map symbols to OpenGL constants.
- (map (match-lambda
- ('depth-buffer 256)
- ('accum-buffer 512)
- ('stencil-buffer 1024)
- ('color-buffer 16384))
- flags)))
+(define clear-buffer-mask
+ (memoize
+ (lambda (flags)
+ (apply logior
+ ;; Map symbols to OpenGL constants.
+ (map (match-lambda
+ ('depth-buffer 256)
+ ('accum-buffer 512)
+ ('stencil-buffer 1024)
+ ('color-buffer 16384))
+ flags)))))
(define (apply-viewport viewport)
"Set the OpenGL state for VIEWPORT. Clip rendering to the viewport