From: Marek Olšák Date: Sat, 21 Aug 2021 18:00:01 +0000 (-0400) Subject: radeonsi: enable shader-based prim culling with polygon mode X-Git-Tag: upstream/22.3.5~18120 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1f8be99621aec6e57e9f72f82a5361ad85f49686;p=platform%2Fupstream%2Fmesa.git 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 Part-of: --- diff --git a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c index d4ed0e8..c789c28 100644 --- a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c +++ b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c @@ -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; diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 8ddaeaa..220e4ec 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -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 */ diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index cde009f..229d634 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -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;