From 2162d706d2015b962c7a41a05670a4ea7cd6f0b8 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 6 Sep 2018 09:25:34 -0400 Subject: 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'. --- chickadee/render/buffer.scm | 7 ++++--- 1 file 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))))) -- cgit v1.2.3