aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-06-18 14:50:35 -0600
committerBrian Paul <[email protected]>2008-06-18 14:55:12 -0600
commit7d7f3e2c9451b2233c196d82d523c50b5d2616cc (patch)
tree74d0cb7a84b4e353d09d71dbf515cc472a04bc89 /src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
parentb623fa9e2d6f97f9febc978c158d790b26e175a7 (diff)
gallium: split long prims into chunks with an even number of vertices
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.
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
index 5ce3aba2a2d..fdf9b6fe6a8 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
@@ -193,6 +193,15 @@ static void fse_prepare( struct draw_pt_middle_end *middle,
*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):
*/