From 8585c01265c5b5cf9c6aa93fbc0cbbb7dc1506ec Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 4 Jun 2010 17:24:40 -0600 Subject: vbo: misc clean-ups --- src/mesa/vbo/vbo_save_draw.c | 65 ++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 29 deletions(-) (limited to 'src/mesa/vbo') diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index 148ea28331..297fd8705b 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -41,12 +41,13 @@ #if FEATURE_dlist -/* +/** * After playback, copy everything but the position from the * last vertex to the saved state */ -static void _playback_copy_to_current( GLcontext *ctx, - const struct vbo_save_vertex_list *node ) +static void +_playback_copy_to_current(GLcontext *ctx, + const struct vbo_save_vertex_list *node) { struct vbo_context *vbo = vbo_context(ctx); GLfloat vertex[VBO_ATTRIB_MAX * 4]; @@ -84,8 +85,7 @@ static void _playback_copy_to_current( GLcontext *ctx, node->attrsz[i], data); - if (memcmp(current, tmp, 4 * sizeof(GLfloat)) != 0) - { + if (memcmp(current, tmp, 4 * sizeof(GLfloat)) != 0) { memcpy(current, tmp, 4 * sizeof(GLfloat)); vbo->currval[i].Size = node->attrsz[i]; @@ -120,11 +120,12 @@ static void _playback_copy_to_current( GLcontext *ctx, -/* Treat the vertex storage as a VBO, define vertex arrays pointing +/** + * Treat the vertex storage as a VBO, define vertex arrays pointing * into it: */ -static void vbo_bind_vertex_list( GLcontext *ctx, - const struct vbo_save_vertex_list *node ) +static void vbo_bind_vertex_list(GLcontext *ctx, + const struct vbo_save_vertex_list *node) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_save_context *save = &vbo->save; @@ -178,7 +179,7 @@ static void vbo_bind_vertex_list( GLcontext *ctx, } for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { - GLuint src = map[attr]; + const GLuint src = map[attr]; if (node_attrsz[src]) { /* override the default array set above */ @@ -206,21 +207,23 @@ static void vbo_bind_vertex_list( GLcontext *ctx, _mesa_set_varying_vp_inputs( ctx, varying_inputs ); } -static void vbo_save_loopback_vertex_list( GLcontext *ctx, - const struct vbo_save_vertex_list *list ) + +static void +vbo_save_loopback_vertex_list(GLcontext *ctx, + const struct vbo_save_vertex_list *list) { const char *buffer = ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER_ARB, GL_READ_ONLY, /* ? */ - list->vertex_store->bufferobj); + list->vertex_store->bufferobj); - vbo_loopback_vertex_list( ctx, - (const GLfloat *)(buffer + list->buffer_offset), - list->attrsz, - list->prim, - list->prim_count, - list->wrap_count, - list->vertex_size); + vbo_loopback_vertex_list(ctx, + (const GLfloat *)(buffer + list->buffer_offset), + list->attrsz, + list->prim, + list->prim_count, + list->wrap_count, + list->vertex_size); ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB, list->vertex_store->bufferobj); @@ -229,10 +232,14 @@ static void vbo_save_loopback_vertex_list( GLcontext *ctx, /** * Execute the buffer and save copied verts. + * This is called from the display list code when executing + * a drawing command. */ -void vbo_save_playback_vertex_list( GLcontext *ctx, void *data ) +void +vbo_save_playback_vertex_list(GLcontext *ctx, void *data) { - const struct vbo_save_vertex_list *node = (const struct vbo_save_vertex_list *) data; + const struct vbo_save_vertex_list *node = + (const struct vbo_save_vertex_list *) data; struct vbo_save_context *save = &vbo_context(ctx)->save; FLUSH_CURRENT(ctx, 0); @@ -277,14 +284,14 @@ void vbo_save_playback_vertex_list( GLcontext *ctx, void *data ) if (ctx->NewState) _mesa_update_state( ctx ); - vbo_context(ctx)->draw_prims( ctx, - save->inputs, - node->prim, - node->prim_count, - NULL, - GL_TRUE, - 0, /* Node is a VBO, so this is ok */ - node->count - 1); + vbo_context(ctx)->draw_prims(ctx, + save->inputs, + node->prim, + node->prim_count, + NULL, + GL_TRUE, + 0, /* Node is a VBO, so this is ok */ + node->count - 1); } /* Copy to current? -- cgit v1.2.3