Module: Mesa Branch: 7.9 Commit: 22ba37aae2c5d6f25002bc4188c437b135d39bb8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=22ba37aae2c5d6f25002bc4188c437b135d39bb8
Author: Brian Paul <bri...@vmware.com> Date: Tue Dec 14 16:27:35 2010 -0700 mesa: make glGet*(GL_NONE) generate GL_INVALID_ENUM In find_value() check if we've hit the 0th/invalid entry before checking if the pname matches. Fixes http://bugs.freedesktop.org/show_bug.cgi?id=31987 NOTE: This is a candidate for the 7.9 branch. (cherry picked from commit 503983b09e86b2ea1bdc1268977e12eaea42293d) --- src/mesa/main/get.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 2062134..073f481 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1769,16 +1769,18 @@ find_value(const char *func, GLenum pname, void **p, union value *v) hash = (pname * prime_factor); while (1) { d = &values[table[hash & mask]]; - if (likely(d->pname == pname)) - break; /* If the enum isn't valid, the hash walk ends with index 0, * which is the API mask entry at the beginning of values[]. */ - if (d->type == TYPE_API_MASK) { + if (unlikely(d->type == TYPE_API_MASK)) { _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func, _mesa_lookup_enum_by_nr(pname)); return &error_value; } + + if (likely(d->pname == pname)) + break; + hash += prime_step; } _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit