summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2018-09-06 09:25:34 -0400
committerDavid Thompson <dthompson2@worcester.edu>2018-09-06 09:25:34 -0400
commit2162d706d2015b962c7a41a05670a4ea7cd6f0b8 (patch)
tree5ef6b0416d5c9498e7ef17624691e3f39ac07640
parent02c79cc63c52c310aa1e96c7cac1f881055a2714 (diff)
render: buffer: Orphan before mapping only when used for streaming.
* chickdaee/render/buffer.scm (map-buffer!): Orphan buffer data only when the buffer usage is 'stream'.
-rw-r--r--chickadee/render/buffer.scm7
1 files changed, 4 insertions, 3 deletions
diff --git a/chickadee/render/buffer.scm b/chickadee/render/buffer.scm
index 7f0c168..4363d22 100644
--- a/chickadee/render/buffer.scm
+++ b/chickadee/render/buffer.scm
@@ -196,9 +196,10 @@ vertex buffer data back to the GPU."
(length (buffer-length buffer))
(usage (buffer-usage-gl buffer)))
(gpu-state-set! *buffer-state* buffer)
- ;; 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)
+ (when (eq? usage '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))
(let ((ptr (gl-map-buffer target (version-1-5 read-write))))
(set-buffer-data! buffer (pointer->bytevector ptr length)))))