radv: fix the number of generated primitive queries with NGG GS vs legacy
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 12 Apr 2022 14:36:45 +0000 (16:36 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 29 Apr 2022 11:46:19 +0000 (11:46 +0000)
commitcdd201010df2770aac010ab6e6eb465ef40f76e1
treec022963a927e12661ba94de2f2b9c5ae9e9928aa
parent725ae34458ff3cbb9d87e08c8a73780672221a9e
radv: fix the number of generated primitive queries with NGG GS vs legacy

With NGG GS, the hardware can't know the number of generated primitives
and we have to increment it manually from the shader using a plain GDS
atomic operation.

Though this had a serious problem (see this old TODO) if the bound
pipeline was using legacy GS because the query implementation was
relying on NGG GS. Another situation is if we had one draw with NGG GS,
followed by one draw with legacy (or the opposite) the query result
would have been broken.

The solution is to allocate two 64-bit values for storing the begin/end
values if the query pool is supposed to need GDS and accumulate the
result with the number of generated primitives generated by the hw.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15892>
src/amd/vulkan/radv_private.h
src/amd/vulkan/radv_query.c