Commit 57c1f072 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3d9/tests: Extend test_checkdevicemultisampletype().

parent 99bcae02
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment