mesa: Don't compare unsigned for < 0

The INTEL_performance_query spec says

   "Performance counter id 0 is reserved as an invalid counter."

GLuint counterid_to_index(GLuint counterid) just returns counterid - 1,
so with unsigned overflow rules, it will generate 0xFFFFFFFF given an
input of 0. 0xFFFFFFFF will trigger the counterIndex >= queryNumCounters
check, so the code worked as is. It just contained a useless comparison.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
Matt Turner 2017-07-06 18:48:03 -07:00
parent 4e97084591
commit 384e27174d
1 changed files with 1 additions and 1 deletions

View File

@ -349,7 +349,7 @@ _mesa_GetPerfCounterInfoINTEL(GLuint queryId, GLuint counterId,
counterIndex = counterid_to_index(counterId);
if (counterIndex < 0 || counterIndex >= queryNumCounters) {
if (counterIndex >= queryNumCounters) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glGetPerfCounterInfoINTEL(invalid counterId)");
return;