llvmpipe: fix ps invocations query bug
authorBrian Paul <brianp@vmware.com>
Tue, 4 Apr 2023 02:23:51 +0000 (20:23 -0600)
committerMarge Bot <emma+marge@anholt.net>
Wed, 5 Apr 2023 03:49:16 +0000 (03:49 +0000)
We were not initializing the PS invocation count to zero before
computing the sum of the per-thread results.

This fixes an issue where querying the result of the query more
than once would cause the result to grow larger each time.

Signed-off-by: Brian Paul <brianp@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22281>

src/gallium/drivers/llvmpipe/lp_query.c

index 79582ea..e9b5abf 100644 (file)
@@ -184,6 +184,7 @@ llvmpipe_get_query_result(struct pipe_context *pipe,
       struct pipe_query_data_pipeline_statistics *stats =
          (struct pipe_query_data_pipeline_statistics *)vresult;
       /* only ps_invocations come from binned query */
+      pq->stats.ps_invocations = 0;
       for (unsigned i = 0; i < num_threads; i++) {
          pq->stats.ps_invocations += pq->end[i];
       }