diff options
author | Roland Scheidegger <[email protected]> | 2017-10-26 21:23:27 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2017-10-27 22:37:19 +0200 |
commit | 3e4fd2d4b185dac55a481384f8ce3a8c93d78f87 (patch) | |
tree | 7ff7c3f4ba5af976c31969ed1d8ed19aa1a61758 /src/gallium/auxiliary/draw/draw_pipe_cull.c | |
parent | f7f12780c82fa566be5622b077c1279d15dd5972 (diff) |
draw: don't cull tris with zero area
Culling tris with zero area seems like a great idea, but apparently with
fill mode line (and point) we're supposed to draw them, at least some tests
for some other state tracker complained otherwise.
Such tris also always seem to be back facing (not sure if this can be
inferred from anything, since in a mathematical sense it cannot really be
determined), so make sure to account for this when filling in the face
information.
(For solid tris, this is of course unnecessary, drivers will throw the tris
away later in any case.)
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pipe_cull.c')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe_cull.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_cull.c b/src/gallium/auxiliary/draw/draw_pipe_cull.c index 3e8e4589597..318d743dbbf 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_cull.c +++ b/src/gallium/auxiliary/draw/draw_pipe_cull.c @@ -181,6 +181,16 @@ static void cull_tri( struct draw_stage *stage, /* triangle is not culled, pass to next stage */ stage->next->tri( stage->next, header ); } + } else { + /* + * With zero area, this is back facing (because the spec says + * it's front facing if sign is positive?). + * Some apis apparently do not allow us to cull zero area tris + * here, in case of fill mode line (which is rather lame). + */ + if ((PIPE_FACE_BACK & cull_stage(stage)->cull_face) == 0) { + stage->next->tri( stage->next, header ); + } } } } |