Remove the Shared->TexObjectList pointer and Next field from gl_texture_object.
Was only used by two drivers to walk over all texture objects. Can do that via the hash table instead. Cleaned up some comments for struct gl_texture_object.
This commit is contained in:
@@ -1250,13 +1250,9 @@ struct gl_texture_object
|
|||||||
GLfloat Priority; /**< in [0,1] */
|
GLfloat Priority; /**< in [0,1] */
|
||||||
GLfloat BorderColor[4]; /**< unclamped */
|
GLfloat BorderColor[4]; /**< unclamped */
|
||||||
GLchan _BorderChan[4]; /**< clamped, as GLchan */
|
GLchan _BorderChan[4]; /**< clamped, as GLchan */
|
||||||
/** \name Wrap modes
|
GLenum WrapS; /**< S-axis texture image wrap mode */
|
||||||
* Are GL_CLAMP, REPEAT, GL_CLAMP_TO_EDGE, and GL_CLAMP_TO_BORDER_ARB. */
|
GLenum WrapT; /**< T-axis texture image wrap mode */
|
||||||
/*@{*/
|
GLenum WrapR; /**< R-axis texture image wrap mode */
|
||||||
GLenum WrapS;
|
|
||||||
GLenum WrapT;
|
|
||||||
GLenum WrapR;
|
|
||||||
/*@}*/
|
|
||||||
GLenum MinFilter; /**< minification filter */
|
GLenum MinFilter; /**< minification filter */
|
||||||
GLenum MagFilter; /**< magnification filter */
|
GLenum MagFilter; /**< magnification filter */
|
||||||
GLfloat MinLod; /**< min lambda, OpenGL 1.2 */
|
GLfloat MinLod; /**< min lambda, OpenGL 1.2 */
|
||||||
@@ -1267,7 +1263,7 @@ struct gl_texture_object
|
|||||||
GLfloat MaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */
|
GLfloat MaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */
|
||||||
GLboolean CompareFlag; /**< GL_SGIX_shadow */
|
GLboolean CompareFlag; /**< GL_SGIX_shadow */
|
||||||
GLenum CompareOperator; /**< GL_SGIX_shadow */
|
GLenum CompareOperator; /**< GL_SGIX_shadow */
|
||||||
GLfloat ShadowAmbient;
|
GLfloat ShadowAmbient; /**< GL_ARB_shadow_ambient */
|
||||||
GLenum CompareMode; /**< GL_ARB_shadow */
|
GLenum CompareMode; /**< GL_ARB_shadow */
|
||||||
GLenum CompareFunc; /**< GL_ARB_shadow */
|
GLenum CompareFunc; /**< GL_ARB_shadow */
|
||||||
GLenum DepthMode; /**< GL_ARB_depth_texture */
|
GLenum DepthMode; /**< GL_ARB_depth_texture */
|
||||||
@@ -1275,21 +1271,23 @@ struct gl_texture_object
|
|||||||
GLfloat _MaxLambda; /**< = _MaxLevel - BaseLevel (q - b in spec) */
|
GLfloat _MaxLambda; /**< = _MaxLevel - BaseLevel (q - b in spec) */
|
||||||
GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */
|
GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */
|
||||||
GLboolean _IsPowerOfTwo; /**< Are all image dimensions powers of two? */
|
GLboolean _IsPowerOfTwo; /**< Are all image dimensions powers of two? */
|
||||||
|
GLboolean Complete; /**< Is texture object complete? */
|
||||||
|
|
||||||
|
/** Actual texture images, indexed by [cube face] and [mipmap level] */
|
||||||
struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS];
|
struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS];
|
||||||
|
|
||||||
/** GL_EXT_paletted_texture */
|
/** GL_EXT_paletted_texture */
|
||||||
struct gl_color_table Palette;
|
struct gl_color_table Palette;
|
||||||
|
|
||||||
GLboolean Complete; /**< Is texture object complete? */
|
|
||||||
struct gl_texture_object *Next; /**< Next in linked list */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name For device driver
|
* \name For device driver.
|
||||||
|
* Note: instead of attaching driver data to this pointer, it's preferable
|
||||||
|
* to instead use this struct as a base class for your own texture object
|
||||||
|
* class. Driver->NewTextureObject() can be used to implement the
|
||||||
|
* allocation.
|
||||||
*/
|
*/
|
||||||
/*@{*/
|
|
||||||
void *DriverData; /**< Arbitrary device driver data */
|
void *DriverData; /**< Arbitrary device driver data */
|
||||||
/*@}*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1935,7 +1933,6 @@ struct gl_shared_state
|
|||||||
GLint RefCount; /**< Reference count */
|
GLint RefCount; /**< Reference count */
|
||||||
struct _mesa_HashTable *DisplayList; /**< Display lists hash table */
|
struct _mesa_HashTable *DisplayList; /**< Display lists hash table */
|
||||||
struct _mesa_HashTable *TexObjects; /**< Texture objects hash table */
|
struct _mesa_HashTable *TexObjects; /**< Texture objects hash table */
|
||||||
struct gl_texture_object *TexObjectList;/**< Linked list of texture objects */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Default texture objects (shared by all multi-texture units)
|
* \name Default texture objects (shared by all multi-texture units)
|
||||||
|
@@ -157,63 +157,11 @@ _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the given texture object to the texture object pool.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
_mesa_save_texture_object( GLcontext *ctx, struct gl_texture_object *texObj )
|
|
||||||
{
|
|
||||||
/* insert into linked list */
|
|
||||||
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
|
||||||
texObj->Next = ctx->Shared->TexObjectList;
|
|
||||||
ctx->Shared->TexObjectList = texObj;
|
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
|
||||||
|
|
||||||
if (texObj->Name > 0) {
|
|
||||||
/* insert into hash table */
|
|
||||||
_mesa_HashInsert(ctx->Shared->TexObjects, texObj->Name, texObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the given texture object from the texture object pool.
|
|
||||||
* Do not deallocate the texture object though.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
_mesa_remove_texture_object( GLcontext *ctx, struct gl_texture_object *texObj )
|
|
||||||
{
|
|
||||||
struct gl_texture_object *tprev, *tcurr;
|
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
|
||||||
|
|
||||||
/* unlink from the linked list */
|
|
||||||
tprev = NULL;
|
|
||||||
tcurr = ctx->Shared->TexObjectList;
|
|
||||||
while (tcurr) {
|
|
||||||
if (tcurr == texObj) {
|
|
||||||
if (tprev) {
|
|
||||||
tprev->Next = texObj->Next;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ctx->Shared->TexObjectList = texObj->Next;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
tprev = tcurr;
|
|
||||||
tcurr = tcurr->Next;
|
|
||||||
}
|
|
||||||
|
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
|
||||||
|
|
||||||
if (texObj->Name > 0) {
|
|
||||||
/* remove from hash table */
|
|
||||||
_mesa_HashRemove(ctx->Shared->TexObjects, texObj->Name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy texture object state from one texture object to another.
|
* Copy texture object state from one texture object to another.
|
||||||
|
* Use for glPush/PopAttrib.
|
||||||
*
|
*
|
||||||
* \param dest destination texture object.
|
* \param dest destination texture object.
|
||||||
* \param src source texture object.
|
* \param src source texture object.
|
||||||
@@ -620,7 +568,12 @@ _mesa_GenTextures( GLsizei n, GLuint *textures )
|
|||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenTextures");
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenTextures");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_mesa_save_texture_object(ctx, texObj);
|
|
||||||
|
/* insert into hash table */
|
||||||
|
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
||||||
|
_mesa_HashInsert(ctx->Shared->TexObjects, texObj->Name, texObj);
|
||||||
|
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
||||||
|
|
||||||
textures[i] = name;
|
textures[i] = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -702,8 +655,13 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures)
|
|||||||
}
|
}
|
||||||
ctx->NewState |= _NEW_TEXTURE;
|
ctx->NewState |= _NEW_TEXTURE;
|
||||||
|
|
||||||
/* The texture _name_ is now free for re-use. */
|
/* The texture _name_ is now free for re-use.
|
||||||
_mesa_remove_texture_object(ctx, delObj);
|
* Remove it from the hash table now.
|
||||||
|
*/
|
||||||
|
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
||||||
|
_mesa_HashRemove(ctx->Shared->TexObjects, delObj->Name);
|
||||||
|
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
||||||
|
|
||||||
/* The actual texture object will not be freed until it's no
|
/* The actual texture object will not be freed until it's no
|
||||||
* longer bound in any context.
|
* longer bound in any context.
|
||||||
* XXX all RefCount accesses should be protected by a mutex.
|
* XXX all RefCount accesses should be protected by a mutex.
|
||||||
@@ -848,7 +806,11 @@ _mesa_BindTexture( GLenum target, GLuint texName )
|
|||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindTexture");
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindTexture");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_mesa_save_texture_object(ctx, newTexObj);
|
|
||||||
|
/* and insert it into hash table */
|
||||||
|
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
||||||
|
_mesa_HashInsert(ctx->Shared->TexObjects, texName, newTexObj);
|
||||||
|
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
||||||
}
|
}
|
||||||
newTexObj->Target = target;
|
newTexObj->Target = target;
|
||||||
}
|
}
|
||||||
|
@@ -50,12 +50,6 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj,
|
|||||||
extern void
|
extern void
|
||||||
_mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *obj );
|
_mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *obj );
|
||||||
|
|
||||||
extern void
|
|
||||||
_mesa_save_texture_object( GLcontext *ctx, struct gl_texture_object *obj );
|
|
||||||
|
|
||||||
extern void
|
|
||||||
_mesa_remove_texture_object( GLcontext *ctx, struct gl_texture_object *obj );
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_copy_texture_object( struct gl_texture_object *dest,
|
_mesa_copy_texture_object( struct gl_texture_object *dest,
|
||||||
const struct gl_texture_object *src );
|
const struct gl_texture_object *src );
|
||||||
|
Reference in New Issue
Block a user