diff options
Diffstat (limited to '2d/shader.scm')
-rw-r--r-- | 2d/shader.scm | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/2d/shader.scm b/2d/shader.scm index 0be977f..1ed18bd 100644 --- a/2d/shader.scm +++ b/2d/shader.scm @@ -284,9 +284,12 @@ location." (color-b c) (color-a c)))) -(define (uniform-location shader-program name) - "Retrieve the location for the uniform NAME within SHADER-PROGRAM." - (glGetUniformLocation (shader-program-id shader-program) name)) +(define uniform-location + (memoize + (lambda (shader-program name) + "Retrieve the location for the uniform NAME within SHADER-PROGRAM." + (glGetUniformLocation (shader-program-id shader-program) + (symbol->string name))))) (define (uniform-set! shader-program name value) "Use the appropriate setter procedure to translate VALUE into OpenGL @@ -313,8 +316,6 @@ within SHADER-PROGRAM." (begin body ...)) ((_ ((name value) ...) body ...) (begin - (uniform-set! (current-shader-program) - (symbol->string 'name) - value) + (uniform-set! (current-shader-program) 'name value) ... body ...)))) |