Matteo Bruni : d3d9/tests: Extend test_checkdevicemultisampletype().
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Jan 28 10:06:46 CST 2016
Module: wine
Branch: master
Commit: 57c1f072f0778405eab9a112f668ba1d74bac3fe
URL: http://source.winehq.org/git/wine.git/?a=commit;h=57c1f072f0778405eab9a112f668ba1d74bac3fe
Author: Matteo Bruni <mbruni at codeweavers.com>
Date: Thu Jan 28 00:15:45 2016 +0100
d3d9/tests: Extend test_checkdevicemultisampletype().
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3d9/tests/device.c | 71 ++++++++++++++++++++++++++++++++++++------------
1 file changed, 54 insertions(+), 17 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 39789a8..ad3e21b 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -1003,10 +1003,8 @@ cleanup:
static void test_checkdevicemultisampletype(void)
{
- IDirect3DDevice9 *device;
DWORD quality_levels;
IDirect3D9 *d3d;
- ULONG refcount;
HWND window;
HRESULT hr;
@@ -1015,34 +1013,73 @@ static void test_checkdevicemultisampletype(void)
ok(!!window, "Failed to create a window.\n");
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
- if (!(device = create_device(d3d, window, NULL)))
+
+ if (IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES, NULL) == D3DERR_NOTAVAILABLE)
{
- skip("Failed to create a 3D device, skipping test.\n");
+ skip("Multisampling not supported for D3DFMT_X8R8G8B8, skipping test.\n");
goto cleanup;
}
+ hr = IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ D3DFMT_UNKNOWN, TRUE, D3DMULTISAMPLE_NONE, NULL);
+ ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ hr = IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ 65536, TRUE, D3DMULTISAMPLE_NONE, NULL);
+ todo_wine ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
+
+ hr = IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_NONE, NULL);
+ ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
+
quality_levels = 0;
hr = IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_NONE, &quality_levels);
- ok(SUCCEEDED(hr) || hr == D3DERR_NOTAVAILABLE, "CheckDeviceMultiSampleType failed with (%08x)\n", hr);
- if (hr == D3DERR_NOTAVAILABLE)
- {
- skip("IDirect3D9_CheckDeviceMultiSampleType not available\n");
- goto cleanup;
- }
+ ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
ok(quality_levels == 1, "Got unexpected quality_levels %u.\n", quality_levels);
-
+ quality_levels = 0;
hr = IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
D3DFMT_X8R8G8B8, FALSE, D3DMULTISAMPLE_NONE, &quality_levels);
- ok(SUCCEEDED(hr), "CheckDeviceMultiSampleType failed with (%08x)\n", hr);
+ ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
+ ok(quality_levels == 1, "Got unexpected quality_levels %u.\n", quality_levels);
+
+ quality_levels = 0;
+ hr = IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_NONMASKABLE, NULL);
+ ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
+ hr = IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_NONMASKABLE, &quality_levels);
+ ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
+ ok(quality_levels, "Got unexpected quality_levels %u.\n", quality_levels);
+
+ quality_levels = 0;
+ hr = IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES, NULL);
+ ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
+ hr = IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES, &quality_levels);
+ ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
+ ok(quality_levels, "Got unexpected quality_levels %u.\n", quality_levels);
+
+ /* We assume D3DMULTISAMPLE_15_SAMPLES is never supported in practice. */
+ quality_levels = 0;
+ hr = IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_15_SAMPLES, NULL);
+ ok(hr == D3DERR_NOTAVAILABLE, "Got unexpected hr %#x.\n", hr);
+ hr = IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_15_SAMPLES, &quality_levels);
+ ok(hr == D3DERR_NOTAVAILABLE, "Got unexpected hr %#x.\n", hr);
ok(quality_levels == 1, "Got unexpected quality_levels %u.\n", quality_levels);
+ hr = IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ D3DFMT_X8R8G8B8, TRUE, 65536, NULL);
+ ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+
+ hr = IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ D3DFMT_DXT5, TRUE, D3DMULTISAMPLE_2_SAMPLES, NULL);
+ ok(hr == D3DERR_NOTAVAILABLE, "Got unexpected hr %#x.\n", hr);
+
cleanup:
- if (device)
- {
- refcount = IDirect3DDevice9_Release(device);
- ok(!refcount, "Device has %u references left.\n", refcount);
- }
IDirect3D9_Release(d3d);
DestroyWindow(window);
}
More information about the wine-cvs
mailing list