panfrost: Only cull polygons

The spec says only polygons, not points/lines, should be culled when
culling is enabled. The hardware does not make this distinction, so we
have to.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reported-by: Icecream95 <ixn@disroot.org>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14575>
This commit is contained in:
Alyssa Rosenzweig 2022-01-15 09:48:02 -05:00 committed by Marge Bot
parent 3f1abda631
commit 1e5bb54f59
2 changed files with 12 additions and 3 deletions

View file

@ -2739,6 +2739,7 @@ panfrost_draw_emit_tiler(struct panfrost_batch *batch,
}
enum pipe_prim_type prim = u_reduced_prim(info->mode);
bool polygon = (prim == PIPE_PRIM_TRIANGLES);
void *prim_size = pan_section_ptr(job, TILER_JOB, PRIMITIVE_SIZE);
#if PAN_ARCH >= 6
@ -2754,8 +2755,17 @@ panfrost_draw_emit_tiler(struct panfrost_batch *batch,
cfg.four_components_per_vertex = true;
cfg.draw_descriptor_is_64b = true;
cfg.front_face_ccw = rast->front_ccw;
cfg.cull_front_face = rast->cull_face & PIPE_FACE_FRONT;
cfg.cull_back_face = rast->cull_face & PIPE_FACE_BACK;
/*
* From the Gallium documentation,
* pipe_rasterizer_state::cull_face "indicates which faces of
* polygons to cull". Points and lines are not considered
* polygons and should be drawn even if all faces are culled.
* The hardware does not take primitive type into account when
* culling, so we need to do that check ourselves.
*/
cfg.cull_front_face = polygon && (rast->cull_face & PIPE_FACE_FRONT);
cfg.cull_back_face = polygon && (rast->cull_face & PIPE_FACE_BACK);
cfg.position = pos;
cfg.state = batch->rsd[PIPE_SHADER_FRAGMENT];
cfg.attributes = batch->attribs[PIPE_SHADER_FRAGMENT];

View file

@ -1129,7 +1129,6 @@ spec@!opengl 1.1@linestipple,Fail
spec@!opengl 1.1@linestipple@Line loop,Fail
spec@!opengl 1.1@linestipple@Line strip,Fail
spec@!opengl 1.1@linestipple@Restarting lines within a single Begin-End block,Fail
spec@!opengl 1.1@point-line-no-cull,Fail
spec@!opengl 1.1@polygon-mode-facing,Fail
spec@!opengl 1.1@polygon-mode,Fail
spec@!opengl 1.1@polygon-mode-offset@config 0: Expected white pixel on bottom edge,Fail