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
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2016-08-10 00:17:34 +0300
committerMike Erwin <significant.bit@gmail.com>2016-08-10 00:17:34 +0300
commite4e1b0c7d353d1c37ef88cd1670001974e717841 (patch)
tree998177caae945b5955309a7ff2b60d9308a3ee2f /source/blender/gpu/intern/gpu_immediate.c
parentf3d65ad23c7b12f608ad8ee8cfe3976b782b0155 (diff)
OpenGL: invalidate buffers the modern way
There are older ways to give OpenGL hints about buffer invalidation, but glInvalidateBufferData does exactly what we want. Use this function when OpenGL 4.3 is available (Windows and proprietary Linux drivers). Part of Gawain immediate mode.
Diffstat (limited to 'source/blender/gpu/intern/gpu_immediate.c')
-rw-r--r--source/blender/gpu/intern/gpu_immediate.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_immediate.c b/source/blender/gpu/intern/gpu_immediate.c
index 5e85c9a5374..b08484ea134 100644
--- a/source/blender/gpu/intern/gpu_immediate.c
+++ b/source/blender/gpu/intern/gpu_immediate.c
@@ -318,8 +318,10 @@ void immBegin(GLenum primitive, unsigned vertex_ct)
#if APPLE_LEGACY
glBufferData(GL_ARRAY_BUFFER, IMM_BUFFER_SIZE, NULL, GL_DYNAMIC_DRAW);
#else
- glMapBufferRange(GL_ARRAY_BUFFER, 0, IMM_BUFFER_SIZE, GL_MAP_INVALIDATE_BUFFER_BIT);
- // glInvalidateBufferData(imm.vbo_id); // VERSION >= 4.3 || ARB_invalidate_subdata
+ 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);
#endif
imm.buffer_offset = 0;