<div dir="ltr">Looks good to me :)<div><br></div><div>Reviewed-by: Plamena Manolova <<a href="mailto:plamena.manolova@intel.com">plamena.manolova@intel.com</a>></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 24, 2017 at 6:46 PM, Robert Bragg <span dir="ltr"><<a href="mailto:robert@sixbynine.org" target="_blank">robert@sixbynine.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">In queryid_valid() index is unsigned so checking if it is less<br>
than zero is useless. On queryid_to_index() is comment<br>
saying 0 is reserved to be invalid thus rule it out.<br>
<br>
This is a v2 of a fix for an issue identified by Juha-Pekka (thanks)<br>
and the commit message is gratuitously stolen.<br>
<br>
Cc: Juha-Pekka Heikkila <<a href="mailto:juhapekka.heikkila@gmail.com">juhapekka.heikkila@gmail.com</a>><br>
Signed-off-by: Robert Bragg <<a href="mailto:robert@sixbynine.org">robert@sixbynine.org</a>><br>
---<br>
src/mesa/main/performance_<wbr>query.c | 8 ++++++--<br>
1 file changed, 6 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/mesa/main/performance_<wbr>query.c b/src/mesa/main/performance_<wbr>query.c<br>
index aa103516a5..56f6a7da8b 100644<br>
--- a/src/mesa/main/performance_<wbr>query.c<br>
+++ b/src/mesa/main/performance_<wbr>query.c<br>
@@ -90,8 +90,12 @@ index_to_queryid(unsigned index)<br>
static inline bool<br>
queryid_valid(const struct gl_context *ctx, unsigned numQueries, GLuint queryid)<br>
{<br>
- GLuint index = queryid_to_index(queryid);<br>
- return index >= 0 && index < numQueries;<br>
+ /* The GL_INTEL_performance_query spec says:<br>
+ *<br>
+ * "Performance counter ids values start with 1. Performance counter id 0<br>
+ * is reserved as an invalid counter."<br>
+ */<br>
+ return queryid != 0 && queryid_to_index(queryid) < numQueries;<br>
}<br>
<br>
static inline GLuint<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.11.1<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>