diff options
author | Mathias Fröhlich <[email protected]> | 2018-02-25 18:01:07 +0100 |
---|---|---|
committer | Mathias Fröhlich <[email protected]> | 2018-03-01 04:06:23 +0100 |
commit | 19a0f27a491ae7cb3abceda8e60b9944cd273558 (patch) | |
tree | 94fa564dac7b79a84c0a990dd2495e9fc869ece0 /src/mesa | |
parent | 6e410270ee73f21c4363c8d9cc8f4eef4bf949b1 (diff) |
vbo: Remove reference to the vertex_store from the dlist node.
Since we now store a set of VAOs in the display list, use these object
to get the reference to the VBO in several places.
Reviewed-by: Brian Paul <[email protected]>
Signed-off-by: Mathias Fröhlich <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/vbo/vbo_save.c | 11 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save.h | 6 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save_api.c | 14 |
3 files changed, 10 insertions, 21 deletions
diff --git a/src/mesa/vbo/vbo_save.c b/src/mesa/vbo/vbo_save.c index f106cf279ad..361964195c3 100644 --- a/src/mesa/vbo/vbo_save.c +++ b/src/mesa/vbo/vbo_save.c @@ -65,12 +65,11 @@ void vbo_save_destroy( struct gl_context *ctx ) 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; } } diff --git a/src/mesa/vbo/vbo_save.h b/src/mesa/vbo/vbo_save.h index 00f18363b73..f4565023fd2 100644 --- a/src/mesa/vbo/vbo_save.h +++ b/src/mesa/vbo/vbo_save.h @@ -81,7 +81,6 @@ struct vbo_save_vertex_list { struct _mesa_prim *prims; GLuint prim_count; - struct vbo_save_vertex_store *vertex_store; struct vbo_save_primitive_store *prim_store; }; @@ -163,15 +162,14 @@ _vbo_save_get_vertex_count(const struct vbo_save_vertex_list *node) #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; diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index db9a3fbdfae..8dac6251c4d 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -222,7 +222,6 @@ alloc_vertex_store(struct gl_context *ctx) vertex_store->buffer_map = NULL; vertex_store->used = 0; - vertex_store->refcount = 1; return vertex_store; } @@ -574,7 +573,6 @@ compile_vertex_list(struct gl_context *ctx) 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 @@ -583,7 +581,7 @@ compile_vertex_list(struct gl_context *ctx) 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 */ @@ -591,7 +589,6 @@ compile_vertex_list(struct gl_context *ctx) _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) { @@ -680,8 +677,7 @@ compile_vertex_list(struct gl_context *ctx) /* 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: @@ -1817,9 +1813,6 @@ vbo_destroy_vertex_list(struct gl_context *ctx, void *data) 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); @@ -1833,8 +1826,7 @@ vbo_print_vertex_list(struct gl_context *ctx, void *data, FILE *f) { 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, " |