summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2018-02-25 18:01:07 +0100
committerMathias Fröhlich <[email protected]>2018-03-01 04:06:23 +0100
commitf7178d677ca6a072455ff45b328b1078175a93b6 (patch)
tree4d3c4c0d5e44563f2e6ddcd78c11d3b899a1c4af /src/mesa/vbo
parent1cc3516a1105c90214b2e3465421681f64699a7f (diff)
vbo: Use a local variable for the dlist offsets.
The master value is now stored inside the VAO already present in struct vbo_save_vertex_list. Remove the unneeded copy from dlist storage. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r--src/mesa/vbo/vbo_save.h1
-rw-r--r--src/mesa/vbo/vbo_save_api.c15
2 files changed, 7 insertions, 9 deletions
diff --git a/src/mesa/vbo/vbo_save.h b/src/mesa/vbo/vbo_save.h
index 414a477f31c..14ac831ffd7 100644
--- a/src/mesa/vbo/vbo_save.h
+++ b/src/mesa/vbo/vbo_save.h
@@ -64,7 +64,6 @@ struct vbo_save_vertex_list {
GLbitfield64 enabled; /**< mask of enabled vbo arrays. */
GLubyte attrsz[VBO_ATTRIB_MAX];
GLenum16 attrtype[VBO_ATTRIB_MAX];
- GLuint offsets[VBO_ATTRIB_MAX];
GLuint vertex_size; /**< size in GLfloats */
struct gl_vertex_array_object *VAO[VP_MODE_MAX];
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index a87bbe08569..b6fc7daa356 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -529,8 +529,6 @@ compile_vertex_list(struct gl_context *ctx)
struct vbo_save_context *save = &vbo_context(ctx)->save;
struct vbo_save_vertex_list *node;
GLintptr buffer_offset = 0;
- GLuint offset;
- unsigned i;
/* Allocate space for this structure in the display list currently
* being compiled.
@@ -563,13 +561,14 @@ compile_vertex_list(struct gl_context *ctx)
* changes in drivers. In particular, the Gallium CSO module will
* filter out redundant vertex buffer changes.
*/
- offset = 0;
+ buffer_offset = 0;
} else {
- offset = node->buffer_offset;
+ buffer_offset = node->buffer_offset;
}
- for (i = 0; i < VBO_ATTRIB_MAX; ++i) {
- node->offsets[i] = offset;
- offset += node->attrsz[i] * sizeof(GLfloat);
+ GLuint offsets[VBO_ATTRIB_MAX];
+ for (unsigned i = 0, offset = 0; i < VBO_ATTRIB_MAX; ++i) {
+ offsets[i] = offset;
+ offset += save->attrsz[i] * sizeof(GLfloat);
}
node->vertex_count = save->vert_count;
node->wrap_count = save->copied.nr;
@@ -586,7 +585,7 @@ compile_vertex_list(struct gl_context *ctx)
update_vao(ctx, vpm, &save->VAO[vpm],
node->vertex_store->bufferobj, buffer_offset,
node->vertex_size*sizeof(GLfloat), node->enabled,
- node->attrsz, node->attrtype, node->offsets);
+ node->attrsz, node->attrtype, offsets);
/* Reference the vao in the dlist */
node->VAO[vpm] = NULL;
_mesa_reference_vao(ctx, &node->VAO[vpm], save->VAO[vpm]);