render: buffer: Fix buffer orphaning for streaming buffers.
authorDavid Thompson <dthompson2@worcester.edu>
Fri, 10 May 2019 12:25:28 +0000 (08:25 -0400)
committerDavid Thompson <dthompson2@worcester.edu>
Fri, 10 May 2019 12:25:28 +0000 (08:25 -0400)
* chickadee/render/buffer.scm (map-buffer!): Compare symbols to
  symbols for checking stream usage. -__-

chickadee/render/buffer.scm

index 04598df..4d196d9 100644 (file)
@@ -209,13 +209,12 @@ the vertex buffer to be updated with new vertex data.  The
 vertex buffer data back to the GPU."
   (unless (buffer-mapped? buffer) ;; Don't map a buffer that is already mapped!
     (let ((target (buffer-target-gl buffer))
-          (length (buffer-length buffer))
-          (usage (buffer-usage-gl buffer)))
+          (length (buffer-length buffer)))
       (gpu-state-set! *buffer-state* buffer)
-      (when (eq? usage 'stream)
+      (when (eq? (buffer-usage buffer) 'stream)
         ;; Orphan the buffer to avoid implicit synchronization.
         ;; See: https://www.opengl.org/wiki/Buffer_Object_Streaming#Buffer_re-specification
-        (gl-buffer-data target length %null-pointer usage))
+        (gl-buffer-data target length %null-pointer (buffer-usage-gl buffer)))
       (let ((ptr (gl-map-buffer target (version-1-5 read-write))))
         (set-buffer-data! buffer (pointer->bytevector ptr length))))))