From 7d7f3e2c9451b2233c196d82d523c50b5d2616cc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 18 Jun 2008 14:50:35 -0600 Subject: 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. --- src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c') 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 5ce3aba2a2..fdf9b6fe6a 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): */ -- cgit v1.2.3