render: buffer: Add buffer-mapped? procedure.
authorDavid Thompson <dthompson2@worcester.edu>
Thu, 9 May 2019 20:27:18 +0000 (16:27 -0400)
committerDavid Thompson <dthompson2@worcester.edu>
Thu, 9 May 2019 20:27:18 +0000 (16:27 -0400)
* chickadee/render/buffer.scm (buffer-mapped?): New procedure.

chickadee/render/buffer.scm

index 702423b..5285be3 100644 (file)
@@ -39,6 +39,7 @@
             make-streaming-buffer
             buffer?
             index-buffer?
+            buffer-mapped?
             buffer-name
             buffer-length
             buffer-stride
@@ -197,6 +198,10 @@ never sent to the GPU."
 for streaming data to the GPU every frame."
   (make-buffer #f #:usage 'stream #:length length #:name name #:target target))
 
+(define (buffer-mapped? buffer)
+  "Return #t if buffer data has been mapped from GPU."
+  (if (buffer-data buffer) #t #f))
+
 (define (map-buffer! buffer)
   "Map the memory space for BUFFER from the GPU to the CPU, allowing
 the vertex buffer to be updated with new vertex data.  The