ac/nir/ngg: support clipdist culling

Port from radeonsi.

Besides vertex position based primitive culling, clipdist
attribute can also be used to cull a primitive. Normally
it's used by fixed-pipeline, but when NGG we can treate it
as a culling condition to filter out invisible primitive
before fixed-pipeline.

There are two kinds of clipdist:
1. user define a clip plane explicitly by glClipPlane(),
   fixed-pipeline calculate with vertex position to get
   clipdist, then cull. This is the legacy way.
2. Now GLSL define gl_ClipDistance/gl_CullDiatance so that
   user can calculate clipdist in any way he like.

This implementation support both way.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17651>
This commit is contained in:
Qiang Yu
2022-07-08 21:35:18 +08:00
committed by Marge Bot
parent 620e62bb39
commit f75452918b
3 changed files with 111 additions and 18 deletions

View File

@@ -131,7 +131,9 @@ ac_nir_lower_ngg_nogs(nir_shader *shader,
bool provoking_vtx_last,
bool use_edgeflags,
bool has_prim_query,
uint32_t instance_rate_inputs);
uint32_t instance_rate_inputs,
uint32_t clipdist_enable_mask,
uint32_t user_clip_plane_enable_mask);
void
ac_nir_lower_ngg_gs(nir_shader *shader,