ac/nir/ngg: Include culled primitives in query.
authorTimur Kristóf <timur.kristof@gmail.com>
Wed, 1 Feb 2023 12:07:42 +0000 (13:07 +0100)
committerEric Engestrom <eric@engestrom.ch>
Wed, 8 Feb 2023 20:34:44 +0000 (20:34 +0000)
commit18f0d33423b6635d0157a2eca46155ff0c2fe4b1
tree03ec0f861484883d116557b18d257906d0447970
parent489f1293dbfab427bcf816b19b2807d24bb50dff
ac/nir/ngg: Include culled primitives in query.

Vulkan spec 18.8. Primitives Generated Queries:

When a generated primitive query for a vertex stream is active,
the primitives-generated count is incremented every time a
primitive emitted to that stream reaches the transform feedback
stage, whether or not transform feedback is active.

We can see the order of stages in chapter 27 Fixed-Function
Vertex Post-Processing, which shows that the transform feedback
stage is before rasterization (and therefore culling).

Conclusion is that culled primitives should be included
in the primitives generated query.

This commit makes sure to emit the primitives generated query
code before culling and uses the input primitive count passed
to the current wave instead of the exec mask after culling.

Cc: mesa-stable
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21037>
(cherry picked from commit 3a819bd22ec5a7eea2e0e337977cbc0af9e38032)
.pick_status.json
src/amd/common/ac_nir_lower_ngg.c