D3D blend mode fix

James Perry jamesp at epcc.ed.ac.uk
Fri Mar 26 03:03:58 CST 2004


Hi,

This patch fixes the Direct3D blend modes D3DBLEND_BOTHSRCALPHA
and D3DBLEND_BOTHINVSRCALPHA. Previously Wine took these names
literally and set both source and dest blend to SRCALPHA or
INVSRCALPHA. In fact, dest blend mode should be set to the
inverse of source blend mode. This affects 'Sonic R' in which
*everything* is transparent without the patch!

ChangeLog:
	Fix handling of D3DBLEND_BOTH* blend modes

Cheers,
James

-------------- next part --------------
--- dlls/ddraw/mesa.c.old	Wed Mar 24 08:28:27 2004
+++ dlls/ddraw/mesa.c	Wed Mar 24 08:29:02 2004
@@ -553,11 +553,11 @@
     if (dwRenderStateType == D3DRENDERSTATE_SRCBLEND) {
         if (dwRenderState == D3DBLEND_BOTHSRCALPHA) {
 	    lpStateBlock->render_state[D3DRENDERSTATE_SRCBLEND - 1] = D3DBLEND_SRCALPHA;
-	    lpStateBlock->render_state[D3DRENDERSTATE_DESTBLEND - 1] = D3DBLEND_SRCALPHA;
+	    lpStateBlock->render_state[D3DRENDERSTATE_DESTBLEND - 1] = D3DBLEND_INVSRCALPHA;
 	    return;
 	} else if (dwRenderState == D3DBLEND_BOTHINVSRCALPHA) {
 	    lpStateBlock->render_state[D3DRENDERSTATE_SRCBLEND - 1] = D3DBLEND_INVSRCALPHA;
-	    lpStateBlock->render_state[D3DRENDERSTATE_DESTBLEND - 1] = D3DBLEND_INVSRCALPHA;
+	    lpStateBlock->render_state[D3DRENDERSTATE_DESTBLEND - 1] = D3DBLEND_SRCALPHA;
 	    return;
 	}
     } else if (dwRenderStateType == D3DRENDERSTATE_TEXTUREADDRESS) {



More information about the wine-patches mailing list