removed need for Shared->TexObjectList, walk over texture hash table entries instead
This commit is contained in:
parent
557dce9bc2
commit
cf899d400d
|
@ -49,6 +49,7 @@
|
||||||
#include "tdfx_span.h"
|
#include "tdfx_span.h"
|
||||||
#include "tdfx_texman.h"
|
#include "tdfx_texman.h"
|
||||||
#include "extensions.h"
|
#include "extensions.h"
|
||||||
|
#include "hash.h"
|
||||||
|
|
||||||
#include "swrast/swrast.h"
|
#include "swrast/swrast.h"
|
||||||
#include "swrast_setup/swrast_setup.h"
|
#include "swrast_setup/swrast_setup.h"
|
||||||
|
@ -560,12 +561,24 @@ tdfxDestroyContext( __DRIcontextPrivate *driContextPriv )
|
||||||
/* This share group is about to go away, free our private
|
/* This share group is about to go away, free our private
|
||||||
* texture object data.
|
* texture object data.
|
||||||
*/
|
*/
|
||||||
|
#if 0
|
||||||
struct gl_texture_object *tObj;
|
struct gl_texture_object *tObj;
|
||||||
tObj = fxMesa->glCtx->Shared->TexObjectList;
|
tObj = fxMesa->glCtx->Shared->TexObjectList;
|
||||||
while (tObj) {
|
while (tObj) {
|
||||||
tdfxTMFreeTexture(fxMesa, tObj);
|
tdfxTMFreeTexture(fxMesa, tObj);
|
||||||
tObj = tObj->Next;
|
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 */
|
tdfxTMClose(fxMesa); /* free texture memory */
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "tdfx_context.h"
|
#include "tdfx_context.h"
|
||||||
#include "tdfx_tex.h"
|
#include "tdfx_tex.h"
|
||||||
#include "tdfx_texman.h"
|
#include "tdfx_texman.h"
|
||||||
|
#include "hash.h"
|
||||||
|
|
||||||
|
|
||||||
#define BAD_ADDRESS ((FxU32) -1)
|
#define BAD_ADDRESS ((FxU32) -1)
|
||||||
|
@ -76,10 +77,14 @@ VerifyFreeList(tdfxContextPtr fxMesa, FxU32 tmu)
|
||||||
assert(totalFree == shared->freeTexMem[tmu]);
|
assert(totalFree == shared->freeTexMem[tmu]);
|
||||||
|
|
||||||
{
|
{
|
||||||
struct gl_texture_object *obj;
|
struct _mesa_HashTable *textures = fxMesa->glCtx->Shared->TexObjects;
|
||||||
for (obj = mesaShared->TexObjectList; obj; obj = obj->Next) {
|
GLuint id;
|
||||||
tdfxTexInfo *ti = TDFX_TEXTURE_DATA(obj);
|
for (id = _mesa_HashFirstEntry(textures);
|
||||||
numObj++;
|
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) {
|
||||||
if (ti->isInTM) {
|
if (ti->isInTM) {
|
||||||
numRes++;
|
numRes++;
|
||||||
|
@ -106,13 +111,18 @@ static void
|
||||||
dump_texmem(tdfxContextPtr fxMesa)
|
dump_texmem(tdfxContextPtr fxMesa)
|
||||||
{
|
{
|
||||||
struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
|
struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
|
||||||
|
struct _mesa_HashTable *textures = mesaShared->TexObjects;
|
||||||
struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
|
struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
|
||||||
struct gl_texture_object *oldestObj, *obj, *lowestPriorityObj;
|
|
||||||
tdfxMemRange *r;
|
tdfxMemRange *r;
|
||||||
FxU32 prev;
|
FxU32 prev;
|
||||||
|
GLuint id;
|
||||||
|
|
||||||
printf("DUMP Objects:\n");
|
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);
|
tdfxTexInfo *info = TDFX_TEXTURE_DATA(obj);
|
||||||
|
|
||||||
if (info && info->isInTM) {
|
if (info && info->isInTM) {
|
||||||
|
@ -378,9 +388,11 @@ static struct gl_texture_object *
|
||||||
FindOldestObject(tdfxContextPtr fxMesa, FxU32 tmu)
|
FindOldestObject(tdfxContextPtr fxMesa, FxU32 tmu)
|
||||||
{
|
{
|
||||||
const GLuint bindnumber = fxMesa->texBindNumber;
|
const GLuint bindnumber = fxMesa->texBindNumber;
|
||||||
struct gl_texture_object *oldestObj, *obj, *lowestPriorityObj;
|
struct gl_texture_object *oldestObj, *lowestPriorityObj;
|
||||||
GLfloat lowestPriority;
|
GLfloat lowestPriority;
|
||||||
GLuint oldestAge;
|
GLuint oldestAge;
|
||||||
|
GLuint id;
|
||||||
|
struct _mesa_HashTable *textures = fxMesa->glCtx->Shared->TexObjects;
|
||||||
|
|
||||||
oldestObj = NULL;
|
oldestObj = NULL;
|
||||||
oldestAge = 0;
|
oldestAge = 0;
|
||||||
|
@ -388,7 +400,11 @@ FindOldestObject(tdfxContextPtr fxMesa, FxU32 tmu)
|
||||||
lowestPriority = 1.0F;
|
lowestPriority = 1.0F;
|
||||||
lowestPriorityObj = NULL;
|
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);
|
tdfxTexInfo *info = TDFX_TEXTURE_DATA(obj);
|
||||||
|
|
||||||
if (info && info->isInTM &&
|
if (info && info->isInTM &&
|
||||||
|
@ -437,11 +453,14 @@ FindOldestObject(tdfxContextPtr fxMesa, FxU32 tmu)
|
||||||
static void
|
static void
|
||||||
FlushTexMemory(tdfxContextPtr fxMesa)
|
FlushTexMemory(tdfxContextPtr fxMesa)
|
||||||
{
|
{
|
||||||
struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
|
struct _mesa_HashTable *textures = fxMesa->glCtx->Shared->TexObjects;
|
||||||
struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
|
GLuint id;
|
||||||
struct gl_texture_object *obj;
|
|
||||||
|
|
||||||
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);
|
||||||
if (obj->RefCount < 2) {
|
if (obj->RefCount < 2) {
|
||||||
/* don't flush currently bound textures */
|
/* don't flush currently bound textures */
|
||||||
tdfxTMMoveOutTM_NoLock(fxMesa, obj);
|
tdfxTMMoveOutTM_NoLock(fxMesa, obj);
|
||||||
|
@ -946,12 +965,17 @@ tdfxTMFreeTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj)
|
||||||
void tdfxTMRestoreTextures_NoLock( tdfxContextPtr fxMesa )
|
void tdfxTMRestoreTextures_NoLock( tdfxContextPtr fxMesa )
|
||||||
{
|
{
|
||||||
GLcontext *ctx = fxMesa->glCtx;
|
GLcontext *ctx = fxMesa->glCtx;
|
||||||
struct gl_texture_object *tObj;
|
struct _mesa_HashTable *textures = fxMesa->glCtx->Shared->TexObjects;
|
||||||
int i;
|
GLuint id;
|
||||||
|
|
||||||
for ( tObj = ctx->Shared->TexObjectList ; tObj ; tObj = tObj->Next ) {
|
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 );
|
tdfxTexInfo *ti = TDFX_TEXTURE_DATA( tObj );
|
||||||
if ( ti && ti->isInTM ) {
|
if ( ti && ti->isInTM ) {
|
||||||
|
int i;
|
||||||
for ( i = 0 ; i < MAX_TEXTURE_UNITS ; i++ ) {
|
for ( i = 0 ; i < MAX_TEXTURE_UNITS ; i++ ) {
|
||||||
if ( ctx->Texture.Unit[i]._Current == tObj ) {
|
if ( ctx->Texture.Unit[i]._Current == tObj ) {
|
||||||
tdfxTMDownloadTexture( fxMesa, tObj );
|
tdfxTMDownloadTexture( fxMesa, tObj );
|
||||||
|
|
Loading…
Reference in New Issue