[D3D] Some small fixes

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

 



Well, while trying to fix the color keying in Motoracer2, I found these
small bugs.

Anyway, the more I look at this, the more the fact that color keying works
in some applications is a plain miracle :-) (and to do a proper fix will
require some big ugly magic :-/ ).

Changelog:
 - small TRACEing fix
 - fix bug in texture upload (I wonder how I missed this :-/ )
 - improve the D3D1/2 texture mapping modes

-- 
		 Lionel Ulmer - http://www.bbrox.org/
--- dlls/ddraw_CVS/d3ddevice/mesa.c	Tue Jun  3 12:08:08 2003
+++ dlls/ddraw/d3ddevice/mesa.c	Tue Jun  3 12:55:26 2003
@@ -1806,7 +1806,7 @@
 	} break;
 
 	case D3DTSS_MAXMIPLEVEL: 
-	    TRACE(" Stage type : D3DTSS_MAXMIPLEVEL => 0 (disabled) \n");
+	    TRACE(" Stage type : D3DTSS_MAXMIPLEVEL => %ld\n", dwState);
 	    break;
 
 	case D3DTSS_BORDERCOLOR:
--- dlls/ddraw_CVS/mesa.c	Tue Jun  3 12:08:08 2003
+++ dlls/ddraw/mesa.c	Tue Jun  3 15:18:30 2003
@@ -244,19 +244,31 @@
 			    convert_D3D_blendop_to_GL(lpStateBlock->render_state[D3DRENDERSTATE_DESTBLEND - 1]));
 	        break;
 
-	    case D3DRENDERSTATE_TEXTUREMAPBLEND:    /* 21 */
+	    case D3DRENDERSTATE_TEXTUREMAPBLEND: {  /* 21 */
+		IDirect3DDevice7 *d3ddev = ICOM_INTERFACE(This, IDirect3DDevice7);
+		
 	        switch ((D3DTEXTUREBLEND) dwRenderState) {
 		    case D3DTBLEND_DECAL:
+		        glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+			break;
+		    case D3DTBLEND_DECALALPHA:
 		        glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
 			break;
 		    case D3DTBLEND_MODULATE:
+			glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+			break;
 		    case D3DTBLEND_MODULATEALPHA:
-		        glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+			IDirect3DDevice7_SetTextureStageState(d3ddev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
+			IDirect3DDevice7_SetTextureStageState(d3ddev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
+			IDirect3DDevice7_SetTextureStageState(d3ddev, 0, D3DTSS_COLORARG2, D3DTA_CURRENT);
+			IDirect3DDevice7_SetTextureStageState(d3ddev, 0, D3DTSS_ALPHAARG2, D3DTA_CURRENT);
+			IDirect3DDevice7_SetTextureStageState(d3ddev, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
+			IDirect3DDevice7_SetTextureStageState(d3ddev, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
 			break;
 		    default:
 		        ERR("Unhandled texture environment %ld !\n",dwRenderState);
 		}
-	        break;
+	    } break;
 
 	    case D3DRENDERSTATE_CULLMODE:           /* 22 */
 	        switch ((D3DCULL) dwRenderState) {
@@ -980,7 +992,7 @@
 	    DWORD i;
 	    WORD *src = (WORD *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top)), *dst;
 	    
-	    if (*temp_buffer != NULL)
+	    if (*temp_buffer == NULL)
 		*temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
 					 current_tex_width * current_tex_height * sizeof(WORD));
 	    dst = (WORD *) *temp_buffer;

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

  Powered by Linux