[PATCH 2/3] d3d9/tests: Introduce a create_device_pp function for custom present parameters.
Stefan Dösinger
stefan at codeweavers.com
Tue Oct 7 08:11:08 CDT 2014
Not changing test_fpu_setup because it explicitly requests hardware
vertex processing and FPUPRESERVE and is the only test doing so. Not
changing test_swvp_buffer because it is the only test explicitly
requesting software vertex processing.
---
dlls/d3d9/tests/device.c | 62 +++++++++++++++++++-----------------------------
1 file changed, 25 insertions(+), 37 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index f3771d9..f6e46d2 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -144,6 +144,19 @@ static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9, HWND device_window, HWN
return NULL;
}
+static IDirect3DDevice9 *create_device_pp(IDirect3D9 *d3d9, HWND focus_window, D3DPRESENT_PARAMETERS *pp)
+{
+ IDirect3DDevice9 *device;
+
+ if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window,
+ D3DCREATE_HARDWARE_VERTEXPROCESSING, pp, &device))) return device;
+
+ if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window,
+ D3DCREATE_SOFTWARE_VERTEXPROCESSING, pp, &device))) return device;
+
+ return NULL;
+}
+
static HRESULT reset_device(IDirect3DDevice9 *device, HWND device_window, BOOL windowed)
{
D3DPRESENT_PARAMETERS present_parameters = {0};
@@ -1642,11 +1655,9 @@ static void test_reset(void)
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8;
- hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
- hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &device1);
- if (FAILED(hr))
+ if (!(device1 = create_device_pp(d3d, hwnd, &d3dpp)))
{
- skip("could not create device, IDirect3D9_CreateDevice returned %#x\n", hr);
+ skip("Failed to create a D3D device, skipping tests.\n");
goto cleanup;
}
hr = IDirect3DDevice9_TestCooperativeLevel(device1);
@@ -2007,10 +2018,9 @@ static void test_reset(void)
d3dpp.EnableAutoDepthStencil = FALSE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8;
- if (FAILED(hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
- hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &device2)))
+ if (!(device2 = create_device_pp(d3d, hwnd, &d3dpp)))
{
- skip("could not create device, IDirect3D9_CreateDevice returned %#x\n", hr);
+ skip("Failed to create a D3D device, skipping tests.\n");
goto cleanup;
}
@@ -2346,12 +2356,9 @@ static void test_depthstenciltest(void)
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
- hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */,
- hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice);
- ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE || broken(hr == D3DERR_INVALIDCALL), "IDirect3D9_CreateDevice failed with %08x\n", hr);
- if(!pDevice)
+ if (!(pDevice = create_device_pp(d3d, hwnd, &d3dpp)))
{
- skip("Failed to create a d3d device\n");
+ skip("Failed to create a D3D device, skipping tests.\n");
goto cleanup;
}
@@ -2415,12 +2422,9 @@ static void test_depthstenciltest(void)
d3dpp.EnableAutoDepthStencil = FALSE;
d3dpp.AutoDepthStencilFormat = D3DFMT_UNKNOWN;
- hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */,
- hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice);
- ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE, "IDirect3D9_CreateDevice failed with %08x\n", hr);
- if(!pDevice)
+ if (!(pDevice = create_device_pp(d3d, hwnd, &d3dpp)))
{
- skip("Failed to create a d3d device\n");
+ skip("Failed to create a D3D device, skipping tests.\n");
goto cleanup;
}
@@ -2449,12 +2453,9 @@ static void test_depthstenciltest(void)
d3dpp.EnableAutoDepthStencil = FALSE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
- hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */,
- hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice);
- ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE, "IDirect3D9_CreateDevice failed with %08x\n", hr);
- if(!pDevice)
+ if (!(pDevice = create_device_pp(d3d, hwnd, &d3dpp)))
{
- skip("Failed to create a d3d device\n");
+ skip("Failed to create a D3D device, skipping tests.\n");
goto cleanup;
}
@@ -2959,23 +2960,10 @@ static void test_scissor_size(void)
present_parameters.BackBufferWidth = scts[i].backx;
present_parameters.BackBufferHeight = scts[i].backy;
present_parameters.BackBufferFormat = D3DFMT_A8R8G8B8;
- present_parameters.EnableAutoDepthStencil = TRUE;
- present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8;
-
- hr = IDirect3D9_CreateDevice(d3d9_ptr, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, present_parameters.hDeviceWindow, D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device_ptr);
- if(FAILED(hr)) {
- present_parameters.AutoDepthStencilFormat = D3DFMT_D16;
- hr = IDirect3D9_CreateDevice(d3d9_ptr, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, present_parameters.hDeviceWindow, D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device_ptr);
- if(FAILED(hr)) {
- hr = IDirect3D9_CreateDevice(d3d9_ptr, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, present_parameters.hDeviceWindow, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device_ptr);
- }
- }
- ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE, "IDirect3D_CreateDevice returned: %08x\n", hr);
-
- if (!device_ptr)
+ if (!(device_ptr = create_device_pp(d3d9_ptr, hwnd, &present_parameters)))
{
DestroyWindow(hwnd);
- skip("Creating the device failed\n");
+ skip("Failed to create a D3D device, skipping tests.\n");
goto err_out;
}
--
2.0.4
More information about the wine-patches
mailing list