remove dependency on Shared->TexObjectList
authorBrian Paul <brian.paul@tungstengraphics.com>
Sat, 5 Feb 2005 17:43:33 +0000 (17:43 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Sat, 5 Feb 2005 17:43:33 +0000 (17:43 +0000)
src/mesa/drivers/windows/gldirect/dglwgl.c

index a1b7e5d..437358a 100644 (file)
@@ -1417,31 +1417,37 @@ DoClipperOnly:
        dglInitStateD3D(ctx);
 
        // Now we have to recreate all of our textures (+ mipmaps).
-       // Luckily, Mesa has a list of them.
-       tObj = ctx->Shared->TexObjectList;
-       while (tObj != NULL) {
-               if (tObj->DriverData) {
-                       // We could call our TexImage function directly, but it's
-                       // safer to use the driver pointer.
-                       for (i=0; i<MAX_TEXTURE_LEVELS; i++) {
-                               image = tObj->Image[i];
-                               if (image) {
-                                       switch (tObj->Dimensions){
-                                       case 1:
-                                               if (ctx->Driver.TexImage)
-                                                       (*ctx->Driver.TexImage)(ctx, GL_TEXTURE_1D, tObj, i, image->Format, image);
-                                               break;
-                                       case 2:
-                                               if (ctx->Driver.TexImage)
-                                                       (*ctx->Driver.TexImage)(ctx, GL_TEXTURE_2D, tObj, i, image->Format, image);
-                                               break;
-                                       default:
-                                               break;
+       // Walk over all textures in hash table
+       // XXX what about the default texture objects (id=0)?
+       {
+               struct _mesa_HashTable *textures = ctx->Shared->TexObjects;
+               GLuint id;
+               for (id = _mesa_HashFirstEntry(textures);
+                                id;
+                                id = _mesa_HashNextEntry(textures, id)) {
+                       tObj = (struct gl_texture_object *) _mesa_HashLookup(textures, id);
+                       if (tObj->DriverData) {
+                               // We could call our TexImage function directly, but it's
+                               // safer to use the driver pointer.
+                               for (i=0; i<MAX_TEXTURE_LEVELS; i++) {
+                                       image = tObj->Image[i];
+                                       if (image) {
+                                               switch (tObj->Dimensions){
+                                               case 1:
+                                                       if (ctx->Driver.TexImage)
+                                                               (*ctx->Driver.TexImage)(ctx, GL_TEXTURE_1D, tObj, i, image->Format, image);
+                                                       break;
+                                               case 2:
+                                                       if (ctx->Driver.TexImage)
+                                                               (*ctx->Driver.TexImage)(ctx, GL_TEXTURE_2D, tObj, i, image->Format, image);
+                                                       break;
+                                               default:
+                                                       break;
+                                               }
                                        }
                                }
                        }
                }
-               tObj = tObj->Next;
        }
 
        // Re-Bind each texture Unit