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

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


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
-- 
2.7.4



More information about the mesa-dev mailing list