From 2b656ad8fcafc1ebaaa7fe154f015e85b9dbd941 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 22 May 2014 21:20:13 -0400 Subject: Rename, unexport, and memoize shader-program-attribute-location. * 2d/shader.scm (shader-program-attribute-location): Rename. (attribute-location): Memoize. --- 2d/shader.scm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to '2d/shader.scm') diff --git a/2d/shader.scm b/2d/shader.scm index 1ed18bd..4fffcb3 100644 --- a/2d/shader.scm +++ b/2d/shader.scm @@ -46,7 +46,6 @@ shader-program-id shader-program? shader-program-linked? - shader-program-attribute-location with-shader-program %uniform-setters register-uniform-setter! @@ -233,10 +232,6 @@ VERTEX-SHADER and FRAGMENT-SHADER." (glUseProgram 0) return-value)))) -(define (shader-program-attribute-location program name) - "Get the location of the attribute NAME within the shader PROGRAM." - (glGetAttribLocation (shader-program-id program) name)) - (define-record-type (make-uniform-setter predicate proc) uniform-setter? @@ -291,6 +286,13 @@ location." (glGetUniformLocation (shader-program-id shader-program) (symbol->string name))))) +(define attribute-location + (memoize + (lambda (shader-program name) + "Retrieve the location for the uniform NAME within SHADER-PROGRAM." + (glGetAttribLocation (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 compatible data and assign it to the location of the uniform NAME -- cgit v1.2.3