From 4c232dc721645c147c864f102268a52c9536096d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mathias=20Fr=C3=B6hlich?= Date: Sun, 25 Feb 2018 18:01:07 +0100 Subject: [PATCH] vbo: Remove vbo_save_vertex_list::vertex_size. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Like before use local variables from compile_vertex_list instead. Remove vertex_size from struct vbo_save_vertex_list. Reviewed-by: Brian Paul Signed-off-by: Mathias Fröhlich --- src/mesa/vbo/vbo_save.h | 1 - src/mesa/vbo/vbo_save_api.c | 14 ++++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/mesa/vbo/vbo_save.h b/src/mesa/vbo/vbo_save.h index a9834d6e6d4..b158c077957 100644 --- a/src/mesa/vbo/vbo_save.h +++ b/src/mesa/vbo/vbo_save.h @@ -61,7 +61,6 @@ struct vbo_save_copied_vtx { * compiled using the fallback opcode mechanism provided by dlist.c. */ struct vbo_save_vertex_list { - GLuint vertex_size; /**< size in GLfloats */ struct gl_vertex_array_object *VAO[VP_MODE_MAX]; /* Copy of the final vertex from node->vertex_store->bufferobj. diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index e6cd04281e3..47ee355e725 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -543,7 +543,6 @@ compile_vertex_list(struct gl_context *ctx) /* Duplicate our template, increment refcounts to the storage structs: */ const GLsizei stride = save->vertex_size*sizeof(GLfloat); - node->vertex_size = save->vertex_size; GLintptr buffer_offset = (save->buffer_map - save->vertex_store->buffer_map) * sizeof(GLfloat); GLuint start_offset = 0; @@ -579,9 +578,8 @@ 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], - save->vertex_store->bufferobj, buffer_offset, - node->vertex_size*sizeof(GLfloat), save->enabled, - save->attrsz, save->attrtype, offsets); + save->vertex_store->bufferobj, buffer_offset, stride, + save->enabled, save->attrsz, save->attrtype, offsets); /* Reference the vao in the dlist */ node->VAO[vpm] = NULL; _mesa_reference_vao(ctx, &node->VAO[vpm], save->VAO[vpm]); @@ -593,7 +591,7 @@ compile_vertex_list(struct gl_context *ctx) node->current_data = NULL; } else { - GLuint current_size = node->vertex_size - save->attrsz[0]; + GLuint current_size = save->vertex_size - save->attrsz[0]; node->current_data = NULL; if (current_size) { @@ -604,8 +602,7 @@ compile_vertex_list(struct gl_context *ctx) unsigned vertex_offset = 0; if (node->vertex_count) - vertex_offset = - (node->vertex_count - 1) * node->vertex_size * sizeof(GLfloat); + vertex_offset = (node->vertex_count - 1) * stride; memcpy(node->current_data, buffer + vertex_offset + attr_offset, current_size * sizeof(GLfloat)); @@ -1817,11 +1814,12 @@ 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->VAO[0]->BufferBinding[0].BufferObj; + const GLuint vertex_size = _vbo_save_get_stride(node)/sizeof(GLfloat); (void) ctx; fprintf(f, "VBO-VERTEX-LIST, %u vertices, %d primitives, %d vertsize, " "buffer %p\n", - node->vertex_count, node->prim_count, node->vertex_size, + node->vertex_count, node->prim_count, vertex_size, buffer); for (i = 0; i < node->prim_count; i++) { -- 2.30.2