From 720aa5bf2326dd31874fa9965ea3388dfe66d0f8 Mon Sep 17 00:00:00 2001 From: Christian Costa Date: Mon, 15 Feb 2010 09:48:38 +0100 Subject: [PATCH] ddraw: Fix D3DTBLEND_MODULATE emulation. Alpha source should be selected with WINED3DTSS_ALPHAOP and not by changing the source itself. --- dlls/ddraw/device.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index 68b149e998c..136d73e2a38 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -2580,7 +2580,8 @@ IDirect3DDeviceImpl_3_GetRenderState(IDirect3DDevice3 *iface, } if (!(colorop == WINED3DTOP_MODULATE && colorarg1 == WINED3DTA_TEXTURE && colorarg2 == WINED3DTA_CURRENT && - alphaop == WINED3DTOP_SELECTARG1 && alphaarg1 == (tex_alpha ? WINED3DTA_TEXTURE : WINED3DTA_CURRENT))) + alphaop == (tex_alpha ? WINED3DTOP_SELECTARG1 : WINED3DTOP_SELECTARG2) && + alphaarg1 == WINED3DTA_TEXTURE && alphaarg2 == WINED3DTA_CURRENT)) { ERR("Unexpected texture stage state setup, returning D3DTBLEND_MODULATE - likely erroneous\n"); } @@ -2852,16 +2853,12 @@ IDirect3DDeviceImpl_3_SetRenderState(IDirect3DDevice3 *iface, IWineD3DBaseTexture_Release(tex); } - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG1); if (tex_alpha) - { - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG1, WINED3DTA_TEXTURE); - } + IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG1); else - { - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG1, WINED3DTA_CURRENT); - } - + IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG2); + IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG1, WINED3DTA_TEXTURE); + IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG2, WINED3DTA_CURRENT); IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE); IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG2, WINED3DTA_CURRENT); IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLOROP, WINED3DTOP_MODULATE); @@ -4664,15 +4661,11 @@ IDirect3DDeviceImpl_3_SetTexture(IDirect3DDevice3 *iface, IWineD3DBaseTexture_Release(tex); } - /* alphaop is WINED3DTOP_SELECTARG1 if it's D3DTBLEND_MODULATE, so only modify alphaarg1 */ + /* Arg 1/2 are already set to WINED3DTA_TEXTURE/WINED3DTA_CURRENT in case of D3DTBLEND_MODULATE */ if (tex_alpha) - { - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG1, WINED3DTA_TEXTURE); - } + IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG1); else - { - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG1, WINED3DTA_CURRENT); - } + IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG2); } LeaveCriticalSection(&ddraw_cs);