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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-08-09 23:55:43 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-08-09 23:55:43 +0400
commit3fbd8abcfd01b3e8b47bfc8420e2be5fca50036c (patch)
tree57de0e031f293623a051e62b19bd770bab988bc9 /source/blender/gpu/intern/gpu_buffers.c
parenta18112249d826046fd7d8692571a0eab5bb5ec04 (diff)
OpenGL VBO's: free VBO pool before redraw, otherwise this just holds onto memory
after objects are deleted until another big object is added. There's no good reason to do this, or to think that our pool is somehow much faster than using the OpenGL API to allocate and free buffers.
Diffstat (limited to 'source/blender/gpu/intern/gpu_buffers.c')
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 11cf64b0995..c54f937f4a9 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -172,6 +172,15 @@ static void gpu_buffer_pool_free(GPUBufferPool *pool)
MEM_freeN(pool);
}
+static void gpu_buffer_pool_free_unused(GPUBufferPool *pool)
+{
+ if (!pool)
+ return;
+
+ while (pool->totbuf)
+ gpu_buffer_pool_delete_last(pool);
+}
+
static GPUBufferPool *gpu_buffer_pool = NULL;
static GPUBufferPool *gpu_get_global_buffer_pool(void)
{
@@ -188,6 +197,11 @@ void GPU_global_buffer_pool_free(void)
gpu_buffer_pool = NULL;
}
+void GPU_global_buffer_pool_free_unused(void)
+{
+ gpu_buffer_pool_free_unused(gpu_buffer_pool);
+}
+
/* get a GPUBuffer of at least `size' bytes; uses one from the buffer
* pool if possible, otherwise creates a new one */
GPUBuffer *GPU_buffer_alloc(int size)