diff options
author | Brian Paul <[email protected]> | 2006-03-26 05:22:17 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2006-03-26 05:22:17 +0000 |
commit | ea4fe661d7f3a95d9db17e1475076f1badf8e1a6 (patch) | |
tree | ffc663f1a02dea07254e08620f8ad872fb1a3e20 /src/mesa/main/texobj.c | |
parent | 4cbd16ed3ffecd743b4921fab3a65f8510d151c9 (diff) |
merge from texman branchmesa_20060325
Diffstat (limited to 'src/mesa/main/texobj.c')
-rw-r--r-- | src/mesa/main/texobj.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 59a1d9375ff..cfe9229cdb1 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -50,6 +50,19 @@ /** \name Internal functions */ /*@{*/ + +/** + * Return the gl_texture_object for a given ID. + */ +struct gl_texture_object * +_mesa_lookup_texture(GLcontext *ctx, GLuint id) +{ + return (struct gl_texture_object *) + _mesa_HashLookup(ctx->Shared->TexObjects, id); +} + + + /** * Allocate and initialize a new texture object. But don't put it into the * texture object hash table. @@ -682,8 +695,8 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures) for (i = 0; i < n; i++) { if (textures[i] > 0) { - struct gl_texture_object *delObj = (struct gl_texture_object *) - _mesa_HashLookup(ctx->Shared->TexObjects, textures[i]); + struct gl_texture_object *delObj + = _mesa_lookup_texture(ctx, textures[i]); if (delObj) { /* Check if texture is bound to any framebuffer objects. @@ -817,8 +830,7 @@ _mesa_BindTexture( GLenum target, GLuint texName ) } else { /* non-default texture object */ - const struct _mesa_HashTable *hash = ctx->Shared->TexObjects; - newTexObj = (struct gl_texture_object *) _mesa_HashLookup(hash, texName); + newTexObj = _mesa_lookup_texture(ctx, texName); if (newTexObj) { /* error checking */ if (newTexObj->Target != 0 && newTexObj->Target != target) { @@ -935,8 +947,7 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName, for (i = 0; i < n; i++) { if (texName[i] > 0) { - struct gl_texture_object *t = (struct gl_texture_object *) - _mesa_HashLookup(ctx->Shared->TexObjects, texName[i]); + struct gl_texture_object *t = _mesa_lookup_texture(ctx, texName[i]); if (t) { t->Priority = CLAMP( priorities[i], 0.0F, 1.0F ); if (ctx->Driver.PrioritizeTexture) @@ -985,8 +996,7 @@ _mesa_AreTexturesResident(GLsizei n, const GLuint *texName, _mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident"); return GL_FALSE; } - t = (struct gl_texture_object *) - _mesa_HashLookup(ctx->Shared->TexObjects, texName[i]); + t = _mesa_lookup_texture(ctx, texName[i]); if (!t) { _mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident"); return GL_FALSE; @@ -1033,8 +1043,7 @@ _mesa_IsTexture( GLuint texture ) if (!texture) return GL_FALSE; - t = (struct gl_texture_object *) - _mesa_HashLookup(ctx->Shared->TexObjects, texture); + t = _mesa_lookup_texture(ctx, texture); /* IsTexture is true only after object has been bound once. */ return t && t->Target; |