Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2017-04-27 17:16:20 +0300
committerMike Erwin <significant.bit@gmail.com>2017-04-27 18:43:25 +0300
commit75fac519c0535df6c13c3d534796e8b263af895f (patch)
treee2929b62ec32508d45e411be4552914c9fa2d899 /intern
parent741ed16d13b3a1ca15390f641369930eda5035a8 (diff)
Gawain: safely orphan immediate mode's VBO
There are multiple ways to orphan a buffer resource, and this code picks the oldest/safest way no matter which OpenGL version we're running. TODO: use other (more recent) methods after thorough testing Follow up to 8e0c57a812e8
Diffstat (limited to 'intern')
-rw-r--r--intern/gawain/src/immediate.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/intern/gawain/src/immediate.c b/intern/gawain/src/immediate.c
index 0cf24668b10..f7c2a172c9b 100644
--- a/intern/gawain/src/immediate.c
+++ b/intern/gawain/src/immediate.c
@@ -208,12 +208,26 @@ void immBegin(PrimitiveType prim_type, unsigned vertex_ct)
else
{
// orphan this buffer & start with a fresh one
+#if 1 || APPLE_LEGACY
+ // this method works on all platforms, old & new
glBufferData(GL_ARRAY_BUFFER, IMM_BUFFER_SIZE, NULL, GL_DYNAMIC_DRAW);
-#if !APPLE_LEGACY
+#else
+ // TODO: use other (more recent) methods after thorough testing
if (GLEW_VERSION_4_3 || GLEW_ARB_invalidate_subdata)
glInvalidateBufferData(imm.vbo_id);
else
- glMapBufferRange(GL_ARRAY_BUFFER, 0, IMM_BUFFER_SIZE, GL_MAP_INVALIDATE_BUFFER_BIT);
+ {
+ // glitches!
+// glMapBufferRange(GL_ARRAY_BUFFER, 0, IMM_BUFFER_SIZE, GL_MAP_INVALIDATE_BUFFER_BIT);
+
+ // works
+// glMapBufferRange(GL_ARRAY_BUFFER, 0, IMM_BUFFER_SIZE,
+// GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_FLUSH_EXPLICIT_BIT);
+// glUnmapBuffer(GL_ARRAY_BUFFER);
+
+ // also works
+ glBufferData(GL_ARRAY_BUFFER, IMM_BUFFER_SIZE, NULL, GL_DYNAMIC_DRAW);
+ }
#endif
imm.buffer_offset = 0;