From bb67a925d69b50c2b3f61666c5347ab0902da8b7 Mon Sep 17 00:00:00 2001 From: David Adam Date: Thu, 21 Aug 2008 18:54:27 +0200 Subject: [PATCH] ddraw: Only ddraw checks wether one can give a null pointer to SetMaterial. --- dlls/ddraw/device.c | 1 + dlls/ddraw/tests/d3d.c | 9 +++++++++ dlls/wined3d/device.c | 2 -- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index b154ce47b7c..edcb88f956e 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -5543,6 +5543,7 @@ IDirect3DDeviceImpl_7_SetMaterial(IDirect3DDevice7 *iface, HRESULT hr; TRACE("(%p)->(%p): Relay!\n", This, Mat); + if (!Mat) return DDERR_INVALIDPARAMS; /* Note: D3DMATERIAL7 is compatible with WINED3DMATERIAL */ EnterCriticalSection(&ddraw_cs); hr = IWineD3DDevice_SetMaterial(This->wineD3DDevice, diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c index 37c0a8ebe5f..221a95b322e 100644 --- a/dlls/ddraw/tests/d3d.c +++ b/dlls/ddraw/tests/d3d.c @@ -2735,6 +2735,14 @@ static void DeviceLoadTest() } } +static void SetMaterialTest(void) +{ + HRESULT rc; + + rc =IDirect3DDevice7_SetMaterial(lpD3DDevice, NULL); + ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc); +} + START_TEST(d3d) { init_function_pointers(); @@ -2752,6 +2760,7 @@ START_TEST(d3d) SceneTest(); LimitTest(); D3D7EnumTest(); + SetMaterialTest(); CapsTest(); VertexBufferDescTest(); D3D7_OldRenderStateTest(); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index d247d65761d..350c6d5e560 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3144,8 +3144,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetClipStatus(IWineD3DDevice *iface, static HRESULT WINAPI IWineD3DDeviceImpl_SetMaterial(IWineD3DDevice *iface, CONST WINED3DMATERIAL* pMaterial) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - if (!pMaterial) return WINED3DERR_INVALIDCALL; - This->updateStateBlock->changed.material = TRUE; This->updateStateBlock->material = *pMaterial;