[Mesa-dev] Mesa: Fix performance query id check

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Fri Feb 24 13:21:54 UTC 2017


Oops. Original code can never fail on zero id but my patch is also 
wrong. Please ignore this patch.

/Juha-Pekka

On 24.02.2017 15:10, Juha-Pekka Heikkila wrote:
> In queryid_valid() index is unsigned so checking if it is less
> than zero is useless. On queryid_to_index() is comment
> saying 0 is reserved to be invalid thus rule it out.
>
> CC: Robert Bragg <robert at sixbynine.org>
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> ---
>  src/mesa/main/performance_query.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/performance_query.c b/src/mesa/main/performance_query.c
> index aa10351..079d3c8 100644
> --- a/src/mesa/main/performance_query.c
> +++ b/src/mesa/main/performance_query.c
> @@ -91,7 +91,7 @@ static inline bool
>  queryid_valid(const struct gl_context *ctx, unsigned numQueries, GLuint queryid)
>  {
>     GLuint index = queryid_to_index(queryid);
> -   return index >= 0 && index < numQueries;
> +   return index != 0 && index < numQueries;
>  }
>
>  static inline GLuint
>



More information about the mesa-dev mailing list