ddraw/tests: Don't crash on W2K.

This commit is contained in:
Paul Vriens 2009-02-19 11:20:29 +01:00 committed by Alexandre Julliard
parent 166db1e934
commit b63728a850
1 changed files with 5 additions and 1 deletions

View File

@ -37,6 +37,8 @@ IDirect3DDevice *Direct3DDevice1 = NULL;
IDirect3DExecuteBuffer *ExecuteBuffer = NULL; IDirect3DExecuteBuffer *ExecuteBuffer = NULL;
IDirect3DViewport *Viewport = NULL; IDirect3DViewport *Viewport = NULL;
static BOOL refdevice = FALSE;
static HRESULT (WINAPI *pDirectDrawCreateEx)(LPGUID,LPVOID*,REFIID,LPUNKNOWN); static HRESULT (WINAPI *pDirectDrawCreateEx)(LPGUID,LPVOID*,REFIID,LPUNKNOWN);
static BOOL createObjects(void) static BOOL createObjects(void)
@ -100,6 +102,8 @@ static BOOL createObjects(void)
{ {
trace("Creating a HAL device failed, trying Ref\n"); trace("Creating a HAL device failed, trying Ref\n");
hr = IDirect3D7_CreateDevice(Direct3D, &IID_IDirect3DRefDevice, Surface, &Direct3DDevice); hr = IDirect3D7_CreateDevice(Direct3D, &IID_IDirect3DRefDevice, Surface, &Direct3DDevice);
if (SUCCEEDED(hr))
refdevice = TRUE;
} }
} }
if(!Direct3DDevice) goto err; if(!Direct3DDevice) goto err;
@ -562,7 +566,7 @@ static void offscreen_test(IDirect3DDevice7 *device)
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE); hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE);
ok(hr == D3D_OK, "IDirect3DDevice7_SetRenderState returned hr = %08x\n", hr); ok(hr == D3D_OK, "IDirect3DDevice7_SetRenderState returned hr = %08x\n", hr);
if(IDirect3DDevice7_BeginScene(device) == D3D_OK) { if(IDirect3DDevice7_BeginScene(device) == D3D_OK && !refdevice) {
hr = IDirect3DDevice7_SetRenderTarget(device, offscreen, 0); hr = IDirect3DDevice7_SetRenderTarget(device, offscreen, 0);
ok(hr == D3D_OK, "SetRenderTarget failed, hr = %08x\n", hr); ok(hr == D3D_OK, "SetRenderTarget failed, hr = %08x\n", hr);
hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff00ff, 0.0, 0); hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff00ff, 0.0, 0);