ac/nir: Implement NGG deferred attribute culling in NIR.
authorTimur Kristóf <timur.kristof@gmail.com>
Mon, 26 Apr 2021 14:56:11 +0000 (16:56 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 13 Jul 2021 23:56:33 +0000 (23:56 +0000)
commite97f0463a8f55d5d407178f74b0cdb916a42aef8
treec3b67ec23209a8bb81338946694692c76f1038d4
parent556a690bac3a48f7f1c0627f3fc4caf8f21d0f89
ac/nir: Implement NGG deferred attribute culling in NIR.

Culling is traditionally done by the rasterizer, but that
can be a bottleneck when an app creates a large number
of primitives. Eg. a lot of tiny triangles reduce the
rasterziation efficiency.

NGG makes it possible for the shader to check primitives
and delete those that it can prove are not needed.

After this is done, we have to repack the surviving invocations
so they remain compact. This also saves bandwidth, because
some memory loads are only executed by those vertices that
survived the culling.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10525>
src/amd/common/ac_nir.h
src/amd/common/ac_nir_lower_ngg.c