[dx65] mipmap change

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The following is not a result of actually seeing a problem, but
something I noticed while debugging another problem. If texture 1 has
mip levels of 10 and is replaced by texture 2 with mip levels 1, should
texture 1 need to be bound back in then we should reset the max levels
back to 10. I also took the setting out of the for loop (we dont need to
issue it 'levels' times) as well as moving the setting of the dirty flag
outside the for loop.

Changelog
Ensure MIPMAP levels is reset when rebinding an existing texture to a
texture unit.
Jason
Index: dlls/d3d8/texture.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/texture.c,v
retrieving revision 1.12
diff -u -r1.12 texture.c
--- dlls/d3d8/texture.c	18 Jun 2003 03:17:42 -0000	1.12
+++ dlls/d3d8/texture.c	1 Jul 2003 20:19:03 -0000
@@ -119,7 +119,8 @@
 	checkGLcall("glBindTexture");
 	TRACE("Texture %p (level %d) given name %d\n", This->surfaces[i], i, This->surfaces[i]->textureName);
 	/* No need to walk through all mip-map levels, since already all assigned */
-	i = This->levels;
+        i = This->levels;
+
       } else {
 	if (i == 0) {
 	  if (This->surfaces[i]->textureName == 0) {
@@ -130,18 +131,20 @@
 	  
 	  glBindTexture(GL_TEXTURE_2D, This->surfaces[i]->textureName);
 	  checkGLcall("glBindTexture");
-	  
-	  TRACE("Setting GL_TEXTURE_MAX_LEVEL to %d\n", This->levels - 1);   
-	  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, This->levels - 1);
-	  checkGLcall("glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, This->levels)");
-	  
 	}
-
 	IDirect3DSurface8Impl_LoadTexture((LPDIRECT3DSURFACE8) This->surfaces[i], GL_TEXTURE_2D, i); 
-	/* Removed glTexParameterf now TextureStageStates are initialized at startup */
-	This->Dirty = FALSE;
       }
     }
+
+    /* No longer dirty */
+    This->Dirty = FALSE;
+
+    /* Always need to reset the number of mipmap levels when rebinding as it is
+       a property of the active texture unit, and another texture may have set it
+       to a different value                                                       */
+    TRACE("Setting GL_TEXTURE_MAX_LEVEL to %d\n", This->levels - 1);   
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, This->levels - 1);
+    checkGLcall("glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, This->levels)");
 
     LEAVE_GL();
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux