From 3f61d286611c97573f1da8549352fa7d032e2c10 Mon Sep 17 00:00:00 2001 From: Lionel Ulmer Date: Wed, 4 Jun 2003 23:38:22 +0000 Subject: [PATCH] - small TRACEing fix - fix bug in texture upload (I wonder how I missed this :-/ ) - improve the D3D1/2 texture mapping modes --- dlls/ddraw/d3ddevice/mesa.c | 2 +- dlls/ddraw/mesa.c | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/dlls/ddraw/d3ddevice/mesa.c b/dlls/ddraw/d3ddevice/mesa.c index 5d8449f8e47..2ff793acb80 100644 --- a/dlls/ddraw/d3ddevice/mesa.c +++ b/dlls/ddraw/d3ddevice/mesa.c @@ -1833,7 +1833,7 @@ GL_IDirect3DDeviceImpl_7_3T_SetTextureStageState(LPDIRECT3DDEVICE7 iface, } break; case D3DTSS_MAXMIPLEVEL: - TRACE(" Stage type : D3DTSS_MAXMIPLEVEL => 0 (disabled) \n"); + TRACE(" Stage type : D3DTSS_MAXMIPLEVEL => %ld\n", dwState); break; case D3DTSS_BORDERCOLOR: diff --git a/dlls/ddraw/mesa.c b/dlls/ddraw/mesa.c index 93e1d109f62..3682661a919 100644 --- a/dlls/ddraw/mesa.c +++ b/dlls/ddraw/mesa.c @@ -244,19 +244,31 @@ void set_render_state(IDirect3DDeviceImpl* This, 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) { @@ -968,7 +980,7 @@ HRESULT upload_surface_to_tex_memory(RECT *rect, DWORD xoffset, DWORD yoffset, v 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;