summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2019-05-10 08:25:28 -0400
committerDavid Thompson <dthompson2@worcester.edu>2019-05-10 08:25:28 -0400
commit39d610bb7fd573941c3dd362949a7fff02165908 (patch)
tree0d5abfcb7cf7511400dbb41c2e22495b17a9fa87
parent94e892ff8c227c066543fa430dc4605db506944c (diff)
render: buffer: Fix buffer orphaning for streaming buffers.
* chickadee/render/buffer.scm (map-buffer!): Compare symbols to symbols for checking stream usage. -__-
-rw-r--r--chickadee/render/buffer.scm7
1 files changed, 3 insertions, 4 deletions
diff --git a/chickadee/render/buffer.scm b/chickadee/render/buffer.scm
index 04598df..4d196d9 100644
--- a/chickadee/render/buffer.scm
+++ b/chickadee/render/buffer.scm
@@ -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))))))