[PATCH 3/3] d3d8/tests: Introduce a create_device_pp function for custom present parameters.
Stefan Dösinger
stefan at codeweavers.com
Tue Oct 7 08:11:09 CDT 2014
---
dlls/d3d8/tests/device.c | 39 +++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index e066b77..40c49a2 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -105,6 +105,19 @@ static IDirect3DDevice8 *create_device(IDirect3D8 *d3d8, HWND device_window, HWN
return NULL;
}
+static IDirect3DDevice8 *create_device_pp(IDirect3D8 *d3d8, HWND focus_window, D3DPRESENT_PARAMETERS *pp)
+{
+ IDirect3DDevice8 *device;
+
+ if (SUCCEEDED(IDirect3D8_CreateDevice(d3d8, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window,
+ D3DCREATE_HARDWARE_VERTEXPROCESSING, pp, &device))) return device;
+
+ if (SUCCEEDED(IDirect3D8_CreateDevice(d3d8, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window,
+ D3DCREATE_SOFTWARE_VERTEXPROCESSING, pp, &device))) return device;
+
+ return NULL;
+}
+
static HRESULT reset_device(IDirect3DDevice8 *device, HWND device_window, BOOL windowed)
{
D3DPRESENT_PARAMETERS present_parameters = {0};
@@ -1132,11 +1145,9 @@ static void test_reset(void)
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8;
- hr = IDirect3D8_CreateDevice(d3d8, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
- window, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &device1);
- if (FAILED(hr))
+ if (!(device1 = create_device_pp(d3d8, window, &d3dpp)))
{
- skip("Failed to create device, hr %#x.\n", hr);
+ skip("Failed to create a D3D device, skipping tests.\n");
goto cleanup;
}
hr = IDirect3DDevice8_TestCooperativeLevel(device1);
@@ -1486,11 +1497,9 @@ static void test_reset(void)
d3dpp.EnableAutoDepthStencil = FALSE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8;
- hr = IDirect3D8_CreateDevice(d3d8, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
- window, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &device2);
- if (FAILED(hr))
+ if (!(device2 = create_device_pp(d3d8, window, &d3dpp)))
{
- skip("Failed to create device, hr %#x.\n", hr);
+ skip("Failed to create a D3D device, skipping tests.\n");
goto cleanup;
}
@@ -1989,11 +1998,9 @@ static void test_depth_stencil_reset(void)
present_parameters.EnableAutoDepthStencil = TRUE;
present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8;
- hr = IDirect3D8_CreateDevice(d3d8, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd,
- D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device);
- if(FAILED(hr))
+ if (!(device = create_device_pp(d3d8, hwnd, &present_parameters)))
{
- skip("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr);
+ skip("Failed to create a D3D device, skipping tests.\n");
goto cleanup;
}
@@ -2046,13 +2053,9 @@ static void test_depth_stencil_reset(void)
present_parameters.BackBufferFormat = display_mode.Format;
present_parameters.EnableAutoDepthStencil = FALSE;
present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8;
-
- hr = IDirect3D8_CreateDevice( d3d8, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd,
- D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device );
-
- if(FAILED(hr))
+ if (!(device = create_device_pp(d3d8, hwnd, &present_parameters)))
{
- skip("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr);
+ skip("Failed to create a D3D device, skipping tests.\n");
goto cleanup;
}
--
2.0.4
More information about the wine-patches
mailing list