From ae5931a62e1f873ce963a20cfab2bbd7524b7c67 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stefan=20D=C3=B6singer?= Date: Wed, 24 Feb 2016 22:28:09 +0000 Subject: [PATCH] d3d9/tests: Test multisample flip. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Dösinger Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d9/tests/visual.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index b96ccd16c4f..f531dc5e655 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -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); } -- 2.11.4.GIT