[D3D] Fix graphical corruption in DungeonSiege

Lionel Ulmer lionel.ulmer at free.fr
Sat Nov 15 08:53:01 CST 2003


This fixes the most glaring corruptions when DungeonSiege abruptly decides
at the middle of one level to activate multi-texturing.

            Lionel

Changelog:
 - fix graphical corruption on surface lock when multi-texturing
   is active

-- 
		 Lionel Ulmer - http://www.bbrox.org/
-------------- next part --------------
--- dlls/ddraw_CVS/d3ddevice/mesa.c	Mon Nov 10 19:42:20 2003
+++ dlls/ddraw/d3ddevice/mesa.c	Sat Nov 15 15:45:00 2003
@@ -105,10 +105,22 @@
     IDirect3DDeviceGLImpl* gl_d3d_dev = (IDirect3DDeviceGLImpl*) d3d_dev;
     DWORD opt_bitmap = 0x00000000;
     
+    if (gl_d3d_dev->current_bound_texture[1] != NULL) {
+	if (gl_d3d_dev->current_active_tex_unit != GL_TEXTURE1_WINE) {
+	    GL_extensions.glActiveTexture(GL_TEXTURE1_WINE);
+	    gl_d3d_dev->current_active_tex_unit = GL_TEXTURE1_WINE;
+	}
+	/* 'unbound' texture level 1 in that case to disable multi-texturing */
+	glBindTexture(GL_TEXTURE_2D, 0);
+	glDisable(GL_TEXTURE_2D);
+    }
     if (gl_d3d_dev->current_active_tex_unit != GL_TEXTURE0_WINE) {
 	GL_extensions.glActiveTexture(GL_TEXTURE0_WINE);
 	gl_d3d_dev->current_active_tex_unit = GL_TEXTURE0_WINE;
     }
+    if ((gl_d3d_dev->current_bound_texture[0] == NULL) ||
+	(d3d_dev->state_block.texture_stage_state[0][D3DTSS_COLOROP - 1] == D3DTOP_DISABLE))
+	glEnable(GL_TEXTURE_2D);
     if (gl_d3d_dev->unlock_tex == 0) {
         glGenTextures(1, &gl_d3d_dev->unlock_tex);
 	glBindTexture(GL_TEXTURE_2D, gl_d3d_dev->unlock_tex);
@@ -132,18 +144,6 @@
     }
     
     if (gl_d3d_dev->depth_test != FALSE) glDisable(GL_DEPTH_TEST);
-    if ((gl_d3d_dev->current_bound_texture[0] == NULL) ||
-	(d3d_dev->state_block.texture_stage_state[0][D3DTSS_COLOROP - 1] == D3DTOP_DISABLE))
-	glEnable(GL_TEXTURE_2D);
-    if (gl_d3d_dev->current_bound_texture[1] != NULL) {
-	if (gl_d3d_dev->current_active_tex_unit != GL_TEXTURE1_WINE) {
-	    GL_extensions.glActiveTexture(GL_TEXTURE1_WINE);
-	    gl_d3d_dev->current_active_tex_unit = GL_TEXTURE1_WINE;
-	}
-	/* 'unbound' texture level 1 in that case to disable multi-texturing */
-	glBindTexture(GL_TEXTURE_2D, 0);
-	glDisable(GL_TEXTURE_2D);
-    }
     glEnable(GL_SCISSOR_TEST);
     if ((d3d_dev->active_viewport.dvMinZ != 0.0) ||
 	(d3d_dev->active_viewport.dvMaxZ != 1.0)) {
--- dlls/ddraw_CVS/mesa.c	Mon Nov 10 19:42:20 2003
+++ dlls/ddraw/mesa.c	Sat Nov 15 13:29:51 2003
@@ -907,6 +907,8 @@
     }
     glPixelStorei(GL_UNPACK_ROW_LENGTH, current_storage_width);
 
+    TRACE(" initialized texture upload for level %d with conversion %d.\n", current_level, convert_type);
+    
     return DD_OK;
 }
 
@@ -933,8 +935,6 @@
     /* Used when converting stuff */
     line_increase = src_d->u1.lPitch - (width * bpp);
 
-    TRACE(" uploading texture to memory using conversion %d.\n", convert_type);
-    
     switch (convert_type) {
         case CONVERT_PALETTED: {
 	    IDirectDrawPaletteImpl* pal = current_surface->palette;


More information about the wine-patches mailing list