mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
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.
This commit is contained in:
parent
b623fa9e2d
commit
7d7f3e2c94
2 changed files with 13 additions and 0 deletions
|
|
@ -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):
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -147,6 +147,10 @@ static void varray_prepare(struct draw_pt_front_end *frontend,
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue