free(save->prim_store);
save->prim_store = NULL;
}
- if ( --save->vertex_store->refcount == 0 ) {
- _mesa_reference_buffer_object(ctx,
- &save->vertex_store->bufferobj, NULL);
- free(save->vertex_store);
- save->vertex_store = NULL;
- }
+ }
+ if (save->vertex_store) {
+ _mesa_reference_buffer_object(ctx, &save->vertex_store->bufferobj, NULL);
+ free(save->vertex_store);
+ save->vertex_store = NULL;
}
}
struct _mesa_prim *prims;
GLuint prim_count;
- struct vbo_save_vertex_store *vertex_store;
struct vbo_save_primitive_store *prim_store;
};
#define VBO_SAVE_FALLBACK 0x10000000
-/* Storage to be shared among several vertex_lists.
- */
struct vbo_save_vertex_store {
struct gl_buffer_object *bufferobj;
fi_type *buffer_map;
GLuint used; /**< Number of 4-byte words used in buffer */
- GLuint refcount;
};
+/* Storage to be shared among several vertex_lists.
+ */
struct vbo_save_primitive_store {
struct _mesa_prim prims[VBO_SAVE_PRIM_SIZE];
GLuint used;
vertex_store->buffer_map = NULL;
vertex_store->used = 0;
- vertex_store->refcount = 1;
return vertex_store;
}
node->wrap_count = save->copied.nr;
node->prims = save->prims;
node->prim_count = save->prim_count;
- node->vertex_store = save->vertex_store;
node->prim_store = save->prim_store;
/* Create a pair of VAOs for the possible VERTEX_PROCESSING_MODEs
for (gl_vertex_processing_mode vpm = VP_MODE_FF; vpm < VP_MODE_MAX; ++vpm) {
/* create or reuse the vao */
update_vao(ctx, vpm, &save->VAO[vpm],
- node->vertex_store->bufferobj, buffer_offset,
+ save->vertex_store->bufferobj, buffer_offset,
node->vertex_size*sizeof(GLfloat), node->enabled,
node->attrsz, node->attrtype, offsets);
/* Reference the vao in the dlist */
_mesa_reference_vao(ctx, &node->VAO[vpm], save->VAO[vpm]);
}
- node->vertex_store->refcount++;
node->prim_store->refcount++;
if (node->prims[0].no_current_update) {
/* Release old reference:
*/
- save->vertex_store->refcount--;
- assert(save->vertex_store->refcount != 0);
+ free_vertex_store(ctx, save->vertex_store);
save->vertex_store = NULL;
/* Allocate and map new store:
for (gl_vertex_processing_mode vpm = VP_MODE_FF; vpm < VP_MODE_MAX; ++vpm)
_mesa_reference_vao(ctx, &node->VAO[vpm], NULL);
- if (--node->vertex_store->refcount == 0)
- free_vertex_store(ctx, node->vertex_store);
-
if (--node->prim_store->refcount == 0)
free(node->prim_store);
{
struct vbo_save_vertex_list *node = (struct vbo_save_vertex_list *) data;
GLuint i;
- struct gl_buffer_object *buffer = node->vertex_store ?
- node->vertex_store->bufferobj : NULL;
+ struct gl_buffer_object *buffer = node->VAO[0]->BufferBinding[0].BufferObj;
(void) ctx;
fprintf(f, "VBO-VERTEX-LIST, %u vertices, %d primitives, %d vertsize, "