This fixes culling "parity" errors when splitting long tri strips. Splitting
strips into chunks with an odd number of vertices causes front/back-face
orientation to get reversed and upsets culling.
*max_vertices = (draw->render->max_vertex_buffer_bytes /
(vinfo->size * 4));
+ /* Return an even number of verts.
+ * This prevents "parity" errors when splitting long triangle strips which
+ * can lead to front/back culling mix-ups.
+ * Every other triangle in a strip has an alternate front/back orientation
+ * so splitting at an odd position can cause the orientation of subsequent
+ * triangles to get reversed.
+ */
+ *max_vertices = *max_vertices & ~1;
+
/* Probably need to do this somewhere (or fix exec shader not to
* need it):
*/
varray->middle = middle;
middle->prepare(middle, varray->output_prim, opt, &varray->driver_fetch_max );
+
+ /* check that the max is even */
+ assert((varray->driver_fetch_max & 1) == 0);
+
varray->fetch_max = MIN2(FETCH_MAX, varray->driver_fetch_max);
}