diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index ddeaca3..9a2aeb9 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -745,8 +745,14 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetDepthStencilSurface(LPDIRECT3DDE *ppZStencilSurface = NULL; } } else { - WARN("Call to IWineD3DDevice_GetDepthStencilSurface failed\n"); - *ppZStencilSurface = NULL; + WARN("Call to IWineD3DDevice_GetDepthStencilSurface failed with %i\n", hr); + if( hr == D3DERR_INVALIDCALL ) { + FIXME("D3DERR_INVALIDCALL %i\n", hr); + } + else if(hr == D3DERR_NOTFOUND) { + FIXME("D3DERR_NOTFOUND %i\n", hr); + *ppZStencilSurface = NULL; + } } LeaveCriticalSection(&d3d9_cs); return hr; diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 41dcafb..b67ed93 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -1365,6 +1365,27 @@ static void test_depthstenciltest(void) ok(hr == D3DERR_NOTFOUND && pDepthStencil2 == NULL, "IDirect3DDevice9_GetDepthStencilSurface failed with %08x\n", hr); if(pDepthStencil2) IDirect3DSurface9_Release(pDepthStencil2); + /* This shows that pDepthStencil2 is set to 0 when hr == D3DERR_NOTFOUND */ +#define testnumber 10 + pDepthStencil2 = testnumber; + hr = IDirect3DDevice9_GetDepthStencilSurface(pDevice, &pDepthStencil2); + ok(hr == D3DERR_NOTFOUND && pDepthStencil2 == NULL, "IDirect3DDevice9_GetDepthStencilSurface failed %08x (%08x) pDepthStencil %08x (%08x)\n", hr, D3DERR_NOTFOUND, pDepthStencil2, 0); + if(pDepthStencil2 != testnumber && pDepthStencil2 != 0) IDirect3DSurface9_Release(pDepthStencil2); + + /* This shows that pDepthStencil2 is NOT set to 0 when hr == D3DERR_INVALIDCALL. + * Current implementation couldn't set it (see IWineD3DDeviceImpl_GetDepthStencilSurface) */ + + /* the DepthStencilSurface is NULL and Reset should add a new one ?? + * At least this provocates an INVALIDCALL in GetDepthStencil afterwards on windows, on wine (D3DERR_NOTFOUND)! */ + pDepthStencil2 = testnumber; /* set a value so that we could check if it is changed after an invalid call */ + hr = IDirect3DDevice9_Reset(pDevice, &d3dpp); + ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice9_Reset failed with %08x\n", hr); + hr = IDirect3DDevice9_GetDepthStencilSurface(pDevice, &pDepthStencil2); + ok(hr == D3DERR_INVALIDCALL && pDepthStencil2 == testnumber, "IDirect3DDevice9_GetDepthStencilSurface failed %08x (%08x) pDepthStencil %08x (%08x)\n", hr, D3DERR_INVALIDCALL, pDepthStencil2, testnumber); + if(pDepthStencil2 != testnumber && pDepthStencil2 != 0) IDirect3DSurface9_Release(pDepthStencil2); + pDepthStencil2 = 0; +exit(0); + /* This left the render states untouched! */ hr = IDirect3DDevice9_GetRenderState(pDevice, D3DRS_ZENABLE, &state); ok(hr == D3D_OK, "IDirect3DDevice9_GetRenderState failed with %08x\n", hr);