=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: d3d8/tests: Add test for changing multisample type of implicit swapchain.

Alexandre Julliard julliard at winehq.org
Thu Feb 15 14:42:28 CST 2018


Module: wine
Branch: master
Commit: 6503946fc749434804131681ce70af4631403f35
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6503946fc749434804131681ce70af4631403f35

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Thu Feb 15 13:49:33 2018 +0100

d3d8/tests: Add test for changing multisample type of implicit swapchain.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d8/tests/device.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 57 insertions(+), 1 deletion(-)

diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 9efa943..6ae1782 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -8492,9 +8492,64 @@ static void test_clip_planes_limits(void)
     DestroyWindow(window);
 }
 
+static void test_swapchain_multisample_reset(void)
+{
+    D3DPRESENT_PARAMETERS present_parameters;
+    IDirect3DDevice8 *device;
+    IDirect3D8 *d3d;
+    ULONG refcount;
+    HWND window;
+    HRESULT hr;
+
+    window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW,
+            0, 0, 640, 480, NULL, NULL, NULL, NULL);
+    ok(!!window, "Failed to create a window.\n");
+    d3d = Direct3DCreate8(D3D_SDK_VERSION);
+    ok(!!d3d, "Failed to create D3D object.\n");
+
+    if (IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+            D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES) == D3DERR_NOTAVAILABLE)
+    {
+        skip("Multisampling not supported for D3DFMT_A8R8G8B8.\n");
+        IDirect3D8_Release(d3d);
+        DestroyWindow(window);
+        return;
+    }
+
+    if (!(device = create_device(d3d, window, NULL)))
+    {
+        skip("Failed to create 3D device.\n");
+        IDirect3D8_Release(d3d);
+        DestroyWindow(window);
+        return;
+    }
+
+    hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0);
+    ok(hr == D3D_OK, "Failed to clear, hr %#x.\n", hr);
+
+    memset(&present_parameters, 0, sizeof(present_parameters));
+    present_parameters.BackBufferWidth = 640;
+    present_parameters.BackBufferHeight = 480;
+    present_parameters.BackBufferFormat = D3DFMT_A8R8G8B8;
+    present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
+    present_parameters.hDeviceWindow = NULL;
+    present_parameters.Windowed = TRUE;
+    present_parameters.MultiSampleType = D3DMULTISAMPLE_2_SAMPLES;
+    hr = IDirect3DDevice8_Reset(device, &present_parameters);
+    ok(hr == D3D_OK, "Failed to reset device, hr %#x.\n", hr);
+
+    hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0f, 0);
+    ok(hr == D3D_OK, "Failed to clear, hr %#x.\n", hr);
+
+    refcount = IDirect3DDevice8_Release(device);
+    ok(!refcount, "Device has %u references left.\n", refcount);
+    IDirect3D8_Release(d3d);
+    DestroyWindow(window);
+}
+
 START_TEST(device)
 {
-    HMODULE d3d8_handle = GetModuleHandleA( "d3d8.dll" );
+    HMODULE d3d8_handle = GetModuleHandleA("d3d8.dll");
     WNDCLASSA wc = {0};
     IDirect3D8 *d3d8;
     DEVMODEW current_mode;
@@ -8600,6 +8655,7 @@ START_TEST(device)
     test_format_unknown();
     test_destroyed_window();
     test_clip_planes_limits();
+    test_swapchain_multisample_reset();
 
     UnregisterClassA("d3d8_test_wc", GetModuleHandleA(NULL));
 }




More information about the wine-cvs mailing list