d3d9/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:09 +00:00 committed by Alexandre Julliard
parent d71f452c4d
commit ae5931a62e

View file

@ -20211,6 +20211,51 @@ static void test_flip(void)
refcount = IDirect3DDevice9_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
if (FAILED(IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES, NULL)))
{
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 = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
window, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device);
for (i = 0; i < present_parameters.BackBufferCount; ++i)
{
hr = IDirect3DDevice9_GetBackBuffer(device, 0, i, D3DBACKBUFFER_TYPE_MONO, &back_buffers[i]);
ok(SUCCEEDED(hr), "Failed to get back buffer, hr %#x.\n", hr);
}
hr = IDirect3DDevice9_SetRenderTarget(device, 0, back_buffers[1]);
ok(SUCCEEDED(hr), "Failed to set render target, hr %#x.\n", hr);
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff808080, 0.0f, 0);
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateRenderTarget(device, 640, 480, D3DFMT_A8R8G8B8,
D3DMULTISAMPLE_NONE, 0, TRUE, &test_surface, NULL);
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
hr = IDirect3DDevice9_StretchRect(device, back_buffers[0], NULL, test_surface, NULL, D3DTEXF_POINT);
ok(SUCCEEDED(hr), "StretchRect failed, hr %#x.\n", hr);
color = getPixelColorFromSurface(test_surface, 1, 1);
ok(color == 0xff808080, "Got unexpected color 0x%08x.\n", color);
IDirect3DSurface9_Release(test_surface);
for (i = 0; i < present_parameters.BackBufferCount; ++i)
IDirect3DSurface9_Release(back_buffers[i]);
refcount = IDirect3DDevice9_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
done:
IDirect3D9_Release(d3d);
DestroyWindow(window);
}