radeonsi: enable shader-based prim culling with polygon mode
authorMarek Olšák <marek.olsak@amd.com>
Sat, 21 Aug 2021 18:00:01 +0000 (14:00 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 10 Sep 2021 23:32:03 +0000 (23:32 +0000)
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>

src/gallium/drivers/radeonsi/gfx10_shader_ngg.c
src/gallium/drivers/radeonsi/si_shader.h
src/gallium/drivers/radeonsi/si_state.c

index d4ed0e8..c789c28 100644 (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;
 
index 8ddaeaa..220e4ec 100644 (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 */
index cde009f..229d634 100644 (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;