diff options
author | David Thompson <dthompson2@worcester.edu> | 2018-09-06 09:25:34 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2018-09-06 09:25:34 -0400 |
commit | 2162d706d2015b962c7a41a05670a4ea7cd6f0b8 (patch) | |
tree | 5ef6b0416d5c9498e7ef17624691e3f39ac07640 | |
parent | 02c79cc63c52c310aa1e96c7cac1f881055a2714 (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.scm | 7 |
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))))) |