radeonsi: enable shader-based prim culling with polygon mode

Polygon mode should have no effect on culling, so keep it enabled.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12812>
This commit is contained in:
Marek Olšák 2021-08-21 14:00:01 -04:00 committed by Marge Bot
parent af7c6720de
commit 1f8be99621
3 changed files with 8 additions and 12 deletions

View File

@ -995,8 +995,8 @@ void gfx10_emit_ngg_culling_epilogue(struct ac_shader_abi *abi)
struct ac_cull_options options = {};
options.cull_front = shader->key.opt.ngg_culling & SI_NGG_CULL_FRONT_FACE;
options.cull_back = shader->key.opt.ngg_culling & SI_NGG_CULL_BACK_FACE;
options.cull_view_xy = shader->key.opt.ngg_culling & SI_NGG_CULL_VIEW_SMALLPRIMS;
options.cull_small_prims = options.cull_view_xy;
options.cull_view_xy = true;
options.cull_small_prims = true; /* this would only be false with conservative rasterization */
options.cull_zero_area = options.cull_front || options.cull_back;
options.cull_w = true;

View File

@ -272,7 +272,7 @@ enum
SI_VS_BLIT_SGPRS_POS_TEXCOORD = 9,
};
#define SI_NGG_CULL_VIEW_SMALLPRIMS (1 << 0) /* view.xy + small prims */
#define SI_NGG_CULL_ENABLED (1 << 0) /* this implies W, view.xy, and small prim culling */
#define SI_NGG_CULL_BACK_FACE (1 << 1) /* back faces */
#define SI_NGG_CULL_FRONT_FACE (1 << 2) /* front faces */
#define SI_NGG_CULL_GS_FAST_LAUNCH_TRI_LIST (1 << 3) /* GS fast launch: triangles */

View File

@ -949,17 +949,13 @@ static void *si_create_rs_state(struct pipe_context *ctx, const struct pipe_rast
S_028810_DX_LINEAR_ATTR_CLIP_ENA(1);
if (rs->rasterizer_discard) {
rs->ngg_cull_flags = SI_NGG_CULL_FRONT_FACE | SI_NGG_CULL_BACK_FACE;
rs->ngg_cull_flags = SI_NGG_CULL_ENABLED |
SI_NGG_CULL_FRONT_FACE |
SI_NGG_CULL_BACK_FACE;
rs->ngg_cull_flags_y_inverted = rs->ngg_cull_flags;
} else {
/* Polygon mode can't use view and small primitive culling,
* because it draws points or lines where the culling depends
* on the point or line width.
*/
if (!rs->polygon_mode_enabled) {
rs->ngg_cull_flags |= SI_NGG_CULL_VIEW_SMALLPRIMS;
rs->ngg_cull_flags_y_inverted |= SI_NGG_CULL_VIEW_SMALLPRIMS;
}
rs->ngg_cull_flags = SI_NGG_CULL_ENABLED;
rs->ngg_cull_flags_y_inverted = rs->ngg_cull_flags;
if (rs->cull_front) {
rs->ngg_cull_flags |= SI_NGG_CULL_FRONT_FACE;