r300/compiler: Enable rename_reg pass for r500 cards
[mesa.git] / src / mesa / vbo / vbo_save_draw.c
index d834fa1f2e75994d76d33a1b9c67b52102b2eb0d..533c150a9182b5c9aace49ccade34a2d87986c0a 100644 (file)
 #include "vbo_context.h"
 
 
-/*
+#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(struct gl_context *ctx,
+                          const struct vbo_save_vertex_list *node)
 {
    struct vbo_context *vbo = vbo_context(ctx);
    GLfloat vertex[VBO_ATTRIB_MAX * 4];
@@ -81,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];
@@ -117,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(struct gl_context *ctx,
+                                 const struct vbo_save_vertex_list *node)
 {
    struct vbo_context *vbo = vbo_context(ctx);
    struct vbo_save_context *save = &vbo->save;
@@ -175,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 */
@@ -203,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(struct gl_context *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);
@@ -226,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(struct gl_context *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);
@@ -243,7 +253,7 @@ void vbo_save_playback_vertex_list( GLcontext *ctx, void *data )
          * includes operations such as glBegin or glDrawArrays.
          */
         if (0)
-           _mesa_printf("displaylist recursive begin");
+           printf("displaylist recursive begin");
 
         vbo_save_loopback_vertex_list( ctx, node );
         return;
@@ -274,17 +284,20 @@ 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?
     */
    _playback_copy_to_current( ctx, node );
 }
+
+
+#endif /* FEATURE_dlist */