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@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15861>
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2022-04-15 15:11:58 +02:00
parent 9918a9a990
commit 3402c435f9
1 changed files with 5 additions and 3 deletions

View File

@ -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;