diff options
author | Brian <brian.paul@tungstengraphics.com> | 2007-08-20 11:05:35 -0600 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2007-08-20 11:05:35 -0600 |
commit | f252974121febc6a1a59793d932b32b798f90fc6 (patch) | |
tree | 47d6383146962faaa44891308d987bd3cdd5dc4e /src/mesa/vbo | |
parent | df1df82f1660996d09fa272e6129c194afde3ece (diff) |
fix VBO clean-up in vbo_exec_vtx_destroy()
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r-- | src/mesa/vbo/vbo_exec_api.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 24e2eba472..b7f4d8a307 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -673,7 +673,8 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec ) GLuint i; /* Allocate a buffer object. Will just reuse this object - * continuously. + * continuously, unless vbo_use_buffer_objects() is called to enable + * use of real VBOs. */ exec->vtx.bufferobj = ctx->Array.NullBufferObj; exec->vtx.buffer_map = ALIGN_MALLOC(VBO_VERT_BUFFER_SIZE * sizeof(GLfloat), 64); @@ -702,9 +703,17 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec ) void vbo_exec_vtx_destroy( struct vbo_exec_context *exec ) { - if (exec->vtx.buffer_map) { - ALIGN_FREE(exec->vtx.buffer_map); - exec->vtx.buffer_map = NULL; + GLcontext *ctx = exec->ctx; + if (exec->vtx.bufferobj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB, exec->vtx.bufferobj); + ctx->Driver.DeleteBuffer(ctx, exec->vtx.bufferobj); + exec->vtx.bufferobj = NULL; + } + else { + if (exec->vtx.buffer_map) { + ALIGN_FREE(exec->vtx.buffer_map); + exec->vtx.buffer_map = NULL; + } } } |