#include "tdfx_span.h"
#include "tdfx_texman.h"
#include "extensions.h"
+#include "hash.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
/* This share group is about to go away, free our private
* texture object data.
*/
+#if 0
struct gl_texture_object *tObj;
tObj = fxMesa->glCtx->Shared->TexObjectList;
while (tObj) {
tdfxTMFreeTexture(fxMesa, tObj);
tObj = tObj->Next;
}
+#else
+ struct _mesa_HashTable *textures = fxMesa->glCtx->Shared->TexObjects;
+ GLuint id;
+ for (id = _mesa_HashFirstEntry(textures);
+ id;
+ id = _mesa_HashNextEntry(textures, id)) {
+ struct gl_texture_object *tObj
+ = (struct gl_texture_object *) _mesa_HashLookup(textures, id);
+ tdfxTMFreeTexture(fxMesa, tObj);
+ }
+#endif
}
tdfxTMClose(fxMesa); /* free texture memory */
#include "tdfx_context.h"
#include "tdfx_tex.h"
#include "tdfx_texman.h"
+#include "hash.h"
#define BAD_ADDRESS ((FxU32) -1)
assert(totalFree == shared->freeTexMem[tmu]);
{
- struct gl_texture_object *obj;
- for (obj = mesaShared->TexObjectList; obj; obj = obj->Next) {
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA(obj);
- numObj++;
+ struct _mesa_HashTable *textures = fxMesa->glCtx->Shared->TexObjects;
+ GLuint id;
+ for (id = _mesa_HashFirstEntry(textures);
+ id;
+ id = _mesa_HashNextEntry(textures, id)) {
+ struct gl_texture_object *tObj;
+ tObj = (struct gl_texture_object *) _mesa_HashLookup(textures, id);
+ tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
if (ti) {
if (ti->isInTM) {
numRes++;
dump_texmem(tdfxContextPtr fxMesa)
{
struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
+ struct _mesa_HashTable *textures = mesaShared->TexObjects;
struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- struct gl_texture_object *oldestObj, *obj, *lowestPriorityObj;
tdfxMemRange *r;
FxU32 prev;
+ GLuint id;
printf("DUMP Objects:\n");
- for (obj = mesaShared->TexObjectList; obj; obj = obj->Next) {
+ for (id = _mesa_HashFirstEntry(textures);
+ id;
+ id = _mesa_HashNextEntry(textures, id)) {
+ struct gl_texture_object *obj
+ = (struct gl_texture_object *) _mesa_HashLookup(textures, id);
tdfxTexInfo *info = TDFX_TEXTURE_DATA(obj);
if (info && info->isInTM) {
FindOldestObject(tdfxContextPtr fxMesa, FxU32 tmu)
{
const GLuint bindnumber = fxMesa->texBindNumber;
- struct gl_texture_object *oldestObj, *obj, *lowestPriorityObj;
+ struct gl_texture_object *oldestObj, *lowestPriorityObj;
GLfloat lowestPriority;
GLuint oldestAge;
+ GLuint id;
+ struct _mesa_HashTable *textures = fxMesa->glCtx->Shared->TexObjects;
oldestObj = NULL;
oldestAge = 0;
lowestPriority = 1.0F;
lowestPriorityObj = NULL;
- for (obj = fxMesa->glCtx->Shared->TexObjectList; obj; obj = obj->Next) {
+ for (id = _mesa_HashFirstEntry(textures);
+ id;
+ id = _mesa_HashNextEntry(textures, id)) {
+ struct gl_texture_object *obj
+ = (struct gl_texture_object *) _mesa_HashLookup(textures, id);
tdfxTexInfo *info = TDFX_TEXTURE_DATA(obj);
if (info && info->isInTM &&
static void
FlushTexMemory(tdfxContextPtr fxMesa)
{
- struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- struct gl_texture_object *obj;
-
- for (obj = mesaShared->TexObjectList; obj; obj = obj->Next) {
+ struct _mesa_HashTable *textures = fxMesa->glCtx->Shared->TexObjects;
+ GLuint id;
+
+ for (id = _mesa_HashFirstEntry(textures);
+ id;
+ id = _mesa_HashNextEntry(textures, id)) {
+ struct gl_texture_object *obj
+ = (struct gl_texture_object *) _mesa_HashLookup(textures, id);
if (obj->RefCount < 2) {
/* don't flush currently bound textures */
tdfxTMMoveOutTM_NoLock(fxMesa, obj);
void tdfxTMRestoreTextures_NoLock( tdfxContextPtr fxMesa )
{
GLcontext *ctx = fxMesa->glCtx;
- struct gl_texture_object *tObj;
- int i;
-
- for ( tObj = ctx->Shared->TexObjectList ; tObj ; tObj = tObj->Next ) {
+ struct _mesa_HashTable *textures = fxMesa->glCtx->Shared->TexObjects;
+ GLuint id;
+
+ for (id = _mesa_HashFirstEntry(textures);
+ id;
+ id = _mesa_HashNextEntry(textures, id)) {
+ struct gl_texture_object *tObj
+ = (struct gl_texture_object *) _mesa_HashLookup(textures, id);
tdfxTexInfo *ti = TDFX_TEXTURE_DATA( tObj );
if ( ti && ti->isInTM ) {
+ int i;
for ( i = 0 ; i < MAX_TEXTURE_UNITS ; i++ ) {
if ( ctx->Texture.Unit[i]._Current == tObj ) {
tdfxTMDownloadTexture( fxMesa, tObj );