diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index c1dc886634a..5b72b43dd0e 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -790,6 +790,61 @@ cleanup: DestroyWindow(window); } +static void test_checkdevicemultisampletype(void) +{ + IDirect3D8 *d3d; + 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 a D3D object.\n"); + + if (IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES) == D3DERR_NOTAVAILABLE) + { + skip("Multisampling not supported for D3DFMT_X8R8G8B8, skipping test.\n"); + goto cleanup; + } + + hr = IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_UNKNOWN, TRUE, D3DMULTISAMPLE_NONE); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + hr = IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + 65536, TRUE, D3DMULTISAMPLE_NONE); + todo_wine ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr); + + hr = IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_NONE); + ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr); + hr = IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, FALSE, D3DMULTISAMPLE_NONE); + ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr); + + hr = IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES); + ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr); + + /* We assume D3DMULTISAMPLE_15_SAMPLES is never supported in practice. */ + hr = IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_15_SAMPLES); + ok(hr == D3DERR_NOTAVAILABLE, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, TRUE, 65536); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_DXT5, TRUE, D3DMULTISAMPLE_2_SAMPLES); + ok(hr == D3DERR_NOTAVAILABLE, "Got unexpected hr %#x.\n", hr); + +cleanup: + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + static void test_cursor(void) { HMODULE user32_handle = GetModuleHandleA("user32.dll"); @@ -7786,6 +7841,7 @@ START_TEST(device) test_swapchain(); test_refcount(); test_mipmap_levels(); + test_checkdevicemultisampletype(); test_cursor(); test_cursor_pos(); test_states();