Mesa (main): gallium: always return the correct pipeline stats index

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu May 12 07:45:02 UTC 2022


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

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Fri Apr 15 15:11:58 2022 +0200

gallium: always return the correct pipeline stats index

Drivers with PIPE_CAP_QUERY_PIPELINE_STATISTICS_SINGLE = 0 shouldn't care
about the value of index, but radeonsi actually needs it in some situations.

So return the correct index instead of 0.

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15861>

---

 src/mesa/main/queryobj.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index 77b800145c5..3080cdfbd7b 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -90,8 +90,11 @@ target_to_index(const struct st_context *st, const struct gl_query_object *q)
        q->Target == GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB)
       return q->Stream;
 
-   if (st->has_single_pipe_stat) {
-      switch (q->Target) {
+   /* Drivers with PIPE_CAP_QUERY_PIPELINE_STATISTICS_SINGLE = 0 ignore the
+    * index param so it should be useless; but radeonsi needs it in some cases,
+    * so pass the correct value.
+    */
+   switch (q->Target) {
       case GL_VERTICES_SUBMITTED_ARB:
          return PIPE_STAT_QUERY_IA_VERTICES;
       case GL_PRIMITIVES_SUBMITTED_ARB:
@@ -116,7 +119,6 @@ target_to_index(const struct st_context *st, const struct gl_query_object *q)
          return PIPE_STAT_QUERY_CS_INVOCATIONS;
       default:
          break;
-      }
    }
 
    return 0;



More information about the mesa-commit mailing list