summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo/vbo_save_api.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-09-04 14:58:02 -0600
committerBrian Paul <[email protected]>2008-09-04 14:59:40 -0600
commit37c74af01ce52b603f565a6c8a9094500d5cb87a (patch)
tree8c1a0207de4a4a623d32a3f686170205c984e779 /src/mesa/vbo/vbo_save_api.c
parent4a32f0c63886b985743ecadc24fd60a23864c491 (diff)
mesa: improved gl_buffer_object reference counting
Use new _mesa_reference_buffer_object() function wherever possible. Fixes buffer object/display list crash reported in ParaView.
Diffstat (limited to 'src/mesa/vbo/vbo_save_api.c')
-rw-r--r--src/mesa/vbo/vbo_save_api.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index f62be5c14cf..88d573f1283 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -1,6 +1,6 @@
/**************************************************************************
-Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas.
+Copyright 2002-2008 Tungsten Graphics Inc., Cedar Park, Texas.
All Rights Reserved.
@@ -68,6 +68,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/glheader.h"
+#include "main/bufferobj.h"
#include "main/context.h"
#include "main/dlist.h"
#include "main/enums.h"
@@ -85,6 +86,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#endif
+/* An interesting VBO number/name to help with debugging */
+#define VBO_BUF_ID 12345
+
+
/*
* NOTE: Old 'parity' issue is gone, but copying can still be
* wrong-footed on replay.
@@ -170,7 +175,9 @@ static struct vbo_save_vertex_store *alloc_vertex_store( GLcontext *ctx )
* user. Perhaps there could be a special number for internal
* buffers:
*/
- vertex_store->bufferobj = ctx->Driver.NewBufferObject(ctx, 1, GL_ARRAY_BUFFER_ARB);
+ vertex_store->bufferobj = ctx->Driver.NewBufferObject(ctx,
+ VBO_BUF_ID,
+ GL_ARRAY_BUFFER_ARB);
ctx->Driver.BufferData( ctx,
GL_ARRAY_BUFFER_ARB,
@@ -190,8 +197,9 @@ static void free_vertex_store( GLcontext *ctx, struct vbo_save_vertex_store *ver
{
assert(!vertex_store->buffer);
- if (vertex_store->bufferobj)
- ctx->Driver.DeleteBuffer( ctx, vertex_store->bufferobj );
+ if (vertex_store->bufferobj) {
+ _mesa_reference_buffer_object(ctx, &vertex_store->bufferobj, NULL);
+ }
FREE( vertex_store );
}
@@ -1139,6 +1147,7 @@ void vbo_save_api_init( struct vbo_save_context *save )
_save_vtxfmt_init( ctx );
_save_current_init( ctx );
+ /* These will actually get set again when binding/drawing */
for (i = 0; i < VBO_ATTRIB_MAX; i++)
save->inputs[i] = &save->arrays[i];