From e4e1b0c7d353d1c37ef88cd1670001974e717841 Mon Sep 17 00:00:00 2001 From: Mike Erwin Date: Tue, 9 Aug 2016 17:17:34 -0400 Subject: 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. --- source/blender/gpu/intern/gpu_immediate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source/blender/gpu/intern/gpu_immediate.c') 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; -- cgit v1.2.3