From: Brian Paul Date: Fri, 3 Dec 2010 22:59:29 +0000 (-0700) Subject: mesa: make glGet*(GL_NONE) generate GL_INVALID_ENUM X-Git-Tag: mesa-7.10~229 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=503983b09e86b2ea1bdc1268977e12eaea42293d;p=platform%2Fupstream%2Fmesa.git 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. --- diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 916b87d..5ae35b8 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1759,16 +1759,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; }