I just ran git grep -e "_err(" --and -e "lookup", followed by git grep -e "_error(" --and -e "lookup".
It looks like there is precedence for the naming convention _mesa_lookup_[object_name]_err instead of error. On Wed, Dec 17, 2014 at 5:51 PM, Laura Ekstrand <la...@jlekstrand.net> wrote: > That makes sense. It's now > > main: Added utility function _mesa_lookup_texture_err(). > > On Wed, Dec 17, 2014 at 3:47 AM, Anuj Phogat <anuj.pho...@gmail.com> > wrote: >> >> Keep the subject of commit message short (under 50 chars) and use present >> tense. >> Here you can use "mesa: Add utility function >> _mesa_lookup_texture_error()". >> >> On Tue, Dec 16, 2014 at 6:52 AM, Laura Ekstrand <la...@jlekstrand.net> >> wrote: >> > Most ARB_DIRECT_STATE_ACCESS functions take an object's ID and use it >> to look >> > up the object in its hash table. If the user passes a fake object ID >> (ie. a >> > non-generated name), the implementation should throw INVALID_OPERATION. >> > This is a convenience function for texture objects. >> > --- >> > src/mesa/main/texobj.c | 17 ++++++++++++++++- >> > src/mesa/main/texobj.h | 3 +++ >> > 2 files changed, 19 insertions(+), 1 deletion(-) >> > >> > diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c >> > index 923cf60..49ab2c4 100644 >> > --- a/src/mesa/main/texobj.c >> > +++ b/src/mesa/main/texobj.c >> > @@ -60,6 +60,22 @@ _mesa_lookup_texture(struct gl_context *ctx, GLuint >> id) >> > _mesa_HashLookup(ctx->Shared->TexObjects, id); >> > } >> > >> > +/** >> > + * Wrapper around _mesa_lookup_texture that throws >> GL_INVALID_OPERATION if id >> > + * is not in the hash table. After calling _mesa_error, it returns >> NULL. >> > + */ >> > +struct gl_texture_object * >> > +_mesa_lookup_texture_err(struct gl_context *ctx, GLuint id, const >> char* func) >> I would use the name _mesa_lookup_texture_error() here. >> > +{ >> > + struct gl_texture_object *texObj; >> > + >> > + texObj = _mesa_lookup_texture(ctx, id); /* Returns NULL if not >> found. */ >> > + >> > + if (!texObj) >> > + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(texture)", func); >> > + >> > + return texObj; >> > +} >> > >> > void >> > _mesa_begin_texture_lookups(struct gl_context *ctx) >> > @@ -1419,7 +1435,6 @@ _mesa_BindTexture( GLenum target, GLuint texName ) >> > ctx->Driver.BindTexture(ctx, ctx->Texture.CurrentUnit, target, >> newTexObj); >> > } >> > >> > - >> unwanted change. >> > void GLAPIENTRY >> > _mesa_BindTextures(GLuint first, GLsizei count, const GLuint *textures) >> > { >> > diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h >> > index b1b7a30..abf03a1 100644 >> > --- a/src/mesa/main/texobj.h >> > +++ b/src/mesa/main/texobj.h >> > @@ -46,6 +46,9 @@ >> > extern struct gl_texture_object * >> > _mesa_lookup_texture(struct gl_context *ctx, GLuint id); >> > >> > +extern struct gl_texture_object * >> > +_mesa_lookup_texture_err(struct gl_context *ctx, GLuint id, const >> char* func); >> > + >> > extern void >> > _mesa_begin_texture_lookups(struct gl_context *ctx); >> > >> > -- >> > 2.1.0 >> > >> > _______________________________________________ >> > mesa-dev mailing list >> > mesa-dev@lists.freedesktop.org >> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev >> >
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev