Module: Mesa
Branch: main
Commit: 43773fdda75f4d8ff47fe7fc28e8667653f4d850
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=43773fdda75f4d8ff47fe7fc28e8667653f4d850

Author: Brian Paul <[email protected]>
Date:   Mon Apr  3 20:23:51 2023 -0600

llvmpipe: fix ps invocations query bug

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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22281>

---

 src/gallium/drivers/llvmpipe/lp_query.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/llvmpipe/lp_query.c 
b/src/gallium/drivers/llvmpipe/lp_query.c
index 79582ea9ab3..e9b5abf34bb 100644
--- a/src/gallium/drivers/llvmpipe/lp_query.c
+++ b/src/gallium/drivers/llvmpipe/lp_query.c
@@ -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];
       }

Reply via email to