Henri Verbeet : d3d9/tests: Add a small test for having multiple device active at the same time.
Alexandre Julliard
julliard at winehq.org
Fri Jul 3 09:31:08 CDT 2009
Module: wine
Branch: master
Commit: 17c0e991065033eec1e14f5e985e418a555bc81e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=17c0e991065033eec1e14f5e985e418a555bc81e
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Fri Jul 3 09:39:20 2009 +0200
d3d9/tests: Add a small test for having multiple device active at the same time.
This is essentially the situation that caused problems with reusing the
initial GL context.
---
dlls/d3d9/tests/device.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 65 insertions(+), 0 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 279c065..66f53b9 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -2312,6 +2312,70 @@ err_out:
return;
}
+static void test_multi_device(void)
+{
+ IDirect3DDevice9 *device1 = NULL, *device2 = NULL;
+ D3DPRESENT_PARAMETERS present_parameters;
+ HWND hwnd1 = NULL, hwnd2 = NULL;
+ IDirect3D9 *d3d9;
+ ULONG refcount;
+ HRESULT hr;
+
+ d3d9 = pDirect3DCreate9(D3D_SDK_VERSION);
+ ok(d3d9 != NULL, "Failed to create a d3d9 object.\n");
+ if (!d3d9) goto fail;
+
+ hwnd1 = CreateWindow("static", "d3d9_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL);
+ ok(hwnd1 != NULL, "Failed to create a window.\n");
+ if (!hwnd1) goto fail;
+
+ memset(&present_parameters, 0, sizeof(present_parameters));
+ present_parameters.Windowed = TRUE;
+ present_parameters.hDeviceWindow = hwnd1;
+ present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
+
+ hr = IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd1,
+ D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device1);
+ ok(SUCCEEDED(hr), "Failed to create a device, hr %#x\n", hr);
+ IDirect3D9_Release(d3d9);
+ d3d9 = NULL;
+ if (FAILED(hr)) goto fail;
+
+ d3d9 = pDirect3DCreate9(D3D_SDK_VERSION);
+ ok(d3d9 != NULL, "Failed to create a d3d9 object.\n");
+ if (!d3d9) goto fail;
+
+ hwnd2 = CreateWindow("static", "d3d9_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL);
+ ok(hwnd2 != NULL, "Failed to create a window.\n");
+ if (!hwnd2) goto fail;
+
+ memset(&present_parameters, 0, sizeof(present_parameters));
+ present_parameters.Windowed = TRUE;
+ present_parameters.hDeviceWindow = hwnd2;
+ present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
+
+ hr = IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd2,
+ D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device2);
+ ok(SUCCEEDED(hr), "Failed to create a device, hr %#x\n", hr);
+ IDirect3D9_Release(d3d9);
+ d3d9 = NULL;
+ if (FAILED(hr)) goto fail;
+
+fail:
+ if (d3d9) IDirect3D9_Release(d3d9);
+ if (device1)
+ {
+ refcount = IDirect3DDevice9_Release(device1);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+ }
+ if (device2)
+ {
+ refcount = IDirect3DDevice9_Release(device2);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+ }
+ if (hwnd1) DestroyWindow(hwnd1);
+ if (hwnd2) DestroyWindow(hwnd2);
+}
START_TEST(device)
{
@@ -2334,6 +2398,7 @@ START_TEST(device)
}
IDirect3D9_Release(d3d9);
+ test_multi_device();
test_display_formats();
test_display_modes();
test_swapchain();
More information about the wine-cvs
mailing list