Commit 6503946f authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

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

parent 6e550735
...@@ -8492,9 +8492,64 @@ static void test_clip_planes_limits(void) ...@@ -8492,9 +8492,64 @@ static void test_clip_planes_limits(void)
DestroyWindow(window); 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) START_TEST(device)
{ {
HMODULE d3d8_handle = GetModuleHandleA( "d3d8.dll" ); HMODULE d3d8_handle = GetModuleHandleA("d3d8.dll");
WNDCLASSA wc = {0}; WNDCLASSA wc = {0};
IDirect3D8 *d3d8; IDirect3D8 *d3d8;
DEVMODEW current_mode; DEVMODEW current_mode;
...@@ -8600,6 +8655,7 @@ START_TEST(device) ...@@ -8600,6 +8655,7 @@ START_TEST(device)
test_format_unknown(); test_format_unknown();
test_destroyed_window(); test_destroyed_window();
test_clip_planes_limits(); test_clip_planes_limits();
test_swapchain_multisample_reset();
UnregisterClassA("d3d8_test_wc", GetModuleHandleA(NULL)); UnregisterClassA("d3d8_test_wc", GetModuleHandleA(NULL));
} }
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