d3d8/tests: Test multisample flip.

Signed-off-by: Stefan Dösinger <stefandoesinger@gmx.at>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Stefan Dösinger 2016-02-24 22:28:10 +00:00 committed by Alexandre Julliard
parent ae5931a62e
commit 9307474f1d
1 changed files with 45 additions and 0 deletions

View File

@ -8067,6 +8067,51 @@ static void test_flip(void)
refcount = IDirect3DDevice8_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
if (FAILED(IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES)))
{
skip("Multisampling not supported for D3DFMT_A8R8G8B8, skipping multisample flip test.\n");
goto done;
}
present_parameters.BackBufferCount = 2;
present_parameters.MultiSampleType = D3DMULTISAMPLE_2_SAMPLES;
present_parameters.Flags = 0;
hr = IDirect3D8_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
window, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device);
for (i = 0; i < present_parameters.BackBufferCount; ++i)
{
hr = IDirect3DDevice8_GetBackBuffer(device, i, D3DBACKBUFFER_TYPE_MONO, &back_buffers[i]);
ok(SUCCEEDED(hr), "Failed to get back buffer, hr %#x.\n", hr);
}
hr = IDirect3DDevice8_SetRenderTarget(device, back_buffers[1], NULL);
ok(SUCCEEDED(hr), "Failed to set render target, hr %#x.\n", hr);
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff808080, 0.0f, 0);
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
hr = IDirect3DDevice8_CreateRenderTarget(device, 640, 480, D3DFMT_A8R8G8B8,
D3DMULTISAMPLE_NONE, TRUE, &test_surface);
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
hr = IDirect3DDevice8_CopyRects(device, back_buffers[0], NULL, 0, test_surface, NULL);
ok(SUCCEEDED(hr), "CopyRects failed, hr %#x.\n", hr);
color = get_surface_color(test_surface, 1, 1);
ok(color == 0xff808080, "Got unexpected color 0x%08x.\n", color);
IDirect3DSurface8_Release(test_surface);
for (i = 0; i < present_parameters.BackBufferCount; ++i)
IDirect3DSurface8_Release(back_buffers[i]);
refcount = IDirect3DDevice8_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
done:
IDirect3D8_Release(d3d);
DestroyWindow(window);
}