vbo: s/_API_NOOP_H/VBO_NOOP_H/ in vbo_noop.h
[mesa.git] / src / mesa / vbo / vbo_save.h
index 2eec87a6370b983d7592177184f5ca86a1f9b755..51ea9ccb3d065b8f36599d651028cb1c937eac9e 100644 (file)
@@ -73,19 +73,34 @@ struct vbo_save_vertex_list {
    fi_type *current_data;
    GLuint current_size;
 
-   GLuint buffer_offset;
-   GLuint count;                /**< vertex count */
+   GLuint buffer_offset;        /**< in bytes */
+   GLuint start_vertex;         /**< first vertex used by any primitive */
+   GLuint vertex_count;         /**< number of vertices in this list */
    GLuint wrap_count;          /* number of copied vertices at start */
    GLboolean dangling_attr_ref;        /* current attr implicitly referenced
                                    outside the list */
 
-   struct _mesa_prim *prim;
+   struct _mesa_prim *prims;
    GLuint prim_count;
 
    struct vbo_save_vertex_store *vertex_store;
    struct vbo_save_primitive_store *prim_store;
 };
 
+
+/**
+ * Is the vertex list's buffer offset an exact multiple of the
+ * vertex size (in bytes)?  This is used to check for a vertex array /
+ * drawing optimization.
+ */
+static inline bool
+aligned_vertex_buffer_offset(const struct vbo_save_vertex_list *node)
+{
+   unsigned vertex_size = node->vertex_size * sizeof(GLfloat); /* in bytes */
+   return vertex_size != 0 && node->buffer_offset % vertex_size == 0;
+}
+
+
 /* These buffers should be a reasonable size to support upload to
  * hardware.  Current vbo implementation will re-upload on any
  * changes, so don't make too big or apps which dynamically create
@@ -108,13 +123,13 @@ struct vbo_save_vertex_list {
  */
 struct vbo_save_vertex_store {
    struct gl_buffer_object *bufferobj;
-   fi_type *buffer;
-   GLuint used;
+   fi_type *buffer_map;
+   GLuint used;           /**< Number of 4-byte words used in buffer */
    GLuint refcount;
 };
 
 struct vbo_save_primitive_store {
-   struct _mesa_prim buffer[VBO_SAVE_PRIM_SIZE];
+   struct _mesa_prim prims[VBO_SAVE_PRIM_SIZE];
    GLuint used;
    GLuint refcount;
 };
@@ -135,18 +150,17 @@ struct vbo_save_context {
 
    GLboolean out_of_memory;  /**< True if last VBO allocation failed */
 
-   fi_type *buffer;
-   GLuint count;
    GLuint wrap_count;
-   GLuint replay_flags;
+   GLbitfield replay_flags;
 
-   struct _mesa_prim *prim;
+   struct _mesa_prim *prims;
    GLuint prim_count, prim_max;
 
    struct vbo_save_vertex_store *vertex_store;
    struct vbo_save_primitive_store *prim_store;
 
-   fi_type *buffer_ptr;                   /* cursor, points into buffer */
+   fi_type *buffer_map;            /**< Mapping of vertex_store's buffer */
+   fi_type *buffer_ptr;                   /**< cursor, points into buffer_map */
    fi_type vertex[VBO_ATTRIB_MAX*4];      /* current values */
    fi_type *attrptr[VBO_ATTRIB_MAX];
    GLuint vert_count;