From 7a025001d341aa36a4e4a92ca58842bda442eec6 Mon Sep 17 00:00:00 2001 From: Lionel Ulmer Date: Thu, 2 Jan 2003 19:52:22 +0000 Subject: [PATCH] - implemented GetTexture - semi-stubbed ValidateTexture - fixed some errors in logging --- dlls/ddraw/d3ddevice/main.c | 55 +++++++++++++++++++++++++++---------- dlls/ddraw/d3ddevice/main.h | 16 +++++------ dlls/ddraw/d3ddevice/mesa.c | 10 +++---- 3 files changed, 53 insertions(+), 28 deletions(-) diff --git a/dlls/ddraw/d3ddevice/main.c b/dlls/ddraw/d3ddevice/main.c index 9037d9678ce..a513cdfd1e0 100644 --- a/dlls/ddraw/d3ddevice/main.c +++ b/dlls/ddraw/d3ddevice/main.c @@ -468,12 +468,23 @@ Main_IDirect3DDeviceImpl_7_3T_ComputeSphereVisibility(LPDIRECT3DDEVICE7 iface, } HRESULT WINAPI -Main_IDirect3DDeviceImpl_7_GetTexture(LPDIRECT3DDEVICE7 iface, - DWORD dwStage, - LPDIRECTDRAWSURFACE7* lpTexture) +Main_IDirect3DDeviceImpl_7_3T_GetTexture(LPDIRECT3DDEVICE7 iface, + DWORD dwStage, + LPDIRECTDRAWSURFACE7* lpTexture) { ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface); - FIXME("(%p/%p)->(%08lx,%p): stub!\n", This, iface, dwStage, lpTexture); + TRACE("(%p/%p)->(%08lx,%p)\n", This, iface, dwStage, lpTexture); + + if (This->current_texture[dwStage] != NULL) { + *lpTexture = ICOM_INTERFACE(This->current_texture[dwStage], IDirectDrawSurface7); + } else { + *lpTexture = NULL; + } + + TRACE(" returning interface at %p (for implementation at %p).\n", *lpTexture, This->current_texture[dwStage]); + + /* Note: should this method increase the reference count for this ?? */ + return DD_OK; } @@ -514,7 +525,11 @@ Main_IDirect3DDeviceImpl_7_3T_ValidateDevice(LPDIRECT3DDEVICE7 iface, LPDWORD lpdwPasses) { ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface); - FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpdwPasses); + FIXME("(%p/%p)->(%p): semi-stub!\n", This, iface, lpdwPasses); + + /* For the moment, we have a VERY good hardware which does everything in one pass :-) */ + *lpdwPasses = 1; + return DD_OK; } @@ -832,16 +847,6 @@ Main_IDirect3DDeviceImpl_3_2T_SetLightState(LPDIRECT3DDEVICE3 iface, return DD_OK; } -HRESULT WINAPI -Main_IDirect3DDeviceImpl_3_GetTexture(LPDIRECT3DDEVICE3 iface, - DWORD dwStage, - LPDIRECT3DTEXTURE2* lplpTexture2) -{ - ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface); - FIXME("(%p/%p)->(%08lx,%p): stub!\n", This, iface, dwStage, lplpTexture2); - return DD_OK; -} - HRESULT WINAPI Main_IDirect3DDeviceImpl_2_SwapTextureHandles(LPDIRECT3DDEVICE2 iface, LPDIRECT3DTEXTURE2 lpD3DTex1, @@ -1783,3 +1788,23 @@ Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE3 iface, dwIndexCount, dwFlags); } + +HRESULT WINAPI +Thunk_IDirect3DDeviceImpl_3_GetTexture(LPDIRECT3DDEVICE3 iface, + DWORD dwStage, + LPDIRECT3DTEXTURE2* lplpTexture2) +{ + HRESULT ret; + LPDIRECTDRAWSURFACE7 ret_val; + + TRACE("(%p)->(%ld,%p) thunking to IDirect3DDevice7 interface.\n", iface, dwStage, lplpTexture2); + ret = IDirect3DDevice7_GetTexture(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface), + dwStage, + &ret_val); + + *lplpTexture2 = COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7, IDirect3DTexture2, ret_val); + + TRACE(" returning interface %p.\n", *lplpTexture2); + + return ret; +} diff --git a/dlls/ddraw/d3ddevice/main.h b/dlls/ddraw/d3ddevice/main.h index da3d659cd32..dab5977df4a 100644 --- a/dlls/ddraw/d3ddevice/main.h +++ b/dlls/ddraw/d3ddevice/main.h @@ -201,9 +201,9 @@ Main_IDirect3DDeviceImpl_7_3T_ComputeSphereVisibility(LPDIRECT3DDEVICE7 iface, LPDWORD lpdwReturnValues); HRESULT WINAPI -Main_IDirect3DDeviceImpl_7_GetTexture(LPDIRECT3DDEVICE7 iface, - DWORD dwStage, - LPDIRECTDRAWSURFACE7* lpTexture); +Main_IDirect3DDeviceImpl_7_3T_GetTexture(LPDIRECT3DDEVICE7 iface, + DWORD dwStage, + LPDIRECTDRAWSURFACE7* lpTexture); HRESULT WINAPI Main_IDirect3DDeviceImpl_7_3T_SetTexture(LPDIRECT3DDEVICE7 iface, @@ -344,11 +344,6 @@ Main_IDirect3DDeviceImpl_3_2T_SetLightState(LPDIRECT3DDEVICE3 iface, D3DLIGHTSTATETYPE dwLightStateType, DWORD dwLightState); -HRESULT WINAPI -Main_IDirect3DDeviceImpl_3_GetTexture(LPDIRECT3DDEVICE3 iface, - DWORD dwStage, - LPDIRECT3DTEXTURE2* lplpTexture2); - HRESULT WINAPI Main_IDirect3DDeviceImpl_2_SwapTextureHandles(LPDIRECT3DDEVICE2 iface, LPDIRECT3DTEXTURE2 lpD3DTex1, @@ -757,3 +752,8 @@ Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE3 iface, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags); + +HRESULT WINAPI +Thunk_IDirect3DDeviceImpl_3_GetTexture(LPDIRECT3DDEVICE3 iface, + DWORD dwStage, + LPDIRECT3DTEXTURE2* lplpTexture2); diff --git a/dlls/ddraw/d3ddevice/mesa.c b/dlls/ddraw/d3ddevice/mesa.c index 70b5dd9ab5c..b961fe04b6b 100644 --- a/dlls/ddraw/d3ddevice/mesa.c +++ b/dlls/ddraw/d3ddevice/mesa.c @@ -1358,7 +1358,7 @@ GL_IDirect3DDeviceImpl_7_3T_SetTextureStageState(LPDIRECT3DDEVICE7 iface, gl_state = GL_LINEAR; break; default: - if (TRACE_ON(ddraw)) DPRINTF(" state unhandled.\n"); + if (TRACE_ON(ddraw)) DPRINTF(" state unhandled (%ld).\n", dwState); gl_state = GL_LINEAR; break; } @@ -1377,7 +1377,7 @@ GL_IDirect3DDeviceImpl_7_3T_SetTextureStageState(LPDIRECT3DDEVICE7 iface, gl_state = GL_LINEAR; break; default: - if (TRACE_ON(ddraw)) DPRINTF(" state unhandled.\n"); + if (TRACE_ON(ddraw)) DPRINTF(" state unhandled (%ld).\n", dwState); gl_state = GL_LINEAR; break; } @@ -1393,7 +1393,7 @@ GL_IDirect3DDeviceImpl_7_3T_SetTextureStageState(LPDIRECT3DDEVICE7 iface, case D3DTADDRESS_WRAP: if (TRACE_ON(ddraw)) DPRINTF("D3DTADDRESS_WRAP\n"); arg = GL_REPEAT; break; case D3DTADDRESS_CLAMP: if (TRACE_ON(ddraw)) DPRINTF("D3DTADDRESS_CLAMP\n"); arg = GL_CLAMP; break; case D3DTADDRESS_BORDER: if (TRACE_ON(ddraw)) DPRINTF("D3DTADDRESS_BORDER\n"); arg = GL_CLAMP_TO_EDGE; break; - default: ERR("Unhandled TEXTUREADDRESS mode %ld !\n", dwState); + default: DPRINTF(" state unhandled (%ld).\n", dwState); } if ((d3dTexStageStateType == D3DTSS_ADDRESS) || (d3dTexStageStateType == D3DTSS_ADDRESSU)) @@ -1503,7 +1503,7 @@ ICOM_VTABLE(IDirect3DDevice7) VTABLE_IDirect3DDevice7 = XCAST(DrawPrimitiveVB) GL_IDirect3DDeviceImpl_7_3T_DrawPrimitiveVB, XCAST(DrawIndexedPrimitiveVB) GL_IDirect3DDeviceImpl_7_3T_DrawIndexedPrimitiveVB, XCAST(ComputeSphereVisibility) Main_IDirect3DDeviceImpl_7_3T_ComputeSphereVisibility, - XCAST(GetTexture) Main_IDirect3DDeviceImpl_7_GetTexture, + XCAST(GetTexture) Main_IDirect3DDeviceImpl_7_3T_GetTexture, XCAST(SetTexture) GL_IDirect3DDeviceImpl_7_3T_SetTexture, XCAST(GetTextureStageState) Main_IDirect3DDeviceImpl_7_3T_GetTextureStageState, XCAST(SetTextureStageState) GL_IDirect3DDeviceImpl_7_3T_SetTextureStageState, @@ -1571,7 +1571,7 @@ ICOM_VTABLE(IDirect3DDevice3) VTABLE_IDirect3DDevice3 = XCAST(DrawPrimitiveVB) Thunk_IDirect3DDeviceImpl_3_DrawPrimitiveVB, XCAST(DrawIndexedPrimitiveVB) Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveVB, XCAST(ComputeSphereVisibility) Thunk_IDirect3DDeviceImpl_3_ComputeSphereVisibility, - XCAST(GetTexture) Main_IDirect3DDeviceImpl_3_GetTexture, + XCAST(GetTexture) Thunk_IDirect3DDeviceImpl_3_GetTexture, XCAST(SetTexture) Thunk_IDirect3DDeviceImpl_3_SetTexture, XCAST(GetTextureStageState) Thunk_IDirect3DDeviceImpl_3_GetTextureStageState, XCAST(SetTextureStageState) Thunk_IDirect3DDeviceImpl_3_SetTextureStageState,