diff options
-rw-r--r-- | chickadee/render/buffer.scm | 234 | ||||
-rw-r--r-- | chickadee/render/shapes.scm | 40 | ||||
-rw-r--r-- | chickadee/render/sprite.scm | 90 | ||||
-rw-r--r-- | doc/api.texi | 76 |
4 files changed, 220 insertions, 220 deletions
diff --git a/chickadee/render/buffer.scm b/chickadee/render/buffer.scm index e784456..19d1e8d 100644 --- a/chickadee/render/buffer.scm +++ b/chickadee/render/buffer.scm @@ -51,25 +51,25 @@ unmap-buffer! with-mapped-buffer *buffer-state* - make-typed-buffer - make-streaming-typed-buffer - typed-buffer? - typed-buffer->buffer - typed-buffer->vector - typed-buffer-name - typed-buffer-offset - typed-buffer-component-type - typed-buffer-normalized? - typed-buffer-count - typed-buffer-type - typed-buffer-max - typed-buffer-min - typed-buffer-sparse - typed-buffer-data - typed-buffer-divisor - map-typed-buffer! - unmap-typed-buffer! - with-mapped-typed-buffer + make-buffer-view + make-streaming-buffer-view + buffer-view? + buffer-view->buffer + buffer-view->vector + buffer-view-name + buffer-view-offset + buffer-view-component-type + buffer-view-normalized? + buffer-view-count + buffer-view-type + buffer-view-max + buffer-view-min + buffer-view-sparse + buffer-view-data + buffer-view-divisor + map-buffer-view! + unmap-buffer-view! + with-mapped-buffer-view make-vertex-array vertex-array? vertex-array-indices @@ -237,29 +237,29 @@ vertex buffer data back to the GPU." ;;; -;;; Typed Buffers +;;; Buffer Views ;;; -(define-record-type <typed-buffer> - (%make-typed-buffer name buffer offset component-type - normalized? length type max min sparse divisor) - typed-buffer? - (name typed-buffer-name) - (buffer typed-buffer->buffer) - (offset typed-buffer-offset) - (component-type typed-buffer-component-type) - (normalized? typed-buffer-normalized?) - (length typed-buffer-length) - (type typed-buffer-type) - (max typed-buffer-max) - (min typed-buffer-min) - (sparse typed-buffer-sparse) - (divisor typed-buffer-divisor)) ; for instanced rendering - -(define (typed-buffer-stride typed-buffer) - (or (buffer-stride (typed-buffer->buffer typed-buffer)) - (* (type-size (typed-buffer-type typed-buffer)) - (component-type-size (typed-buffer-component-type typed-buffer))))) +(define-record-type <buffer-view> + (%make-buffer-view name buffer offset component-type + normalized? length type max min sparse divisor) + buffer-view? + (name buffer-view-name) + (buffer buffer-view->buffer) + (offset buffer-view-offset) + (component-type buffer-view-component-type) + (normalized? buffer-view-normalized?) + (length buffer-view-length) + (type buffer-view-type) + (max buffer-view-max) + (min buffer-view-min) + (sparse buffer-view-sparse) + (divisor buffer-view-divisor)) ; for instanced rendering + +(define (buffer-view-stride buffer-view) + (or (buffer-stride (buffer-view->buffer buffer-view)) + (* (type-size (buffer-view-type buffer-view)) + (component-type-size (buffer-view-component-type buffer-view))))) (define (num-elements byte-length byte-offset type component-type) (inexact->exact @@ -269,21 +269,21 @@ vertex buffer data back to the GPU." (type-size type)))))) -(define* (make-typed-buffer #:key - (name "anonymous") - buffer - type - component-type - normalized? - (offset 0) - (length (num-elements (buffer-length buffer) - offset - type - component-type)) - max - min - sparse - divisor) +(define* (make-buffer-view #:key + (name "anonymous") + buffer + type + component-type + normalized? + (offset 0) + (length (num-elements (buffer-length buffer) + offset + type + component-type)) + max + min + sparse + divisor) "Return a new typed buffer view for BUFFER starting at byte index OFFSET of LENGTH elements, where each element is of TYPE and composed of COMPONENT-TYPE values. @@ -314,8 +314,8 @@ divisor of 0 means that a single element is used for every instance and is used for the data being instanced. A divisor of 1 means that each element is used for 1 instance. A divisor of 2 means that each element is used for 2 instances, and so on." - (%make-typed-buffer name buffer offset component-type - normalized? length type max min sparse divisor)) + (%make-buffer-view name buffer offset component-type + normalized? length type max min sparse divisor)) (define (type-size type) (match type @@ -337,11 +337,11 @@ element is used for 2 instances, and so on." ('float 4) ('double 8))) -(define* (make-streaming-typed-buffer type component-type length #:key - (name "anonymous") - (target 'vertex) - data - divisor) +(define* (make-streaming-buffer-view type component-type length #:key + (name "anonymous") + (target 'vertex) + data + divisor) "Return a new typed buffer to hold LENGTH elements of TYPE whose components are comprised of COMPONENT-TYPE values. The underlying untyped buffer is configured for GPU streaming. Optonally, a NAME can @@ -359,32 +359,32 @@ which attributes advance when rendering multiple instances." (make-streaming-buffer buffer-length #:name name #:target target)))) - (make-typed-buffer #:name name - #:buffer buffer - #:type type - #:component-type component-type - #:length length - #:divisor divisor))) - -(define (display-typed-buffer typed-buffer port) - (format port "#<typed-buffer name: ~s buffer: ~a type: ~s component-type: ~s length: ~d offset: ~d>" - (typed-buffer-name typed-buffer) - (typed-buffer->buffer typed-buffer) - (typed-buffer-type typed-buffer) - (typed-buffer-component-type typed-buffer) - (typed-buffer-length typed-buffer) - (typed-buffer-offset typed-buffer))) - -(set-record-type-printer! <typed-buffer> display-typed-buffer) - -(define (typed-buffer-type-size typed-buffer) - (type-size (typed-buffer-type typed-buffer))) - -(define (typed-buffer-data typed-buffer) - (buffer-data (typed-buffer->buffer typed-buffer))) - -(define (typed-buffer-type-gl typed-buffer) - (match (typed-buffer-component-type typed-buffer) + (make-buffer-view #:name name + #:buffer buffer + #:type type + #:component-type component-type + #:length length + #:divisor divisor))) + +(define (display-buffer-view buffer-view port) + (format port "#<buffer-view name: ~s buffer: ~a type: ~s component-type: ~s length: ~d offset: ~d>" + (buffer-view-name buffer-view) + (buffer-view->buffer buffer-view) + (buffer-view-type buffer-view) + (buffer-view-component-type buffer-view) + (buffer-view-length buffer-view) + (buffer-view-offset buffer-view))) + +(set-record-type-printer! <buffer-view> display-buffer-view) + +(define (buffer-view-type-size buffer-view) + (type-size (buffer-view-type buffer-view))) + +(define (buffer-view-data buffer-view) + (buffer-data (buffer-view->buffer buffer-view))) + +(define (buffer-view-type-gl buffer-view) + (match (buffer-view-component-type buffer-view) ('byte (data-type byte)) ('unsigned-byte (data-type unsigned-byte)) ('short (data-type short)) @@ -394,33 +394,33 @@ which attributes advance when rendering multiple instances." ('float (data-type float)) ('double (data-type double)))) -(define (map-typed-buffer! typed-buffer) - (map-buffer! (typed-buffer->buffer typed-buffer))) +(define (map-buffer-view! buffer-view) + (map-buffer! (buffer-view->buffer buffer-view))) -(define (unmap-typed-buffer! typed-buffer) - (unmap-buffer! (typed-buffer->buffer typed-buffer))) +(define (unmap-buffer-view! buffer-view) + (unmap-buffer! (buffer-view->buffer buffer-view))) -(define-syntax-rule (with-mapped-typed-buffer typed-buffer body ...) - (with-mapped-buffer (typed-buffer->buffer typed-buffer) body ...)) +(define-syntax-rule (with-mapped-buffer-view buffer-view body ...) + (with-mapped-buffer (buffer-view->buffer buffer-view) body ...)) -(define* (apply-typed-buffer typed-buffer #:optional attribute-index) - (gpu-state-set! *buffer-state* (typed-buffer->buffer typed-buffer)) +(define* (apply-buffer-view buffer-view #:optional attribute-index) + (gpu-state-set! *buffer-state* (buffer-view->buffer buffer-view)) ;; If there is no attribute-index, we assume this is being bound for ;; use as an index buffer. (when attribute-index (gl-enable-vertex-attrib-array attribute-index) (gl-vertex-attrib-pointer attribute-index - (typed-buffer-type-size typed-buffer) - (typed-buffer-type-gl typed-buffer) - (typed-buffer-normalized? typed-buffer) - (typed-buffer-stride typed-buffer) - (make-pointer (typed-buffer-offset typed-buffer))) - (let ((divisor (typed-buffer-divisor typed-buffer))) + (buffer-view-type-size buffer-view) + (buffer-view-type-gl buffer-view) + (buffer-view-normalized? buffer-view) + (buffer-view-stride buffer-view) + (make-pointer (buffer-view-offset buffer-view))) + (let ((divisor (buffer-view-divisor buffer-view))) (when divisor (gl-vertex-attrib-divisor attribute-index divisor))))) ;; TODO: Handle 4-byte alignment rule for the types that need it. -(define (typed-buffer->vector typed-buffer) +(define (buffer-view->vector buffer-view) (define (component-parser type) (match type ('byte bytevector-s8-ref) @@ -490,13 +490,13 @@ which attributes advance when rendering multiple instances." (parse-component bv (+ i (* component-type-size 13))) (parse-component bv (+ i (* component-type-size 14))) (parse-component bv (+ i (* component-type-size 15))))))))) - (with-mapped-typed-buffer typed-buffer - (let* ((data (typed-buffer-data typed-buffer)) - (length (typed-buffer-length typed-buffer)) - (offset (typed-buffer-offset typed-buffer)) - (stride (typed-buffer-stride typed-buffer)) - (type (typed-buffer-type typed-buffer)) - (component-type (typed-buffer-component-type typed-buffer)) + (with-mapped-buffer-view buffer-view + (let* ((data (buffer-view-data buffer-view)) + (length (buffer-view-length buffer-view)) + (offset (buffer-view-offset buffer-view)) + (stride (buffer-view-stride buffer-view)) + (type (buffer-view-type buffer-view)) + (component-type (buffer-view-component-type buffer-view)) (type-byte-size (* (type-size type) (component-type-size component-type))) (v (make-vector length)) @@ -574,10 +574,10 @@ argument may be overridden. The following values are supported: mode)))) (gpu-state-set! *vertex-array-state* array) (for-each (match-lambda - ((index . typed-buffer) - (apply-typed-buffer typed-buffer index))) + ((index . buffer-view) + (apply-buffer-view buffer-view index))) attributes) - (apply-typed-buffer indices) + (apply-buffer-view indices) (gpu-state-set! *vertex-array-state* null-vertex-array) array)) @@ -596,8 +596,8 @@ argument may be overridden. The following values are supported: (let ((indices (vertex-array-indices array))) (gl-draw-elements (vertex-array-mode-gl array) (or count - (typed-buffer-length indices)) - (typed-buffer-type-gl indices) + (buffer-view-length indices)) + (buffer-view-type-gl indices) %null-pointer))) (define* (render-vertices/instanced array instances #:optional count) @@ -605,7 +605,7 @@ argument may be overridden. The following values are supported: (let ((indices (vertex-array-indices array))) (gl-draw-elements-instanced (vertex-array-mode-gl array) (or count - (typed-buffer-length indices)) - (typed-buffer-type-gl indices) + (buffer-view-length indices)) + (buffer-view-type-gl indices) %null-pointer instances))) diff --git a/chickadee/render/shapes.scm b/chickadee/render/shapes.scm index db54e3d..f7412e8 100644 --- a/chickadee/render/shapes.scm +++ b/chickadee/render/shapes.scm @@ -42,14 +42,14 @@ (define draw-filled-rect (let* ((vertex-buffer (delay - (make-streaming-typed-buffer 'vec2 'float 4 - #:name "rect-typed-buffer"))) + (make-streaming-buffer-view 'vec2 'float 4 + #:name "rect-buffer-view"))) (index-buffer (delay - (make-typed-buffer #:type 'scalar - #:component-type 'unsigned-int - #:buffer (make-buffer (u32vector 0 3 2 0 2 1) - #:target 'index)))) + (make-buffer-view #:type 'scalar + #:component-type 'unsigned-int + #:buffer (make-buffer (u32vector 0 3 2 0 2 1) + #:target 'index)))) (vertex-array (delay (make-vertex-array #:indices (force index-buffer) @@ -88,8 +88,8 @@ void main (void) { (y1 (rect-y region)) (x2 (+ x1 (rect-width region))) (y2 (+ y1 (rect-height region)))) - (with-mapped-typed-buffer (force vertex-buffer) - (let ((bv (typed-buffer-data (force vertex-buffer)))) + (with-mapped-buffer-view (force vertex-buffer) + (let ((bv (buffer-view-data (force vertex-buffer)))) (f32vector-set! bv 0 x1) (f32vector-set! bv 1 y1) (f32vector-set! bv 2 x2) @@ -112,18 +112,18 @@ void main (void) { (let* ((mvp (make-null-matrix4)) (vertex-buffer (delay - (make-streaming-typed-buffer 'vec2 'float 4 - #:name "line-typed-buffer"))) + (make-streaming-buffer-view 'vec2 'float 4 + #:name "line-buffer-view"))) (texcoord-buffer (delay - (make-streaming-typed-buffer 'vec2 'float 4 - #:name "line-typed-buffer"))) + (make-streaming-buffer-view 'vec2 'float 4 + #:name "line-buffer-view"))) (index-buffer (delay - (make-typed-buffer #:type 'scalar - #:component-type 'unsigned-int - #:buffer (make-buffer (u32vector 0 3 2 0 2 1) - #:target 'index)))) + (make-buffer-view #:type 'scalar + #:component-type 'unsigned-int + #:buffer (make-buffer (u32vector 0 3 2 0 2 1) + #:target 'index)))) (vertex-array (delay (make-vertex-array #:indices (force index-buffer) @@ -255,8 +255,8 @@ may use SHADER to override the built-in line segment shader." (vy4 (+ (+ y2 ypad) (- xpad))) (s4 (+ length padding)) (t4 padding)) - (with-mapped-typed-buffer (force vertex-buffer) - (let ((bv (typed-buffer-data (force vertex-buffer)))) + (with-mapped-buffer-view (force vertex-buffer) + (let ((bv (buffer-view-data (force vertex-buffer)))) (f32vector-set! bv 0 vx1) (f32vector-set! bv 1 vy1) (f32vector-set! bv 2 vx2) @@ -265,8 +265,8 @@ may use SHADER to override the built-in line segment shader." (f32vector-set! bv 5 vy3) (f32vector-set! bv 6 vx4) (f32vector-set! bv 7 vy4))) - (with-mapped-typed-buffer (force texcoord-buffer) - (let ((bv (typed-buffer-data (force texcoord-buffer)))) + (with-mapped-buffer-view (force texcoord-buffer) + (let ((bv (buffer-view-data (force texcoord-buffer)))) (f32vector-set! bv 0 s1) (f32vector-set! bv 1 t1) (f32vector-set! bv 2 s2) diff --git a/chickadee/render/sprite.scm b/chickadee/render/sprite.scm index c453a9d..f1b3515 100644 --- a/chickadee/render/sprite.scm +++ b/chickadee/render/sprite.scm @@ -81,25 +81,25 @@ void main (void) { #:stride stride #:usage 'stream))) (pos (delay - (make-typed-buffer #:name "unbatched sprite vertices" - #:buffer (force buffer) - #:type 'vec2 - #:component-type 'float - #:length 4))) + (make-buffer-view #:name "unbatched sprite vertices" + #:buffer (force buffer) + #:type 'vec2 + #:component-type 'float + #:length 4))) (tex (delay - (make-typed-buffer #:name "unbatched sprite texcoords" - #:buffer (force buffer) - #:type 'vec2 - #:component-type 'float - #:length 4 - #:offset 8))) + (make-buffer-view #:name "unbatched sprite texcoords" + #:buffer (force buffer) + #:type 'vec2 + #:component-type 'float + #:length 4 + #:offset 8))) (indices (delay - (make-typed-buffer #:name "unbatched sprite indices" - #:type 'scalar - #:component-type 'unsigned-int - #:buffer (make-buffer (u32vector 0 3 2 0 2 1) - #:target 'index)))) + (make-buffer-view #:name "unbatched sprite indices" + #:type 'scalar + #:component-type 'unsigned-int + #:buffer (make-buffer (u32vector 0 3 2 0 2 1) + #:target 'index)))) (vertex-array (delay (make-vertex-array #:indices (force indices) @@ -114,7 +114,7 @@ void main (void) { (tint white) (blend-mode 'alpha) (texcoords (texture-gl-tex-rect texture))) - (with-mapped-typed-buffer (force pos) + (with-mapped-buffer-view (force pos) (let* ((x1 (rect-x rect)) (y1 (rect-y rect)) (x2 (+ x1 (rect-width rect))) @@ -123,7 +123,7 @@ void main (void) { (t1 (rect-y texcoords)) (s2 (+ (rect-x texcoords) (rect-width texcoords))) (t2 (+ (rect-y texcoords) (rect-height texcoords))) - (bv (typed-buffer-data (force pos)))) + (bv (buffer-view-data (force pos)))) ;; Texture origin is at the top-left, so we need to flip the Y ;; coordinate relative to the vertices. (f32vector-set! bv 0 x1) @@ -206,46 +206,46 @@ BLEND-MODE." (let* ((index-data (let ((bv (make-u32vector (* capacity 6)))) (let loop ((i 0)) (when (< i capacity) - (let ((index-offset (* i 6)) - (vertex-offset (* i 4))) - (u32vector-set! bv index-offset vertex-offset) - (u32vector-set! bv (+ index-offset 1) (+ vertex-offset 3)) - (u32vector-set! bv (+ index-offset 2) (+ vertex-offset 2)) - (u32vector-set! bv (+ index-offset 3) vertex-offset) - (u32vector-set! bv (+ index-offset 4) (+ vertex-offset 2)) - (u32vector-set! bv (+ index-offset 5) (+ vertex-offset 1)) - (loop (+ i 1))))) + (let ((index-offset (* i 6)) + (vertex-offset (* i 4))) + (u32vector-set! bv index-offset vertex-offset) + (u32vector-set! bv (+ index-offset 1) (+ vertex-offset 3)) + (u32vector-set! bv (+ index-offset 2) (+ vertex-offset 2)) + (u32vector-set! bv (+ index-offset 3) vertex-offset) + (u32vector-set! bv (+ index-offset 4) (+ vertex-offset 2)) + (u32vector-set! bv (+ index-offset 5) (+ vertex-offset 1)) + (loop (+ i 1))))) bv)) (index-buffer (make-buffer index-data #:name "indices" #:target 'index)) - (indices (make-typed-buffer #:name "indices" - #:buffer index-buffer - #:type 'scalar - #:component-type 'unsigned-int)) + (indices (make-buffer-view #:name "indices" + #:buffer index-buffer + #:type 'scalar + #:component-type 'unsigned-int)) (stride 32) ; 8 f32s, 2 for vertex, 2 for texcoord, 4 for tint color (buffer (make-buffer #f #:name "sprite batch buffer" #:length (* capacity stride 4) #:stride stride #:usage 'stream)) - (pos (make-typed-buffer #:name "sprite batch vertices" + (pos (make-buffer-view #:name "sprite batch vertices" + #:buffer buffer + #:type 'vec2 + #:component-type 'float + #:length (* capacity 4))) + (tex (make-buffer-view #:name "sprite batch texture coordinates" + #:buffer buffer + #:type 'vec2 + #:component-type 'float + #:length (* capacity 4) + #:offset 8)) + (tint (make-buffer-view #:name "sprite batch tint colors" #:buffer buffer - #:type 'vec2 - #:component-type 'float - #:length (* capacity 4))) - (tex (make-typed-buffer #:name "sprite batch texture coordinates" - #:buffer buffer - #:type 'vec2 + #:type 'vec4 #:component-type 'float #:length (* capacity 4) - #:offset 8)) - (tint (make-typed-buffer #:name "sprite batch tint colors" - #:buffer buffer - #:type 'vec4 - #:component-type 'float - #:length (* capacity 4) - #:offset 16)) + #:offset 16)) (va (make-vertex-array #:indices indices #:attributes `((0 . ,pos) (1 . ,tex) diff --git a/doc/api.texi b/doc/api.texi index 26525f6..8e3ba98 100644 --- a/doc/api.texi +++ b/doc/api.texi @@ -2111,20 +2111,20 @@ Within a VBO, one or more ``attributes'', as OpenGL calls them, may be present. Attributes are subregions within the buffer that have a particular data type. In this case, there are two attributes packed into the buffer. To provided a typed view into a buffer, the -@code{make-typed-buffer} procedure is needed: +@code{make-buffer-view} procedure is needed: @example (define vertices - (make-typed-buffer #:buffer buffer - #:type 'vec2 - #:component-type 'float - #:length 4)) + (make-buffer-view #:buffer buffer + #:type 'vec2 + #:component-type 'float + #:length 4)) (define texcoords - (make-typed-buffer #:buffer buffer - #:type 'vec2 - #:component-type 'float - #:length 4 - #:offset 8)) + (make-buffer-view #:buffer buffer + #:type 'vec2 + #:component-type 'float + #:length 4 + #:offset 8)) @end example To render a square, the GPU needs to draw two triangles, which means @@ -2139,18 +2139,18 @@ created. (make-buffer (u32vector 0 3 2 0 2 1) #:target 'index) (define indices - (make-typed-buffer #:type 'scalar - #:component-type 'unsigned-int - #:buffer index-buffer)) + (make-buffer-view #:type 'scalar + #:component-type 'unsigned-int + #:buffer index-buffer)) @end example Note the use of the @code{#:target} keyword argument. It is required because the GPU treats index data in a special way and must be told which data is index data. -Now that the typed buffers representing each attribute have been +Now that the buffer views representing each attribute have been created, all that's left is to bind them all together in a ``vertex -array object'', or VAO. Vertex arrays associate each typed buffer +array object'', or VAO. Vertex arrays associate each buffer view with an attribute index on the GPU. The indices that are chosen must correspond with the indices that the shader (@pxref{Shaders}) expects for each attribute. @@ -2267,11 +2267,11 @@ This form is useful for streaming buffers that need to update their contents dynamically, such as a sprite batch. @end deffn -@deffn {Procedure} make-typed-buffer #:buffer #:type @ +@deffn {Procedure} make-buffer-view #:buffer #:type @ #:component-type #:length [#:offset 0] [#:divisor] @ [#:name "anonymous"] -Return a new typed buffer view for @var{buffer} starting at byte index +Return a new buffer view for @var{buffer} starting at byte index @var{offset} of @var{length} elements, where each element is of @var{type} and composed of @var{component-type} values. @@ -2324,37 +2324,37 @@ used for 1 instance. A divisor of 2 means that each element is used for 2 instances, and so on. @end deffn -@deffn {Procedure} typed-buffer? @var{obj} -Return @code{#t} if @var{obj} is a typed buffer. +@deffn {Procedure} buffer-view? @var{obj} +Return @code{#t} if @var{obj} is a buffer view. @end deffn -@deffn {Procedure} typed-buffer->buffer @var{typed-buffer} -Return the buffer that @var{typed-buffer} is using. +@deffn {Procedure} buffer-view->buffer @var{buffer-view} +Return the buffer that @var{buffer-view} is using. @end deffn -@deffn {Procedure} typed-buffer-name @var{typed-buffer} -Return the name of @var{typed-buffer}. +@deffn {Procedure} buffer-view-name @var{buffer-view} +Return the name of @var{buffer-view}. @end deffn -@deffn {Procedure} typed-buffer-offset @var{typed-buffer} -Return the byte offset of @var{typed-buffer}. +@deffn {Procedure} buffer-view-offset @var{buffer-view} +Return the byte offset of @var{buffer-view}. @end deffn -@deffn {Procedure} typed-buffer-type @var{typed-buffer} -Return the data type of @var{typed-buffer}. +@deffn {Procedure} buffer-view-type @var{buffer-view} +Return the data type of @var{buffer-view}. @end deffn -@deffn {Procedure} typed-buffer-component-type @var{typed-buffer} -Return the component data type of @var{typed-buffer} +@deffn {Procedure} buffer-view-component-type @var{buffer-view} +Return the component data type of @var{buffer-view} @end deffn -@deffn {Procedure} typed-buffer-divisor @var{typed-buffer} -Return the instance divisor for @var{typed-buffer}. +@deffn {Procedure} buffer-view-divisor @var{buffer-view} +Return the instance divisor for @var{buffer-view}. @end deffn -@deffn {Syntax} with-mapped-typed-buffer @var{typed-buffer} @var{body} @dots{} +@deffn {Syntax} with-mapped-buffer-view @var{buffer-view} @var{body} @dots{} -Evaluate @var{body} in the context of @var{typed-buffer} having its +Evaluate @var{body} in the context of @var{buffer-view} having its data synced from GPU memory to RAM. See @code{with-mapped-buffer} for more information. @end deffn @@ -2362,15 +2362,15 @@ more information. @deffn {Procedure} make-vertex-array #:indices #:attributes @ [#:mode @code{triangles}] -Return a new vertex array using the index data within the typed buffer +Return a new vertex array using the index data within the buffer view @var{indices} and the vertex attribute data within @var{attributes}. @var{attributes} is an alist mapping shader attribute indices to typed buffers containing vertex data: @example -`((1 . ,typed-buffer-a) - (2 . ,typed-buffer-b) +`((1 . ,buffer-view-a) + (2 . ,buffer-view-b) ...) @end example @@ -2400,11 +2400,11 @@ Return @code{#t} if @var{obj} is a vertex array. @end deffn @deffn {Procedure} vertex-array-indices @var{vertex-array} -Return the typed buffer containing index data for @var{vertex-array}. +Return the buffer view containing index data for @var{vertex-array}. @end deffn @deffn {Procedure} vertex-array-attributes @var{vertex-array} -Return the attribute index -> typed buffer mapping of vertex attribute +Return the attribute index -> buffer view mapping of vertex attribute data for @var{vertex-array}. @end deffn |