mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 12:19:49 +00:00
d3d9/tests: Make sure create_device() returns NULL on failure.
This commit is contained in:
parent
ddae20b689
commit
86ffd6c4ea
1 changed files with 5 additions and 8 deletions
|
@ -177,7 +177,6 @@ static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9)
|
||||||
{
|
{
|
||||||
D3DPRESENT_PARAMETERS present_parameters = {0};
|
D3DPRESENT_PARAMETERS present_parameters = {0};
|
||||||
IDirect3DDevice9 *device;
|
IDirect3DDevice9 *device;
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
present_parameters.Windowed = TRUE;
|
present_parameters.Windowed = TRUE;
|
||||||
present_parameters.hDeviceWindow = create_window();
|
present_parameters.hDeviceWindow = create_window();
|
||||||
|
@ -188,14 +187,12 @@ static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9)
|
||||||
present_parameters.EnableAutoDepthStencil = TRUE;
|
present_parameters.EnableAutoDepthStencil = TRUE;
|
||||||
present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8;
|
present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8;
|
||||||
|
|
||||||
hr = IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
|
if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
|
||||||
present_parameters.hDeviceWindow, D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device);
|
present_parameters.hDeviceWindow, D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device)))
|
||||||
ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE || hr == D3DERR_INVALIDCALL,
|
return device;
|
||||||
"Failed to create a device, hr %#x.\n", hr);
|
|
||||||
if (FAILED(hr))
|
|
||||||
DestroyWindow(present_parameters.hDeviceWindow);
|
|
||||||
|
|
||||||
return device;
|
DestroyWindow(present_parameters.hDeviceWindow);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IDirect3DDevice9 *init_d3d9(void)
|
static IDirect3DDevice9 *init_d3d9(void)
|
||||||
|
|
Loading…
Reference in a new issue