vbo: s/_API_NOOP_H/VBO_NOOP_H/ in vbo_noop.h
[mesa.git] / src / mesa / vbo / vbo_split.c
index c445acca7d6d96544fbfb3bcc9694dd4db697770..974a708dcb64ad772a281f742ca867405faece77 100644 (file)
@@ -1,7 +1,6 @@
 
 /*
  * Mesa 3-D graphics library
- * Version:  6.5
  *
  * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  *
  * Authors:
- *    Keith Whitwell <keith@tungstengraphics.com>
+ *    Keith Whitwell <keithw@vmware.com>
  */
 
 /* Deal with hardware and/or swtnl maximums:
@@ -36,7 +36,7 @@
  *
  * We want buffer splitting to be a convenience function for the code
  * actually drawing the primitives rather than a system-wide maximum,
- * otherwise it is hard to avoid pessimism.  
+ * otherwise it is hard to avoid pessimism.
  *
  * For instance, if a driver has no hardware limits on vertex buffer
  * dimensions, it would not ordinarily want to split vbos.  But if
  */
 
 #include "main/glheader.h"
-#include "main/imports.h"
 #include "main/mtypes.h"
-#include "main/macros.h"
 
 #include "vbo_split.h"
 #include "vbo.h"
 
+
 /* True if a primitive can be split without copying of vertices, false
  * otherwise.
  */
-GLboolean split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr)
+GLboolean
+split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr)
 {
    switch (mode) {
    case GL_POINTS:
@@ -98,69 +98,62 @@ GLboolean split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr)
 
 
 
-void vbo_split_prims( GLcontext *ctx,
-                     const struct gl_client_array *arrays[],
-                     const struct _mesa_prim *prim,
-                     GLuint nr_prims,
-                     const struct _mesa_index_buffer *ib,
-                     GLuint min_index,
-                     GLuint max_index,
-                     vbo_draw_func draw,
-                     const struct split_limits *limits )
+void
+vbo_split_prims(struct gl_context *ctx,
+                const struct gl_vertex_array *arrays[],
+                const struct _mesa_prim *prim,
+                GLuint nr_prims,
+                const struct _mesa_index_buffer *ib,
+                GLuint min_index,
+                GLuint max_index,
+                vbo_draw_func draw,
+                const struct split_limits *limits)
 {
-   GLuint max_basevertex = prim->basevertex;
-   GLuint i;
-
-   for (i = 1; i < nr_prims; i++)
-      max_basevertex = MAX2(max_basevertex, prim[i].basevertex);
-
    if (ib) {
       if (limits->max_indices == 0) {
-        /* Could traverse the indices, re-emitting vertices in turn.
-         * But it's hard to see why this case would be needed - for
-         * software tnl, it is better to convert to non-indexed
-         * rendering after transformation is complete, as is done in
-         * the t_dd_rendertmp.h templates.  Are there any devices
-         * with hardware tnl that cannot do indexed rendering?
-         *
-         * For now, this path is disabled.
-         */
-        assert(0);
+         /* Could traverse the indices, re-emitting vertices in turn.
+          * But it's hard to see why this case would be needed - for
+          * software tnl, it is better to convert to non-indexed
+          * rendering after transformation is complete.  Are there any devices
+          * with hardware tnl that cannot do indexed rendering?
+          *
+          * For now, this path is disabled.
+          */
+         assert(0);
       }
       else if (max_index - min_index >= limits->max_verts) {
-        /* The vertex buffers are too large for hardware (or the
-         * swtnl module).  Traverse the indices, re-emitting vertices
-         * in turn.  Use a vertex cache to preserve some of the
-         * sharing from the original index list.
-         */
-        vbo_split_copy(ctx, arrays, prim, nr_prims, ib,
-                       draw, limits );
+         /* The vertex buffers are too large for hardware (or the
+          * swtnl module).  Traverse the indices, re-emitting vertices
+          * in turn.  Use a vertex cache to preserve some of the
+          * sharing from the original index list.
+          */
+         vbo_split_copy(ctx, arrays, prim, nr_prims, ib, draw, limits);
       }
       else if (ib->count > limits->max_indices) {
-        /* The index buffer is too large for hardware.  Try to split
-         * on whole-primitive boundaries, otherwise try to split the
-         * individual primitives.
-         */
-        vbo_split_inplace(ctx, arrays, prim, nr_prims, ib,
-                          min_index, max_index, draw, limits );
+         /* The index buffer is too large for hardware.  Try to split
+          * on whole-primitive boundaries, otherwise try to split the
+          * individual primitives.
+          */
+         vbo_split_inplace(ctx, arrays, prim, nr_prims, ib,
+                           min_index, max_index, draw, limits);
       }
       else {
-        /* Why were we called? */
-        assert(0);
+         /* Why were we called? */
+         assert(0);
       }
    }
    else {
       if (max_index - min_index >= limits->max_verts) {
-        /* The vertex buffer is too large for hardware (or the swtnl
-         * module).  Try to split on whole-primitive boundaries,
-         * otherwise try to split the individual primitives.
-         */
-        vbo_split_inplace(ctx, arrays, prim, nr_prims, ib,
-                          min_index, max_index, draw, limits );
+         /* The vertex buffer is too large for hardware (or the swtnl
+          * module).  Try to split on whole-primitive boundaries,
+          * otherwise try to split the individual primitives.
+          */
+         vbo_split_inplace(ctx, arrays, prim, nr_prims, ib,
+                           min_index, max_index, draw, limits);
       }
       else {
-        /* Why were we called? */
-        assert(0);
+         /* Why were we called? */
+         assert(0);
       }
    }
 }