Mesa (master): vbo: misc clean-ups

Brian Paul brianp at kemper.freedesktop.org
Fri Jun 4 23:48:08 UTC 2010


Module: Mesa
Branch: master
Commit: 8585c01265c5b5cf9c6aa93fbc0cbbb7dc1506ec
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8585c01265c5b5cf9c6aa93fbc0cbbb7dc1506ec

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Jun  4 17:24:40 2010 -0600

vbo: misc clean-ups

---

 src/mesa/vbo/vbo_save_draw.c |   65 +++++++++++++++++++++++------------------
 1 files changed, 36 insertions(+), 29 deletions(-)

diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c
index 148ea28..297fd87 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?




More information about the mesa-commit mailing list